Skip to content

Commit

Permalink
Merge pull request #642 from hotwax/#640_partial_and_collateral_rejec…
Browse files Browse the repository at this point in the history
…tion_settings

Implemented: Added 'Allow partial rejections' and 'Collateral rejections' settings (#640).
  • Loading branch information
ravilodhi authored Jul 19, 2024
2 parents b16d0aa + cbb0f16 commit 8a7b385
Show file tree
Hide file tree
Showing 15 changed files with 226 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/authorization/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export default {
"APP_CARRIERS_VIEW" : "APP_CARRIERS_VIEW",
"APP_CARRIERS_CREATE" : "APP_CARRIERS_CREATE",
"APP_ORDER_LOOKUP_VIEW": "APP_ORDER_LOOKUP_VIEW",
"APP_PARTIAL_ORDER_REJECTION_CONFIG_UPDATE": "APP_PARTIAL_ORDER_REJECTION_CONFIG_UPDATE"
"APP_PARTIAL_ORDER_REJECTION_CONFIG_UPDATE": "APP_PARTIAL_ORDER_REJECTION_CONFIG_UPDATE",
"APP_COLLATERAL_REJECTION_CONFIG_UPDATE": "APP_COLLATERAL_REJECTION_CONFIG_UPDATE"
}
3 changes: 2 additions & 1 deletion src/authorization/Rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export default {
"APP_CARRIERS_VIEW": "CARRIER_SETUP_VIEW",
"APP_CARRIERS_CREATE": "CARRIER_SETUP_VIEW",
"APP_ORDER_LOOKUP_VIEW": "FF_ORDER_LOOKUP_VIEW",
"APP_PARTIAL_ORDER_REJECTION_CONFIG_UPDATE": "COMMON_ADMIN"
"APP_PARTIAL_ORDER_REJECTION_CONFIG_UPDATE": "COMMON_ADMIN",
"APP_COLLATERAL_REJECTION_CONFIG_UPDATE": "COMMON_ADMIN"
} as any
8 changes: 8 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"Address 1": "Address 1",
"Address 2": "Address 2",
"Allocation": "Allocation",
"Allow collateral rejections": "Allow collateral rejections",
"Allow partial rejections": "Allow partial rejections",
"Any edits made on this page will be lost.": "Any edits made on this page will be lost.",
"Apply": "Apply",
"Approved": "Approved",
Expand All @@ -31,6 +33,7 @@
"Are you sure you want to reject in progress order(s)?": "Are you sure you want to reject { ordersCount } in progress order(s)?",
"Are you sure you want to update box selection?": "Are you sure you want to update box selection?",
"Assign Pickers": "Assign Pickers",
"Auto reject related items": "Auto reject related items",
"Back to Launchpad": "Back to Launchpad",
"Billing Address 1": "Billing Address 1",
"Billing Address 2": "Billing Address 2",
Expand Down Expand Up @@ -74,6 +77,7 @@
"Credit Card": "Credit Card",
"COD Fee": "COD Fee",
"COD Fee Tax": "COD Fee Tax",
"Collateral rejections": "Collateral rejections",
"Completed": "Completed",
"Configuration Missing": "Configuration Missing",
"Confirm": "Confirm",
Expand Down Expand Up @@ -113,6 +117,7 @@
"Delivery days updated.": "Delivery days updated.",
"Delivery Time": "Delivery Time",
"Destination": "Destination",
"Disallow collateral rejections": "Disallow collateral rejections",
"Discard": "Discard",
"Discard shipment": "Discard shipment",
"Download packed orders": "Download packed orders",
Expand Down Expand Up @@ -340,6 +345,7 @@
"Pack using default packaging": "Pack using default packaging",
"Packed": "Packed",
"Packed Orders": "Packed Orders",
"Partial rejections": "Partial rejections",
"Password": "Password",
"Payment": "Payment",
"PAYMENT_AUTHORIZED": "PAYMENT_AUTHORIZED",
Expand Down Expand Up @@ -391,6 +397,7 @@
"Reject in progress orders.": "Reject { ordersCount } in progress orders.",
"Reject open orders.": "Reject { ordersCount } open orders.",
"Reject order": "Reject order",
"Rejecting any items in an order will automatically reject other items of an order.": "Rejecting any items in an order will automatically reject other items of an order.",
"Rejecting has been started. All in progress orders will be rejected shortly.": "Rejecting has been started. All in progress orders will be rejected shortly.",
"Rejecting has been started. All outstanding orders will be rejected shortly.": "Rejecting has been started. All outstanding orders will be rejected shortly.",
"Rejection reason created successfully.": "Rejection reason created successfully.",
Expand Down Expand Up @@ -565,6 +572,7 @@
"View Saved Mappings": "View Saved Mappings",
"Web Channel": "Web Channel",
"Weight": "Weight",
"When rejecting an item, automatically reject all other orders for that item as well.": "When rejecting an item, automatically reject all other orders for that item as well.",
"Worn Display": "Worn Display",
"You are packing an order. Select additional documents that you would like to print.": "You are packing an order. Select additional documents that you would like to print.",
"You are packing orders. Select additional documents that you would like to print.": "You are packing { count } orders. { space } Select additional documents that you would like to print.",
Expand Down
8 changes: 8 additions & 0 deletions src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"Address 1": "Dirección 1",
"Address 2": "Dirección 2",
"Allocation": "Asignación",
"Allow collateral rejections": "Allow collateral rejections",
"Allow partial rejections": "Allow partial rejections",
"Any edits made on this page will be lost.": "Any edits made on this page will be lost.",
"Apply": "Aplicar",
"Approved": "Aprobado",
Expand All @@ -31,6 +33,7 @@
"Are you sure you want to reject in progress order(s)?": "¿Estás seguro/a de que quieres rechazar { ordersCount } pedido(s) en curso?",
"Are you sure you want to update box selection?": "¿Está seguro de que desea actualizar la selección del cuadro?",
"Assign Pickers": "Asignar Recolectores",
"Auto reject related items": "Auto reject related items",
"Back to Launchpad": "Volver a Launchpad",
"Billing Address 1": "Dirección de Facturación 1",
"Billing Address 2": "Dirección de Facturación 2",
Expand Down Expand Up @@ -70,6 +73,7 @@
"Credit Card": "Tarjeta de Credito",
"COD Fee": "Tarifa COD",
"COD Fee Tax": "Impuesto de Tarifa COD",
"Collateral rejections": "Collateral rejections",
"Completed": "Completado",
"Configuration Missing": "Configuración Faltante",
"Confirm": "Confirmar",
Expand Down Expand Up @@ -111,6 +115,7 @@
"Delivery Time": "Hora de entrega",
"Description": "Description",
"Destination": "Destino",
"Disallow collateral rejections": "Disallow collateral rejections",
"Discard": "Discard",
"Discard shipment": "Discard shipment",
"Download packed orders": "Descargar pedidos empaquetados",
Expand Down Expand Up @@ -337,6 +342,7 @@
"Pack using default packaging": "Empacar utilizando el empaque predeterminado",
"Packed": "Empacado",
"Packed Orders": "Pedidos Empacados",
"Partial rejections": "Partial rejections",
"Password": "Contraseña",
"Payment": "Pago",
"PAYMENT_AUTHORIZED": "PAYMENT_AUTHORIZED",
Expand Down Expand Up @@ -389,6 +395,7 @@
"Reject open orders.": "Rechazar { ordersCount } pedidos abiertos.",
"Reject order": "Rechazar pedido",
"Rejected": "Rechazado",
"Rejecting any items in an order will automatically reject other items of an order.": "Rejecting any items in an order will automatically reject other items of an order.",
"Rejecting has been started. All in progress orders will be rejected shortly.": "Se ha iniciado el proceso de rechazo. Todos los pedidos en curso se rechazarán en breve.",
"Rejecting has been started. All outstanding orders will be rejected shortly.": "Se ha iniciado el proceso de rechazo. Todos los pedidos pendientes se rechazarán en breve.",
"Rejection reason created successfully.": "Rejection reason created successfully.",
Expand Down Expand Up @@ -561,6 +568,7 @@
"View Saved Mappings": "Ver mapeos guardados",
"Web Channel": "Canal Web",
"Weight": "Peso",
"When rejecting an item, automatically reject all other orders for that item as well.": "When rejecting an item, automatically reject all other orders for that item as well.",
"Worn Display": "Pantalla Desgastada",
"You are packing an order. Select additional documents that you would like to print.": "Estás empacando un pedido. Selecciona documentos adicionales que te gustaría imprimir.",
"You are packing orders. Select additional documents that you would like to print.": "Estás empacando {count} pedidos. {space} Selecciona documentos adicionales que te gustaría imprimir.",
Expand Down
8 changes: 8 additions & 0 deletions src/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"Address 1": "住所 1",
"Address 2": "住所 2",
"Allocation": "割り当て",
"Allow collateral rejections": "Allow collateral rejections",
"Allow partial rejections": "Allow partial rejections",
"Any edits made on this page will be lost.": "このページで行われたすべての編集は失われます。",
"Apply": "適用",
"Approved": "承認済み",
Expand All @@ -31,6 +33,7 @@
"Are you sure you want to reject in progress order(s)?": "{ ordersCount }件の進行中の注文を拒否してもよろしいですか?",
"Are you sure you want to update box selection?": "ボックスの選択を更新してもよろしいですか?",
"Assign Pickers": "ピッカーを割り当てる",
"Auto reject related items": "Auto reject related items",
"Back to Launchpad": "ランチパッドに戻る",
"Billing Address 1": "請求先住所 1",
"Billing Address 2": "請求先住所 2",
Expand Down Expand Up @@ -74,6 +77,7 @@
"Credit Card": "クレジットカード",
"COD Fee": "代金引換手数料",
"COD Fee Tax": "代金引換手数料の税金",
"Collateral rejections": "Collateral rejections",
"Completed": "完了",
"Configuration Missing": "設定がありません",
"Confirm": "確認",
Expand Down Expand Up @@ -113,6 +117,7 @@
"Delivery days updated.": "配達日数が更新されました。",
"Delivery Time": "配達時間",
"Destination": "目的地",
"Disallow collateral rejections": "Disallow collateral rejections",
"Discard": "破棄",
"Discard shipment": "出荷を破棄",
"Download packed orders": "梱包済み注文をダウンロード",
Expand Down Expand Up @@ -339,6 +344,7 @@
"Pack using default packaging": "デフォルトの梱包材を使用して梱包",
"Packed": "梱包済み",
"Packed Orders": "梱包済み注文",
"Partial rejections": "Partial rejections",
"Password": "パスワード",
"Payment": "支払い",
"PAYMENT_AUTHORIZED": "支払い承認済み",
Expand Down Expand Up @@ -389,6 +395,7 @@
"Reject in progress orders.": "進行中の{ordersCount}件の注文を拒否。",
"Reject open orders.": "オープンの{ordersCount}件の注文を拒否。",
"Reject order": "注文を拒否",
"Rejecting any items in an order will automatically reject other items of an order.": "Rejecting any items in an order will automatically reject other items of an order.",
"Rejecting has been started. All in progress orders will be rejected shortly.": "拒否が開始されました。進行中のすべての注文はまもなく拒否されます。",
"Rejecting has been started. All outstanding orders will be rejected shortly.": "拒否が開始されました。未処理のすべての注文はまもなく拒否されます。",
"Rejection reason created successfully.": "拒否理由が正常に作成されました。",
Expand Down Expand Up @@ -562,6 +569,7 @@
"View Saved Mappings": "保存されたマッピングを表示",
"Web Channel": "ウェブチャネル",
"Weight": "重量",
"When rejecting an item, automatically reject all other orders for that item as well.": "When rejecting an item, automatically reject all other orders for that item as well.",
"Worn Display": "摩耗表示",
"You are packing an order. Select additional documents that you would like to print.": "注文を梱包しています。印刷したい追加書類を選択してください。",
"You are packing orders. Select additional documents that you would like to print.": "{count}件の注文を梱包しています。{ space }印刷したい追加書類を選択してください。",
Expand Down
25 changes: 25 additions & 0 deletions src/services/UserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,38 @@ const updatePartialOrderRejectionConfig = async (payload: any): Promise<any> =>
});
}

