From fd092fbd9c0b4698781fe3c01cbc433b627de973 Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Thu, 5 Dec 2024 11:00:35 +0530 Subject: [PATCH 1/6] Implemneted: product identifier component and product store selector from the dxp-components (#220) --- package-lock.json | 16 ++++++++-------- package.json | 4 ++-- src/App.vue | 9 ++++++++- src/adapter/index.ts | 16 ++++++++++++++-- src/authorization/Actions.ts | 3 ++- src/authorization/Rules.ts | 3 ++- src/components/PurchaseOrderDetail.vue | 12 +++++++++--- src/main.ts | 9 +++++++-- src/store/modules/user/actions.ts | 9 ++++++++- src/views/InventoryReview.vue | 14 +++++++++----- src/views/Settings.vue | 11 +++++++++-- 11 files changed, 78 insertions(+), 28 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2b05827d..218d2925 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,8 +13,8 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.2.6", - "@hotwax/dxp-components": "^1.15.4", - "@hotwax/oms-api": "^1.15.1", + "@hotwax/dxp-components": "^1.16.0", + "@hotwax/oms-api": "^1.16.0", "@ionic/core": "^7.6.0", "@ionic/vue": "^7.6.0", "@ionic/vue-router": "~7.6.0", @@ -2795,9 +2795,9 @@ "integrity": "sha512-zpUjGoY7LBlKeiP0V7tonrmoey8HQ5THQmyixQ+IDtrjmEJNBjynW/Ef3gC0FUNNPuVqxWPZdT5CVgaETLGTwg==" }, "node_modules/@hotwax/dxp-components": { - "version": "1.15.5", - "resolved": "https://registry.npmjs.org/@hotwax/dxp-components/-/dxp-components-1.15.5.tgz", - "integrity": "sha512-aOzipZwVk/fL6K7/BShsvE3eYqH8LagEQQpaNCPFtSs18KHgolGQxcKT3dQ1KRLTCmoKJugc7ut9uyxZVL5krg==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/@hotwax/dxp-components/-/dxp-components-1.16.0.tgz", + "integrity": "sha512-9HUrR58Sk9H3wryYGWfGfctcM9hRqq9pnLbaShnNf0mZeK/vTAIqqTPHcObfeKXkSaPtrqS6E/1Y/+Ysmv6v5A==", "dependencies": { "@hotwax/oms-api": "^1.8.1", "@ionic/core": "^7.6.0", @@ -2931,9 +2931,9 @@ } }, "node_modules/@hotwax/oms-api": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/@hotwax/oms-api/-/oms-api-1.15.1.tgz", - "integrity": "sha512-Zc/GcoPoBX/bbY1n2EtNpPaR7PAMGTfEt8lDQZEnX55h85RY00H4uLDslD2OGWbGBjJO0MZrRmGv7PObuFxfWQ==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/@hotwax/oms-api/-/oms-api-1.16.0.tgz", + "integrity": "sha512-WZ3v0TxcHz5UZEBDX+GvZd/cqD08Kws42kGcseN2tfNf5kKWbfaDgWm6KEaBxLFuVBPBdRelRZhGj/nRIxBgGw==", "dependencies": { "@types/node-json-transform": "^1.0.0", "axios": "^0.21.1", diff --git a/package.json b/package.json index 1394cd26..e1a7ec27 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.2.6", - "@hotwax/dxp-components": "^1.15.4", - "@hotwax/oms-api": "^1.15.1", + "@hotwax/dxp-components": "^1.16.0", + "@hotwax/oms-api": "^1.16.0", "@ionic/core": "^7.6.0", "@ionic/vue": "^7.6.0", "@ionic/vue-router": "~7.6.0", diff --git a/src/App.vue b/src/App.vue index 9014ac24..9178695b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -15,8 +15,9 @@ import emitter from "@/event-bus" import { mapGetters, useStore } from 'vuex'; import { initialise, resetConfig } from '@/adapter' import { showToast } from "@/utils"; -import { translate } from "@hotwax/dxp-components"; +import { translate, useProductIdentificationStore, useUserStore } from "@hotwax/dxp-components"; import { useRouter } from 'vue-router'; +import logger from '@/logger'; export default defineComponent({ name: 'App', @@ -100,6 +101,12 @@ export default defineComponent({ emitter.on('presentLoader', this.presentLoader); emitter.on('dismissLoader', this.dismissLoader); emitter.on('playAnimation', this.playAnimation); + + if(this.userToken) { + const currentEComStore : any = useUserStore().getCurrentEComStore; + await useProductIdentificationStore().getIdentificationPref(currentEComStore.productStoreId) + .catch((error) => logger.error(error)); + } }, created() { initialise({ diff --git a/src/adapter/index.ts b/src/adapter/index.ts index 803ace03..63c0f2fb 100644 --- a/src/adapter/index.ts +++ b/src/adapter/index.ts @@ -2,7 +2,11 @@ import { api, client, getConfig, + getEComStoresByFacility, + getProductIdentificationPref, + getUserPreference, hasError, + fetchGoodIdentificationTypes, fetchProducts, initialise, logout, @@ -12,14 +16,20 @@ import { updateToken, updateInstanceUrl, setUserTimeZone, - getAvailableTimeZones + getAvailableTimeZones, + setProductIdentificationPref, + setUserPreference } from '@hotwax/oms-api' export { api, client, getConfig, + getEComStoresByFacility, + getProductIdentificationPref, + getUserPreference, hasError, + fetchGoodIdentificationTypes, fetchProducts, initialise, logout, @@ -29,5 +39,7 @@ export { updateToken, updateInstanceUrl, setUserTimeZone, - getAvailableTimeZones + getAvailableTimeZones, + setProductIdentificationPref, + setUserPreference } \ No newline at end of file diff --git a/src/authorization/Actions.ts b/src/authorization/Actions.ts index 08ab787f..b808ff20 100644 --- a/src/authorization/Actions.ts +++ b/src/authorization/Actions.ts @@ -1,3 +1,4 @@ export default { - 'APP_COMMERCE_VIEW': 'APP_COMMERCE_VIEW' + 'APP_COMMERCE_VIEW': 'APP_COMMERCE_VIEW', + 'APP_PRODUCT_IDENTIFIER_UPDATE': 'APP_PRODUCT_IDENTIFIER_UPDATE', } \ No newline at end of file diff --git a/src/authorization/Rules.ts b/src/authorization/Rules.ts index 78b83d35..9e248e00 100644 --- a/src/authorization/Rules.ts +++ b/src/authorization/Rules.ts @@ -1,5 +1,6 @@ export default { "APP_INVENTORY_VIEW": "MDM_IMP_INVENTORY_VIEW", "IMPORT_APP_VIEW": "IMPORT_APP_VIEW", - "APP_COMMERCE_VIEW": "COMMERCEUSER_VIEW" + "APP_COMMERCE_VIEW": "COMMERCEUSER_VIEW", + "APP_PRODUCT_IDENTIFIER_UPDATE":"COMMON_ADMIN", } as any \ No newline at end of file diff --git a/src/components/PurchaseOrderDetail.vue b/src/components/PurchaseOrderDetail.vue index 8c838cf3..0e1a379a 100644 --- a/src/components/PurchaseOrderDetail.vue +++ b/src/components/PurchaseOrderDetail.vue @@ -27,8 +27,8 @@ -

{{ item.pseudoId }}

-

{{ item.initialSKU }}

+

{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.pseudoId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.pseudoId)) : item.pseudoId }}

