From 738fed37edbfac88a2f5d4211a015a4f925e08ae Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Thu, 5 Sep 2024 12:55:16 +0530 Subject: [PATCH 1/8] Implemented: Added the support for using facility selector from dxp-component --- package-lock.json | 364 ++++-------------- package.json | 4 +- src/components/InventoryDetailsPopover.vue | 1 - .../NotificationPreferenceModal.vue | 10 +- src/components/ProductListItem.vue | 1 - src/main.ts | 7 +- src/store/modules/order/actions.ts | 13 +- src/store/modules/stock/actions.ts | 16 +- src/store/modules/stock/getters.ts | 11 +- src/store/modules/user/UserState.ts | 1 - src/store/modules/user/actions.ts | 24 +- src/store/modules/user/getters.ts | 3 - src/store/modules/user/index.ts | 1 - src/store/modules/user/mutation-types.ts | 1 - src/store/modules/user/mutations.ts | 4 - src/views/OrderDetail.vue | 12 +- src/views/Orders.vue | 20 +- src/views/ProductDetail.vue | 10 +- src/views/Settings.vue | 39 +- src/views/ShipToStoreOrders.vue | 14 +- 20 files changed, 173 insertions(+), 383 deletions(-) diff --git a/package-lock.json b/package-lock.json index b0a61e4a7..a57059b48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,8 +14,8 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.2.6", - "@hotwax/dxp-components": "^1.15.2", - "@hotwax/oms-api": "^1.14.0", + "@hotwax/dxp-components": "file:../dxp-components", + "@hotwax/oms-api": "file:../oms-api", "@ionic/core": "^7.6.0", "@ionic/vue": "^7.6.0", "@ionic/vue-router": "^7.6.0", @@ -53,6 +53,65 @@ "typescript": "~4.7.4" } }, + "../dxp-components": { + "name": "@hotwax/dxp-components", + "version": "1.15.2", + "license": "Apache-2.0", + "dependencies": { + "@hotwax/oms-api": "^1.8.1", + "@ionic/core": "^7.6.0", + "@ionic/vue": "^7.6.0", + "firebase": "^10.3.1", + "luxon": "^3.3.0", + "pinia": "2.0.36", + "pinia-plugin-persistedstate": "^3.1.0", + "register-service-worker": "^1.7.2", + "vue": "^3.3.4", + "vue-i18n": "^9.2.2", + "vue-markdown-render": "^2.2.1" + }, + "devDependencies": { + "@babel/types": "^7.22.11", + "@types/luxon": "^3.3.0", + "@types/node": "^20.5.7", + "@vitejs/plugin-vue": "^4.3.4", + "@vue/eslint-config-prettier": "^8.0.0", + "@vue/eslint-config-typescript": "^11.0.3", + "@vue/tsconfig": "^0.1.3", + "eslint": "^8.48.0", + "eslint-plugin-vue": "^9.17.0", + "rollup-plugin-typescript2": "^0.35.0", + "typescript": "~4.7.4", + "vite": "^4.4.9", + "vue-tsc": "^1.8.8" + } + }, + "../oms-api": { + "name": "@hotwax/oms-api", + "version": "1.15.0", + "license": "Apache-2.0", + "dependencies": { + "@types/node-json-transform": "^1.0.0", + "axios": "^0.21.1", + "axios-cache-adapter": "^2.7.3", + "deepmerge": "^4.3.0", + "http-status-codes": "^2.2.0", + "node-json-transform": "^1.1.2", + "qs": "^6.11.0" + }, + "devDependencies": { + "@babel/cli": "^7.18.10", + "@babel/core": "^7.18.10", + "@babel/preset-env": "^7.18.10", + "@babel/preset-typescript": "^7.18.6", + "@types/qs": "^6.9.7", + "@typescript-eslint/eslint-plugin": "^5.27.0", + "@typescript-eslint/parser": "^5.27.0", + "babel-plugin-module-resolver": "^4.1.0", + "eslint": "^8.16.0", + "typescript": "^4.7.2" + } + }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", @@ -2807,94 +2866,12 @@ "integrity": "sha512-zpUjGoY7LBlKeiP0V7tonrmoey8HQ5THQmyixQ+IDtrjmEJNBjynW/Ef3gC0FUNNPuVqxWPZdT5CVgaETLGTwg==" }, "node_modules/@hotwax/dxp-components": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/@hotwax/dxp-components/-/dxp-components-1.15.2.tgz", - "integrity": "sha512-0jF1xkRIVrDbJwUaaPwWUhp3cVBpdjgAJO/fOQ4XYjzKb8rYXgw0Xm/qHHUnSeAZW5laMnQrm1KtPZp8szu4dQ==", - "dependencies": { - "@hotwax/oms-api": "^1.8.1", - "@ionic/core": "^7.6.0", - "@ionic/vue": "^7.6.0", - "firebase": "^10.3.1", - "luxon": "^3.3.0", - "pinia": "2.0.36", - "pinia-plugin-persistedstate": "^3.1.0", - "register-service-worker": "^1.7.2", - "vue": "^3.3.4", - "vue-i18n": "^9.2.2", - "vue-markdown-render": "^2.2.1" - } - }, - "node_modules/@hotwax/dxp-components/node_modules/pinia": { - "version": "2.0.36", - "resolved": "https://registry.npmjs.org/pinia/-/pinia-2.0.36.tgz", - "integrity": "sha512-4UKApwjlmJH+VuHKgA+zQMddcCb3ezYnyewQ9NVrsDqZ/j9dMv5+rh+1r48whKNdpFkZAWVxhBp5ewYaYX9JcQ==", - "dependencies": { - "@vue/devtools-api": "^6.5.0", - "vue-demi": "*" - }, - "funding": { - "url": "https://github.com/sponsors/posva" - }, - "peerDependencies": { - "@vue/composition-api": "^1.4.0", - "typescript": ">=4.4.4", - "vue": "^2.6.14 || ^3.2.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - }, - "typescript": { - "optional": true - } - } - }, - "node_modules/@hotwax/dxp-components/node_modules/pinia-plugin-persistedstate": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/pinia-plugin-persistedstate/-/pinia-plugin-persistedstate-3.2.1.tgz", - "integrity": "sha512-MK++8LRUsGF7r45PjBFES82ISnPzyO6IZx3CH5vyPseFLZCk1g2kgx6l/nW8pEBKxxd4do0P6bJw+mUSZIEZUQ==", - "peerDependencies": { - "pinia": "^2.0.0" - } - }, - "node_modules/@hotwax/dxp-components/node_modules/pinia/node_modules/vue-demi": { - "version": "0.14.7", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.7.tgz", - "integrity": "sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==", - "hasInstallScript": true, - "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } - } + "resolved": "../dxp-components", + "link": true }, "node_modules/@hotwax/oms-api": { - "version": "1.14.0", - "resolved": "https://registry.npmjs.org/@hotwax/oms-api/-/oms-api-1.14.0.tgz", - "integrity": "sha512-dYkrFEi0oJHKiJ/VctKmyIY4WTVV2lmljm1EflgQ/LM7BTJ9jVEeT1zgYJ5vO906kW7SWM4pl7mZI3dDCt1YCQ==", - "dependencies": { - "@types/node-json-transform": "^1.0.0", - "axios": "^0.21.1", - "axios-cache-adapter": "^2.7.3", - "deepmerge": "^4.3.0", - "http-status-codes": "^2.2.0", - "node-json-transform": "^1.1.2", - "qs": "^6.11.0" - } + "resolved": "../oms-api", + "link": true }, "node_modules/@humanwhocodes/config-array": { "version": "0.5.0", @@ -2916,47 +2893,6 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, - "node_modules/@intlify/core-base": { - "version": "9.10.2", - "resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.10.2.tgz", - "integrity": "sha512-HGStVnKobsJL0DoYIyRCGXBH63DMQqEZxDUGrkNI05FuTcruYUtOAxyL3zoAZu/uDGO6mcUvm3VXBaHG2GdZCg==", - "dependencies": { - "@intlify/message-compiler": "9.10.2", - "@intlify/shared": "9.10.2" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - } - }, - "node_modules/@intlify/message-compiler": { - "version": "9.10.2", - "resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.10.2.tgz", - "integrity": "sha512-ntY/kfBwQRtX5Zh6wL8cSATujPzWW2ZQd1QwKyWwAy5fMqJyyixHMeovN4fmEyCqSu+hFfYOE63nU94evsy4YA==", - "dependencies": { - "@intlify/shared": "9.10.2", - "source-map-js": "^1.0.2" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - } - }, - "node_modules/@intlify/shared": { - "version": "9.10.2", - "resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.10.2.tgz", - "integrity": "sha512-ttHCAJkRy7R5W2S9RVnN9KYQYPIpV2+GiS79T4EE37nrPyH6/1SrOh3bmdCRC1T3ocL8qCDx7x2lBJ0xaITU7Q==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - } - }, "node_modules/@ionic/core": { "version": "7.8.5", "resolved": "https://registry.npmjs.org/@ionic/core/-/core-7.8.5.tgz", @@ -3684,11 +3620,6 @@ "@types/node": "*" } }, - "node_modules/@types/node-json-transform": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/node-json-transform/-/node-json-transform-1.0.2.tgz", - "integrity": "sha512-gOq49i42EmHRKPTTD4cXru3MAFoDADqzUxzAweKtZZBmLJuAK0GsJHNX4HKdvZ/JJHf+F4TYgnvb7Ge0NlQiGw==" - }, "node_modules/@types/normalize-package-data": { "version": "2.4.4", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", @@ -5604,26 +5535,6 @@ "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", "dev": true }, - "node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "dependencies": { - "follow-redirects": "^1.14.0" - } - }, - "node_modules/axios-cache-adapter": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/axios-cache-adapter/-/axios-cache-adapter-2.7.3.tgz", - "integrity": "sha512-A+ZKJ9lhpjthOEp4Z3QR/a9xC4du1ALaAsejgRGrH9ef6kSDxdFrhRpulqsh9khsEnwXxGfgpUuDp1YXMNMEiQ==", - "dependencies": { - "cache-control-esm": "1.0.0", - "md5": "^2.2.1" - }, - "peerDependencies": { - "axios": "~0.21.1" - } - }, "node_modules/babel-loader": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.3.0.tgz", @@ -6004,11 +5915,6 @@ "node": ">= 0.8" } }, - "node_modules/cache-control-esm": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/cache-control-esm/-/cache-control-esm-1.0.0.tgz", - "integrity": "sha512-Fa3UV4+eIk4EOih8FTV6EEsVKO0W5XWtNs6FC3InTfVz+EjurjPfDXY5wZDo/lxjDxg5RjNcurLyxEJBcEUx9g==" - }, "node_modules/cachedir": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.4.0.tgz", @@ -6022,6 +5928,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", + "dev": true, "dependencies": { "function-bind": "^1.1.2", "get-intrinsic": "^1.2.1", @@ -6135,14 +6042,6 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, - "node_modules/charenc": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", - "engines": { - "node": "*" - } - }, "node_modules/check-more-types": { "version": "2.24.0", "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", @@ -6767,14 +6666,6 @@ "node": ">= 8" } }, - "node_modules/crypt": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", - "engines": { - "node": "*" - } - }, "node_modules/crypto-random-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", @@ -7492,6 +7383,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "dev": true, "dependencies": { "get-intrinsic": "^1.2.1", "gopd": "^1.0.1", @@ -9223,6 +9115,7 @@ "version": "1.15.3", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "dev": true, "funding": [ { "type": "individual", @@ -9552,6 +9445,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -9610,6 +9504,7 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", + "dev": true, "dependencies": { "function-bind": "^1.1.2", "has-proto": "^1.0.1", @@ -9773,6 +9668,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, "dependencies": { "get-intrinsic": "^1.1.3" }, @@ -9829,6 +9725,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", + "dev": true, "dependencies": { "get-intrinsic": "^1.2.2" }, @@ -9840,6 +9737,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -9851,6 +9749,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -9883,6 +9782,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, "dependencies": { "function-bind": "^1.1.2" }, @@ -10156,11 +10056,6 @@ "node": ">=0.10" } }, - "node_modules/http-status-codes": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/http-status-codes/-/http-status-codes-2.3.0.tgz", - "integrity": "sha512-RJ8XvFvpPM/Dmc5SV+dC4y5PCeOhT3x1Hq0NU3rjGeg5a/CqlhZ7uudknPwZFz4aeAXDcbAyaeP7GAo9lvngtA==" - }, "node_modules/human-signals": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", @@ -10524,11 +10419,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" - }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -11362,14 +11252,6 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, - "node_modules/linkify-it": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz", - "integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==", - "dependencies": { - "uc.micro": "^1.0.1" - } - }, "node_modules/listr2": { "version": "3.14.0", "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.14.0.tgz", @@ -11462,7 +11344,8 @@ "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true }, "node_modules/lodash.camelcase": { "version": "4.3.0", @@ -11796,58 +11679,12 @@ "semver": "bin/semver.js" } }, - "node_modules/markdown-it": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.2.tgz", - "integrity": "sha512-FtwnEuuK+2yVU7goGn/MJ0WBZMM9ZPgU9spqlFs7/A/pDIUNSOQZhUgOqYCficIuR2QaFnrt8LHqBWsbTAoI5w==", - "dependencies": { - "argparse": "^2.0.1", - "entities": "~3.0.1", - "linkify-it": "^4.0.1", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" - }, - "bin": { - "markdown-it": "bin/markdown-it.js" - } - }, - "node_modules/markdown-it/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, - "node_modules/markdown-it/node_modules/entities": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", - "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/md5": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", - "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", - "dependencies": { - "charenc": "0.0.2", - "crypt": "0.0.2", - "is-buffer": "~1.1.6" - } - }, "node_modules/mdn-data": { "version": "2.0.14", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz", "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", "dev": true }, - "node_modules/mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==" - }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -12237,14 +12074,6 @@ "node": ">= 6.13.0" } }, - "node_modules/node-json-transform": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/node-json-transform/-/node-json-transform-1.1.2.tgz", - "integrity": "sha512-Y3twjldHF1htCiCu6elGwQDdNp5PD54U66waWa2XNKh+g2lXSnWo3nq9SZnZOV3odFAqkM/roiNZx078RE2new==", - "dependencies": { - "lodash": "^4.17.15" - } - }, "node_modules/node-releases": { "version": "2.0.14", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", @@ -12354,6 +12183,7 @@ "version": "1.13.1", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -13794,6 +13624,7 @@ "version": "6.11.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "dev": true, "dependencies": { "side-channel": "^1.0.4" }, @@ -14562,6 +14393,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", + "dev": true, "dependencies": { "define-data-property": "^1.1.1", "get-intrinsic": "^1.2.1", @@ -14644,6 +14476,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, "dependencies": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", @@ -15861,11 +15694,6 @@ "node": ">=4.2.0" } }, - "node_modules/uc.micro": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", - "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==" - }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -16246,25 +16074,6 @@ "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==", "dev": true }, - "node_modules/vue-i18n": { - "version": "9.10.2", - "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.10.2.tgz", - "integrity": "sha512-ECJ8RIFd+3c1d3m1pctQ6ywG5Yj8Efy1oYoAKQ9neRdkLbuKLVeW4gaY5HPkD/9ssf1pOnUrmIFjx2/gkGxmEw==", - "dependencies": { - "@intlify/core-base": "9.10.2", - "@intlify/shared": "9.10.2", - "@vue/devtools-api": "^6.5.0" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - }, - "peerDependencies": { - "vue": "^3.0.0" - } - }, "node_modules/vue-loader": { "version": "17.3.1", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-17.3.1.tgz", @@ -16362,17 +16171,6 @@ "resolved": "https://registry.npmjs.org/vue-logger-plugin/-/vue-logger-plugin-2.2.3.tgz", "integrity": "sha512-PGGwFarWpReyJc8XONuNBb86mpfLqYO6+MWjkFnCDWcagjM2BLY7rskLTgn3eT3skq0qu+2K2roiIAgiXJDXSQ==" }, - "node_modules/vue-markdown-render": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/vue-markdown-render/-/vue-markdown-render-2.2.1.tgz", - "integrity": "sha512-XkYnC0PMdbs6Vy6j/gZXSvCuOS0787Se5COwXlepRqiqPiunyCIeTPQAO2XnB4Yl04EOHXwLx5y6IuszMWSgyQ==", - "dependencies": { - "markdown-it": "^13.0.2" - }, - "peerDependencies": { - "vue": "^3.3.4" - } - }, "node_modules/vue-router": { "version": "4.2.5", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.2.5.tgz", diff --git a/package.json b/package.json index f96d9fe58..e544cd72e 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.2.6", - "@hotwax/dxp-components": "^1.15.2", - "@hotwax/oms-api": "^1.14.0", + "@hotwax/dxp-components": "file:../dxp-components", + "@hotwax/oms-api": "file:../oms-api", "@ionic/core": "^7.6.0", "@ionic/vue": "^7.6.0", "@ionic/vue-router": "^7.6.0", diff --git a/src/components/InventoryDetailsPopover.vue b/src/components/InventoryDetailsPopover.vue index b0184a700..4960c3a19 100644 --- a/src/components/InventoryDetailsPopover.vue +++ b/src/components/InventoryDetailsPopover.vue @@ -54,7 +54,6 @@ export default defineComponent({ product: "product/getCurrent", getProductStock: 'stock/getProductStock', getInventoryInformation: 'stock/getInventoryInformation', - currentFacility: 'user/getCurrentFacility', }) }, async beforeMount () { diff --git a/src/components/NotificationPreferenceModal.vue b/src/components/NotificationPreferenceModal.vue index 29773737a..7130d726e 100644 --- a/src/components/NotificationPreferenceModal.vue +++ b/src/components/NotificationPreferenceModal.vue @@ -44,10 +44,10 @@ import { modalController, alertController, } from "@ionic/vue"; -import { defineComponent } from "vue"; +import { computed, defineComponent } from "vue"; import { closeOutline, save } from "ionicons/icons"; import { mapGetters, useStore } from "vuex"; -import { translate } from '@hotwax/dxp-components' +import { translate, useUserStore } from '@hotwax/dxp-components' import { showToast } from "@/utils"; import emitter from "@/event-bus" import { generateTopicName } from "@/utils/firebase"; @@ -82,7 +82,6 @@ export default defineComponent({ }, computed: { ...mapGetters({ - currentFacility: 'user/getCurrentFacility', instanceUrl: 'user/getInstanceUrl', notificationPrefs: 'user/getNotificationPrefs' }), @@ -138,7 +137,7 @@ export default defineComponent({ } }, async handleTopicSubscription() { - const facilityId = (this.currentFacility as any).facilityId + const facilityId = this.currentFacility.value?.facilityId const subscribeRequests = [] as any this.notificationPrefToUpdate.subscribe.map(async (enumId: string) => { const topicName = generateTopicName(facilityId, enumId) @@ -182,9 +181,12 @@ export default defineComponent({ }, setup() { const store = useStore(); + const userStore = useUserStore() + let currentFacility: any = computed(() => userStore.getCurrentFacility) return { closeOutline, + currentFacility, translate, save, store diff --git a/src/components/ProductListItem.vue b/src/components/ProductListItem.vue index 630ba2a45..8ee26f5e2 100644 --- a/src/components/ProductListItem.vue +++ b/src/components/ProductListItem.vue @@ -55,7 +55,6 @@ export default defineComponent({ getProduct: 'product/getProduct', product: "product/getCurrent", getProductStock: 'stock/getProductStock', - currentFacility: 'user/getCurrentFacility', }) }, methods: { diff --git a/src/main.ts b/src/main.ts index ac45a9496..fc91446e5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -36,7 +36,7 @@ import { dxpComponents } from '@hotwax/dxp-components' import localeMessages from './locales'; import { login, logout, loader } from '@/utils/user'; import { addNotification, storeClientRegistrationToken } from '@/utils/firebase'; -import { getConfig, getProductIdentificationPref, initialise, setProductIdentificationPref, setUserLocale, getAvailableTimeZones, setUserTimeZone } from '@/adapter'; +import { getConfig, getProductIdentificationPref, getUserFacilities, getUserPreference, initialise, setProductIdentificationPref, setUserLocale, getAvailableTimeZones, setUserTimeZone, setUserPreference } from '@/adapter'; import logger from './logger'; const app = createApp(App) @@ -70,7 +70,10 @@ const app = createApp(App) setUserLocale, storeClientRegistrationToken, getAvailableTimeZones, - setUserTimeZone + setUserTimeZone, + getUserFacilities, + setUserPreference, + getUserPreference }); // Filters are removed in Vue 3 and global filter introduced https://v3.vuejs.org/guide/migration/filters.html#global-filters diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index 26766c13a..bcd60bd7f 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -5,13 +5,18 @@ import OrderState from './OrderState' import * as types from './mutation-types' import { showToast } from "@/utils"; import { hasError } from '@/adapter' -import { translate } from "@hotwax/dxp-components"; +import { translate, useUserStore } from "@hotwax/dxp-components"; import emitter from '@/event-bus' import store from "@/store"; import { prepareOrderQuery } from "@/utils/solrHelper"; import { getOrderCategory } from "@/utils/order"; import logger from "@/logger"; +const getCurrentFacilityId = () => { + const currentFacility: any = useUserStore().getCurrentFacility; + return currentFacility?.facilityId +} + const actions: ActionTree ={ async getOrderDetails({ dispatch, commit }, payload ) { @@ -678,7 +683,7 @@ const actions: ActionTree ={ inputFields: { statusId: "SHIPMENT_SHIPPED", shipmentMethodTypeId: "SHIP_TO_STORE", - orderFacilityId: this.state.user.currentFacility.facilityId + orderFacilityId: getCurrentFacilityId() }, viewSize: payload.viewSize ? payload.viewSize : process.env.VUE_APP_VIEW_SIZE, viewIndex: payload.viewIndex ? payload.viewIndex : 0, @@ -764,7 +769,7 @@ const actions: ActionTree ={ inputFields: { statusId: "PICKUP_SCHEDULED", shipmentMethodTypeId: "SHIP_TO_STORE", - orderFacilityId: this.state.user.currentFacility.facilityId + orderFacilityId: getCurrentFacilityId() }, viewSize: payload.viewSize ? payload.viewSize : process.env.VUE_APP_VIEW_SIZE, viewIndex: payload.viewIndex ? payload.viewIndex : 0, @@ -850,7 +855,7 @@ const actions: ActionTree ={ inputFields: { statusId: "SHIPMENT_DELIVERED", shipmentMethodTypeId: "SHIP_TO_STORE", - orderFacilityId: this.state.user.currentFacility.facilityId + orderFacilityId: getCurrentFacilityId() }, viewSize: payload.viewSize ? payload.viewSize : process.env.VUE_APP_VIEW_SIZE, viewIndex: payload.viewIndex ? payload.viewIndex : 0, diff --git a/src/store/modules/stock/actions.ts b/src/store/modules/stock/actions.ts index b70a4d696..df2499a2c 100644 --- a/src/store/modules/stock/actions.ts +++ b/src/store/modules/stock/actions.ts @@ -5,22 +5,28 @@ import StockState from './StockState' import * as types from './mutation-types' import { hasError } from '@/adapter' import { showToast } from '@/utils' -import { translate } from "@hotwax/dxp-components"; +import { translate, useUserStore } from "@hotwax/dxp-components"; import logger from '@/logger' import { prepareOrderQuery } from "@/utils/solrHelper"; import { UtilService } from '@/services/UtilService'; +const getCurrentFacilityId = () => { + const currentFacility: any = useUserStore().getCurrentFacility; + return currentFacility?.facilityId +} + const actions: ActionTree = { async fetchStock({ commit }, { productId }) { + const facilityId = getCurrentFacilityId() try { const payload = { productId: productId, - facilityId: this.state.user.currentFacility.facilityId + facilityId: facilityId } const resp: any = await StockService.getInventoryAvailableByFacility(payload); if (!hasError(resp)) { - commit(types.STOCK_ADD_PRODUCT, { productId: payload.productId, facilityId: this.state.user.currentFacility.facilityId, stock: resp.data }) + commit(types.STOCK_ADD_PRODUCT, { productId: payload.productId, facilityId: facilityId, stock: resp.data }) } else { throw resp.data; } @@ -31,7 +37,7 @@ const actions: ActionTree = { }, async fetchInventoryCount({ commit, state }, { productId }) { - const facilityId = this.state.user.currentFacility.facilityId; + const facilityId = getCurrentFacilityId(); if (state.inventoryInformation[productId] && state.inventoryInformation[productId][facilityId]) { return; } @@ -60,7 +66,7 @@ const actions: ActionTree = { }, async fetchReservedQuantity({ commit, state }, { productId }) { - const facilityId = this.state.user.currentFacility.facilityId; + const facilityId = getCurrentFacilityId(); if (state.inventoryInformation[productId] && state.inventoryInformation[productId][facilityId]?.reservedQuantity) { return; } diff --git a/src/store/modules/stock/getters.ts b/src/store/modules/stock/getters.ts index 3d9a4e392..1f4fe0e21 100644 --- a/src/store/modules/stock/getters.ts +++ b/src/store/modules/stock/getters.ts @@ -1,15 +1,20 @@ import { GetterTree } from 'vuex' +import { useUserStore } from "@hotwax/dxp-components"; import StockState from './StockState' import RootState from '../../RootState' -import store from '@/store' + +const getCurrentFacilityId = () => { + const currentFacility: any = useUserStore().getCurrentFacility; + return currentFacility?.facilityId +} const getters: GetterTree = { getProductStock: (state, RootState) => (productId: any) => { - const facilityId = store.state.user?.currentFacility?.facilityId + const facilityId = getCurrentFacilityId() return state.products[productId] ? state.products[productId][facilityId] ? state.products[productId][facilityId] : {} : {} }, getInventoryInformation: (state) => (productId: any) => { - const facilityId = store.state.user?.currentFacility?.facilityId + const facilityId = getCurrentFacilityId() return state.inventoryInformation[productId] ? state.inventoryInformation[productId][facilityId] ? state.inventoryInformation[productId][facilityId] : {} : {}; } } diff --git a/src/store/modules/user/UserState.ts b/src/store/modules/user/UserState.ts index c6b125cfa..ff29bf5d9 100644 --- a/src/store/modules/user/UserState.ts +++ b/src/store/modules/user/UserState.ts @@ -1,7 +1,6 @@ export default interface UserState { token: string; current: any; - currentFacility: object; instanceUrl: string; preference: any; permissions: any; diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index a14105a07..15a40aabb 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -9,7 +9,6 @@ import { getUserPreference, getNotificationEnumIds, getNotificationUserPrefTypeIds, - getUserFacilities, hasError, logout, resetConfig, @@ -71,8 +70,9 @@ const actions: ActionTree = { //fetching user facilities const isAdminUser = appPermissions.some((appPermission: any) => appPermission?.action === "APP_STOREFULFILLMENT_ADMIN" ); - const baseURL = store.getters['user/getBaseUrl']; - const facilities = await getUserFacilities(token, baseURL, userProfile?.partyId, "PICKUP", isAdminUser); + const facilities = await useUserStore().getUserFacilities(userProfile?.partyId, "PICKUP", isAdminUser) + await useUserStore().getPreferredFacility('SELECTED_FACILITY') + userProfile.facilities = facilities; // removing duplicate records as a single user can be associated with a facility by multiple roles. @@ -82,7 +82,7 @@ const actions: ActionTree = { return uniqueFacilities }, []); // TODO Use a separate API for getting facilities, this should handle user like admin accessing the app - const currentFacility = userProfile.facilities.length > 0 ? userProfile.facilities[0] : {}; + const currentFacility: any = useUserStore().getCurrentFacility const currentEComStore = await UserService.getCurrentEComStore(token, currentFacility?.facilityId); const userPreference = await getUserPreference(token, getters['getBaseUrl'], 'BOPIS_PREFERENCE') @@ -96,7 +96,6 @@ const actions: ActionTree = { // TODO user single mutation commit(types.USER_INFO_UPDATED, userProfile); - commit(types.USER_CURRENT_FACILITY_UPDATED, currentFacility); commit(types.USER_CURRENT_ECOM_STORE_UPDATED, currentEComStore) commit(types.USER_PREFERENCE_UPDATED, userPreference) commit(types.USER_PERMISSIONS_UPDATED, appPermissions); @@ -175,20 +174,14 @@ const actions: ActionTree = { }, /** - * update current facility information + * run after updating current facility */ - async setFacility ({ commit, dispatch, state }, payload) { - let facility = payload.facility; - if(!facility && state.current?.facilities) { - facility = state.current.facilities.find((facility: any) => facility.facilityId === payload.facilityId); - } + async setFacilityUpdates ({ commit, dispatch, state }, selectedFacilityId) { // clearing the orders state whenever changing the facility dispatch("order/clearOrders", null, {root: true}) dispatch("product/clearProducts", null, {root: true}) - commit(types.USER_CURRENT_FACILITY_UPDATED, facility); - const eComStore = await UserService.getCurrentEComStore(undefined, facility?.facilityId); + const eComStore = await UserService.getCurrentEComStore(state.token, selectedFacilityId); commit(types.USER_CURRENT_ECOM_STORE_UPDATED, eComStore) - await useProductIdentificationStore().getIdentificationPref(eComStore?.productStoreId) }, /** @@ -301,7 +294,8 @@ const actions: ActionTree = { async fetchNotificationPreferences({ commit, state }) { let resp = {} as any - const facilityId = (state.currentFacility as any).facilityId + const currentFacility: any = useUserStore().getCurrentFacility + const facilityId = currentFacility?.facilityId let notificationPreferences = [], enumerationResp = [], userPrefIds = [] as any try { resp = await getNotificationEnumIds(process.env.VUE_APP_NOTIF_ENUM_TYPE_ID) diff --git a/src/store/modules/user/getters.ts b/src/store/modules/user/getters.ts index 0fdab88f8..56b139042 100644 --- a/src/store/modules/user/getters.ts +++ b/src/store/modules/user/getters.ts @@ -20,9 +20,6 @@ const getters: GetterTree = { getUserProfile (state) { return state.current }, - getCurrentFacility (state){ - return state.currentFacility - }, getInstanceUrl (state) { const baseUrl = process.env.VUE_APP_BASE_URL; return baseUrl ? baseUrl : state.instanceUrl; diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index ce8d65014..94c787c2b 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -10,7 +10,6 @@ const userModule: Module = { state: { token: '', current: {}, - currentFacility: {}, instanceUrl: '', preference: { showShippingOrders: false, diff --git a/src/store/modules/user/mutation-types.ts b/src/store/modules/user/mutation-types.ts index d9eb6fba7..c1f693675 100644 --- a/src/store/modules/user/mutation-types.ts +++ b/src/store/modules/user/mutation-types.ts @@ -2,7 +2,6 @@ export const SN_USER = 'user' export const USER_TOKEN_CHANGED = SN_USER + '/TOKEN_CHANGED' export const USER_END_SESSION = SN_USER + '/END_SESSION' export const USER_INFO_UPDATED = SN_USER + '/INFO_UPDATED' -export const USER_CURRENT_FACILITY_UPDATED = SN_USER + '/CURRENT_FACILITY_UPDATED' export const USER_INSTANCE_URL_UPDATED = SN_USER + '/INSTANCE_URL_UPDATED' export const USER_PREFERENCE_UPDATED = SN_USER + '/PREFERENCE_UPDATED' export const USER_CURRENT_ECOM_STORE_UPDATED = SN_USER + '/CURRENT_ECOM_STORE_UPDATED' diff --git a/src/store/modules/user/mutations.ts b/src/store/modules/user/mutations.ts index c4aa1767b..a66f8b6d2 100644 --- a/src/store/modules/user/mutations.ts +++ b/src/store/modules/user/mutations.ts @@ -9,7 +9,6 @@ const mutations: MutationTree = { [types.USER_END_SESSION] (state) { state.token = '' state.current = {} - state.currentFacility = {} state.permissions = [] state.preference= { showShippingOrders: false, @@ -21,9 +20,6 @@ const mutations: MutationTree = { [types.USER_INFO_UPDATED] (state, payload) { state.current = payload }, - [types.USER_CURRENT_FACILITY_UPDATED] (state, payload) { - state.currentFacility = payload; - }, [types.USER_INSTANCE_URL_UPDATED] (state, payload) { state.instanceUrl = payload; }, diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 320220e6b..84412c587 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -257,7 +257,7 @@ import { DateTime } from "luxon"; import { api, hasError } from '@/adapter'; import { OrderService } from "@/services/OrderService"; import RejectOrderModal from "@/components/RejectOrderModal.vue"; -import { getProductIdentificationValue, translate, useProductIdentificationStore } from "@hotwax/dxp-components"; +import { getProductIdentificationValue, translate, useProductIdentificationStore, useUserStore } from "@hotwax/dxp-components"; import EditPickerModal from "@/components/EditPickerModal.vue"; import emitter from '@/event-bus' import logger from "@/logger"; @@ -312,7 +312,6 @@ export default defineComponent({ computed: { ...mapGetters({ order: "order/getCurrent", - currentFacility: 'user/getCurrentFacility', configurePicker: "user/configurePicker", partialOrderRejectionConfig: 'user/getPartialOrderRejectionConfig', getPaymentMethodDesc: 'util/getPaymentMethodDesc', @@ -373,7 +372,7 @@ export default defineComponent({ }, async getOrderDetail(orderId: any, orderPartSeqId: any, orderType: any) { const payload = { - facilityId: this.currentFacility.facilityId, + facilityId: this.currentFacility.value?.facilityId, orderId, orderPartSeqId } @@ -388,7 +387,7 @@ export default defineComponent({ return rejectOrderModal.present(); }, async readyForPickup(order: any, part: any) { - if (this.configurePicker) return this.assignPicker(order, part, this.currentFacility.facilityId); + if (this.configurePicker) return this.assignPicker(order, part, this.currentFacility.value?.facilityId); const pickup = part?.shipmentMethodEnum?.shipmentMethodEnumId === 'STOREPICKUP'; const header = pickup ? translate('Ready for pickup') : translate('Ready to ship'); const message = pickup ? translate('An email notification will be sent to that their order is ready for pickup. This order will also be moved to the packed orders tab.', { customerName: order.customer.name, space: '

