Skip to content

Commit

Permalink
Merge pull request #915 from amansinghbais/#912
Browse files Browse the repository at this point in the history
Improved: added optional check while fetching additional info of inprogress orders (#912)
  • Loading branch information
ymaheshwari1 authored Jan 28, 2025
2 parents c3c13d6 + 3eabe11 commit bd96700
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ const actions: ActionTree<OrderState, RootState> = {
item.shipmentItemSeqId = shipment.shipmentItemSeqId
}

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

const orderItem = order.items[0];
const carrierPartyIds = [...new Set(orderShipmentIds.map((id: any) => carrierPartyIdsByShipment[id]?.map((carrierParty: any) => carrierParty.carrierPartyId)).flat())];
const carrierPartyIds = [...new Set(orderShipmentIds?.map((id: any) => carrierPartyIdsByShipment[id]?.map((carrierParty: any) => carrierParty.carrierPartyId)).flat())];

const shipmentBoxTypeByCarrierParty = carrierPartyIds.reduce((shipmentBoxType: any, carrierPartyId: any) => {
const shipmentBoxTypeByCarrierParty = carrierPartyIds?.reduce((shipmentBoxType: any, carrierPartyId: any) => {
if (shipmentBoxType[carrierPartyId]) {
shipmentBoxType[carrierPartyId].push(carrierShipmentBoxType[carrierPartyId])
} else {
Expand All @@ -106,15 +106,15 @@ const actions: ActionTree<OrderState, RootState> = {
return shipmentBoxType
}, {});

const shipmentPackages = shipmentPackagesByOrderAndPicklistBin[`${orderItem.orderId}_${orderItem.picklistBinId}`].map((shipmentPackage: any) => {
const shipmentPackages = shipmentPackagesByOrderAndPicklistBin[`${orderItem.orderId}_${orderItem.picklistBinId}`]?.map((shipmentPackage: any) => {
return {
...shipmentPackage,
shipmentBoxTypes: shipmentBoxTypeByCarrierParty[shipmentPackage.carrierPartyId] ? shipmentBoxTypeByCarrierParty[shipmentPackage.carrierPartyId] : []
}
});

const currentShipmentPackages = shipmentPackagesByOrderAndPicklistBin[`${orderItem.orderId}_${orderItem.picklistBinId}`].reduce((currentShipmentPackages: any, shipment: any) => {
currentShipmentPackages.push(...orderShipmentPackages.filter((shipmentPackage: any) => shipmentPackage.shipmentId === shipment.shipmentId));
const currentShipmentPackages = shipmentPackagesByOrderAndPicklistBin[`${orderItem.orderId}_${orderItem.picklistBinId}`]?.reduce((currentShipmentPackages: any, shipment: any) => {
currentShipmentPackages.push(...orderShipmentPackages?.filter((shipmentPackage: any) => shipmentPackage.shipmentId === shipment.shipmentId));
return currentShipmentPackages;
}, []);

Expand Down

0 comments on commit bd96700

Please sign in to comment.