+

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.pseudoId)) }}

@@ -69,7 +69,8 @@ import { defineComponent } from "@vue/runtime-core"; import { mapGetters, useStore } from "vuex"; import ProductPopover from '@/components/ProductPopover.vue' import { DateTime } from 'luxon'; -import { translate } from "@hotwax/dxp-components"; +import { getProductIdentificationValue, translate, useProductIdentificationStore } from "@hotwax/dxp-components"; +import { computed } from "vue"; export default defineComponent({ name: "PurchaseOrderDetails", @@ -158,10 +159,15 @@ export default defineComponent({ }, setup() { const store = useStore(); + const productIdentificationStore = useProductIdentificationStore(); + let productIdentificationPref = computed(() => productIdentificationStore.getProductIdentificationPref); + return { + getProductIdentificationValue, sendOutline, store, ellipsisVerticalOutline, + productIdentificationPref, translate } } diff --git a/src/main.ts b/src/main.ts index 4a9ce9c5..f29d0ad4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -32,9 +32,8 @@ import permissionActions from '@/authorization/Actions'; import logger from './logger'; import { dxpComponents } from '@hotwax/dxp-components' import { login, logout, loader } from './user-utils'; -import { getConfig, initialise } from '@hotwax/oms-api'; import localeMessages from './locales'; -import { setUserTimeZone, getAvailableTimeZones} from '@/adapter' +import { fetchGoodIdentificationTypes, getAvailableTimeZones, getConfig, getEComStoresByFacility, getProductIdentificationPref, getUserPreference, initialise, setProductIdentificationPref, setUserPreference, setUserTimeZone } from '@/adapter' const app = createApp(App) .use(IonicVue, { @@ -57,11 +56,17 @@ const app = createApp(App) logout, loader, appLoginUrl: process.env.VUE_APP_LOGIN_URL as string, + fetchGoodIdentificationTypes, getConfig, + getEComStoresByFacility, + getProductIdentificationPref, + getUserPreference, initialise, localeMessages, setUserTimeZone, getAvailableTimeZones, + setProductIdentificationPref, + setUserPreference, hasPermission }); diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index d5764287..58f53289 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -6,7 +6,7 @@ import * as types from './mutation-types' import { hasError, showToast } from '@/utils' import { logout, updateInstanceUrl, updateToken, resetConfig } from '@/adapter' import logger from "@/logger"; -import { useAuthStore, translate } from '@hotwax/dxp-components'; +import { useAuthStore, translate, useUserStore, useProductIdentificationStore } from '@hotwax/dxp-components'; import emitter from '@/event-bus' import { getServerPermissionsFromRules, @@ -62,6 +62,13 @@ const actions: ActionTree = { await dispatch('getProfile') dispatch('setPreferredDateTimeFormat', process.env.VUE_APP_DATE_FORMAT ? process.env.VUE_APP_DATE_FORMAT : 'MM/dd/yyyy'); + + await useUserStore().getEComStoresByFacility("") + await useUserStore().getEComStorePreference("SELECTED_BRAND") + const preferredStore: any = useUserStore().getCurrentEComStore + + await useProductIdentificationStore().getIdentificationPref(preferredStore.productStoreId) + .catch((error) => logger.error(error)); } } catch (err: any) { showToast(translate('Something went wrong')); diff --git a/src/views/InventoryReview.vue b/src/views/InventoryReview.vue index 5861c97c..068f52a7 100644 --- a/src/views/InventoryReview.vue +++ b/src/views/InventoryReview.vue @@ -61,8 +61,8 @@ -

{{ item.pseudoId }}

-

{{ item.initialSKU }}

+

{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.pseudoId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.pseudoId)) : item.pseudoId }}

+

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.pseudoId)) }}

@@ -95,10 +95,10 @@