' }) : ''; @@ -403,7 +402,7 @@ export default defineComponent({ }, { text: header, handler: async () => { - await this.store.dispatch('order/packShipGroupItems', { order: order, part: part, facilityId: this.currentFacility.facilityId }) + await this.store.dispatch('order/packShipGroupItems', { order: order, part: part, facilityId: this.currentFacility.value?.facilityId }) } }] }); @@ -515,8 +514,10 @@ export default defineComponent({ setup() { const store = useStore(); const router = useRouter(); + const userStore = useUserStore() const productIdentificationStore = useProductIdentificationStore(); let productIdentificationPref = computed(() => productIdentificationStore.getProductIdentificationPref) + let currentFacility: any = computed(() => userStore.getCurrentFacility) return { Actions, @@ -531,6 +532,7 @@ export default defineComponent({ checkmarkCircleOutline, checkmarkOutline, cubeOutline, + currentFacility, getProductIdentificationValue, giftOutline, getFeature, diff --git a/src/views/Orders.vue b/src/views/Orders.vue index c421dce41..0c02601f5 100644 --- a/src/views/Orders.vue +++ b/src/views/Orders.vue @@ -190,7 +190,7 @@ import { IonToolbar, modalController } from "@ionic/vue"; -import { defineComponent, ref } from "vue"; +import { defineComponent, ref, computed } from "vue"; import ProductListItem from '@/components/ProductListItem.vue' import { swapVerticalOutline, @@ -206,7 +206,7 @@ import { copyToClipboard, showToast } from '@/utils' import { DateTime } from 'luxon'; import emitter from "@/event-bus" import { api, hasError } from '@/adapter'; -import { translate } from "@hotwax/dxp-components"; +import { translate, useUserStore } from "@hotwax/dxp-components"; import AssignPickerModal from "./AssignPickerModal.vue"; import { OrderService } from "@/services/OrderService"; import { Actions, hasPermission } from '@/authorization' @@ -248,7 +248,6 @@ export default defineComponent({ packedOrders: 'order/getPackedOrders', completedOrders: 'order/getCompletedOrders', configurePicker: "user/configurePicker", - currentFacility: 'user/getCurrentFacility', isPackedOrdersScrollable: 'order/isPackedOrdersScrollable', isOpenOrdersScrollable: 'order/isOpenOrdersScrollable', isCompletedOrdersScrollable: 'order/isCompletedOrdersScrollable', @@ -326,19 +325,19 @@ export default defineComponent({ const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; const viewIndex = vIndex ? vIndex : 0; - await this.store.dispatch("order/getOpenOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.facilityId }); + await this.store.dispatch("order/getOpenOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.value?.facilityId }); }, async getPackedOrders (vSize?: any, vIndex?: any) { const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; const viewIndex = vIndex ? vIndex : 0; - await this.store.dispatch("order/getPackedOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.facilityId }); + await this.store.dispatch("order/getPackedOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.value?.facilityId }); }, async getCompletedOrders (vSize?: any, vIndex?: any) { const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; const viewIndex = vIndex ? vIndex : 0; - await this.store.dispatch("order/getCompletedOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.facilityId }); + await this.store.dispatch("order/getCompletedOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.value?.facilityId }); }, enableScrolling() { const parentElement = (this as any).$refs.contentRef.$el @@ -380,7 +379,7 @@ export default defineComponent({ } }, async readyForPickup (order: any, part: any) { - if(this.configurePicker) return this.assignPicker(order, part, this.currentFacility.facilityId); + if(this.configurePicker) return this.assignPicker(order, part, this.currentFacility.value?.facilityId); const pickup = part.shipmentMethodEnum?.shipmentMethodEnumId === 'STOREPICKUP'; const header = pickup ? translate('Ready for pickup') : translate('Ready to ship'); const message = pickup ? translate('An email notification will be sent to that their order is ready for pickup. This order will also be moved to the packed orders tab.', { customerName: order.customer.name, space: '

