From f19c514ca93a3f142042ded9f1a5d13924e0fbf0 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 15 Apr 2024 16:24:44 +0530 Subject: [PATCH 1/4] Improved: toast message to be shown in case of scanning success/failure item(#459) --- src/locales/en.json | 2 ++ src/store/modules/transferorder/actions.ts | 14 +++++++------- src/views/TransferOrderDetail.vue | 13 ++++++++++--- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index cbcf2845..4c6c15cb 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -340,6 +340,8 @@ "Setting fulfillment capacity to 0 disables new order from being allocated to this facility. Leave this empty if this facility's fulfillment capacity is unrestricted.": "Setting fulfillment capacity to 0 disables new order from being allocated to this facility. Leave this empty if this facility's fulfillment capacity is unrestricted.", "Settings": "Settings", "Set Limit": "Set Limit", + "Scanned item is not present within the shipment:": "Scanned item is not present within the shipment: {itemName}", + "Scanned successfully.": "Scanned {itemName} successfully.", "Ship": "Ship", "shipments ready to ship": "shipments ready to ship", "Ship Now": "Ship Now", diff --git a/src/store/modules/transferorder/actions.ts b/src/store/modules/transferorder/actions.ts index 6d44db18..021ff077 100644 --- a/src/store/modules/transferorder/actions.ts +++ b/src/store/modules/transferorder/actions.ts @@ -261,13 +261,13 @@ const actions: ActionTree = { }, async updateOrderProductCount({ commit, state }, payload ) { - - state.current.items.find((item: any) => { - if (item.internalName === payload) { - item.pickedQuantity = parseInt(item.pickedQuantity) + 1; - } - }); - commit(types.ORDER_CURRENT_UPDATED, state.current ) + const item = state.current.items.find((item: any) => item.internalName === payload); + if(item){ + item.pickedQuantity = parseInt(item.pickedQuantity) + 1; + commit(types.ORDER_CURRENT_UPDATED, state.current ) + return { isProductFound: true } + } + return { isProductFound: false } }, async updateCurrentTransferOrder({ commit }, payload) { diff --git a/src/views/TransferOrderDetail.vue b/src/views/TransferOrderDetail.vue index 55fdae78..08762189 100644 --- a/src/views/TransferOrderDetail.vue +++ b/src/views/TransferOrderDetail.vue @@ -284,9 +284,16 @@ getShippedQuantity(item: any) { return this.currentOrder?.shippedQuantityInfo?.[item.orderItemSeqId] ? this.currentOrder?.shippedQuantityInfo?.[item.orderItemSeqId] : 0; }, - updateProductCount(payload: any) { - if (this.queryString) payload = this.queryString - this.store.dispatch('transferorder/updateOrderProductCount', payload) + async updateProductCount(payload: any) { + if (this.queryString) { + payload = this.queryString; + } + const result = await this.store.dispatch('transferorder/updateOrderProductCount', payload); + if (result.isProductFound) { + showToast(translate("Scanned successfully.", { itemName: payload })); + } else { + showToast(translate("Scanned item is not present within the shipment:", { itemName: payload })); + } }, async scanCode () { const modal = await modalController From ade0824225218e2abb37bdbae9ef5e41e47ac722 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 15 Apr 2024 18:43:43 +0530 Subject: [PATCH 2/4] Update: changed indentation and toast message(#459) --- src/locales/en.json | 4 ++-- src/views/TransferOrderDetail.vue | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 4c6c15cb..347c156b 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -340,8 +340,8 @@ "Setting fulfillment capacity to 0 disables new order from being allocated to this facility. Leave this empty if this facility's fulfillment capacity is unrestricted.": "Setting fulfillment capacity to 0 disables new order from being allocated to this facility. Leave this empty if this facility's fulfillment capacity is unrestricted.", "Settings": "Settings", "Set Limit": "Set Limit", - "Scanned item is not present within the shipment:": "Scanned item is not present within the shipment: {itemName}", - "Scanned successfully.": "Scanned {itemName} successfully.", + "Scanned item is not present within the order:": "Scanned item is not present within the order: {itemName}", + "Scanned successfully:": "Scanned {itemName} successfully.", "Ship": "Ship", "shipments ready to ship": "shipments ready to ship", "Ship Now": "Ship Now", diff --git a/src/views/TransferOrderDetail.vue b/src/views/TransferOrderDetail.vue index 08762189..b7222949 100644 --- a/src/views/TransferOrderDetail.vue +++ b/src/views/TransferOrderDetail.vue @@ -290,9 +290,9 @@ } const result = await this.store.dispatch('transferorder/updateOrderProductCount', payload); if (result.isProductFound) { - showToast(translate("Scanned successfully.", { itemName: payload })); + showToast(translate("Scanned successfully:", { itemName: payload })); } else { - showToast(translate("Scanned item is not present within the shipment:", { itemName: payload })); + showToast(translate("Scanned item is not present within the order:", { itemName: payload })); } }, async scanCode () { From 4965ba79f91a20041dfd65e501fc7b467a78f781 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Tue, 16 Apr 2024 14:26:07 +0530 Subject: [PATCH 3/4] Updated: change in some indentation(#459) --- src/locales/en.json | 2 +- src/views/TransferOrderDetail.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 347c156b..f88155a5 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -341,7 +341,7 @@ "Settings": "Settings", "Set Limit": "Set Limit", "Scanned item is not present within the order:": "Scanned item is not present within the order: {itemName}", - "Scanned successfully:": "Scanned {itemName} successfully.", + "Scanned successfully.": "Scanned {itemName} successfully.", "Ship": "Ship", "shipments ready to ship": "shipments ready to ship", "Ship Now": "Ship Now", diff --git a/src/views/TransferOrderDetail.vue b/src/views/TransferOrderDetail.vue index b7222949..b4d8ce2c 100644 --- a/src/views/TransferOrderDetail.vue +++ b/src/views/TransferOrderDetail.vue @@ -290,7 +290,7 @@ } const result = await this.store.dispatch('transferorder/updateOrderProductCount', payload); if (result.isProductFound) { - showToast(translate("Scanned successfully:", { itemName: payload })); + showToast(translate("Scanned successfully.", { itemName: payload })); } else { showToast(translate("Scanned item is not present within the order:", { itemName: payload })); } From 100c2d8f09164506b5efa6003b5201d9c00c16cd Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Tue, 16 Apr 2024 14:49:37 +0530 Subject: [PATCH 4/4] Improved: indentation(#459) --- src/views/TransferOrderDetail.vue | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/views/TransferOrderDetail.vue b/src/views/TransferOrderDetail.vue index b4d8ce2c..8aa0ba0c 100644 --- a/src/views/TransferOrderDetail.vue +++ b/src/views/TransferOrderDetail.vue @@ -288,13 +288,16 @@ if (this.queryString) { payload = this.queryString; } - const result = await this.store.dispatch('transferorder/updateOrderProductCount', payload); - if (result.isProductFound) { - showToast(translate("Scanned successfully.", { itemName: payload })); - } else { - showToast(translate("Scanned item is not present within the order:", { itemName: payload })); - } + + const result = await this.store.dispatch('transferorder/updateOrderProductCount', payload); + + if (result.isProductFound) { + showToast(translate("Scanned successfully.", { itemName: payload })); + } else { + showToast(translate("Scanned item is not present within the order:", { itemName: payload })); + } }, + async scanCode () { const modal = await modalController .create({