diff --git a/src/locales/en.json b/src/locales/en.json index 75d8215d..63705e8f 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -48,6 +48,7 @@ "Dismiss": "Dismiss", "Delete": "Delete", "Delete mapping": "Delete mapping", + "Destination": "Destination", "eCom Store": "eCom Store", "ECom inventory status updated successfully": "ECom inventory status updated successfully", "Edit packaging": "Edit packaging", @@ -100,6 +101,7 @@ "Generate shipping label": "Generate shipping label", "Go to OMS": "Go to OMS", "Go to Launchpad": "Go to Launchpad", + "Handling Instructions": "Handling Instructions", "is identified as unfulfillable. other containing this product will be unassigned from this store and sent to be rebrokered.": "{ productName } is identified as unfulfillable. { space } { orders } other { orderText } containing this product will be unassigned from this store and sent to be rebrokered.", "is identified as unfulfillable. This order item will be unassigned from this store and sent to be rebrokered.": "{ productName } is identified as unfulfillable. { space } This order item will be unassigned from this store and sent to be rebrokered.", "is identified as. This order item will be unassigned from the store and sent to be rebrokered.": "{ productName } is identified as { rejectReason }. This order item will be unassigned from the store and sent to be rebrokered.", @@ -127,6 +129,7 @@ "Mismatch": "Mismatch", "Next day": "Next day", "New mapping": "New mapping", + "No carrier error": "No carrier error", "No data available!": "No data available!", "No data Found.": "No data Found.", "No capacity sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. To add a fulfillment capacity to this facility, use the custom option.": "No capacity sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. {space}To add a fulfillment capacity to this facility, use the custom option.", diff --git a/src/locales/es.json b/src/locales/es.json index 4256d079..c7d66aac 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -48,6 +48,7 @@ "Dismiss": "Dismiss", "Delete": "Delete", "Delete mapping": "Delete mapping", + "Destination": "Destination", "eCom Store": "Tienda eCom", "ECom inventory status updated successfully": "ECom inventory status updated successfully", "Edit packaging": "Editar empaque", @@ -100,6 +101,7 @@ "Generate shipping label": "Generate shipping label", "Go to OMS": "Go to OMS", "Go to Launchpad": "Go to Launchpad", + "Handling Instructions": "Handling Instructions", "is identified as unfulfillable. other containing this product will be unassigned from this store and sent to be rebrokered.": "{ productName } is identified as unfulfillable. { space } { orders } other { orderText } containing this product will be unassigned from this store and sent to be rebrokered.", "is identified as unfulfillable. This order item will be unassigned from this store and sent to be rebrokered.": "{ productName } is identified as unfulfillable. { space } This order item will be unassigned from this store and sent to be rebrokered.", "is identified as. This order item will be unassigned from the store and sent to be rebrokered.": "{ productName } is identified as { rejectReason }. This order item will be unassigned from the store and sent to be rebrokered.", @@ -129,6 +131,7 @@ "Next day": "Día siguiente", "No Capacity": "No Capacity", "No capacity sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. To add a fulfillment capacity to this facility, use the custom option.": "No capacity sets the fulfillment capacity to 0, preventing any new orders from being allocated to this facility. Use the \"Reject all orders\" option in the fulfillment pages to clear your facilities fulfillment queue. {space}To add a fulfillment capacity to this facility, use the custom option.", + "No carrier error": "No carrier error", "No data available!": "No data available!", "No data Found.": "No data Found.", "No new file upload. Please try again": "No se cargó ningún archivo nuevo. Por favor, inténtalo nuevamente.", diff --git a/src/services/OrderService.ts b/src/services/OrderService.ts index f0bf1d05..7791663d 100644 --- a/src/services/OrderService.ts +++ b/src/services/OrderService.ts @@ -376,6 +376,66 @@ const fetchShipmentLabelError = async (shipmentIds: Array): Promise return shipmentLabelError; } +const fetchOrderItemShipGroup = async (order: any): Promise => { + let shipGroup = {}; + + const params = { + "entityName": "OrderItemShipGroup", + "inputFields": { + "orderId": order.orderId, + "shipGroupSeqId": order.items[0].shipGroupSeqId, + }, + "fieldList": ["orderId", "shipGroupSeqId", "facilityId", "shipmentMethodTypeId", "contactMechId"], + "distinct": "Y" + } + + try { + const resp = await api({ + url: "performFind", + method: "get", + params + }) + + if (!hasError(resp)) { + shipGroup = resp?.data.docs[0]; + } else if (!resp?.data.error || (resp.data.error && resp.data.error !== "No record found")) { + return Promise.reject(resp?.data.error); + } + } catch (err) { + logger.error('Failed to fetch shipments for orders', err) + } + + return shipGroup; +} + +const fetchShippingAddress = async (contactMechId: string): Promise => { + let shippingAddress = {}; + + const params = { + "entityName": "PostalAddressAndGeo", + "inputFields": { + "contactMechId": contactMechId, + }, + } + + try { + const resp = await api({ + url: "performFind", + method: "get", + params + }) + + if (!hasError(resp)) { + shippingAddress = resp?.data.docs[0]; + } else if (!resp?.data.error || (resp.data.error && resp.data.error !== "No record found")) { + return Promise.reject(resp?.data.error); + } + } catch (err) { + logger.error('Failed to fetch shipments for orders', err) + } + return shippingAddress; +} + export const OrderService = { addShipmentBox, bulkShipOrders, @@ -396,5 +456,7 @@ export const OrderService = { shipOrder, unpackOrder, updateOrder, - fetchShipmentLabelError + fetchShipmentLabelError, + fetchOrderItemShipGroup, + fetchShippingAddress } diff --git a/src/store/modules/order/OrderState.ts b/src/store/modules/order/OrderState.ts index 81a1c135..7a0dcbe0 100644 --- a/src/store/modules/order/OrderState.ts +++ b/src/store/modules/order/OrderState.ts @@ -30,5 +30,5 @@ export default interface OrderState { queryString: string } }, - current: Array, + current: any, } \ No newline at end of file diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index b1fe7d14..c7fc141d 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -275,7 +275,8 @@ const actions: ActionTree = { picklistBinId: orderItem.picklistBinId, items: order.doclist.docs, shipmentMethodTypeId: orderItem.shipmentMethodTypeId, - shipmentMethodTypeDesc: orderItem.shipmentMethodTypeDesc + shipmentMethodTypeDesc: orderItem.shipmentMethodTypeDesc, + shippingInstructions: orderItem.shippingInstructions } }) } else { @@ -366,6 +367,7 @@ const actions: ActionTree = { items: order.doclist.docs, shipmentMethodTypeId: orderItem.shipmentMethodTypeId, shipmentMethodTypeDesc: orderItem.shipmentMethodTypeDesc, + shippingInstructions: orderItem.shippingInstructions, reservedDatetime: orderItem.reservedDatetime } }) @@ -451,6 +453,7 @@ const actions: ActionTree = { shipmentId: orderItem.shipmentId, shipmentMethodTypeId: orderItem.shipmentMethodTypeId, shipmentMethodTypeDesc: orderItem.shipmentMethodTypeDesc, + shippingInstructions: orderItem.shippingInstructions, isGeneratingShippingLabel: false, isGeneratingPackingSlip: false } @@ -469,6 +472,27 @@ const actions: ActionTree = { emitter.emit('dismissLoader'); return resp; }, + async fetchShippingAddress ({ commit }, currentOrder) { + let resp; + + try { + resp = await OrderService.fetchOrderItemShipGroup(currentOrder); + if (resp) { + const contactMechId = resp.contactMechId; + + resp = await OrderService.fetchShippingAddress(contactMechId); + if (resp) { + currentOrder = { + ...currentOrder, + shippingAddress: resp + } + } + } + } catch (err: any) { + logger.error("Error in setting current order", err); + } + commit(types.ORDER_CURRENT_UPDATED, { order: currentOrder }) + }, async clearOrders ({ commit }) { commit(types.ORDER_INPROGRESS_CLEARED) @@ -518,8 +542,9 @@ const actions: ActionTree = { }, // TODO clear current on logout - updateCurrent ({ commit }, payload) { + async updateCurrent ({ commit, dispatch }, payload) { commit(types.ORDER_CURRENT_UPDATED, { order: payload }) + await dispatch('fetchShippingAddress', payload); }, } diff --git a/src/store/modules/order/index.ts b/src/store/modules/order/index.ts index daf8d8e9..7ef72263 100644 --- a/src/store/modules/order/index.ts +++ b/src/store/modules/order/index.ts @@ -39,7 +39,7 @@ const orderModule: Module = { queryString: '' } }, - current: [] + current: {} }, getters, actions, diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 0ed90049..27e74054 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -150,6 +150,7 @@ + @@ -214,6 +215,7 @@ import AssignPickerModal from '@/views/AssignPickerModal.vue'; import ShipmentBoxTypePopover from '@/components/ShipmentBoxTypePopover.vue' import ShipmentBoxPopover from '@/components/ShipmentBoxPopover.vue' import ReportIssuePopover from '@/components/ReportIssuePopover.vue' +import ShippingDetails from '@/views/ShippingDetails.vue'; export default defineComponent({ name: "OrderDetail", @@ -237,6 +239,7 @@ export default defineComponent({ IonTitle, IonToolbar, IonThumbnail, + ShippingDetails }, computed: { ...mapGetters({ diff --git a/src/views/ShippingDetails.vue b/src/views/ShippingDetails.vue new file mode 100644 index 00000000..6fb14ce4 --- /dev/null +++ b/src/views/ShippingDetails.vue @@ -0,0 +1,107 @@ + + + \ No newline at end of file