From 02f00ed0e230a47210c31f82c9acc07b864bb69a Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Fri, 10 May 2024 11:30:06 +0530 Subject: [PATCH 01/37] Updated: added searchbar functionality on the otherInventoryModal(#386) --- src/views/OtherStoresInventoryModal.vue | 26 +++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/views/OtherStoresInventoryModal.vue b/src/views/OtherStoresInventoryModal.vue index 56a97f608..7c96536e0 100644 --- a/src/views/OtherStoresInventoryModal.vue +++ b/src/views/OtherStoresInventoryModal.vue @@ -10,9 +10,9 @@ - - - + + + {{ details.facilityName }} {{ details.stock }} @@ -36,7 +36,8 @@ import { IonNote, IonTitle, IonToolbar, - modalController } from "@ionic/vue"; + modalController +} from "@ionic/vue"; import { defineComponent } from "vue"; import { close } from "ionicons/icons"; import { useStore } from "@/store"; @@ -58,9 +59,26 @@ export default defineComponent({ IonToolbar }, props: ["otherStoresInventory"], + data() { + return{ + queryString: "", + filteredInventory: [] as any + } + }, + mounted() { + this.filteredInventory = this.otherStoresInventory.slice(); + }, methods: { closeModal() { modalController.dismiss({ dismissed: true }); + }, + searchFacilities(){ + if (this.queryString !== "") { + this.filteredInventory = this.otherStoresInventory.filter((facility: any) => + facility.facilityName.toLowerCase().includes(this.queryString.toLowerCase())); + } else { + this.filteredInventory = this.otherStoresInventory.slice(); + } } }, setup() { From bcc09ee77cbaf8d04b203b619d719c1d7b23da1b Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 13 May 2024 13:00:38 +0530 Subject: [PATCH 02/37] Implemented: API for fetcting the minimumStock & lastInventoryCount(#386) --- src/services/StockService.ts | 13 ++++++++++-- src/store/modules/stock/StockState.ts | 1 + src/store/modules/stock/actions.ts | 24 +++++++++++++++++++++++ src/store/modules/stock/getters.ts | 3 +++ src/store/modules/stock/index.ts | 3 ++- src/store/modules/stock/mutation-types.ts | 3 ++- src/store/modules/stock/mutations.ts | 10 ++++++++++ src/views/ProductDetail.vue | 15 +++++++++----- 8 files changed, 63 insertions(+), 9 deletions(-) diff --git a/src/services/StockService.ts b/src/services/StockService.ts index 8941484ac..e22be78fd 100644 --- a/src/services/StockService.ts +++ b/src/services/StockService.ts @@ -1,4 +1,4 @@ -import { api } from '@/adapter'; +import { api, hasError } from '@/adapter'; const checkInventory = async (query: any): Promise => { return api({ @@ -16,7 +16,16 @@ const getInventoryAvailableByFacility = async (query: any): Promise => { }); } +const getInventoryComputation = async (payload: any ): Promise => { + return api({ + url: 'performFind', + method: 'post', + data: payload + }); +} + export const StockService = { checkInventory, - getInventoryAvailableByFacility + getInventoryAvailableByFacility, + getInventoryComputation } \ No newline at end of file diff --git a/src/store/modules/stock/StockState.ts b/src/store/modules/stock/StockState.ts index 128855bc6..80416cb19 100644 --- a/src/store/modules/stock/StockState.ts +++ b/src/store/modules/stock/StockState.ts @@ -1,3 +1,4 @@ export default interface StockState { products: any; + count: any; } \ No newline at end of file diff --git a/src/store/modules/stock/actions.ts b/src/store/modules/stock/actions.ts index b8d36d70d..605a20634 100644 --- a/src/store/modules/stock/actions.ts +++ b/src/store/modules/stock/actions.ts @@ -26,6 +26,30 @@ const actions: ActionTree = { logger.error(err) showToast(translate('No data available!')) } + }, + + async fetchInvCount({ commit }, { productId }) { + try { + + const params = { + "entityName": "ProductFacility", + "inputFields": { + productId, + "facilityId": this.state.user.currentFacility.facilityId + }, + "fieldList": ["minimumStock", "lastInventoryCount"], + "viewSize": 1 + } as any + + const resp: any = await StockService.getInventoryComputation(params); + if(!hasError(resp)) { + commit(types.INVENTORY_COMPUTATIONS, { productId: productId, facilityId: this.state.user.currentFacility.facilityId, minimumStock: resp.minimumStock, lastInventoryCount: resp.lastInventoryCount}) + } + } + catch (err) { + logger.error(err) + showToast(translate('No data available!')) + } } } export default actions; \ No newline at end of file diff --git a/src/store/modules/stock/getters.ts b/src/store/modules/stock/getters.ts index 59ebd8f02..77f3b2332 100644 --- a/src/store/modules/stock/getters.ts +++ b/src/store/modules/stock/getters.ts @@ -7,6 +7,9 @@ const getters: GetterTree = { getProductStock: (state, RootState) => (productId: any) => { const facilityId = store.state.user?.currentFacility?.facilityId return state.products[productId] ? state.products[productId][facilityId] ? state.products[productId][facilityId] : {} : {} + }, + getInventoryCount: (state) => { + return state.count; } } export default getters; \ No newline at end of file diff --git a/src/store/modules/stock/index.ts b/src/store/modules/stock/index.ts index a4bbc14b8..1e1a4c252 100644 --- a/src/store/modules/stock/index.ts +++ b/src/store/modules/stock/index.ts @@ -8,7 +8,8 @@ import RootState from '../../RootState' const stockModule: Module = { namespaced: true, state: { - products: {} + products: {}, + count: {}, }, getters, actions, diff --git a/src/store/modules/stock/mutation-types.ts b/src/store/modules/stock/mutation-types.ts index 3937ac90e..7bd23a022 100644 --- a/src/store/modules/stock/mutation-types.ts +++ b/src/store/modules/stock/mutation-types.ts @@ -1,2 +1,3 @@ export const SN_STOCK = 'stock' -export const STOCK_ADD_PRODUCT = SN_STOCK + '/ADD_PRODUCT' \ No newline at end of file +export const STOCK_ADD_PRODUCT = SN_STOCK + '/ADD_PRODUCT' +export const INVENTORY_COMPUTATIONS = SN_STOCK + '/INVENTORY_COMPUTATIONS' \ No newline at end of file diff --git a/src/store/modules/stock/mutations.ts b/src/store/modules/stock/mutations.ts index cc2f3329d..5ab73c122 100644 --- a/src/store/modules/stock/mutations.ts +++ b/src/store/modules/stock/mutations.ts @@ -11,6 +11,16 @@ const mutations: MutationTree = { [payload.facilityId]: payload.stock } } + }, + [types.INVENTORY_COMPUTATIONS] (state, { productId, facilityId, minimumStock, lastInventoryCount }) { + if (!state.count[productId]) { + state.count[productId] = {}; + } + + state.count[productId][facilityId] = { + minimumStock, + lastInventoryCount + }; } } export default mutations; \ No newline at end of file diff --git a/src/views/ProductDetail.vue b/src/views/ProductDetail.vue index 24870c04c..301920588 100644 --- a/src/views/ProductDetail.vue +++ b/src/views/ProductDetail.vue @@ -60,7 +60,7 @@ Quantity on hand - 10 + {{ getProductStock(product)?.quantityOnHandTotal ?? '0' }} Safety Stock @@ -72,18 +72,18 @@ Available to promise - 70 + {{ }} Other Stores - 100 ATP + {{ otherStoresInventory }} Warehouse - 100 ATP + {{ warehouseInventory }} @@ -228,11 +228,15 @@ export default defineComponent({ ...mapGetters({ product: "product/getCurrent", currentFacility: 'user/getCurrentFacility', - currency: 'user/getCurrency' + currency: 'user/getCurrency', + getProductStock: 'stock/getProductStock', + getInventoryCount: 'stock/getInventoryCount', }) }, async beforeMount() { await this.store.dispatch('product/setCurrent', { productId: this.$route.params.productId }) + await this.store.dispatch('stock/fetchStock', { productId: this.$route.params.productId }) + await this.store.dispatch('stock/fetchInvCount', { productId: this.$route.params.productId }); if (this.product.variants) { this.getFeatures() await this.updateVariant() @@ -245,6 +249,7 @@ export default defineComponent({ await this.updateVariant(); }, getFeatures() { + console.log(this.getInventoryCount); const features = {} as any this.product.variants.map((variant: any) => { const size = getFeature(variant.featureHierarchy, '1/SIZE/'); From b2f2a07ad95084c05ba7cc2bcd4dd09e25ae723f Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 15 May 2024 19:20:51 +0530 Subject: [PATCH 03/37] Implemneted: Functional UI to Display Inventory Computation for Order Items(#386) --- src/components/InventoryDetailsPopover.vue | 58 ++++++-- src/components/ProductListItem.vue | 38 ++++-- src/services/UtilService.ts | 11 +- src/store/modules/order/OrderState.ts | 3 +- src/store/modules/order/actions.ts | 103 ++++++++++++++ src/store/modules/order/getters.ts | 3 + src/store/modules/order/index.ts | 1 + src/store/modules/order/mutation-types.ts | 1 + src/store/modules/order/mutations.ts | 5 +- src/store/modules/stock/actions.ts | 4 +- src/store/modules/stock/mutations.ts | 4 +- src/utils/order.ts | 58 ++++++++ src/utils/solrHelper.ts | 18 +++ src/views/ProductDetail.vue | 151 ++++++++++++--------- 14 files changed, 366 insertions(+), 92 deletions(-) create mode 100644 src/utils/order.ts diff --git a/src/components/InventoryDetailsPopover.vue b/src/components/InventoryDetailsPopover.vue index df5de9fd0..438f0e36f 100644 --- a/src/components/InventoryDetailsPopover.vue +++ b/src/components/InventoryDetailsPopover.vue @@ -4,19 +4,19 @@ Inventory computation Quantity on hands - 52 + {{ getProductStock(item.productId)?.quantityOnHandTotal ?? '0' }} Safety stock - 4 + {{ minimumStock }} Order reservation - 1 + {{ reservedQuantity ?? '0' }} Online ATP - 52 + {{ onlineAtp }} @@ -37,9 +37,13 @@ import { } from '@ionic/vue' import { defineComponent } from 'vue'; -import { useStore } from 'vuex' +import { useStore, mapGetters } from 'vuex'; +import { prepareOrderQuery } from '@/utils/solrHelper'; +import { UtilService } from '@/services/UtilService'; +import { hasError } from '@/adapter'; +import logger from "@/logger"; - export default defineComponent({ + export default defineComponent({ name: 'InventoryDetailsPopover', component:{ IonHeader, @@ -53,17 +57,47 @@ import { useStore } from 'vuex' IonBadge, IonList, }, - props: { - }, + props: ['minimumStock', 'onlineAtp', 'item'], data () { - return { - - } + return { + reservedQuantity: '' + } }, computed: { - + ...mapGetters({ + product: "product/getCurrent", + getProductStock: 'stock/getProductStock', + currentFacility: 'user/getCurrentFacility', + }) + }, + async beforeMount () { + await this.store.dispatch('stock/fetchStock', { productId: this.item.productId }) + this.fetchReservedQuantity( this.item.productId ); }, methods: { + async fetchReservedQuantity(productId: any){ + const payload = prepareOrderQuery({ + viewSize: "0", // passing viewSize as 0, as we don't want to fetch any data + defType: "edismax", + filters: { + facilityId: this.currentFacility.facilityId, + productId: productId + }, + facet: { + "reservedQuantityFacet": "sum(itemQuantity)" + } + }) + try { + const resp = await UtilService.fetchReservedQuantity(payload) + if(resp.status == 200 && !hasError(resp)) { + this.reservedQuantity = resp.data.facets.reservedQuantityFacet + } else { + throw resp.data + } + } catch(err) { + logger.error('Failed to fetch reserved quantity', err) + } + }, }, setup () { diff --git a/src/components/ProductListItem.vue b/src/components/ProductListItem.vue index 1f2d6ca31..a63305989 100644 --- a/src/components/ProductListItem.vue +++ b/src/components/ProductListItem.vue @@ -15,7 +15,7 @@
- 50 ATP + {{ getOnlineAtp() }} @@ -52,20 +52,35 @@ export default defineComponent({ showInfoIcon: false } }, - props: { - item: Object, - isShipToStoreOrder: { - type: Boolean, - default: false - } - }, + props: ['item', 'isShipToStoreOrder'], computed: { ...mapGetters({ getProduct: 'product/getProduct', - getProductStock: 'stock/getProductStock' + product: "product/getCurrent", + getInventoryCount: 'stock/getInventoryCount', + currentFacility: 'user/getCurrentFacility', }) }, + async beforeMount () { + await this.store.dispatch('stock/fetchInvCount', { productId: this.item.productId }); + }, methods: { + getMinimumStock() { + const inventoryCount = this.getInventoryCount; + const productId = this.item.productId; + if (inventoryCount && inventoryCount[productId]) { + return inventoryCount[productId][this.currentFacility.facilityId]?.minimumStock ?? 0; + } + return 0; + }, + getOnlineAtp() { + const inventoryCount = this.getInventoryCount; + const productId = this.item.productId; + if (inventoryCount && inventoryCount[productId]) { + return inventoryCount[productId][this.currentFacility.facilityId]?.onlineAtp ?? 0; + } + return 0; + }, async fetchProductStock(productId: string) { this.isFetchingStock = true await this.store.dispatch('stock/fetchStock', { productId }) @@ -73,13 +88,14 @@ export default defineComponent({ this.showInfoIcon = true; }, async getInventoryComputationDetails(Event: any){ + const minimumStock = this.getMinimumStock(); + const onlineAtp = this.getOnlineAtp(); const popover = await popoverController.create({ component: InventoryDetailsPopover, event: Event, - // componentProps: { otherStoresInventory: this.otherStoresInventoryDetails } + componentProps: { minimumStock, onlineAtp, item: this.item.productId } }); await popover.present(); - }, updateColor(stock: number) { return stock ? stock < 10 ? 'warning' : 'success' : 'danger'; diff --git a/src/services/UtilService.ts b/src/services/UtilService.ts index 079f86547..a80a263fe 100644 --- a/src/services/UtilService.ts +++ b/src/services/UtilService.ts @@ -33,9 +33,18 @@ const resetPicker = async (payload: any): Promise => { }) } +const fetchReservedQuantity = async (query: any): Promise => { + return api({ + url: "solr-query", + method: "post", + data: query + }); +} + export const UtilService = { fetchPaymentMethodTypeDesc, fetchRejectReasons, fetchStatusDesc, - resetPicker + resetPicker, + fetchReservedQuantity } \ No newline at end of file diff --git a/src/store/modules/order/OrderState.ts b/src/store/modules/order/OrderState.ts index 2c6e2b312..8afd2b465 100644 --- a/src/store/modules/order/OrderState.ts +++ b/src/store/modules/order/OrderState.ts @@ -4,5 +4,6 @@ export default interface OrderState { current: any; packed: any; completed: any; - shipToStore: any + shipToStore: any; + otherItem: any; } diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index 44a972658..d0eb282b6 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -10,8 +10,111 @@ import emitter from '@/event-bus' import store from "@/store"; import { prepareOrderQuery } from "@/utils/solrHelper"; import logger from "@/logger"; +import { getOrderCategory } from "@/utils/order"; const actions: ActionTree ={ + + async getOrderDetails({commit}, payload ) { + // Show loader only when new query and not the infinite scroll + // if (payload.viewIndex === 0) emitter.emit("presentLoader"); + let resp; + const orderQueryPayload = prepareOrderQuery({ + ...payload, + orderStatusId: 'ORDER_APPROVED', + orderTypeId: 'SALES_ORDER', + '-fulfillmentStatus': '(Cancelled OR Rejected)', + }) + + try { + resp = await OrderService.getOpenOrders(orderQueryPayload); + if (resp.status === 200 && !hasError(resp) && resp.data.grouped?.orderId?.ngroups > 0) { + const orderIds = resp.data.grouped?.orderId?.groups.map((order: any) => order.doclist.docs[0].orderId); + const { productId, ...params } = payload; + this.dispatch('order/getOtherOrderItem', {...params, orderIds}); + emitter.emit("dismissLoader"); + } else { + showToast(translate("Orders Not Found")) + emitter.emit("dismissLoader"); + } + emitter.emit("dismissLoader"); + } catch(err) { + logger.error(err) + showToast(translate("Something went wrong")) + } + return resp; + }, + + async getOtherOrderItem({ commit }, payload) { + // Show loader only when new query and not the infinite scroll + // if (payload.viewIndex === 0) emitter.emit("presentLoader"); + let resp; + + const orderQueryPayload = prepareOrderQuery({ + ...payload, + orderStatusId: 'ORDER_APPROVED', + orderTypeId: 'SALES_ORDER', + }) + + try { + resp = await OrderService.getOpenOrders(orderQueryPayload); + if (resp.status === 200 && !hasError(resp) && resp.data.grouped?.orderId?.ngroups > 0) { + const orders = resp.data.grouped?.orderId?.groups.map((order: any) => { + const orderItem = order.doclist.docs[0] + return { + orderId: orderItem.orderId, + orderName: orderItem.orderName, + customer: { + partyId: orderItem.customerId, + name: orderItem.customerName + }, + category: getOrderCategory(orderItem), + parts: order.doclist.docs.reduce((arr: Array, item: any) => { + const currentOrderPart = arr.find((orderPart: any) => orderPart.orderPartSeqId === item.shipGroupSeqId) + if (!currentOrderPart) { + arr.push({ + orderPartSeqId: item.shipGroupSeqId, + items: [{ + shipGroupSeqId: item.shipGroupSeqId, + orderId: orderItem.orderId, + orderItemSeqId: item.orderItemSeqId, + quantity: item.itemQuantity, + brand: item.productStoreId, + virtualName: item.virtualProductName, + productId: item.productId, + }] + }) + } else { + currentOrderPart.items.push({ + shipGroupSeqId: item.shipGroupSeqId, + orderId: orderItem.orderId, + orderItemSeqId: item.orderItemSeqId, + quantity: item.itemQuantity, + brand: item.productStoreId, + virtualName: item.virtualProductName, + productId: item.productId, + }) + } + return arr + }, []), + } + }) + // const total = resp.data.grouped?.orderId?.ngroups; + // if(payload.viewIndex && payletload.viewIndex > 0) orders = state.open.list.concat(orders) + commit(types.OTHER_ITEM_UPDATED, { orders }) + emitter.emit("dismissLoader"); + } else { + commit(types.OTHER_ITEM_UPDATED, { orders: {} }) + showToast(translate("Orders Not Found")) + } + emitter.emit("dismissLoader"); + } + catch(err) { + logger.error(err) + showToast(translate("Something went wrong")) + } + return resp; + }, + async getOpenOrders({ commit, state }, payload) { // Show loader only when new query and not the infinite scroll if (payload.viewIndex === 0) emitter.emit("presentLoader"); diff --git a/src/store/modules/order/getters.ts b/src/store/modules/order/getters.ts index 290265522..45bc223de 100644 --- a/src/store/modules/order/getters.ts +++ b/src/store/modules/order/getters.ts @@ -3,6 +3,9 @@ import OrderState from "./OrderState" import RootState from "../../RootState"; const getters: GetterTree = { + getOtherItem: (state) => { + return state.otherItem; + }, getOpenOrders: (state) => { return state.open.list; }, diff --git a/src/store/modules/order/index.ts b/src/store/modules/order/index.ts index 44d9a6e6e..1f161e0ce 100644 --- a/src/store/modules/order/index.ts +++ b/src/store/modules/order/index.ts @@ -15,6 +15,7 @@ const orderModule: Module = { list: {}, total: 0 }, + otherItem:{}, packed: { list: {}, total: 0 diff --git a/src/store/modules/order/mutation-types.ts b/src/store/modules/order/mutation-types.ts index 862b8047e..c8fb23f4a 100644 --- a/src/store/modules/order/mutation-types.ts +++ b/src/store/modules/order/mutation-types.ts @@ -1,6 +1,7 @@ export const SN_ORDER = 'order' export const ORDER_CURRENT_UPDATED = SN_ORDER + '/CURRENT_UPDATED' export const ORDER_OPEN_UPDATED = SN_ORDER + '/OPEN_UPDATED' +export const OTHER_ITEM_UPDATED = SN_ORDER + '/OTHER_ITEM_UPDATED' export const ORDER_PACKED_UPDATED = SN_ORDER + '/PACKED_UPDATED' export const ORDER_COMPLETED_UPDATED = SN_ORDER + '/COMPLETED_UPDATED' export const ORDER_SHIP_TO_STORE_INCOMING_UPDATED = SN_ORDER + '/SHIP_TO_STORE_INCOMING_UPDATED' diff --git a/src/store/modules/order/mutations.ts b/src/store/modules/order/mutations.ts index 6d0780814..fe61bd7c1 100644 --- a/src/store/modules/order/mutations.ts +++ b/src/store/modules/order/mutations.ts @@ -3,6 +3,9 @@ import ProductState from './OrderState' import * as types from './mutation-types' const mutations: MutationTree = { + [types.OTHER_ITEM_UPDATED] (state, payload){ + state.otherItem = payload.orders + }, [types.ORDER_OPEN_UPDATED] (state , payload ) { state.open.list = payload.orders state.open.total = payload.total @@ -35,4 +38,4 @@ const mutations: MutationTree = { } } -export default mutations; \ No newline at end of file +export default mutations; diff --git a/src/store/modules/stock/actions.ts b/src/store/modules/stock/actions.ts index 605a20634..67eb6017f 100644 --- a/src/store/modules/stock/actions.ts +++ b/src/store/modules/stock/actions.ts @@ -37,13 +37,13 @@ const actions: ActionTree = { productId, "facilityId": this.state.user.currentFacility.facilityId }, - "fieldList": ["minimumStock", "lastInventoryCount"], + "fieldList": ["minimumStock", "computedLastInventoryCount"], "viewSize": 1 } as any const resp: any = await StockService.getInventoryComputation(params); if(!hasError(resp)) { - commit(types.INVENTORY_COMPUTATIONS, { productId: productId, facilityId: this.state.user.currentFacility.facilityId, minimumStock: resp.minimumStock, lastInventoryCount: resp.lastInventoryCount}) + commit(types.INVENTORY_COMPUTATIONS, { productId: productId, facilityId: this.state.user.currentFacility.facilityId, minimumStock: resp.data.docs[0].minimumStock, onlineAtp: resp.data.docs[0].computedLastInventoryCount}) } } catch (err) { diff --git a/src/store/modules/stock/mutations.ts b/src/store/modules/stock/mutations.ts index 5ab73c122..aaa42f457 100644 --- a/src/store/modules/stock/mutations.ts +++ b/src/store/modules/stock/mutations.ts @@ -12,14 +12,14 @@ const mutations: MutationTree = { } } }, - [types.INVENTORY_COMPUTATIONS] (state, { productId, facilityId, minimumStock, lastInventoryCount }) { + [types.INVENTORY_COMPUTATIONS] (state, { productId, facilityId, minimumStock, onlineAtp }) { if (!state.count[productId]) { state.count[productId] = {}; } state.count[productId][facilityId] = { minimumStock, - lastInventoryCount + onlineAtp }; } } diff --git a/src/utils/order.ts b/src/utils/order.ts new file mode 100644 index 000000000..39d588cba --- /dev/null +++ b/src/utils/order.ts @@ -0,0 +1,58 @@ +const orderCategoryParameters = { + 'Open': { + 'orderStatusId': { + 'value': 'ORDER_APPROVED' + }, + 'orderTypeId': { + 'value': 'SALES_ORDER' + }, + 'isPicked': { + 'value': 'N' + } + }, + 'In Progress': { + 'picklistItemStatusId': { + 'value': 'PICKITEM_PENDING', + }, + }, + 'Packed': { + // Array to denote ORing + 'shipmentStatusId': { + 'value': 'SHIPMENT_SHIPPED' + } + } +} + +const handleParameterMatching = (orderVal: any, parameterVal: any, operation?: string) => { + // considering params will always be an Array for ORing and ANDing + if (operation === 'OR') { + return parameterVal.some((param: any) => orderVal === param) + } else if (operation === 'AND') { + return parameterVal.every((param: any) => orderVal === param) + } else if (operation === 'NOT') { + return orderVal !== parameterVal + } else if (!operation) { + return orderVal === parameterVal + } + } + +const getOrderCategory = (order: any) => { + const orderCategoryParameterEntries = Object.entries(orderCategoryParameters) + let result = '' + // using find, as once any of the category is matched then return from here; + orderCategoryParameterEntries.find((entry: any) => { + const [category, parameters] = entry + const paramKeys = Object.keys(parameters) + // used every as to check against each filtering property + const isMatched = paramKeys.every((key: string) => Object.prototype.hasOwnProperty.call(order, key) && handleParameterMatching(order[key], parameters[key].value, parameters[key]['OP'])) + // return the value when all params matched for an order + if (isMatched) { + result = category; + return result; + } + }) + return result; +} + +export { getOrderCategory } + diff --git a/src/utils/solrHelper.ts b/src/utils/solrHelper.ts index eb5970ad3..3686292c2 100644 --- a/src/utils/solrHelper.ts +++ b/src/utils/solrHelper.ts @@ -53,6 +53,24 @@ const prepareOrderQuery = (params: any) => { payload.json.filter.push(`facilityId: ${params.facilityId}`) } + if (params.productId) { + payload.json.filter.push(`productId: ${params.productId}`) + } + + if (params.filters) { + Object.keys(params.filters).forEach((key) => { + payload.json.filter.push(`${key}: ${params.filters[key]}`); + }); + } + + if(params.orderIds){ + payload.json.filter.push(`orderId: (${params.orderIds.join(' OR ')})`) + } + + if(params.facet) { + payload.json['facet'] = params.facet + } + if (params.orderPartSeqId) { payload.json.filter.push(`shipGroupSeqId: ${params.orderPartSeqId}`) } diff --git a/src/views/ProductDetail.vue b/src/views/ProductDetail.vue index 301920588..bd542c047 100644 --- a/src/views/ProductDetail.vue +++ b/src/views/ProductDetail.vue @@ -60,19 +60,19 @@ Quantity on hand - {{ getProductStock(product)?.quantityOnHandTotal ?? '0' }} + {{ getProductStock(product.variants[0].productId)?.quantityOnHandTotal ?? '0' }} Safety Stock - 10 + {{ getMinimumStock() }} Order Reservation - 20 + {{ reservedQuantity ?? '0' }} Available to promise - {{ }} + {{ getOnlineAtp() }} @@ -91,70 +91,42 @@
-

{count} order reservtion at the store

+

{{ reservedQuantity ?? '0' }} order reservtion at the store

- - - - Order ID -

Customer name

-
- Open -
- - - - - -

BRAND

-

Virtual name

-
- 2 units -
- - Order items - +
+ - - - - -

BRAND

-

Virtual name

+ {{ order.orderId }} +

{{ order.customer ? order.customer.name : '' }}

+ {{ order.category }}
-
- - - Order ID -

Customer name

-
- Packed -
- + - + - -

BRAND

-

Virtual name

+ +

{{ item.brand }}

+

{{ item.virtualName }}

- 2 units + {{ item.quantity }}
- + + Order items - + -

BRAND

-

Virtual name

+

{{ item.brand }}

+

{{ item.virtualName }}

+
@@ -190,6 +162,8 @@ import { sortSizes } from '@/apparel-sorter'; import OtherStoresInventoryModal from "./OtherStoresInventoryModal.vue"; import { DxpShopifyImg, getProductIdentificationValue, translate, useProductIdentificationStore } from "@hotwax/dxp-components"; import logger from "@/logger"; +import { prepareOrderQuery } from '@/utils/solrHelper'; +import { UtilService } from '@/services/UtilService'; export default defineComponent({ name: "ProductDetail", @@ -222,6 +196,8 @@ export default defineComponent({ warehouseInventory: 0, otherStoresInventoryDetails: [] as any, selectedSegment: 'inStore', + queryString: '', + reservedQuantity: '' } }, computed: { @@ -231,25 +207,80 @@ export default defineComponent({ currency: 'user/getCurrency', getProductStock: 'stock/getProductStock', getInventoryCount: 'stock/getInventoryCount', - }) + otherItem: 'order/getOtherItem', + getProduct: 'product/getProduct', + }), + getOrderItems() { + return (order: any) => order.parts[0].items.filter((item: any) => item.productId == this.product.variants[0].productId); + }, + getOtherItems() { + return (order: any) => order.parts[0].items.filter((item: any) => item.productId != this.product.variants[0].productId); + } }, async beforeMount() { await this.store.dispatch('product/setCurrent', { productId: this.$route.params.productId }) - await this.store.dispatch('stock/fetchStock', { productId: this.$route.params.productId }) - await this.store.dispatch('stock/fetchInvCount', { productId: this.$route.params.productId }); + await this.store.dispatch('stock/fetchStock', { productId: this.product.variants[0].productId }) + await this.store.dispatch('stock/fetchInvCount', { productId: this.product.variants[0].productId }); if (this.product.variants) { this.getFeatures() await this.updateVariant() } }, methods: { + getMinimumStock() { + const inventoryCount = this.getInventoryCount; + const productId = this.currentVariant.productId; + if (inventoryCount && inventoryCount[productId]) { + return inventoryCount[productId][this.currentFacility.facilityId]?.minimumStock ?? 0; + } + return 0; + }, + getOnlineAtp() { + const inventoryCount = this.getInventoryCount; + const productId = this.currentVariant.productId; + if (inventoryCount && inventoryCount[productId]) { + return inventoryCount[productId][this.currentFacility.facilityId]?.onlineAtp ?? 0; + } + return 0; + }, + + //For fetching the order reservation count. + async fetchReservedQuantity(productId: any){ + const payload = prepareOrderQuery({ + viewSize: "0", // passing viewSize as 0, as we don't want to fetch any data + defType: "edismax", + filters: { + facilityId: this.currentFacility.facilityId, + productId: productId + }, + facet: { + "reservedQuantityFacet": "sum(itemQuantity)" + } + }) + try { + const resp = await UtilService.fetchReservedQuantity(payload) + if(resp.status == 200 && !hasError(resp)) { + this.reservedQuantity = resp.data.facets.reservedQuantityFacet + } else { + throw resp.data + } + } catch(err) { + logger.error('Failed to fetch reserved quantity', err) + } + }, + + //For fetching all the orders for this product & facility. + async getOpenOrders (vSize?: any, vIndex?: any) { + const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; + const viewIndex = vIndex ? vIndex : 0; + await this.store.dispatch("order/getOrderDetails", { viewSize, viewIndex, facilityId: this.currentFacility.facilityId, productId: this.currentVariant.productId}); + }, async applyFeature(feature: string, type: string) { if(type === 'color') this.selectedColor = feature; else if(type === 'size') this.selectedSize = feature await this.updateVariant(); }, getFeatures() { - console.log(this.getInventoryCount); const features = {} as any this.product.variants.map((variant: any) => { const size = getFeature(variant.featureHierarchy, '1/SIZE/'); @@ -283,6 +314,8 @@ export default defineComponent({ // if the variant does not have color or size as features this.currentVariant = variant || this.product.variants[0]; await this.checkInventory(); + await this.getOpenOrders(); + this.fetchReservedQuantity( this.currentVariant.productId ); }, async checkInventory() { this.currentStoreInventory = this.otherStoresInventory = this.warehouseInventory = 0 @@ -354,16 +387,10 @@ export default defineComponent({ width: 200px; } -.metadata { - display: flex; - flex-direction: column; - align-items: flex-end; - row-gap: 4px; -} - .reservation-section { display: grid; - grid-template-columns: repeat(auto-fill, minmax(343px, 1fr)); + grid-template-columns: repeat(3, 1fr); + /* gap: 5px; */ } .product-section { From 2f5f4d930367826635a1f8ccbba4b6440999c57b Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Fri, 17 May 2024 16:35:57 +0530 Subject: [PATCH 04/37] Update ProductDetail.vue --- src/views/ProductDetail.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/ProductDetail.vue b/src/views/ProductDetail.vue index bac324764..439af7487 100644 --- a/src/views/ProductDetail.vue +++ b/src/views/ProductDetail.vue @@ -91,7 +91,7 @@
-

{{ reservedQuantity ?? '0' }} order reservtion at the store

+

{{ translate('order reservtions at the store', { count: reservedQuantity }) }}

@@ -197,7 +197,7 @@ export default defineComponent({ otherStoresInventoryDetails: [] as any, selectedSegment: 'inStore', queryString: '', - reservedQuantity: '' + reservedQuantity: 0 } }, computed: { From e46378ce03e6db72949cae5287463429e2443b3e Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Fri, 17 May 2024 16:45:54 +0530 Subject: [PATCH 05/37] Updated: added check Order section on product details page(#386) --- src/views/ProductDetail.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/ProductDetail.vue b/src/views/ProductDetail.vue index 439af7487..f53207259 100644 --- a/src/views/ProductDetail.vue +++ b/src/views/ProductDetail.vue @@ -90,7 +90,7 @@
-
+

{{ translate('order reservtions at the store', { count: reservedQuantity }) }}

From e1e829c0ded661c3d737837065c0bab357695768 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 20 May 2024 10:40:33 +0530 Subject: [PATCH 06/37] Improved: changed indentations, nomenclature, locales, and code refactoring(#386) --- src/components/InventoryDetailsPopover.vue | 13 ++-- src/components/ProductListItem.vue | 2 +- src/locales/en.json | 1 + src/locales/es.json | 1 + src/locales/ja.json | 1 + src/services/StockService.ts | 2 +- src/store/modules/order/actions.ts | 5 +- src/store/modules/stock/actions.ts | 7 +- src/store/modules/stock/mutations.ts | 19 +++-- src/utils/order.ts | 84 ++++++++++------------ src/views/OtherStoresInventoryModal.vue | 4 +- src/views/ProductDetail.vue | 23 +++--- 12 files changed, 82 insertions(+), 80 deletions(-) diff --git a/src/components/InventoryDetailsPopover.vue b/src/components/InventoryDetailsPopover.vue index 0bd6c53f4..87dff5a88 100644 --- a/src/components/InventoryDetailsPopover.vue +++ b/src/components/InventoryDetailsPopover.vue @@ -99,13 +99,14 @@ export default defineComponent({ logger.error('Failed to fetch reserved quantity', err) } }, + }, -}, -setup () { - const store = useStore(); + setup () { + const store = useStore(); return { - store, - translate - }} + store, + translate + } + } }) \ No newline at end of file diff --git a/src/components/ProductListItem.vue b/src/components/ProductListItem.vue index 80e510f0a..28b1b4974 100644 --- a/src/components/ProductListItem.vue +++ b/src/components/ProductListItem.vue @@ -62,7 +62,7 @@ export default defineComponent({ }) }, async beforeMount () { - await this.store.dispatch('stock/fetchInvCount', { productId: this.item.productId }); + await this.store.dispatch('stock/fetchInventoryCount', { productId: this.item.productId }); }, methods: { getMinimumStock() { diff --git a/src/locales/en.json b/src/locales/en.json index 1b7b81865..f6a0c02f1 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -197,6 +197,7 @@ "Worn Display": "Worn Display", "This order will be removed from your dashboard. This action cannot be undone.": "This order will be removed from your dashboard.{ space } This action cannot be undone.", "Update notification preferences": "Update notification preferences", + "units": "{ item } units", "View shipping orders along with pickup orders.": "View shipping orders along with pickup orders.", "You do not have permission to access this page": "You do not have permission to access this page", "Zipcode": "Zipcode" diff --git a/src/locales/es.json b/src/locales/es.json index 6cd4f2625..1ba83273c 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -195,6 +195,7 @@ "Worn Display": "Pantalla desgastada", "This order will be removed from your dashboard. This action cannot be undone.": "Este pedido será eliminado de tu panel de control.{ space } Esta acción no se puede deshacer.", "Update notification preferences": "Actualizar preferencias de notificación", + "units": "{ item } units", "View shipping orders along with pickup orders.": "Ver órdenes de envío junto con órdenes de recogida.", "You do not have permission to access this page": "No tienes permiso para acceder a esta página", "Zipcode": "Código postal", diff --git a/src/locales/ja.json b/src/locales/ja.json index d827485a6..2c012a6dd 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -194,6 +194,7 @@ "Worn Display": "すり切れたディスプレイ", "This order will be removed from your dashboard. This action cannot be undone.": "この注文はダッシュボードから削除されます。{ space } この操作は元に戻せません。", "Update notification preferences": "Update notification preferences", + "units": "{ item } units", "View shipping orders along with pickup orders.": "店舗受取の注文と一緒に配送注文を表示します", "You do not have permission to access this page": "このページにアクセスする権限がありません", "Zipcode": "郵便番号" diff --git a/src/services/StockService.ts b/src/services/StockService.ts index e22be78fd..9110270d0 100644 --- a/src/services/StockService.ts +++ b/src/services/StockService.ts @@ -1,4 +1,4 @@ -import { api, hasError } from '@/adapter'; +import { api } from '@/adapter'; const checkInventory = async (query: any): Promise => { return api({ diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index d0eb282b6..2b5950ca1 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -25,7 +25,7 @@ const actions: ActionTree ={ '-fulfillmentStatus': '(Cancelled OR Rejected)', }) - try { + try { resp = await OrderService.getOpenOrders(orderQueryPayload); if (resp.status === 200 && !hasError(resp) && resp.data.grouped?.orderId?.ngroups > 0) { const orderIds = resp.data.grouped?.orderId?.groups.map((order: any) => order.doclist.docs[0].orderId); @@ -48,14 +48,13 @@ const actions: ActionTree ={ // Show loader only when new query and not the infinite scroll // if (payload.viewIndex === 0) emitter.emit("presentLoader"); let resp; - const orderQueryPayload = prepareOrderQuery({ ...payload, orderStatusId: 'ORDER_APPROVED', orderTypeId: 'SALES_ORDER', }) - try { + try { resp = await OrderService.getOpenOrders(orderQueryPayload); if (resp.status === 200 && !hasError(resp) && resp.data.grouped?.orderId?.ngroups > 0) { const orders = resp.data.grouped?.orderId?.groups.map((order: any) => { diff --git a/src/store/modules/stock/actions.ts b/src/store/modules/stock/actions.ts index 67eb6017f..1a2f90251 100644 --- a/src/store/modules/stock/actions.ts +++ b/src/store/modules/stock/actions.ts @@ -28,9 +28,8 @@ const actions: ActionTree = { } }, - async fetchInvCount({ commit }, { productId }) { + async fetchInventoryCount({ commit }, { productId }) { try { - const params = { "entityName": "ProductFacility", "inputFields": { @@ -43,7 +42,9 @@ const actions: ActionTree = { const resp: any = await StockService.getInventoryComputation(params); if(!hasError(resp)) { - commit(types.INVENTORY_COMPUTATIONS, { productId: productId, facilityId: this.state.user.currentFacility.facilityId, minimumStock: resp.data.docs[0].minimumStock, onlineAtp: resp.data.docs[0].computedLastInventoryCount}) + commit(types.INVENTORY_COMPUTATIONS, { productId: productId, facilityId: this.state.user.currentFacility.facilityId, minimumStock: resp.data.docs[0].minimumStock, onlineAtp: resp.data.docs[0].computedLastInventoryCount }) + } else { + throw resp.data; } } catch (err) { diff --git a/src/store/modules/stock/mutations.ts b/src/store/modules/stock/mutations.ts index aaa42f457..64f744984 100644 --- a/src/store/modules/stock/mutations.ts +++ b/src/store/modules/stock/mutations.ts @@ -13,14 +13,19 @@ const mutations: MutationTree = { } }, [types.INVENTORY_COMPUTATIONS] (state, { productId, facilityId, minimumStock, onlineAtp }) { - if (!state.count[productId]) { - state.count[productId] = {}; + if (state.count[productId]) { + state.count[productId][facilityId] = { + minimumStock: minimumStock, + onlineAtp: onlineAtp + } + } else { + state.count[productId] = { + [facilityId]: { + minimumStock: minimumStock, + onlineAtp: onlineAtp + } + } } - - state.count[productId][facilityId] = { - minimumStock, - onlineAtp - }; } } export default mutations; \ No newline at end of file diff --git a/src/utils/order.ts b/src/utils/order.ts index 39d588cba..a1562611e 100644 --- a/src/utils/order.ts +++ b/src/utils/order.ts @@ -1,57 +1,51 @@ const orderCategoryParameters = { - 'Open': { - 'orderStatusId': { - 'value': 'ORDER_APPROVED' - }, - 'orderTypeId': { - 'value': 'SALES_ORDER' - }, - 'isPicked': { - 'value': 'N' - } - }, - 'In Progress': { - 'picklistItemStatusId': { - 'value': 'PICKITEM_PENDING', - }, + 'Open': { + 'isPicked': { + 'value': 'N' + } + }, + 'In Progress': { + 'picklistItemStatusId': { + 'value': 'PICKITEM_PENDING', }, - 'Packed': { - // Array to denote ORing - 'shipmentStatusId': { - 'value': 'SHIPMENT_SHIPPED' - } + }, + 'Packed': { + // Array to denote ORing + 'shipmentStatusId': { + 'value': 'SHIPMENT_SHIPPED' } + } } const handleParameterMatching = (orderVal: any, parameterVal: any, operation?: string) => { - // considering params will always be an Array for ORing and ANDing - if (operation === 'OR') { - return parameterVal.some((param: any) => orderVal === param) - } else if (operation === 'AND') { - return parameterVal.every((param: any) => orderVal === param) - } else if (operation === 'NOT') { - return orderVal !== parameterVal - } else if (!operation) { - return orderVal === parameterVal - } + // considering params will always be an Array for ORing and ANDing + if (operation === 'OR') { + return parameterVal.some((param: any) => orderVal === param) + } else if (operation === 'AND') { + return parameterVal.every((param: any) => orderVal === param) + } else if (operation === 'NOT') { + return orderVal !== parameterVal + } else if (!operation) { + return orderVal === parameterVal } +} const getOrderCategory = (order: any) => { - const orderCategoryParameterEntries = Object.entries(orderCategoryParameters) - let result = '' - // using find, as once any of the category is matched then return from here; - orderCategoryParameterEntries.find((entry: any) => { - const [category, parameters] = entry - const paramKeys = Object.keys(parameters) - // used every as to check against each filtering property - const isMatched = paramKeys.every((key: string) => Object.prototype.hasOwnProperty.call(order, key) && handleParameterMatching(order[key], parameters[key].value, parameters[key]['OP'])) - // return the value when all params matched for an order - if (isMatched) { - result = category; - return result; - } - }) - return result; + const orderCategoryParameterEntries = Object.entries(orderCategoryParameters) + let result = '' + // using find, as once any of the category is matched then return from here; + orderCategoryParameterEntries.find((entry: any) => { + const [category, parameters] = entry + const paramKeys = Object.keys(parameters) + // used every as to check against each filtering property + const isMatched = paramKeys.every((key: string) => Object.prototype.hasOwnProperty.call(order, key) && handleParameterMatching(order[key], parameters[key].value, parameters[key]['OP'])) + // return the value when all params matched for an order + if (isMatched) { + result = category; + return result; + } + }) + return result; } export { getOrderCategory } diff --git a/src/views/OtherStoresInventoryModal.vue b/src/views/OtherStoresInventoryModal.vue index 7c96536e0..087ca0f07 100644 --- a/src/views/OtherStoresInventoryModal.vue +++ b/src/views/OtherStoresInventoryModal.vue @@ -66,6 +66,7 @@ export default defineComponent({ } }, mounted() { + // Create a copy of otherStoresInventory on mount this.filteredInventory = this.otherStoresInventory.slice(); }, methods: { @@ -77,7 +78,8 @@ export default defineComponent({ this.filteredInventory = this.otherStoresInventory.filter((facility: any) => facility.facilityName.toLowerCase().includes(this.queryString.toLowerCase())); } else { - this.filteredInventory = this.otherStoresInventory.slice(); + // Reset filteredInventory when query is empty + this.filteredInventory = this.otherStoresInventory.slice(); } } }, diff --git a/src/views/ProductDetail.vue b/src/views/ProductDetail.vue index f53207259..379e5962c 100644 --- a/src/views/ProductDetail.vue +++ b/src/views/ProductDetail.vue @@ -48,7 +48,7 @@
- + In Store @@ -60,7 +60,7 @@ {{ translate("Quantity on hands")}} - {{ getProductStock(product.variants[0].productId)?.quantityOnHandTotal ?? '0' }} + {{ getProductStock(product.variants[0].productId)?.quantityOnHandTotal ?? '0' }} {{ translate("Safety stock")}} @@ -68,7 +68,7 @@ {{ translate("Order reservations")}} - {{ reservedQuantity }} + {{ reservedQuantity ?? 0 }} {{ translate("Available to promise")}} @@ -110,9 +110,10 @@

{{ item.brand }}

{{ item.virtualName }}

- {{ item.quantity }} + {{ translate("units", { item: item.quantity}) }}
- + + Other items @@ -220,7 +221,7 @@ export default defineComponent({ async beforeMount() { await this.store.dispatch('product/setCurrent', { productId: this.$route.params.productId }) await this.store.dispatch('stock/fetchStock', { productId: this.product.variants[0].productId }) - await this.store.dispatch('stock/fetchInvCount', { productId: this.product.variants[0].productId }); + await this.store.dispatch('stock/fetchInventoryCount', { productId: this.product.variants[0].productId }); if (this.product.variants) { this.getFeatures() await this.updateVariant() @@ -243,7 +244,6 @@ export default defineComponent({ } return 0; }, - //For fetching the order reservation count. async fetchReservedQuantity(productId: any){ const payload = prepareOrderQuery({ @@ -268,12 +268,9 @@ export default defineComponent({ logger.error('Failed to fetch reserved quantity', err) } }, - //For fetching all the orders for this product & facility. - async getOpenOrders (vSize?: any, vIndex?: any) { - const viewSize = vSize ? vSize : process.env.VUE_APP_VIEW_SIZE; - const viewIndex = vIndex ? vIndex : 0; - await this.store.dispatch("order/getOrderDetails", { viewSize, viewIndex, facilityId: this.currentFacility.facilityId, productId: this.currentVariant.productId}); + async getOrderDetails() { + await this.store.dispatch("order/getOrderDetails", { facilityId: this.currentFacility.facilityId, productId: this.currentVariant.productId }); }, async applyFeature(feature: string, type: string) { if(type === 'color') this.selectedColor = feature; @@ -314,7 +311,7 @@ export default defineComponent({ // if the variant does not have color or size as features this.currentVariant = variant || this.product.variants[0]; await this.checkInventory(); - await this.getOpenOrders(); + await this.getOrderDetails(); this.fetchReservedQuantity( this.currentVariant.productId ); }, async checkInventory() { From e04bf31550ab22ddc26c49875cc3ded7e2cab9be Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 20 May 2024 11:32:39 +0530 Subject: [PATCH 07/37] Updated: the prop struture as the api is failing when popover opens(#386) --- src/components/InventoryDetailsPopover.vue | 5 +++-- src/components/ProductListItem.vue | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/InventoryDetailsPopover.vue b/src/components/InventoryDetailsPopover.vue index 87dff5a88..3c72b7650 100644 --- a/src/components/InventoryDetailsPopover.vue +++ b/src/components/InventoryDetailsPopover.vue @@ -12,7 +12,7 @@ {{ translate("Order reservations")}} - {{ reservedQuantity }} + {{ reservedQuantity ?? 0 }} {{ translate("Online ATP")}} @@ -72,7 +72,8 @@ export default defineComponent({ }) }, async beforeMount () { - await this.store.dispatch('stock/fetchStock', { productId: this.item.productId }) + const productId = this.item?.productId; + await this.store.dispatch('stock/fetchStock', { productId }) this.fetchReservedQuantity( this.item.productId ); }, methods: { diff --git a/src/components/ProductListItem.vue b/src/components/ProductListItem.vue index 28b1b4974..8143aacae 100644 --- a/src/components/ProductListItem.vue +++ b/src/components/ProductListItem.vue @@ -93,7 +93,7 @@ export default defineComponent({ const popover = await popoverController.create({ component: InventoryDetailsPopover, event: Event, - componentProps: { minimumStock, onlineAtp, item: this.item.productId } + componentProps: { minimumStock, onlineAtp, item: this.item } }); await popover.present(); }, From 564c59fee524423ed3c5377ddef75c8ff2664a8d Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 20 May 2024 11:38:31 +0530 Subject: [PATCH 08/37] Updated: the alphabetical order of ion imports(#386) --- src/components/InventoryDetailsPopover.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/InventoryDetailsPopover.vue b/src/components/InventoryDetailsPopover.vue index 3c72b7650..6abab299c 100644 --- a/src/components/InventoryDetailsPopover.vue +++ b/src/components/InventoryDetailsPopover.vue @@ -47,16 +47,16 @@ import logger from "@/logger"; export default defineComponent({ name: 'InventoryDetailsPopover', component:{ - IonHeader, - IonToolbar, + IonBadge, IonButtons, - IonTitle, IonContent, + IonHeader, IonItem, IonLabel, - IonNote, - IonBadge, IonList, + IonNote, + IonTitle, + IonToolbar, }, props: ['minimumStock', 'onlineAtp', 'item'], data () { From adc1639548f18005866b9ef4a8eeafae549205a5 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 20 May 2024 16:47:52 +0530 Subject: [PATCH 09/37] Improved: the fetching logic of various inventory information(#386) --- src/components/InventoryDetailsPopover.vue | 54 ++++-------------- src/components/ProductListItem.vue | 25 ++------ src/store/modules/stock/StockState.ts | 2 +- src/store/modules/stock/actions.ts | 29 +++++++++- src/store/modules/stock/getters.ts | 5 +- src/store/modules/stock/index.ts | 2 +- src/store/modules/stock/mutation-types.ts | 2 +- src/store/modules/stock/mutations.ts | 25 ++++---- src/views/ProductDetail.vue | 66 ++++++---------------- 9 files changed, 76 insertions(+), 134 deletions(-) diff --git a/src/components/InventoryDetailsPopover.vue b/src/components/InventoryDetailsPopover.vue index 6abab299c..11d93ccc6 100644 --- a/src/components/InventoryDetailsPopover.vue +++ b/src/components/InventoryDetailsPopover.vue @@ -8,15 +8,15 @@ {{ translate("Safety stock")}} - {{ minimumStock }} + {{ getInventoryInformation(item.productId)?.minimumStock ?? '0' }} {{ translate("Order reservations")}} - {{ reservedQuantity ?? 0 }} + {{ getInventoryInformation(item.productId)?.reservedQuantity ?? '0' }} {{ translate("Online ATP")}} - {{ onlineAtp }} + {{ getInventoryInformation(item.productId)?.onlineAtp ?? '0' }}
@@ -25,49 +25,35 @@