diff --git a/src/locales/ja.json b/src/locales/ja.json index dffd6aad..7a82e6ca 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -118,6 +118,7 @@ "Packing slips help customer reconcile their order against the delivered items.": "内容明細票はお客様が注文と配送された商品を確認(照合)する際に役立ちます。", "Partial Order rejection": "部分的な注文拒否", "Password": "パスワード", + "Pending allocation": "Pending allocation", "pending approval": "承認待ち", "Picked by": "{pickers} によってピックアップされました", "Pick up location": "受取場所", diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index 64115d7a..26766c13 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -1134,7 +1134,6 @@ const actions: ActionTree ={ shipGroups = payload.shipGroups.map((shipGroup: any) => { const reservedShipGroupForOrder = shipGroups.find((group: any) => shipGroup.shipGroupSeqId === group.doclist?.docs[0]?.shipGroupSeqId) - const reservedShipGroup = reservedShipGroupForOrder?.groupValue ? reservedShipGroupForOrder.doclist.docs[0] : '' return reservedShipGroup ? { @@ -1142,7 +1141,7 @@ const actions: ActionTree ={ items: reservedShipGroupForOrder.doclist.docs, carrierPartyId: reservedShipGroup.carrierPartyId, shipmentId: reservedShipGroup.shipmentId, - category: getOrderCategory(reservedShipGroupForOrder.doclist.docs[0]) + category: getOrderCategory({ ...reservedShipGroupForOrder.doclist.docs[0], ...shipGroup.items[0] }) // Passing shipGroup item information as we need to derive the order status and for that we need some properties those are available on ORDER doc } : { ...shipGroup, category: getOrderCategory(shipGroup.items[0]) diff --git a/src/utils/order.ts b/src/utils/order.ts index bc5486bb..e48de90b 100644 --- a/src/utils/order.ts +++ b/src/utils/order.ts @@ -1,9 +1,7 @@ +import store from "@/store" + const orderCategoryParameters = { 'Open': { - 'shipmentMethodTypeId': { - 'value': 'STOREPICKUP', - 'OP': 'NOT' - }, 'shipmentStatusId': { 'value': '*', 'OP': 'NOT', @@ -20,10 +18,6 @@ const orderCategoryParameters = { } }, 'Packed': { - 'shipmentMethodTypeId': { - 'value': 'STOREPICKUP', - 'OP': 'NOT' - }, 'shipmentStatusId': { 'value': 'SHIPMENT_PACKED', }, @@ -36,10 +30,6 @@ const orderCategoryParameters = { }, }, 'Completed': { - 'shipmentMethodTypeId': { - 'value': 'STOREPICKUP', - 'OP': 'NOT' - }, 'orderItemStatusId': { 'value': 'ITEM_COMPLETED' }, @@ -50,7 +40,7 @@ const orderCategoryParameters = { 'value': 'ORDER' } } -} +} as any const handleParameterMatching = (orderVal: any, parameterVal: any, operation?: string) => { // considering params will always be an Array for ORing and ANDing @@ -73,6 +63,13 @@ const handleParameterMatching = (orderVal: any, parameterVal: any, operation?: s } const getOrderCategory = (order: any) => { + + if(!store.state.user.preference.showShippingOrders) { + orderCategoryParameters["Open"]["shipmentMethodTypeId"] = { value: "STOREPICKUP" } + orderCategoryParameters["Packed"]["shipmentMethodTypeId"] = { value: "STOREPICKUP" } + orderCategoryParameters["Completed"]["shipmentMethodTypeId"] = { value: "STOREPICKUP" } + } + const orderCategoryParameterEntries = Object.entries(orderCategoryParameters) let result = '' // using find, as once any of the category is matched then return from here; @@ -81,7 +78,8 @@ const getOrderCategory = (order: any) => { const paramKeys = Object.keys(parameters) // used every as to check against each filtering property - const isMatched = paramKeys.every((key: string) => Object.prototype.hasOwnProperty.call(order, key) && handleParameterMatching(order[key], parameters[key].value, parameters[key]['OP'])) + // Added check for property value *, as we will add * as value when operator NOT is defined and also for * values we do not want to check for property existence directly on order + const isMatched = paramKeys.every((key: string) => (parameters[key].value === "*" || Object.prototype.hasOwnProperty.call(order, key)) && handleParameterMatching(order[key], parameters[key].value, parameters[key]['OP'])) // return the value when all params matched for an order if (isMatched) { diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 96c4a1a7..320220e6 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -134,7 +134,7 @@ {{ shipGroup.facilityName }} {{ shipGroup.shipGroupSeqId }} - {{ shipGroup.category ? shipGroup.category : '-' }} + {{ shipGroup.category ? shipGroup.category : translate('Pending allocation') }}