From b19b8d419ae01c90f16701442a57f24baa54a311 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Wed, 12 Jul 2023 14:03:29 +0530 Subject: [PATCH 1/3] Implemented: support to add a spinner on the print button to show the loading state(#176) --- src/views/InProgress.vue | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/views/InProgress.vue b/src/views/InProgress.vue index a38fdb8e..5ca89cce 100644 --- a/src/views/InProgress.vue +++ b/src/views/InProgress.vue @@ -27,7 +27,10 @@ {{ picklist.pickersName }}

{{ picklist.date }}

- + + + + @@ -181,6 +184,7 @@ import { IonSelect, IonSelectOption, IonSkeletonText, + IonSpinner, IonThumbnail, IonTitle, IonToolbar, @@ -229,6 +233,7 @@ export default defineComponent({ IonSelect, IonSelectOption, IonSkeletonText, + IonSpinner, IonThumbnail, IonTitle, IonToolbar, @@ -249,6 +254,7 @@ export default defineComponent({ picklists: [] as any, defaultShipmentBoxType: '', itemsIssueSegmentSelected: [] as any, + isGeneratingDocument: false as boolean } }, methods: { @@ -615,7 +621,8 @@ export default defineComponent({ picklists.push({ id: picklist.picklistId, pickersName: pickersName.join(', '), - date: DateTime.fromMillis(picklist.picklistDate).toLocaleString(DateTime.TIME_SIMPLE) + date: DateTime.fromMillis(picklist.picklistDate).toLocaleString(DateTime.TIME_SIMPLE), + isGeneratingDocument: false // used to display the spinner on the button when trying to generate picklist }) return picklists @@ -756,8 +763,10 @@ export default defineComponent({ async initialiseOrderQuery() { await this.updateOrderQuery(process.env.VUE_APP_VIEW_SIZE, '') }, - async printPicklist(picklistId: string) { - await OrderService.printPicklist(picklistId) + async printPicklist(picklist: any) { + picklist.isGeneratingDocument = true; + await OrderService.printPicklist(picklist.id) + picklist.isGeneratingDocument = false; } }, async mounted () { From 4c769b82618101c65307ab6288782b49e2650eac Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Wed, 12 Jul 2023 14:51:55 +0530 Subject: [PATCH 2/3] Implemented: support to display spinner on the document buttons(#176) --- src/store/modules/order/actions.ts | 4 +++- src/views/Completed.vue | 28 ++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index 2791d082..68a6e401 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -407,7 +407,9 @@ const actions: ActionTree = { items: order.doclist.docs, shipmentId: orderItem.shipmentId, shipmentMethodTypeId: orderItem.shipmentMethodTypeId, - shipmentMethodTypeDesc: orderItem.shipmentMethodTypeDesc + shipmentMethodTypeDesc: orderItem.shipmentMethodTypeDesc, + isGeneratingShippingLabel: false, + isGeneratingPackingSlip: false } }) diff --git a/src/views/Completed.vue b/src/views/Completed.vue index 4af95f5d..47b19ba6 100644 --- a/src/views/Completed.vue +++ b/src/views/Completed.vue @@ -99,8 +99,14 @@ {{ $t("Ship Now") }} {{ $t("Retry Generate Label") }} - {{ $t("Print Shipping Label") }} - {{ $t("Print Customer Letter") }} + + {{ $t("Print Shipping Label") }} + + + + {{ $t("Print Customer Letter") }} + +
{{ $t("Unpack") }} @@ -144,6 +150,7 @@ import { IonMenuButton, IonPage, IonSearchbar, + IonSpinner, IonThumbnail, IonTitle, IonToolbar, @@ -187,6 +194,7 @@ export default defineComponent({ IonMenuButton, IonPage, IonSearchbar, + IonSpinner, IonThumbnail, IonTitle, IonToolbar, @@ -537,12 +545,28 @@ export default defineComponent({ } }, async printPackingSlip(order: any) { + // if the request to print packing slip is not yet completed, then clicking multiple times on the button + // should not do anything + if(order.isGeneratingPackingSlip) { + return; + } + const shipmentIds = order.shipments.map((shipment: any) => shipment.shipmentId) + order.isGeneratingPackingSlip = true; await OrderService.printPackingSlip(shipmentIds); + order.isGeneratingPackingSlip = false; }, async printShippingLabel(order: any) { + // if the request to print shipping label is not yet completed, then clicking multiple times on the button + // should not do anything + if(order.isGeneratingShippingLabel) { + return; + } + const shipmentIds = order.shipments.map((shipment: any) => shipment.shipmentId) + order.isGeneratingShippingLabel = true; await OrderService.printShippingLabel(shipmentIds) + order.isGeneratingShippingLabel = false; } }, setup() { From 572be439f7d3f390eb9e0bfd58f34bd931737214 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Wed, 12 Jul 2023 15:53:33 +0530 Subject: [PATCH 3/3] Improved: variable name for printing picklist(#176) --- src/views/InProgress.vue | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/views/InProgress.vue b/src/views/InProgress.vue index 5ca89cce..c94b8409 100644 --- a/src/views/InProgress.vue +++ b/src/views/InProgress.vue @@ -27,7 +27,7 @@ {{ picklist.pickersName }}

{{ picklist.date }}

- + @@ -254,7 +254,6 @@ export default defineComponent({ picklists: [] as any, defaultShipmentBoxType: '', itemsIssueSegmentSelected: [] as any, - isGeneratingDocument: false as boolean } }, methods: { @@ -622,7 +621,7 @@ export default defineComponent({ id: picklist.picklistId, pickersName: pickersName.join(', '), date: DateTime.fromMillis(picklist.picklistDate).toLocaleString(DateTime.TIME_SIMPLE), - isGeneratingDocument: false // used to display the spinner on the button when trying to generate picklist + isGeneratingPicklist: false // used to display the spinner on the button when trying to generate picklist }) return picklists @@ -764,9 +763,9 @@ export default defineComponent({ await this.updateOrderQuery(process.env.VUE_APP_VIEW_SIZE, '') }, async printPicklist(picklist: any) { - picklist.isGeneratingDocument = true; + picklist.isGeneratingPicklist = true; await OrderService.printPicklist(picklist.id) - picklist.isGeneratingDocument = false; + picklist.isGeneratingPicklist = false; } }, async mounted () {