'}) : ''; @@ -395,7 +394,7 @@ export default defineComponent({ },{ text: header, handler: () => { - this.store.dispatch('order/packShipGroupItems', {order, part, facilityId: this.currentFacility.facilityId}) + this.store.dispatch('order/packShipGroupItems', {order, part, facilityId: this.currentFacility.value?.facilityId}) } }] }); @@ -492,11 +491,14 @@ export default defineComponent({ const router = useRouter(); const store = useStore(); const segmentSelected = ref('open'); - + const userStore = useUserStore() + let currentFacility: any = computed(() => userStore.getCurrentFacility) + return { Actions, callOutline, copyToClipboard, + currentFacility, hasPermission, notificationsOutline, mailOutline, diff --git a/src/views/ProductDetail.vue b/src/views/ProductDetail.vue index 7a9ba5bfb..9a6ac499d 100644 --- a/src/views/ProductDetail.vue +++ b/src/views/ProductDetail.vue @@ -166,7 +166,7 @@ import { getFeature, showToast } from "@/utils"; import { hasError } from '@/adapter' import { sortSizes } from '@/apparel-sorter'; import OtherStoresInventoryModal from "./OtherStoresInventoryModal.vue"; -import { DxpShopifyImg, getProductIdentificationValue, translate, useProductIdentificationStore } from "@hotwax/dxp-components"; +import { DxpShopifyImg, getProductIdentificationValue, translate, useProductIdentificationStore, useUserStore } from "@hotwax/dxp-components"; import logger from "@/logger"; export default defineComponent({ @@ -210,7 +210,6 @@ export default defineComponent({ computed: { ...mapGetters({ product: "product/getCurrent", - currentFacility: 'user/getCurrentFacility', currency: 'user/getCurrency', getProductStock: 'stock/getProductStock', getInventoryInformation: 'stock/getInventoryInformation', @@ -228,7 +227,7 @@ export default defineComponent({ methods: { //For fetching all the orders for this product & facility. async getOrderDetails() { - await this.store.dispatch("order/getOrderDetails", { viewSize: 200, facilityId: this.currentFacility.facilityId, productId: this.currentVariant.productId }); + await this.store.dispatch("order/getOrderDetails", { viewSize: 200, facilityId: this.currentFacility.value?.facilityId, productId: this.currentVariant.productId }); }, async applyFeature(feature: string, type: string) { if(type === 'color') this.selectedColor = feature; @@ -295,7 +294,7 @@ export default defineComponent({ if (resp.status === 200 && !hasError(resp) && resp.data.docs.length) { resp.data.docs.map((storeInventory: any) => { if(storeInventory.atp) { - const isCurrentStore = storeInventory.facilityId === this.currentFacility.facilityId; + const isCurrentStore = storeInventory.facilityId === this.currentFacility.value?.facilityId; if (isCurrentStore) this.currentStoreInventory = storeInventory.atp; if (storeInventory.facilityTypeId === 'WAREHOUSE') { this.warehouseInventory += storeInventory.atp @@ -322,10 +321,13 @@ export default defineComponent({ }, setup() { const store = useStore(); + const userStore = useUserStore() const productIdentificationStore = useProductIdentificationStore(); let productIdentificationPref = computed(() => productIdentificationStore.getProductIdentificationPref) + let currentFacility: any = computed(() => userStore.getCurrentFacility) return { + currentFacility, getProductIdentificationValue, productIdentificationPref, store, diff --git a/src/views/Settings.vue b/src/views/Settings.vue index ec86ffe64..d7f5e312b 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -35,23 +35,7 @@
- - - - - {{ translate("Facility") }} - - - - {{ translate('Specify which facility you want to operate from. Order, inventory and other configuration data will be specific to the facility you select.') }} - - - - {{ facility.facilityName }} - - - - + @@ -198,7 +182,7 @@ import { IonToggle, IonToolbar } from '@ionic/vue'; -import { defineComponent } from 'vue'; +import { defineComponent, computed } from 'vue'; import { codeWorkingOutline, ellipsisVertical, @@ -214,7 +198,7 @@ import { DateTime } from 'luxon'; import { UserService } from '@/services/UserService' import { showToast } from '@/utils'; import { hasError, removeClientRegistrationToken, subscribeTopic, unsubscribeTopic } from '@/adapter' -import { initialiseFirebaseApp, translate } from "@hotwax/dxp-components"; +import { initialiseFirebaseApp, translate, useUserStore } from "@hotwax/dxp-components"; import { Actions, hasPermission } from '@/authorization' import { addNotification, generateTopicName, isFcmConfigured, storeClientRegistrationToken } from "@/utils/firebase"; import emitter from "@/event-bus" @@ -263,7 +247,6 @@ export default defineComponent({ computed: { ...mapGetters({ userProfile: 'user/getUserProfile', - currentFacility: 'user/getCurrentFacility', currentEComStore: 'user/getCurrentEComStore', configurePicker: "user/configurePicker", showShippingOrders: 'user/showShippingOrders', @@ -292,15 +275,10 @@ export default defineComponent({ await this.store.dispatch('user/fetchNotificationPreferences') }, methods: { - async setFacility (event: any) { - if (this.userProfile) { - await this.store.dispatch('user/setFacility', { - 'facilityId': event.detail.value - }); - await this.store.dispatch('user/fetchNotificationPreferences') - } + async handleFacilityUpdate(selectedFacilityId: any) { + await this.store.dispatch('user/setFacilityUpdates', selectedFacilityId); + await this.store.dispatch('user/fetchNotificationPreferences') }, - async timeZoneUpdated(tzId: string) { await this.store.dispatch("user/setUserTimeZone", tzId) }, @@ -428,7 +406,7 @@ export default defineComponent({ } emitter.emit('presentLoader', { backdropDismiss: false }) - const facilityId = (this.currentFacility as any).facilityId + const facilityId = this.currentFacility.value?.facilityId const topicName = generateTopicName(facilityId, enumId) const notificationPref = this.notificationPrefs.find((pref: any) => pref.enumId === enumId) @@ -485,9 +463,12 @@ export default defineComponent({ setup () { const store = useStore(); const router = useRouter(); + const userStore = useUserStore() + let currentFacility: any = computed(() => userStore.getCurrentFacility) return { Actions, + currentFacility, ellipsisVertical, hasPermission, personCircleOutline, diff --git a/src/views/ShipToStoreOrders.vue b/src/views/ShipToStoreOrders.vue index 4e8e84f56..7e057e944 100644 --- a/src/views/ShipToStoreOrders.vue +++ b/src/views/ShipToStoreOrders.vue @@ -122,7 +122,7 @@ import { IonTitle, IonToolbar, } from "@ionic/vue"; -import { defineComponent, ref } from "vue"; +import { defineComponent, ref, computed } from "vue"; import ProductListItem from '@/components/ProductListItem.vue' import { mailOutline } from "ionicons/icons"; import { mapGetters, useStore } from 'vuex' @@ -133,7 +133,7 @@ import { DateTime } from 'luxon'; import emitter from "@/event-bus" import { Actions, hasPermission } from '@/authorization' import { OrderService } from "@/services/OrderService"; -import { translate } from "@hotwax/dxp-components"; +import { translate, useUserStore } from "@hotwax/dxp-components"; import logger from "@/logger"; export default defineComponent({ @@ -168,7 +168,6 @@ export default defineComponent({ }, computed: { ...mapGetters({ - currentFacility: 'user/getCurrentFacility', incomingOrders: 'order/getShipToStoreIncomingOrders', readyForPickupOrders: 'order/getShipToStoreReadyForPickupOrders', completedOrders: 'order/getShipToStoreCompletedOrders', @@ -201,19 +200,19 @@ export default defineComponent({ const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; const viewIndex = vIndex ? vIndex : 0; - await this.store.dispatch("order/getShipToStoreIncomingOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.facilityId }); + await this.store.dispatch("order/getShipToStoreIncomingOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.value?.facilityId }); }, async getReadyForPickupOrders (vSize?: any, vIndex?: any) { const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; const viewIndex = vIndex ? vIndex : 0; - await this.store.dispatch("order/getShipToStoreReadyForPickupOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.facilityId }); + await this.store.dispatch("order/getShipToStoreReadyForPickupOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.value?.facilityId }); }, async getCompletedOrders (vSize?: any, vIndex?: any) { const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; const viewIndex = vIndex ? vIndex : 0; - await this.store.dispatch("order/getShipToStoreCompletedOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.facilityId }); + await this.store.dispatch("order/getShipToStoreCompletedOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.value?.facilityId }); }, enableScrolling() { const parentElement = (this as any).$refs.contentRef.$el @@ -420,11 +419,14 @@ export default defineComponent({ setup () { const router = useRouter(); const store = useStore(); + const userStore = useUserStore() const segmentSelected = ref('incoming'); + let currentFacility: any = computed(() => userStore.getCurrentFacility) return { Actions, copyToClipboard, + currentFacility, hasPermission, mailOutline, router, From ce62b279f5d7d1ff2473e7a4d9b34885625c766d Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 11 Sep 2024 20:42:08 +0530 Subject: [PATCH 2/8] Improved: changed the computed property & directly accessing the value --- src/components/NotificationPreferenceModal.vue | 2 +- src/views/OrderDetail.vue | 6 +++--- src/views/Orders.vue | 11 +++++------ src/views/ProductDetail.vue | 4 ++-- src/views/Settings.vue | 2 +- src/views/ShipToStoreOrders.vue | 6 +++--- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/components/NotificationPreferenceModal.vue b/src/components/NotificationPreferenceModal.vue index 7130d726e..9212500de 100644 --- a/src/components/NotificationPreferenceModal.vue +++ b/src/components/NotificationPreferenceModal.vue @@ -137,7 +137,7 @@ export default defineComponent({ } }, async handleTopicSubscription() { - const facilityId = this.currentFacility.value?.facilityId + const facilityId = this.currentFacility?.facilityId const subscribeRequests = [] as any this.notificationPrefToUpdate.subscribe.map(async (enumId: string) => { const topicName = generateTopicName(facilityId, enumId) diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 84412c587..8f8a35516 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -372,7 +372,7 @@ export default defineComponent({ }, async getOrderDetail(orderId: any, orderPartSeqId: any, orderType: any) { const payload = { - facilityId: this.currentFacility.value?.facilityId, + facilityId: this.currentFacility?.facilityId, orderId, orderPartSeqId } @@ -387,7 +387,7 @@ export default defineComponent({ return rejectOrderModal.present(); }, async readyForPickup(order: any, part: any) { - if (this.configurePicker) return this.assignPicker(order, part, this.currentFacility.value?.facilityId); + if (this.configurePicker) return this.assignPicker(order, part, this.currentFacility?.facilityId); const pickup = part?.shipmentMethodEnum?.shipmentMethodEnumId === 'STOREPICKUP'; const header = pickup ? translate('Ready for pickup') : translate('Ready to ship'); const message = pickup ? translate('An email notification will be sent to that their order is ready for pickup. This order will also be moved to the packed orders tab.', { customerName: order.customer.name, space: '

' }) : ''; @@ -402,7 +402,7 @@ export default defineComponent({ }, { text: header, handler: async () => { - await this.store.dispatch('order/packShipGroupItems', { order: order, part: part, facilityId: this.currentFacility.value?.facilityId }) + await this.store.dispatch('order/packShipGroupItems', { order: order, part: part, facilityId: this.currentFacility?.facilityId }) } }] }); diff --git a/src/views/Orders.vue b/src/views/Orders.vue index 0c02601f5..c7ee8f35c 100644 --- a/src/views/Orders.vue +++ b/src/views/Orders.vue @@ -324,20 +324,19 @@ export default defineComponent({ async getPickupOrders (vSize?: any, vIndex?: any) { const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; const viewIndex = vIndex ? vIndex : 0; - - await this.store.dispatch("order/getOpenOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.value?.facilityId }); + await this.store.dispatch("order/getOpenOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility?.facilityId }); }, async getPackedOrders (vSize?: any, vIndex?: any) { const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; const viewIndex = vIndex ? vIndex : 0; - await this.store.dispatch("order/getPackedOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.value?.facilityId }); + await this.store.dispatch("order/getPackedOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility?.facilityId }); }, async getCompletedOrders (vSize?: any, vIndex?: any) { const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; const viewIndex = vIndex ? vIndex : 0; - await this.store.dispatch("order/getCompletedOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.value?.facilityId }); + await this.store.dispatch("order/getCompletedOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility?.facilityId }); }, enableScrolling() { const parentElement = (this as any).$refs.contentRef.$el @@ -379,7 +378,7 @@ export default defineComponent({ } }, async readyForPickup (order: any, part: any) { - if(this.configurePicker) return this.assignPicker(order, part, this.currentFacility.value?.facilityId); + if(this.configurePicker) return this.assignPicker(order, part, this.currentFacility?.facilityId); const pickup = part.shipmentMethodEnum?.shipmentMethodEnumId === 'STOREPICKUP'; const header = pickup ? translate('Ready for pickup') : translate('Ready to ship'); const message = pickup ? translate('An email notification will be sent to that their order is ready for pickup. This order will also be moved to the packed orders tab.', { customerName: order.customer.name, space: '

'}) : ''; @@ -394,7 +393,7 @@ export default defineComponent({ },{ text: header, handler: () => { - this.store.dispatch('order/packShipGroupItems', {order, part, facilityId: this.currentFacility.value?.facilityId}) + this.store.dispatch('order/packShipGroupItems', {order, part, facilityId: this.currentFacility?.facilityId}) } }] }); diff --git a/src/views/ProductDetail.vue b/src/views/ProductDetail.vue index 9a6ac499d..1cba9d861 100644 --- a/src/views/ProductDetail.vue +++ b/src/views/ProductDetail.vue @@ -227,7 +227,7 @@ export default defineComponent({ methods: { //For fetching all the orders for this product & facility. async getOrderDetails() { - await this.store.dispatch("order/getOrderDetails", { viewSize: 200, facilityId: this.currentFacility.value?.facilityId, productId: this.currentVariant.productId }); + await this.store.dispatch("order/getOrderDetails", { viewSize: 200, facilityId: this.currentFacility?.facilityId, productId: this.currentVariant.productId }); }, async applyFeature(feature: string, type: string) { if(type === 'color') this.selectedColor = feature; @@ -294,7 +294,7 @@ export default defineComponent({ if (resp.status === 200 && !hasError(resp) && resp.data.docs.length) { resp.data.docs.map((storeInventory: any) => { if(storeInventory.atp) { - const isCurrentStore = storeInventory.facilityId === this.currentFacility.value?.facilityId; + const isCurrentStore = storeInventory.facilityId === this.currentFacility?.facilityId; if (isCurrentStore) this.currentStoreInventory = storeInventory.atp; if (storeInventory.facilityTypeId === 'WAREHOUSE') { this.warehouseInventory += storeInventory.atp diff --git a/src/views/Settings.vue b/src/views/Settings.vue index d7f5e312b..bb5f7b76c 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -406,7 +406,7 @@ export default defineComponent({ } emitter.emit('presentLoader', { backdropDismiss: false }) - const facilityId = this.currentFacility.value?.facilityId + const facilityId = this.currentFacility?.facilityId const topicName = generateTopicName(facilityId, enumId) const notificationPref = this.notificationPrefs.find((pref: any) => pref.enumId === enumId) diff --git a/src/views/ShipToStoreOrders.vue b/src/views/ShipToStoreOrders.vue index 7e057e944..97a35eb4f 100644 --- a/src/views/ShipToStoreOrders.vue +++ b/src/views/ShipToStoreOrders.vue @@ -200,19 +200,19 @@ export default defineComponent({ const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; const viewIndex = vIndex ? vIndex : 0; - await this.store.dispatch("order/getShipToStoreIncomingOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.value?.facilityId }); + await this.store.dispatch("order/getShipToStoreIncomingOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility?.facilityId }); }, async getReadyForPickupOrders (vSize?: any, vIndex?: any) { const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; const viewIndex = vIndex ? vIndex : 0; - await this.store.dispatch("order/getShipToStoreReadyForPickupOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.value?.facilityId }); + await this.store.dispatch("order/getShipToStoreReadyForPickupOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility?.facilityId }); }, async getCompletedOrders (vSize?: any, vIndex?: any) { const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; const viewIndex = vIndex ? vIndex : 0; - await this.store.dispatch("order/getShipToStoreCompletedOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility.value?.facilityId }); + await this.store.dispatch("order/getShipToStoreCompletedOrders", { viewSize, viewIndex, queryString: this.queryString, facilityId: this.currentFacility?.facilityId }); }, enableScrolling() { const parentElement = (this as any).$refs.contentRef.$el From 55780b20f54cebd483e360b132fd26696a140953 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 16 Oct 2024 19:50:35 +0530 Subject: [PATCH 3/8] Improved: updated locale files & change code wrt to updated emit from dxp --- src/locales/en.json | 6 ++++++ src/locales/es.json | 6 ++++++ src/locales/ja.json | 6 ++++++ src/store/modules/user/actions.ts | 2 +- src/views/Settings.vue | 4 ++-- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 5e22253fe..25439ac2f 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -45,6 +45,7 @@ "Failed to load packing slip": "Failed to load packing slip", "Failed to update configuration": "Failed to update configuration", "Failed to print shipping label and packing slip": "Failed to print shipping label and packing slip", + "Fetching facilities": "Fetching facilities", "First name": "First name", "Generate packing slips": "Generate packing slips", "Generate shipping documents": "Generate shipping documents", @@ -73,6 +74,7 @@ "Mismatch": "Mismatch", "More": "More", "New notification received.": "New notification received.", + "No facilities found": "No facilities found", "No items found": "No items found", "No inventory details found": "No inventory details found", "No products found": "No products found", @@ -128,6 +130,7 @@ "Pick up location": "Pick up location", "Pickers successfully replaced in the picklist with the new selections.": "Pickers successfully replaced in the picklist with the new selections.", "pieces in stock": "pieces in stock", + "Primary": "Primary", "Product details": "Product details", "Product not found": "Product not found", "Products not found": "Products not found", @@ -150,7 +153,10 @@ "Search": "Search", "Search Orders": "Search Orders", "Search time zones": "Search time zones", + "Secondary": "Secondary", "Select facility": "Select facility", + "Select Facility": "Select Facility", + "Search facilities": "Search facilities", "Select reason": "Select reason", "Selected TimeZone":"Selected TimeZone", "Select a different time zone": "Select a different time zone", diff --git a/src/locales/es.json b/src/locales/es.json index 36b61da73..3354a8f32 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -43,6 +43,7 @@ "Failed to load packing slip": "Error al cargar el documento de embalaje", "Failed to update configuration": "No se pudo actualizar la configuración", "Failed to print shipping label and packing slip": "Error al imprimir la etiqueta de envío y la hoja de embalaje", + "Fetching facilities": "Fetching facilities", "First name": "Nombre", "Generate packing slips": "Generar documentos de embalaje", "Generate shipping documents": "Generar documentos de envío", @@ -70,6 +71,7 @@ "Mismatch": "Desajuste", "More": "Más", "New notification received.": "Nueva notificación recibida.", + "No facilities found": "No facilities found", "No items found": "No se encontraron artículos", "No inventory details found": "No se encontraron detalles de inventario", "No products found": "No se encontraron productos", @@ -125,6 +127,7 @@ "Pick up location": "Ubicación de recogida", "Pickers successfully replaced in the picklist with the new selections.": "Los recolectores fueron reemplazados exitosamente en la lista de selección con las nuevas selecciones.", "pieces in stock": "piezas en inventario", + "Primary": "Primary", "Product details": "Detalles del producto", "Product not found": "Producto no encontrado", "Products not found": "Productos no encontrados", @@ -147,7 +150,10 @@ "Search": "Buscar", "Search Orders": "Buscar pedidos", "Search time zones": "Buscar zonas horarias", + "Secondary": "Secondary", "Select facility": "Seleccionar instalación", + "Select Facility": "Select Facility", + "Search facilities": "Search facilities", "Select reason": "Seleccionar motivo", "Selected TimeZone":"Selected TimeZone", "Select a different time zone": "Select a different time zone", diff --git a/src/locales/ja.json b/src/locales/ja.json index 7a82e6cac..972432b23 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -43,6 +43,7 @@ "Failed to load packing slip": "納品書の読み込みに失敗しました", "Failed to update configuration": "設定の更新に失敗しました", "Failed to print shipping label and packing slip": "出荷ラベルと納品書の印刷に失敗しました。", + "Fetching facilities": "Fetching facilities", "First name": "名", "Generate packing slips": "内容明細票の作成", "Generate shipping documents": "出荷書類を生成する", @@ -70,6 +71,7 @@ "Mismatch": "不一致", "More": "もっと見る", "New notification received.": "新しい通知を受信しました。", + "No facilities found": "No facilities found", "No items found": "アイテムが見つかりませんでした", "No inventory details found": "在庫の詳細が見つかりません", "No products found": "商品が見つかりません", @@ -124,6 +126,7 @@ "Pick up location": "受取場所", "Pickers successfully replaced in the picklist with the new selections.": "ピッカーは新しい選択によりピックリストで正常に置き換えられました。", "pieces in stock": "在庫あり", + "Primary": "Primary", "Product details": "商品詳細", "Product not found": "商品が見つかりません", "Products not found": "商品が見つかりません", @@ -146,6 +149,9 @@ "Search": "検索", "Search Orders": "注文の検索", "Search time zones": "タイムゾーンの検索", + "Secondary": "Secondary", + "Select Facility": "Select Facility", + "Search facilities": "Search facilities", "Select facility": "拠点の検索", "Select reason": "理由を選択", "Select a different time zone": "別のタイムゾーンを選択", diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 15a40aabb..595a24e9e 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -71,7 +71,7 @@ const actions: ActionTree = { //fetching user facilities const isAdminUser = appPermissions.some((appPermission: any) => appPermission?.action === "APP_STOREFULFILLMENT_ADMIN" ); const facilities = await useUserStore().getUserFacilities(userProfile?.partyId, "PICKUP", isAdminUser) - await useUserStore().getPreferredFacility('SELECTED_FACILITY') + await useUserStore().getFacilityPreference('SELECTED_FACILITY') userProfile.facilities = facilities; diff --git a/src/views/Settings.vue b/src/views/Settings.vue index bb5f7b76c..db4f84a54 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -275,8 +275,8 @@ export default defineComponent({ await this.store.dispatch('user/fetchNotificationPreferences') }, methods: { - async handleFacilityUpdate(selectedFacilityId: any) { - await this.store.dispatch('user/setFacilityUpdates', selectedFacilityId); + async handleFacilityUpdate(selectedFacility: any) { + await this.store.dispatch('user/setFacilityUpdates', selectedFacility?.facilityId); await this.store.dispatch('user/fetchNotificationPreferences') }, async timeZoneUpdated(tzId: string) { From 6f6d8a664afdcd956f224c115de4975ee895830a Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 18 Nov 2024 15:51:55 +0530 Subject: [PATCH 4/8] Improved: added util function to get current facility, updated the dxp-component version to latest and changed the emitted updateFacilty function name(#dxp/288) --- package-lock.json | 8 ++++---- package.json | 2 +- src/adapter/index.ts | 8 ++++++-- src/store/modules/order/actions.ts | 8 ++------ src/store/modules/stock/actions.ts | 8 ++------ src/store/modules/stock/getters.ts | 6 +----- src/store/modules/user/actions.ts | 4 ++-- src/utils/index.ts | 9 +++++++-- src/views/Settings.vue | 6 +++--- 9 files changed, 28 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4ed998063..3424309d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.2.6", - "@hotwax/dxp-components": "^1.15.5", + "@hotwax/dxp-components": "^1.16.0", "@hotwax/oms-api": "^1.16.0", "@ionic/core": "^7.6.0", "@ionic/vue": "^7.6.0", @@ -2807,9 +2807,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", diff --git a/package.json b/package.json index 7c553217c..cd236770c 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.2.6", - "@hotwax/dxp-components": "^1.15.5", + "@hotwax/dxp-components": "^1.16.0", "@hotwax/oms-api": "^1.16.0", "@ionic/core": "^7.6.0", "@ionic/vue": "^7.6.0", diff --git a/src/adapter/index.ts b/src/adapter/index.ts index 912c83bc3..2dfea079d 100644 --- a/src/adapter/index.ts +++ b/src/adapter/index.ts @@ -7,6 +7,7 @@ import { fetchGoodIdentificationTypes, getProductIdentificationPref, getUserFacilities, + getUserPreference, hasError, initialise, logout, @@ -20,7 +21,8 @@ import { updateInstanceUrl, updateToken, getAvailableTimeZones, - setUserTimeZone + setUserTimeZone, + setUserPreference } from '@hotwax/oms-api' export { @@ -32,6 +34,7 @@ export { fetchGoodIdentificationTypes, getProductIdentificationPref, getUserFacilities, + getUserPreference, hasError, initialise, logout, @@ -45,5 +48,6 @@ export { updateInstanceUrl, updateToken, getAvailableTimeZones, - setUserTimeZone + setUserTimeZone, + setUserPreference } \ No newline at end of file diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index e1294fcb3..dbdbab778 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -3,19 +3,15 @@ import { ActionTree } from 'vuex' import RootState from '@/store/RootState' import OrderState from './OrderState' import * as types from './mutation-types' -import { showToast } from "@/utils"; +import { showToast, getCurrentFacilityId } from "@/utils"; import { hasError } from '@/adapter' -import { translate, useUserStore } from "@hotwax/dxp-components"; +import { translate } from "@hotwax/dxp-components"; import emitter from '@/event-bus' import store from "@/store"; import { prepareOrderQuery } from "@/utils/solrHelper"; import { getOrderCategory } from "@/utils/order"; import logger from "@/logger"; -const getCurrentFacilityId = () => { - const currentFacility: any = useUserStore().getCurrentFacility; - return currentFacility?.facilityId -} const actions: ActionTree ={ diff --git a/src/store/modules/stock/actions.ts b/src/store/modules/stock/actions.ts index df2499a2c..dc414220d 100644 --- a/src/store/modules/stock/actions.ts +++ b/src/store/modules/stock/actions.ts @@ -4,16 +4,12 @@ import RootState from '@/store/RootState' import StockState from './StockState' import * as types from './mutation-types' import { hasError } from '@/adapter' -import { showToast } from '@/utils' -import { translate, useUserStore } from "@hotwax/dxp-components"; +import { showToast, getCurrentFacilityId } from '@/utils' +import { translate } from "@hotwax/dxp-components"; import logger from '@/logger' import { prepareOrderQuery } from "@/utils/solrHelper"; import { UtilService } from '@/services/UtilService'; -const getCurrentFacilityId = () => { - const currentFacility: any = useUserStore().getCurrentFacility; - return currentFacility?.facilityId -} const actions: ActionTree = { async fetchStock({ commit }, { productId }) { diff --git a/src/store/modules/stock/getters.ts b/src/store/modules/stock/getters.ts index 1f4fe0e21..296fbd042 100644 --- a/src/store/modules/stock/getters.ts +++ b/src/store/modules/stock/getters.ts @@ -1,12 +1,8 @@ import { GetterTree } from 'vuex' -import { useUserStore } from "@hotwax/dxp-components"; import StockState from './StockState' import RootState from '../../RootState' +import { getCurrentFacilityId } from '@/utils' -const getCurrentFacilityId = () => { - const currentFacility: any = useUserStore().getCurrentFacility; - return currentFacility?.facilityId -} const getters: GetterTree = { getProductStock: (state, RootState) => (productId: any) => { diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 54916fe61..f1f8f3131 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -174,12 +174,12 @@ const actions: ActionTree = { /** * run after updating current facility */ - async setFacilityUpdates ({ commit, dispatch }, selectedFacilityId) { + async setFacility({ commit, dispatch }, facilityId) { const token = store.getters['user/getUserToken']; // clearing the orders state whenever changing the facility dispatch("order/clearOrders", null, {root: true}) dispatch("product/clearProducts", null, {root: true}) - const eComStore = await UserService.getCurrentEComStore(token, selectedFacilityId); + const eComStore = await UserService.getCurrentEComStore(token, facilityId); commit(types.USER_CURRENT_ECOM_STORE_UPDATED, eComStore) await useProductIdentificationStore().getIdentificationPref(eComStore?.productStoreId) }, diff --git a/src/utils/index.ts b/src/utils/index.ts index 3dfec677e..2ec41f243 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,6 +1,6 @@ import { toastController } from '@ionic/vue'; import { Plugins } from '@capacitor/core'; -import { translate } from '@hotwax/dxp-components' +import { translate, useUserStore } from '@hotwax/dxp-components' import { DateTime } from "luxon"; // TODO Use separate files for specific utilities @@ -73,4 +73,9 @@ const formatPhoneNumber = (countryCode: string | null, areaCode: string | null, } } -export { copyToClipboard, showToast, handleDateTimeInput, getFeature, formatPhoneNumber } +const getCurrentFacilityId = () => { + const currentFacility: any = useUserStore().getCurrentFacility; + return currentFacility?.facilityId +} + +export { copyToClipboard, showToast, handleDateTimeInput, getFeature, formatPhoneNumber, getCurrentFacilityId } diff --git a/src/views/Settings.vue b/src/views/Settings.vue index 83944080d..2a054d013 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -35,7 +35,7 @@
- + @@ -276,8 +276,8 @@ export default defineComponent({ await this.store.dispatch('user/fetchNotificationPreferences') }, methods: { - async handleFacilityUpdate(selectedFacility: any) { - await this.store.dispatch('user/setFacilityUpdates', selectedFacility?.facilityId); + async updateFacility(facility: any) { + await this.store.dispatch('user/setFacility', facility?.facilityId); await this.store.dispatch('user/fetchNotificationPreferences') }, async timeZoneUpdated(tzId: string) { From 940a0f255426c8822c43f719b1f16b5cc3f7c18a Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 18 Nov 2024 18:26:10 +0530 Subject: [PATCH 5/8] Improved: used getCurrentFacilityId util function to get current facility instead of useUserStore from dxp-component in user action file(#dxp/288) --- src/store/modules/user/actions.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index f1f8f3131..f50082f16 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -5,7 +5,7 @@ import RootState from '@/store/RootState' import store from '@/store'; import UserState from './UserState' import * as types from './mutation-types' -import { showToast } from '@/utils' +import { getCurrentFacilityId, showToast } from '@/utils' import { getNotificationEnumIds, getNotificationUserPrefTypeIds, @@ -285,9 +285,8 @@ const actions: ActionTree = { async fetchNotificationPreferences({ commit, state }) { let resp = {} as any - const currentFacility: any = useUserStore().getCurrentFacility - const facilityId = currentFacility?.facilityId let notificationPreferences = [], enumerationResp = [], userPrefIds = [] as any + try { resp = await getNotificationEnumIds(process.env.VUE_APP_NOTIF_ENUM_TYPE_ID) enumerationResp = resp.docs @@ -300,7 +299,7 @@ const actions: ActionTree = { // data and getNotificationUserPrefTypeIds fails or returns empty response (all disbaled) if (enumerationResp.length) { notificationPreferences = enumerationResp.reduce((notifactionPref: any, pref: any) => { - const userPrefTypeIdToSearch = generateTopicName(facilityId, pref.enumId) + const userPrefTypeIdToSearch = generateTopicName(getCurrentFacilityId(), pref.enumId) notifactionPref.push({ ...pref, isEnabled: userPrefIds.includes(userPrefTypeIdToSearch) }) return notifactionPref }, []) From f597993fb880227af8dba14eb0abc556d361a121 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 18 Nov 2024 18:37:45 +0530 Subject: [PATCH 6/8] Improved: added getCurrentFacilityId in login action to get current facility(#dxp/288) --- src/store/modules/user/actions.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index f50082f16..127f07e11 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -81,8 +81,7 @@ const actions: ActionTree = { return uniqueFacilities }, []); // TODO Use a separate API for getting facilities, this should handle user like admin accessing the app - const currentFacility: any = useUserStore().getCurrentFacility - const currentEComStore = await UserService.getCurrentEComStore(token, currentFacility?.facilityId); + const currentEComStore = await UserService.getCurrentEComStore(token, getCurrentFacilityId()); /* ---- Guard clauses ends here --- */ From 0164d854f290b5e06c68cf4e5929454725852904 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 18 Nov 2024 20:34:07 +0530 Subject: [PATCH 7/8] Reverted: removed the unnecessary added getter from OrderDetail page(#dxp-288)) --- src/views/OrderDetail.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 8f2b7f006..8a19f554c 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -312,7 +312,6 @@ export default defineComponent({ computed: { ...mapGetters({ order: "order/getCurrent", - configurePicker: "user/configurePicker", partialOrderRejectionConfig: 'user/getPartialOrderRejectionConfig', getPaymentMethodDesc: 'util/getPaymentMethodDesc', getStatusDesc: 'util/getStatusDesc', From de7b298461007ddcaea209d8414037aca99e451a Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Tue, 19 Nov 2024 10:04:41 +0530 Subject: [PATCH 8/8] Reverted: removed the unnecessary added getter from Orders page(#dxp-288)) --- src/views/Orders.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/views/Orders.vue b/src/views/Orders.vue index cc2bf3c13..99c34ce84 100644 --- a/src/views/Orders.vue +++ b/src/views/Orders.vue @@ -252,7 +252,6 @@ export default defineComponent({ orders: 'order/getOpenOrders', packedOrders: 'order/getPackedOrders', completedOrders: 'order/getCompletedOrders', - configurePicker: "user/configurePicker", isPackedOrdersScrollable: 'order/isPackedOrdersScrollable', isOpenOrdersScrollable: 'order/isOpenOrdersScrollable', isCompletedOrdersScrollable: 'order/isCompletedOrdersScrollable',