Skip to content

Commit

Permalink
Merge pull request #425 from R-Sourabh/facility-selector-card
Browse files Browse the repository at this point in the history
Implemented: Added the support for using facility selector from dxp-component(#dxp/288)
  • Loading branch information
ravilodhi authored Nov 19, 2024
2 parents e2aace0 + de7b298 commit 6f452f5
Show file tree
Hide file tree
Showing 25 changed files with 115 additions and 111 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 6 additions & 2 deletions src/adapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
fetchGoodIdentificationTypes,
getProductIdentificationPref,
getUserFacilities,
getUserPreference,
hasError,
initialise,
logout,
Expand All @@ -20,7 +21,8 @@ import {
updateInstanceUrl,
updateToken,
getAvailableTimeZones,
setUserTimeZone
setUserTimeZone,
setUserPreference
} from '@hotwax/oms-api'

export {
Expand All @@ -32,6 +34,7 @@ export {
fetchGoodIdentificationTypes,
getProductIdentificationPref,
getUserFacilities,
getUserPreference,
hasError,
initialise,
logout,
Expand All @@ -45,5 +48,6 @@ export {
updateInstanceUrl,
updateToken,
getAvailableTimeZones,
setUserTimeZone
setUserTimeZone,
setUserPreference
}
1 change: 0 additions & 1 deletion src/components/InventoryDetailsPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export default defineComponent({
product: "product/getCurrent",
getProductStock: 'stock/getProductStock',
getInventoryInformation: 'stock/getInventoryInformation',
currentFacility: 'user/getCurrentFacility',
})
},
async beforeMount () {
Expand Down
10 changes: 6 additions & 4 deletions src/components/NotificationPreferenceModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -82,7 +82,6 @@ export default defineComponent({
},
computed: {
...mapGetters({
currentFacility: 'user/getCurrentFacility',
instanceUrl: 'user/getInstanceUrl',
notificationPrefs: 'user/getNotificationPrefs'
}),
Expand Down Expand Up @@ -138,7 +137,7 @@ export default defineComponent({
}
},
async handleTopicSubscription() {
const facilityId = (this.currentFacility as any).facilityId
const facilityId = this.currentFacility?.facilityId
const subscribeRequests = [] as any
this.notificationPrefToUpdate.subscribe.map(async (enumId: string) => {
const topicName = generateTopicName(facilityId, enumId)
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/components/ProductListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export default defineComponent({
getProduct: 'product/getProduct',
product: "product/getCurrent",
getProductStock: 'stock/getProductStock',
currentFacility: 'user/getCurrentFacility',
})
},
methods: {
Expand Down
6 changes: 6 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"Failed to print shipping label and packing slip": "Failed to print shipping label and packing slip",
"Failed to update product store setting.": "Failed to update product store setting.",
"Fetching pickers": "Fetching pickers",
"Fetching facilities": "Fetching facilities",
"First name": "First name",
"Generate packing slips": "Generate packing slips",
"Generate shipping documents": "Generate shipping documents",
Expand Down Expand Up @@ -75,6 +76,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",
Expand Down Expand Up @@ -131,6 +133,7 @@
"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",
"Print picklists": "Print picklists",
"Primary": "Primary",
"Product details": "Product details",
"Product not found": "Product not found",
"Products not found": "Products not found",
Expand All @@ -153,7 +156,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",
Expand Down
6 changes: 6 additions & 0 deletions src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"Failed to print shipping label and packing slip": "Error al imprimir la etiqueta de envío y la hoja de embalaje",
"Failed to update product store setting.": "Failed to update product store setting.",
"Fetching pickers": "Fetching pickers",
"Fetching facilities": "Fetching facilities",
"First name": "Nombre",
"Generate packing slips": "Generar documentos de embalaje",
"Generate shipping documents": "Generar documentos de envío",
Expand Down Expand Up @@ -72,6 +73,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",
Expand Down Expand Up @@ -128,6 +130,7 @@
"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",
"Print picklists": "Print picklists",
"Primary": "Primary",
"Product details": "Detalles del producto",
"Product not found": "Producto no encontrado",
"Products not found": "Productos no encontrados",
Expand All @@ -150,7 +153,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",
Expand Down
6 changes: 6 additions & 0 deletions src/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"Failed to print shipping label and packing slip": "出荷ラベルと納品書の印刷に失敗しました。",
"Failed to update product store setting.":"Failed to update product store setting.",
"Fetching pickers": "Fetching pickers",
"Fetching facilities": "Fetching facilities",
"First name": "",
"Generate packing slips": "内容明細票の作成",
"Generate shipping documents": "出荷書類を生成する",
Expand Down Expand Up @@ -72,6 +73,7 @@
"Mismatch": "不一致",
"More": "もっと見る",
"New notification received.": "新しい通知を受信しました。",
"No facilities found": "No facilities found",
"No items found": "アイテムが見つかりませんでした",
"No inventory details found": "在庫の詳細が見つかりません",
"No products found": "商品が見つかりません",
Expand Down Expand Up @@ -127,6 +129,7 @@
"Pickers successfully replaced in the picklist with the new selections.": "ピッカーは新しい選択によりピックリストで正常に置き換えられました。",
"pieces in stock": "在庫あり",
"Print picklists": "Print picklists",
"Primary": "Primary",
"Product details": "商品詳細",
"Product not found": "商品が見つかりません",
"Products not found": "商品が見つかりません",
Expand All @@ -149,6 +152,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": "別のタイムゾーンを選択",
Expand Down
7 changes: 5 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, fetchGoodIdentificationTypes, getProductIdentificationPref, initialise, setProductIdentificationPref, setUserLocale, getAvailableTimeZones, setUserTimeZone } from '@/adapter';
import { getConfig, fetchGoodIdentificationTypes, getProductIdentificationPref, getUserFacilities, getUserPreference, initialise, setProductIdentificationPref, setUserLocale, getAvailableTimeZones, setUserTimeZone, setUserPreference } from '@/adapter';
import logger from './logger';

const app = createApp(App)
Expand Down Expand Up @@ -73,7 +73,10 @@ const app = createApp(App)
storeClientRegistrationToken,
getAvailableTimeZones,
hasPermission,
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
Expand Down
9 changes: 5 additions & 4 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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 } from "@hotwax/dxp-components";
import emitter from '@/event-bus'
Expand All @@ -12,6 +12,7 @@ import { prepareOrderQuery } from "@/utils/solrHelper";
import { getOrderCategory } from "@/utils/order";
import logger from "@/logger";


const actions: ActionTree<OrderState , RootState> ={

async getOrderDetails({ dispatch, commit }, payload ) {
Expand Down Expand Up @@ -700,7 +701,7 @@ const actions: ActionTree<OrderState , RootState> ={
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,
Expand Down Expand Up @@ -786,7 +787,7 @@ const actions: ActionTree<OrderState , RootState> ={
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,
Expand Down Expand Up @@ -872,7 +873,7 @@ const actions: ActionTree<OrderState , RootState> ={
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,
Expand Down
12 changes: 7 additions & 5 deletions src/store/modules/stock/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ import RootState from '@/store/RootState'
import StockState from './StockState'
import * as types from './mutation-types'
import { hasError } from '@/adapter'
import { showToast } from '@/utils'
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 actions: ActionTree<StockState, RootState> = {
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;
}
Expand All @@ -31,7 +33,7 @@ const actions: ActionTree<StockState, RootState> = {
},

async fetchInventoryCount({ commit, state }, { productId }) {
const facilityId = this.state.user.currentFacility.facilityId;
const facilityId = getCurrentFacilityId();
if (state.inventoryInformation[productId] && state.inventoryInformation[productId][facilityId]) {
return;
}
Expand Down Expand Up @@ -60,7 +62,7 @@ const actions: ActionTree<StockState, RootState> = {
},

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;
}
Expand Down
7 changes: 4 additions & 3 deletions src/store/modules/stock/getters.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { GetterTree } from 'vuex'
import StockState from './StockState'
import RootState from '../../RootState'
import store from '@/store'
import { getCurrentFacilityId } from '@/utils'


const getters: GetterTree <StockState, RootState> = {
getProductStock: (state, RootState) => (productId: any) => {

Check warning on line 8 in src/store/modules/stock/getters.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'RootState' is defined but never used

Check warning on line 8 in src/store/modules/stock/getters.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / build_and_deploy

'RootState' is defined but never used

Check warning on line 8 in src/store/modules/stock/getters.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'RootState' is defined but never used
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] : {} : {};
}
}
Expand Down
1 change: 0 additions & 1 deletion src/store/modules/user/UserState.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export default interface UserState {
token: string;
current: any;
currentFacility: object;
instanceUrl: string;
permissions: any;
currentEComStore: any;
Expand Down
Loading

0 comments on commit 6f452f5

Please sign in to comment.