const getCollateralRejectionConfig = async (payload: any): Promise<any> => {
return api({
url: "performFind",
method: "get",
params: payload,
});
}
const createCollateralRejectionConfig = async (payload: any): Promise<any> => {
return api({
url: "service/createProductStoreSetting",
method: "post",
data: payload
});
}
const updateCollateralRejectionConfig = async (payload: any): Promise<any> => {
return api({
url: "service/updateProductStoreSetting",
method: "post",
data: payload
});
}


export const UserService = {
addFacilityToGroup,
createCollateralRejectionConfig,
createEnumeration,
createFieldMapping,
createPartialOrderRejectionConfig,
deleteFieldMapping,
login,
getCollateralRejectionConfig,
getEComStores,
getFacilityDetails,
getFacilityOrderCount,
Expand All @@ -374,5 +398,6 @@ export const UserService = {
updateFacility,
updateFacilityToGroup,
updateFieldMapping,
updateCollateralRejectionConfig,
updatePartialOrderRejectionConfig
}
1 change: 1 addition & 0 deletions src/store/modules/user/UserState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export default interface UserState {
hasUnreadNotifications: boolean;
allNotificationPrefs: any;
partialOrderRejectionConfig: any;
collateralRejectionConfig: any;
}
69 changes: 69 additions & 0 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,50 @@ const actions: ActionTree<UserState, RootState> = {
// Fetch the updated configuration
await dispatch("getPartialOrderRejectionConfig");
},
async updateCollateralRejectionConfig ({ dispatch }, payload) {
let resp = {} as any;
try {
if(!await UserService.isEnumExists("FF_COLLATERAL_REJ")) {
resp = await UserService.createEnumeration({
"enumId": "FF_COLLATERAL_REJ",
"enumTypeId": "PROD_STR_STNG",
"description": "Fulfillment Collateral Rejection",
"enumName": "Fulfillment Collateral Rejection",
"enumCode": "FF_COLLATERAL_REJ"
})

if(hasError(resp)) {
throw resp.data;
}
}

if (!payload.fromDate) {
//Create Product Store Setting
payload = {
...payload,
"productStoreId": this.state.user.currentEComStore.productStoreId,
"settingTypeEnumId": "FF_COLLATERAL_REJ",
"fromDate": DateTime.now().toMillis()
}
resp = await UserService.createCollateralRejectionConfig(payload) as any
} else {
//Update Product Store Setting
resp = await UserService.updateCollateralRejectionConfig(payload) as any
}

if (!hasError(resp)) {
showToast(translate('Configuration updated'))
} else {
showToast(translate('Failed to update configuration'))
}
} catch(err) {
showToast(translate('Failed to update configuration'))
logger.error(err)
}

// Fetch the updated configuration
await dispatch("getCollateralRejectionConfig");
},
async getPartialOrderRejectionConfig ({ commit }) {
let config = {};
const params = {
Expand All @@ -472,6 +516,31 @@ const actions: ActionTree<UserState, RootState> = {
}
commit(types.USER_PARTIAL_ORDER_REJECTION_CONFIG_UPDATED, config);
},
async getCollateralRejectionConfig ({ commit }) {
let config = {};
const params = {
"inputFields": {
"productStoreId": this.state.user.currentEComStore.productStoreId,
"settingTypeEnumId": "FF_COLLATERAL_REJ"
},
"filterByDate": 'Y',
"entityName": "ProductStoreSetting",
"fieldList": ["productStoreId", "settingTypeEnumId", "settingValue", "fromDate"],
"viewSize": 1
} as any

try {
const resp = await UserService.getCollateralRejectionConfig(params)
if (resp.status === 200 && !hasError(resp) && resp.data?.docs) {
config = resp.data?.docs[0];
} else {
logger.error('Failed to fetch collateral rejection configuration');
}
} catch (err) {
logger.error(err);
}
commit(types.USER_COLLATERAL_REJECTION_CONFIG_UPDATED, config);
},

addNotification({ state, commit }, payload) {
const notifications = JSON.parse(JSON.stringify(state.notifications))
Expand Down
5 changes: 4 additions & 1 deletion src/store/modules/user/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ const getters: GetterTree <UserState, RootState> = {
},
getPartialOrderRejectionConfig(state) {
return state.partialOrderRejectionConfig;
}
},
getCollateralRejectionConfig(state) {
return state.collateralRejectionConfig;
},
}
export default getters;
3 changes: 2 additions & 1 deletion src/store/modules/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const userModule: Module<UserState, RootState> = {
firebaseDeviceId: '',
hasUnreadNotifications: true,
allNotificationPrefs: [],
partialOrderRejectionConfig: {}
partialOrderRejectionConfig: {},
collateralRejectionConfig: {}
},
getters,
actions,
Expand Down
3 changes: 2 additions & 1 deletion src/store/modules/user/mutation-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export const USER_NOTIFICATIONS_PREFERENCES_UPDATED = SN_USER + '/NOTIFICATIONS_
export const USER_FIREBASE_DEVICEID_UPDATED = SN_USER + '/FIREBASE_DEVICEID_UPDATED'
export const USER_UNREAD_NOTIFICATIONS_STATUS_UPDATED = SN_USER + '/UNREAD_NOTIFICATIONS_STATUS_UPDATED'
export const USER_ALL_NOTIFICATION_PREFS_UPDATED = SN_USER + '/ALL_NOTIFICATION_PREFS_UPDATED'
export const USER_PARTIAL_ORDER_REJECTION_CONFIG_UPDATED = SN_USER + '/PARTIAL_ORDER_REJECTION_CONFIG_UPDATED'
export const USER_PARTIAL_ORDER_REJECTION_CONFIG_UPDATED = SN_USER + '/PARTIAL_ORDER_REJECTION_CONFIG_UPDATED'
export const USER_COLLATERAL_REJECTION_CONFIG_UPDATED = SN_USER + '/COLLATERAL_REJECTION_CONFIG_UPDATED'
3 changes: 3 additions & 0 deletions src/store/modules/user/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ const mutations: MutationTree <UserState> = {
},
[types.USER_PARTIAL_ORDER_REJECTION_CONFIG_UPDATED] (state, payload) {
state.partialOrderRejectionConfig = payload
},
[types.USER_COLLATERAL_REJECTION_CONFIG_UPDATED] (state, payload) {
state.collateralRejectionConfig = payload
}
}
export default mutations;
4 changes: 3 additions & 1 deletion src/views/InProgress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ export default defineComponent({
boxTypeDesc: 'util/getShipmentBoxDesc',
getProductStock: 'stock/getProductStock',
isForceScanEnabled: 'util/isForceScanEnabled',
partialOrderRejectionConfig: 'user/getPartialOrderRejectionConfig'
partialOrderRejectionConfig: 'user/getPartialOrderRejectionConfig',
collateralRejectionConfig: 'user/getCollateralRejectionConfig'
}),
},
data() {
Expand Down Expand Up @@ -767,6 +768,7 @@ export default defineComponent({
data: {
facilityId : this.currentFacility.facilityId,
rejectEntireShipment: this.isEntierOrderRejectionEnabled(order) ? "Y" : "N",
rejectAllRelatedShipment: this.collateralRejectionConfig?.settingValue === 'true' ? "Y" : "N",
defaultReason: this.rejectEntireOrderReasonId, //default reason for items for which reason is not selected but rejecting due to entire order rejection config.
items: rejectedOrderItems
}
Expand Down
Loading

0 comments on commit 8a7b385

Please sign in to comment.