From dd335d78a9dda1358d8f10c96c69bf64124062cd Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Fri, 24 Jan 2025 18:34:04 +0530 Subject: [PATCH 1/5] Implemented: Added support for the edit picker on the details page of Open and Packed orders (#493) --- src/components/EditPickerModal.vue | 5 +++-- src/views/OrderDetailUpdated.vue | 28 +++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/components/EditPickerModal.vue b/src/components/EditPickerModal.vue index 6145d0069..1862510fc 100644 --- a/src/components/EditPickerModal.vue +++ b/src/components/EditPickerModal.vue @@ -22,7 +22,7 @@
{{ translate('No picker found') }}
- + @@ -90,7 +90,7 @@ import { PicklistService } from "@/services/PicklistService"; import logger from "@/logger"; export default defineComponent({ - name: "EditPickersModal", + name: "EditPickerModal", components: { IonButton, IonButtons, @@ -155,6 +155,7 @@ export default defineComponent({ ).toString() ).then(async () => { await event.target.complete(); + this.getAlreadyAssignedPicker(); }); }, async searchPicker() { diff --git a/src/views/OrderDetailUpdated.vue b/src/views/OrderDetailUpdated.vue index 15dede3a1..d8b3fcc47 100644 --- a/src/views/OrderDetailUpdated.vue +++ b/src/views/OrderDetailUpdated.vue @@ -53,6 +53,10 @@

{{ order.orderName }}

{{ order.orderId }}

+ + + {{ order.pickers }} +
@@ -363,6 +367,7 @@ import { informationCircleOutline, locateOutline, mailOutline, + personOutline, printOutline, pulseOutline, sendOutline, @@ -385,6 +390,7 @@ import { useRouter } from 'vue-router' import { Actions, hasPermission } from '@/authorization' import OrderItemRejHistoryModal from '@/components/OrderItemRejHistoryModal.vue'; import AssignPickerModal from "@/views/AssignPickerModal.vue"; +import EditPickerModal from "@/components/EditPickerModal.vue"; import { copyToClipboard, formatCurrency, getColorByDesc, getFeature, showToast } from '@/utils' import { DateTime } from "luxon"; import { api, hasError } from '@/adapter'; @@ -475,8 +481,11 @@ export default defineComponent({ assignPickerModal.onDidDismiss().then(async(result: any) => { if(result.data.selectedPicker) { - this.pickers = result.data.picker + const selectedPicker = result.data.picker + this.pickers = selectedPicker this.picklistDate = DateTime.now().toMillis() + this.order.pickers = selectedPicker.name + this.order.pickerIds = [selectedPicker.id] await this.store.dispatch('order/packShipGroupItems', { order, part, facilityId, selectedPicker: result.data.selectedPicker }) this.prepareOrderTimeline(); } @@ -484,6 +493,22 @@ export default defineComponent({ return assignPickerModal.present(); }, + async editPicker(order: any) { + const editPickerModal = await modalController.create({ + component: EditPickerModal, + componentProps: { order } + }); + + editPickerModal.onDidDismiss().then((result) => { + if(result.data?.selectedPicker){ + const selectedPicker = result.data.selectedPicker + this.order.pickers = selectedPicker.name + this.order.pickerIds = [selectedPicker.id] + this.store.dispatch('order/updateCurrent', { order: this.order }) + } + }) + return editPickerModal.present(); + }, async deliverShipment(order: any) { const pickup = order.part?.shipmentMethodEnum?.shipmentMethodEnumId === 'STOREPICKUP'; const header = pickup ? translate("Handover") : translate("Ship"); @@ -1305,6 +1330,7 @@ export default defineComponent({ isKit, listOutline, locateOutline, + personOutline, personAddOutline, printOutline, productIdentificationPref, From b8ee59ea50d5c838b0a7a5c735886bf5bb8cb7a2 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 27 Jan 2025 11:47:10 +0530 Subject: [PATCH 2/5] Improved: Added permission and enable tracking check on the edit picker chip. Also added a check on the getAlreadyAssignedPicker function call (#493) --- src/components/EditPickerModal.vue | 3 ++- src/views/OrderDetailUpdated.vue | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/EditPickerModal.vue b/src/components/EditPickerModal.vue index 1862510fc..8222022bd 100644 --- a/src/components/EditPickerModal.vue +++ b/src/components/EditPickerModal.vue @@ -155,7 +155,8 @@ export default defineComponent({ ).toString() ).then(async () => { await event.target.complete(); - this.getAlreadyAssignedPicker(); + // Retrieve already assigned picker if not already selected + if(!this.selectedPicker) this.getAlreadyAssignedPicker(); }); }, async searchPicker() { diff --git a/src/views/OrderDetailUpdated.vue b/src/views/OrderDetailUpdated.vue index d8b3fcc47..8f99fe6ca 100644 --- a/src/views/OrderDetailUpdated.vue +++ b/src/views/OrderDetailUpdated.vue @@ -53,7 +53,7 @@

{{ order.orderName }}

{{ order.orderId }}

- + {{ order.pickers }} From 554ed6dfff7d79f61a57da409e28f353a153a846 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 29 Jan 2025 12:10:39 +0530 Subject: [PATCH 3/5] Improved: updated v-if condition by ensuring && applies to the grouped orderType check(#493) --- src/views/OrderDetailUpdated.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/OrderDetailUpdated.vue b/src/views/OrderDetailUpdated.vue index 8f99fe6ca..670b2b8d9 100644 --- a/src/views/OrderDetailUpdated.vue +++ b/src/views/OrderDetailUpdated.vue @@ -53,7 +53,7 @@

{{ order.orderName }}

{{ order.orderId }}

- + {{ order.pickers }} From 39bdf531a62b213799858f62968c6f55018bd535 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 29 Jan 2025 15:28:13 +0530 Subject: [PATCH 4/5] Improved: prevent picker update on API failure(#493) --- src/components/EditPickerModal.vue | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/components/EditPickerModal.vue b/src/components/EditPickerModal.vue index 8222022bd..caf51b823 100644 --- a/src/components/EditPickerModal.vue +++ b/src/components/EditPickerModal.vue @@ -222,10 +222,15 @@ export default defineComponent({ }, { text: translate("Replace"), - handler: () => { - this.resetPicker().then(() => { + handler: async () => { + try { + await this.resetPicker() this.closeModal({ selectedPicker: this.selectedPicker }) - }) + } catch(err) { + showToast(translate('Something went wrong, could not edit picker.')) + logger.error('Something went wrong, could not edit picker', err) + this.closeModal(); + } } } ], @@ -235,20 +240,15 @@ export default defineComponent({ async resetPicker() { const pickerId = this.selectedPicker.id // Api call to remove already selected picker and assign new picker - try { - const resp = await UtilService.resetPicker({ - pickerIds: pickerId, - picklistId: this.order.picklistId - }); + const resp = await UtilService.resetPicker({ + pickerIds: pickerId, + picklistId: this.order.picklistId + }); - if (resp.status === 200 && !hasError(resp)) { - showToast(translate("Pickers successfully replaced in the picklist with the new selections.")) - } else { - throw resp.data - } - } catch (err) { - showToast(translate('Something went wrong, could not edit picker.')) - logger.error('Something went wrong, could not edit picker') + if(resp.status === 200 && !hasError(resp)) { + showToast(translate("Pickers successfully replaced in the picklist with the new selections.")) + } else { + throw resp.data } }, closeModal(payload = {}) { From dc4b8e439e4dc4f2fe32de12366165b29eb48e09 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 29 Jan 2025 16:18:28 +0530 Subject: [PATCH 5/5] Improved: After editing the picker, the order timeline is now updated to reflect the changes(#493) --- src/views/OrderDetailUpdated.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/OrderDetailUpdated.vue b/src/views/OrderDetailUpdated.vue index 670b2b8d9..57ae28bbf 100644 --- a/src/views/OrderDetailUpdated.vue +++ b/src/views/OrderDetailUpdated.vue @@ -505,6 +505,7 @@ export default defineComponent({ this.order.pickers = selectedPicker.name this.order.pickerIds = [selectedPicker.id] this.store.dispatch('order/updateCurrent', { order: this.order }) + this.prepareOrderTimeline(); } }) return editPickerModal.present();