From 860d6e04165f217e40f0637de0325a247583860f Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 14 Jul 2023 10:19:48 +0530 Subject: [PATCH 1/3] Fixed: issue of same package being added when clicking add box button multiple times(#198) --- src/store/modules/order/actions.ts | 1 + src/views/InProgress.vue | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index 83865e06..e88ed936 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -259,6 +259,7 @@ const actions: ActionTree = { items: order.doclist.docs, shipmentMethodTypeId: orderItem.shipmentMethodTypeId, shipmentMethodTypeDesc: orderItem.shipmentMethodTypeDesc, + isAddingBox: false } }) } else { diff --git a/src/views/InProgress.vue b/src/views/InProgress.vue index 67507659..84b7bd46 100644 --- a/src/views/InProgress.vue +++ b/src/views/InProgress.vue @@ -711,6 +711,13 @@ export default defineComponent({ return defaultBoxType; }, async addShipmentBox(order: any) { + if(order.isAddingBox) { + return; + } + + // changing the flag to know that process to add the box is in process + order.isAddingBox = true; + const { carrierPartyId, shipmentMethodTypeId } = await this.fetchShipmentRouteSegmentInformation(order.shipmentIds) if(!this.defaultShipmentBoxType) { @@ -739,6 +746,8 @@ export default defineComponent({ showToast(translate('Failed to add box')) logger.error('Failed to add box', err) } + + order.isAddingBox = false; // setting the value again to default once the box adding process is completed }, getShipmentPackageNameAndType(shipmentPackage: any, order: any) { // TODO From 6e52b010c018e5d4d663896fdb7e9d69f624efe6 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Tue, 18 Jul 2023 17:52:47 +0530 Subject: [PATCH 2/3] Improved: logic to disable the button when box adding is in progress(#198) --- src/views/InProgress.vue | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/views/InProgress.vue b/src/views/InProgress.vue index 84b7bd46..4dc0ce71 100644 --- a/src/views/InProgress.vue +++ b/src/views/InProgress.vue @@ -67,7 +67,7 @@
- {{ $t("Add Box") }} + {{ $t("Add Box") }} {{ getShipmentPackageNameAndType(shipmentPackage, order) }}
@@ -711,11 +711,7 @@ export default defineComponent({ return defaultBoxType; }, async addShipmentBox(order: any) { - if(order.isAddingBox) { - return; - } - - // changing the flag to know that process to add the box is in process + // changing the flag to know that process to add the box is in-progress order.isAddingBox = true; const { carrierPartyId, shipmentMethodTypeId } = await this.fetchShipmentRouteSegmentInformation(order.shipmentIds) From 4a138277c81d8e9d5a7458bb6af7f6332a681a11 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Tue, 18 Jul 2023 19:04:37 +0530 Subject: [PATCH 3/3] Improved: logic to maintain an array of orderIds in which boxes adding is in progress(#198) --- src/store/modules/order/actions.ts | 3 +-- src/views/InProgress.vue | 11 +++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index e88ed936..c03e8498 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -258,8 +258,7 @@ const actions: ActionTree = { picklistBinId: orderItem.picklistBinId, items: order.doclist.docs, shipmentMethodTypeId: orderItem.shipmentMethodTypeId, - shipmentMethodTypeDesc: orderItem.shipmentMethodTypeDesc, - isAddingBox: false + shipmentMethodTypeDesc: orderItem.shipmentMethodTypeDesc } }) } else { diff --git a/src/views/InProgress.vue b/src/views/InProgress.vue index 4dc0ce71..c9b27d8a 100644 --- a/src/views/InProgress.vue +++ b/src/views/InProgress.vue @@ -67,7 +67,7 @@
- {{ $t("Add Box") }} + {{ $t("Add Box") }} {{ getShipmentPackageNameAndType(shipmentPackage, order) }}
@@ -247,13 +247,14 @@ export default defineComponent({ rejectReasons: 'util/getRejectReasons', currentEComStore: 'user/getCurrentEComStore', userPreference: 'user/getUserPreference' - }) + }), }, data() { return { picklists: [] as any, defaultShipmentBoxType: '', itemsIssueSegmentSelected: [] as any, + orderBoxes: [] as any } }, methods: { @@ -711,8 +712,7 @@ export default defineComponent({ return defaultBoxType; }, async addShipmentBox(order: any) { - // changing the flag to know that process to add the box is in-progress - order.isAddingBox = true; + this.orderBoxes.push(order.orderId) const { carrierPartyId, shipmentMethodTypeId } = await this.fetchShipmentRouteSegmentInformation(order.shipmentIds) @@ -742,8 +742,7 @@ export default defineComponent({ showToast(translate('Failed to add box')) logger.error('Failed to add box', err) } - - order.isAddingBox = false; // setting the value again to default once the box adding process is completed + this.orderBoxes.splice(this.orderBoxes.indexOf(order.orderId), 1) }, getShipmentPackageNameAndType(shipmentPackage: any, order: any) { // TODO