From 58e2e638c14ef33cd70df9bb908d2a8cac77170c Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Fri, 13 Sep 2024 11:39:24 +0530 Subject: [PATCH] Improved: support for adding picker role to _NA_ party and fixed issue in assignPicker modal (#428) --- src/services/UserService.ts | 9 +++++++++ src/views/Orders.vue | 19 +++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/services/UserService.ts b/src/services/UserService.ts index 6daf86912..a8069aedb 100644 --- a/src/services/UserService.ts +++ b/src/services/UserService.ts @@ -231,8 +231,17 @@ const isEnumExists = async (enumId: string): Promise => { } } +const ensurePartyRole = async (payload: any): Promise => { + return api({ + url: "service/ensurePartyRole", + method: "post", + data: payload + }); +} + export const UserService = { createEnumeration, + ensurePartyRole, login, getCurrentEComStore, getRerouteFulfillmentConfig, diff --git a/src/views/Orders.vue b/src/views/Orders.vue index e5ebc4262..41acf68ba 100644 --- a/src/views/Orders.vue +++ b/src/views/Orders.vue @@ -213,6 +213,7 @@ import { api, hasError } from '@/adapter'; import { translate } from "@hotwax/dxp-components"; import AssignPickerModal from "./AssignPickerModal.vue"; import { OrderService } from "@/services/OrderService"; +import { UserService } from "@/services/UserService"; import { Actions, hasPermission } from '@/authorization' import logger from "@/logger"; @@ -276,7 +277,7 @@ export default defineComponent({ }); assignPickerModal.onDidDismiss().then(async(result: any) => { - if(result.data?.dismissed) { + if(result.data?.selectedPicker) { await this.store.dispatch('order/packShipGroupItems', { order, part, facilityId, selectedPicker: result.data.selectedPicker }) } }) @@ -516,6 +517,20 @@ export default defineComponent({ } if(!this.configurePicker) { + try { + const resp = await UserService.ensurePartyRole({ + partyId: "_NA_", + roleTypeId: "WAREHOUSE_PICKER", + }) + + if(hasError(resp)) { + throw resp.data; + } + } catch (error) { + showToast(translate("Something went wrong. Picklist can not be created.")); + logger.error(error) + return; + } await this.createPicklist(order, "_NA_"); return; } @@ -526,7 +541,7 @@ export default defineComponent({ }); assignPickerModal.onDidDismiss().then(async(result: any) => { - if(result.data?.dismissed) { + if(result.data?.selectedPicker) { this.createPicklist(order, result.data.selectedPicker) } })