diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index be27c1e8..85475250 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -547,7 +547,6 @@ const actions: ActionTree = { groupBy: 'shipGroupSeqId', filters: { '-shipGroupSeqId': { value: order.items[0].shipGroupSeqId }, - '-shipmentMethodTypeId': { value: 'STOREPICKUP' }, orderId: { value: order.orderId } }, docType: 'ORDER' @@ -603,7 +602,6 @@ const actions: ActionTree = { groupBy: 'shipGroupSeqId', filters: { 'shipGroupSeqId': { value: shipGroupSeqIds }, - '-shipmentMethodTypeId': { value: 'STOREPICKUP' }, '-fulfillmentStatus': { value: ['Rejected', 'Cancelled'] }, orderId: { value: orderId } } diff --git a/src/store/modules/stock/actions.ts b/src/store/modules/stock/actions.ts index 50f9f056..86b88889 100644 --- a/src/store/modules/stock/actions.ts +++ b/src/store/modules/stock/actions.ts @@ -9,18 +9,19 @@ import { showToast } from '@/utils' import { translate } from '@hotwax/dxp-components' const actions: ActionTree = { - async fetchStock({ commit }, { productId }) { + async fetchStock({ commit }, { productId, facilityId = '' }) { + const id = facilityId ? facilityId : this.state.user.currentFacility.facilityId try { const payload = { productId, - facilityId: this.state.user.currentFacility.facilityId + facilityId: id } const resp: any = await StockService.getInventoryAvailableByFacility(payload); if (!hasError(resp)) { - commit(types.STOCK_ADD_PRODUCT, { productId: payload.productId, stock: resp.data }) + commit(types.STOCK_ADD_PRODUCT, { productId: payload.productId, facilityId: id, stock: resp.data }) } else { throw resp.data; } diff --git a/src/store/modules/stock/getters.ts b/src/store/modules/stock/getters.ts index 3d9b2013..491b222d 100644 --- a/src/store/modules/stock/getters.ts +++ b/src/store/modules/stock/getters.ts @@ -3,8 +3,10 @@ import StockState from './StockState' import RootState from '../../RootState' const getters: GetterTree = { - getProductStock: (state) => (productId: string) => { - return state.products[productId] ? state.products[productId] : {} + getProductStock: (state, getters, RootState) => (productId: any, facilityId?: any) => { + const id = facilityId ? facilityId : RootState.user.currentFacility.facilityId + + return state.products[productId] ? state.products[productId][id] ? state.products[productId][id] : {} : {} } } export default getters; \ No newline at end of file diff --git a/src/store/modules/stock/mutations.ts b/src/store/modules/stock/mutations.ts index 44c19ef2..cc2f3329 100644 --- a/src/store/modules/stock/mutations.ts +++ b/src/store/modules/stock/mutations.ts @@ -4,7 +4,13 @@ import * as types from './mutation-types' const mutations: MutationTree = { [types.STOCK_ADD_PRODUCT] (state, payload) { - state.products[payload.productId] = payload.stock + if(state.products[payload.productId]) { + state.products[payload.productId][payload.facilityId] = payload.stock + } else { + state.products[payload.productId] = { + [payload.facilityId]: payload.stock + } + } } } export default mutations; \ No newline at end of file diff --git a/src/views/OrderDetail.vue b/src/views/OrderDetail.vue index 4bd630c8..0436dcc1 100644 --- a/src/views/OrderDetail.vue +++ b/src/views/OrderDetail.vue @@ -189,10 +189,10 @@

{{ getProduct(item.productId).sku }}

{{ getProduct(item.productId).parentProductName }} - + @@ -373,8 +373,8 @@ export default defineComponent({ }); return popover.present(); }, - fetchProductStock(productId: string) { - this.store.dispatch('stock/fetchStock', { productId }) + fetchProductStock(productId: string, facilityId = '') { + this.store.dispatch('stock/fetchStock', { productId, facilityId }) }, async packOrder(order: any) { const confirmPackOrder = await alertController