From b21edcbfc6f893bde5f038abd0fb39a02f623145 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 28 Aug 2024 15:00:47 +0530 Subject: [PATCH] Improved: updating order state in case of create picklist (#415) --- src/store/modules/order/actions.ts | 4 ++++ src/views/Orders.vue | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index 8cb9338d..6424fba3 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -965,6 +965,10 @@ const actions: ActionTree ={ emitter.emit("dismissLoader"); }, + updateOpenOrder ({ commit }, payload) { + commit(types.ORDER_OPEN_UPDATED, {orders: payload.orders , total: payload.total}) + }, + // clearning the orders state when logout, or user store is changed clearOrders ({ commit }) { commit(types.ORDER_OPEN_UPDATED, {orders: {} , total: 0}) diff --git a/src/views/Orders.vue b/src/views/Orders.vue index 28b522cf..14f122ee 100644 --- a/src/views/Orders.vue +++ b/src/views/Orders.vue @@ -530,7 +530,11 @@ export default defineComponent({ if(!hasError(resp)) { // generating picklist after creating a new picklist await OrderService.printPicklist(resp.data.picklistId) - this.getPickupOrders(); + const orders = JSON.parse(JSON.stringify(this.orders)) + const updatedOrder = orders.find((currentOrder: any) => currentOrder.orderId === order.orderId); + updatedOrder["isPicked"] = "Y" + updatedOrder["picklistId"] = resp.data.picklistId + this.store.dispatch("order/updateOpenOrder", { orders, total: orders.length }) } else { throw resp.data; }