diff --git a/.env.example b/.env.example index 6002fc9c..0e210be3 100644 --- a/.env.example +++ b/.env.example @@ -9,7 +9,7 @@ VUE_APP_POLL_TIME=10000 VUE_APP_ORDER_FILTERS=["orderTypeId: SALES_ORDER", "facilityId:PRE_ORDER_PARKING OR facilityId:BACKORDER_PARKING", "orderStatusId: ORDER_APPROVED", "!orderItemStatusId: ITEM_CANCELLED" ] VUE_APP_BASE_URL= VUE_APP_ORDER_IN_BRKRNG_FILTERS=["orderTypeId: SALES_ORDER", "facilityId: _NA_", "orderStatusId: ORDER_APPROVED", "!orderItemStatusId: ITEM_CANCELLED" ] -VUE_APP_PERMISSION_ID= +VUE_APP_PERMISSION_ID="PREORDER_APP_VIEW" VUE_APP_ALIAS= VUE_APP_CTGRY_AND_BRKRNG_JOB=["JOB_REL_PREODR_CAT", "JOB_BKR_ORD", "JOB_RLS_ORD_DTE"] VUE_APP_DEFAULT_ALIAS= diff --git a/package-lock.json b/package-lock.json index 219d233f..d28bc159 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "preorder-app", - "version": "1.17.0", + "version": "1.18.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "preorder-app", - "version": "1.17.0", + "version": "1.18.1", "dependencies": { "@capacitor/android": "^2.5.0", "@capacitor/core": "^2.4.7", diff --git a/package.json b/package.json index 9182f434..f2535a01 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "preorder-app", - "version": "1.17.0", + "version": "1.18.1", "private": true, "description": "HotWax Commece Pre-order App", "scripts": { diff --git a/src/authorization/Rules.ts b/src/authorization/Rules.ts index a2a1a368..6d91d6f9 100644 --- a/src/authorization/Rules.ts +++ b/src/authorization/Rules.ts @@ -4,6 +4,8 @@ export default { "APP_CATALOG_VIEW": "", "APP_PRDT_DTLS_VIEW": "", "APP_CTLG_PRDT_DTLS_VIEW": "", + "APP_COMMERCE_VIEW": "COMMERCEUSER_VIEW", + "MERCHANDISING_ADMIN": "MERCHANDISING_ADMIN", + "PREORDER_APP_VIEW": "PREORDER_APP_VIEW", "APP_INV_CNFG_UPDT": "COMMON_ADMIN", - "APP_COMMERCE_VIEW": "COMMERCEUSER_VIEW" } as any \ No newline at end of file diff --git a/src/services/UserService.ts b/src/services/UserService.ts index 91c30033..4559cb41 100644 --- a/src/services/UserService.ts +++ b/src/services/UserService.ts @@ -21,17 +21,21 @@ const setUserPreference = async (payload: any): Promise => { }); } -const getEComStores = async (token: any, partyId: any): Promise => { +const getEComStores = async (token: any, partyId: any, isAdminUser = false): Promise => { try { const params = { "inputFields": { - "storeName_op": "not-empty", - "partyId": partyId + "storeName_op": "not-empty" }, "fieldList": ["productStoreId", "storeName"], "entityName": "ProductStoreAndRole", "distinct": "Y", - "noConditionFind": "Y" + "noConditionFind": "Y", + "filterByDate": 'Y' + } as any; + + if(!isAdminUser) { + params.inputFields['partyId'] = partyId } const baseURL = store.getters['user/getBaseUrl']; diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 5a10c0d3..d1076e7e 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -49,9 +49,11 @@ const actions: ActionTree = { } } + const isAdminUser = appPermissions.some((appPermission: any) => appPermission?.action === "MERCHANDISING_ADMIN"); + // Getting user profile const userProfile = await UserService.getUserProfile(token); - userProfile.stores = await UserService.getEComStores(token, userProfile.partyId); + userProfile.stores = await UserService.getEComStores(token, userProfile.partyId, isAdminUser); // Getting user preferred store let preferredStore = userProfile.stores[0]; diff --git a/src/views/order-popover.vue b/src/views/order-popover.vue index a17073d3..0b7b7871 100644 --- a/src/views/order-popover.vue +++ b/src/views/order-popover.vue @@ -32,7 +32,7 @@ export default defineComponent({ orderId: item.orderId, orderItemSeqId: item.orderItemSeqId, changeReasonEnumId: "RELEASED", - toFacilityId: "_NA_" // TODO Make it configurable + toFacilityId: "RELEASED_ORD_PARKING" // TODO Make it configurable }) }, async cancelItem (item: any) { diff --git a/src/views/orders.vue b/src/views/orders.vue index f85d2297..6a0b553e 100644 --- a/src/views/orders.vue +++ b/src/views/orders.vue @@ -285,6 +285,7 @@ export default defineComponent({ selectedItemsCount: 'order/getSelectedItemsCount', userProfile: 'user/getUserProfile', query: 'order/getQuery', + currentEComStore: 'user/getCurrentEComStore', }), }, async ionViewWillEnter() { @@ -319,13 +320,14 @@ export default defineComponent({ }, async releaseItems() { emitter.emit("presentLoader") - const selectedItems = this.getSelectedItemsToRelease("_NA_", "RELEASED"); // TODO Make it configurable + const selectedItems = this.getSelectedItemsToRelease("RELEASED_ORD_PARKING", "RELEASED"); // TODO Make it configurable const json = JSON.stringify(selectedItems); const blob = new Blob([json], { type: 'application/json'}); const formData = new FormData(); const fileName = "ReleaseItems_" + Date.now() +".json"; formData.append("uploadedFile", blob, fileName); formData.append("configId", "MDM_REL_ORD_ITM_JSON"); + formData.append("param_productStoreId", this.currentEComStore.productStoreId); this.deselectSelectedItems(); return this.store.dispatch("order/releaseItems", { headers: { @@ -346,6 +348,7 @@ export default defineComponent({ const fileName = "CancelItems_" + Date.now() +".json"; formData.append("uploadedFile", blob, fileName); formData.append("configId", "MDM_CAN_ORD_ITM_JSON"); + formData.append("param_productStoreId", this.currentEComStore.productStoreId); this.deselectSelectedItems(); return this.store.dispatch("order/cancelItems", { headers: { diff --git a/src/views/product-details.vue b/src/views/product-details.vue index 5df0ab15..2817bbfa 100644 --- a/src/views/product-details.vue +++ b/src/views/product-details.vue @@ -436,7 +436,7 @@ export default defineComponent({ orderId: item.orderId, orderItemSeqId: item.orderItemSeqId, changeReasonEnumId: "RELEASED", - toFacilityId: "_NA_" // TODO Make it configurable + toFacilityId: "RELEASED_ORD_PARKING" // TODO Make it configurable } }) selectedItems = [...selectedItems, ...items]; @@ -447,6 +447,8 @@ export default defineComponent({ const fileName = "ReleaseItems_" + Date.now() +".json"; formData.append("uploadedFile", blob, fileName); formData.append("configId", "MDM_REL_ORD_ITM_JSON"); + formData.append("param_productStoreId", this.currentEComStore.productStoreId); + return this.store.dispatch("order/releaseItems", { headers: { 'Content-Type': 'multipart/form-data;' @@ -475,6 +477,7 @@ export default defineComponent({ const fileName = "CancelItems_" + Date.now() +".json"; formData.append("uploadedFile", blob, fileName); formData.append("configId", "MDM_CAN_ORD_ITM_JSON"); + formData.append("param_productStoreId", this.currentEComStore.productStoreId); return this.store.dispatch("order/cancelItems", { headers: { 'Content-Type': 'multipart/form-data;' diff --git a/src/views/promise-date-modal.vue b/src/views/promise-date-modal.vue index 7582adf0..7dfcf474 100644 --- a/src/views/promise-date-modal.vue +++ b/src/views/promise-date-modal.vue @@ -53,6 +53,7 @@ export default defineComponent({ ...mapGetters({ jobTotal: 'job/getTotal', getSelectedItemsToUpdatePromiseDate: 'order/getSelectedItemsToUpdatePromiseDate', + currentEComStore: 'user/getCurrentEComStore', }), disableUpdate(): boolean { return this.promisedDatetime === '' || (this.item && this.item.promisedDatetime && DateTime.fromFormat(this.item.promisedDatetime, "yyyy-MM-dd hh:mm:ss.SSS").toFormat("yyyy-MM-dd") === this.promisedDatetime); @@ -94,6 +95,7 @@ export default defineComponent({ const fileName = "UpdatePromiseDateItems_" + Date.now() +".json"; formData.append("uploadedFile", blob, fileName); formData.append("configId", "MDM_UPD_ORD_ITM_JSON"); + formData.append("param_productStoreId", this.currentEComStore.productStoreId); return this.store.dispatch("order/updatePromiseDateItems", { headers: { 'Content-Type': 'multipart/form-data;' diff --git a/src/views/warehouse-modal.vue b/src/views/warehouse-modal.vue index 31492143..3a3579b1 100644 --- a/src/views/warehouse-modal.vue +++ b/src/views/warehouse-modal.vue @@ -145,6 +145,7 @@ export default defineComponent({ const fileName = "ReleaseItemsToWarehouse_" + Date.now() +".json"; formData.append("uploadedFile", blob, fileName); formData.append("configId", "MDM_REL_ORD_ITM_JSON"); + formData.append("param_productStoreId", this.currentEComStore.productStoreId); return this.store.dispatch("order/releaseItems", { headers: { 'Content-Type': 'multipart/form-data;'