Skip to content

Commit

Permalink
Fixed: Fetched updated package detail on updating order (#801).
Browse files Browse the repository at this point in the history
  • Loading branch information
ravilodhi committed Oct 10, 2024
1 parent be4ec40 commit f8e1e26
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,17 +647,26 @@ const actions: ActionTree<OrderState, RootState> = {
const missingLabelImage = this.state.util.productStoreShipmentMethCount > 0 ? shipmentPackageValues.some((shipmentPackage:any) => !shipmentPackage.trackingCode) : false;

const updateShipmentPackages = (order:any) => {
order.shipmentPackages.forEach((shipmentPackage:any) => {

const updatedShipmentPackages = order.shipmentPackages.reduce((updatedShipmentPackages: any[], shipmentPackage: any) => {
const key = `${shipmentPackage.shipmentId}-${shipmentPackage.shipmentPackageSeqId}`;
const updatedShipmentPackage = shipmentPackagesMap[key];

// Only add the shipment package if updatedShipmentPackage exists
if (updatedShipmentPackage) {
shipmentPackage.trackingCode = updatedShipmentPackage.trackingCode;
shipmentPackage.labelPdfUrl = updatedShipmentPackage.labelPdfUrl;
shipmentPackage.shipmentMethodTypeId = updatedShipmentPackage.shipmentMethodTypeId;
shipmentPackage.carrierPartyId = updatedShipmentPackage.carrierPartyId;
shipmentPackage.missingLabelImage = missingLabelImage;
const newShipmentPackage = { ...shipmentPackage };
newShipmentPackage.trackingCode = updatedShipmentPackage.trackingCode;
newShipmentPackage.labelPdfUrl = updatedShipmentPackage.labelPdfUrl;
newShipmentPackage.shipmentMethodTypeId = updatedShipmentPackage.shipmentMethodTypeId;
newShipmentPackage.carrierPartyId = updatedShipmentPackage.carrierPartyId;
newShipmentPackage.missingLabelImage = missingLabelImage;
updatedShipmentPackages.push(newShipmentPackage);
}
});

return updatedShipmentPackages;
}, []);

order.shipmentPackages = updatedShipmentPackages
order.trackingCode = order.shipmentPackages?.[0]?.trackingCode
order.missingLabelImage = missingLabelImage
};
Expand Down Expand Up @@ -1134,7 +1143,6 @@ const actions: ActionTree<OrderState, RootState> = {
}

item.selectedBox = shipmentPackageContents[`${item.shipmentId}`].find((shipmentPackageContent: any) => shipmentPackageContent.shipmentItemSeqId === item.shipmentItemSeqId)?.packageName
item.selectedBox = shipmentPackagesByOrderAndPicklistBin[`${item.orderId}_${item.picklistBinId}`]?.find((shipmentPackage: any) => shipmentPackage.shipmentId === item.shipmentId)?.packageName
})

const orderItem = current.items[0];
Expand Down
1 change: 1 addition & 0 deletions src/views/InProgress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ export default defineComponent({
order.items = items
await this.store.dispatch('order/updateInProgressOrder', order)
await this.store.dispatch('order/updateShipmentPackageDetail', order)
}
showToast(translate('Order updated successfully'))
} else {
Expand Down
1 change: 1 addition & 0 deletions src/views/OrderDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,7 @@ export default defineComponent({
order.isModified = false;
await this.store.dispatch('order/updateInProgressOrder', order)
await this.store.dispatch('order/updateShipmentPackageDetail', order)
showToast(translate('Order updated successfully'))
return Promise.resolve(order);
} else {
Expand Down

0 comments on commit f8e1e26

Please sign in to comment.