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/locales/en.json b/src/locales/en.json index 9909b699..c323152b 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1,4 +1,5 @@ { + "A store represents a company or a unique catalog of products. If your OMS is connected to multiple eCommerce stores selling different collections of products, you may have multiple Product Stores set up in HotWax Commerce.": "A store represents a company or a unique catalog of products. If your OMS is connected to multiple eCommerce stores selling different collections of products, you may have multiple Product Stores set up in HotWax Commerce.", "All": "All", "App": "App", "Apply": "Apply", @@ -25,6 +26,7 @@ "Changes to the date time format will cause edits done to your PO to be reverted.": "Changes to the date time format will cause edits done to your PO to be reverted.", "Configure date time format": "Configure date time format", "Check sample": "Check sample", + "Choosing a product identifier allows you to view products with your preferred identifiers.": "Choosing a product identifier allows you to view products with your preferred identifiers.", "Click the backdrop to dismiss.": "Click the backdrop to dismiss.", "Completed": "Completed", "Confirm": "Confirm", @@ -123,9 +125,12 @@ "Please upload a valid reset inventory csv to continue": "Please upload a valid reset inventory csv to continue", "PO External Order ID": "PO External Order ID", "Preorder": "Preorder", + "Primary": "Primary", "Product Identification": "Product Identification", + "Product Identifier": "Product Identifier", "Product SKU": "Product SKU", "Product store": "Product store", + "Product Store": "Product Store", "Product not found": "Product not found", "Purchase order": "Purchase order", "Purchase orders": "Purchase orders", @@ -154,12 +159,14 @@ "Search": "Search", "Search products": "Search products", "Search time zones": "Search time zones", + "Secondary": "Secondary", "Seems like uploaded file has missing products, checked with initial records.": "Seems like uploaded file has missing products, checked with initial {initialCount} records.", "Schedule": "Schedule", "Select": "Select", "Select mapping": "Select mapping", "Select SKU": "Select SKU", "Select all the fields to continue": "Select all the fields to continue", + "Select store": "Select store", "Select time zone": "Select time zone", "Select time": "Select time", "Select the column index for the following information in the uploaded CSV.": "Select the column index for the following information in the uploaded CSV.", @@ -180,6 +187,7 @@ "Shopify product UPC": "Shopify product UPC", "Start with Ionic": "Start with Ionic", "STAY": "STAY", + "Store": "Store", "store name": "store name", "The inventory has been updated successfully": "The inventory has been updated successfully", "The PO has been uploaded successfully": "The PO has been uploaded successfully", 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/services/UserService.ts b/src/services/UserService.ts index 5c847ebe..45ce81dd 100644 --- a/src/services/UserService.ts +++ b/src/services/UserService.ts @@ -1,6 +1,7 @@ import { api, client } from '@/adapter' import store from '@/store'; import { hasError } from '@/adapter'; +import logger from '@/logger'; const login = async (username: string, password: string): Promise => { return api({ @@ -141,10 +142,37 @@ const getUserPermissions = async (payload: any, token: any): Promise => { } } +async function getEComStores(): Promise { + const params = { + "viewSize": 200, + "fieldList": ["productStoreId", "storeName"], + "entityName": "ProductStore", + "distinct": "Y", + "noConditionFind": "Y" + }; + + try { + const resp = await api({ + url: "performFind", + method: "get", + params + }) as any; + if(!hasError(resp)) { + return Promise.resolve(resp.data.docs?.length ? resp.data.docs : []); + } else { + throw resp.data + } + } catch(error) { + logger.error(error) + return Promise.resolve([]) + } +} + export const UserService = { createFieldMapping, deleteFieldMapping, login, + getEComStores, getFieldMappings, getProfile, getUserPermissions, diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index d5764287..65e1b4c9 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,14 @@ const actions: ActionTree = { await dispatch('getProfile') dispatch('setPreferredDateTimeFormat', process.env.VUE_APP_DATE_FORMAT ? process.env.VUE_APP_DATE_FORMAT : 'MM/dd/yyyy'); + + const ecomStores = await UserService.getEComStores() + useUserStore().eComStores = ecomStores + 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 @@