diff --git a/src/components/InventoryDetailsPopover.vue b/src/components/InventoryDetailsPopover.vue index 747773184..b0184a700 100644 --- a/src/components/InventoryDetailsPopover.vue +++ b/src/components/InventoryDetailsPopover.vue @@ -3,20 +3,20 @@ {{ translate("Inventory computation")}} - {{ translate("Quantity on hands")}} - 52 + {{ translate("Quantity on hand")}} + {{ getProductStock(item.productId).quantityOnHandTotal ?? '0' }} {{ translate("Safety stock")}} - 4 + {{ getInventoryInformation(item.productId).minimumStock ?? '0' }} {{ translate("Order reservations")}} - 1 + {{ getInventoryInformation(item.productId).reservedQuantity ?? '0' }} {{ translate("Online ATP")}} - 52 + {{ getInventoryInformation(item.productId).onlineAtp ?? '0' }} @@ -25,56 +25,55 @@ \ No newline at end of file diff --git a/src/components/ProductListItem.vue b/src/components/ProductListItem.vue index cc2404678..054703e82 100644 --- a/src/components/ProductListItem.vue +++ b/src/components/ProductListItem.vue @@ -6,22 +6,20 @@

{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) }}

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}

-

Color: color

-

Size: size

-
- - - -
- 50 ATP - +
+ +
+ {{ translate("on hand", { count: getProductStock(item.productId).quantityOnHandTotal ?? '0' }) }} +
- -
+ + + +
@@ -49,37 +47,31 @@ export default defineComponent({ return { goodIdentificationTypeId: process.env.VUE_APP_PRDT_IDENT_TYPE_ID, isFetchingStock: false, - showInfoIcon: false - } - }, - props: { - item: Object, - isShipToStoreOrder: { - type: Boolean, - default: false } }, + props: ['item', 'isShipToStoreOrder'], computed: { ...mapGetters({ getProduct: 'product/getProduct', - getProductStock: 'stock/getProductStock' + product: "product/getCurrent", + getProductStock: 'stock/getProductStock', + currentFacility: 'user/getCurrentFacility', }) }, methods: { async fetchProductStock(productId: string) { this.isFetchingStock = true - await this.store.dispatch('stock/fetchStock', { productId }) + await this.store.dispatch('stock/fetchStock', { productId }); this.isFetchingStock = false - this.showInfoIcon = true; }, - async getInventoryComputationDetails(Event: any){ + async openInventoryDetailPopover(Event: any){ const popover = await popoverController.create({ component: InventoryDetailsPopover, event: Event, - // componentProps: { otherStoresInventory: this.otherStoresInventoryDetails } + showBackdrop: false, + componentProps: { item: this.item } }); await popover.present(); - }, updateColor(stock: number) { return stock ? stock < 10 ? 'warning' : 'success' : 'danger'; diff --git a/src/locales/en.json b/src/locales/en.json index 1b7b81865..83e544bd4 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -8,6 +8,7 @@ "Are you sure you want to change the time zone to?": "Are you sure you want to change the time zone to?", "Are you sure you want to update the notification preferences?": "Are you sure you want to update the notification preferences?", "Arrived": "Arrived", + "ATP": "{ count } ATP", "Available to promise": "Available to promise", "Authenticating": "Authenticating", "Assign Pickers": "Assign Pickers", @@ -93,6 +94,7 @@ "On rejecting this item, will be sent an email with alternate fulfillment options and this order item will be removed from your dashboard.": "On rejecting this item, { customerName } will be sent an email with alternate fulfillment options and this order item will be removed from your dashboard.", "On rejecting this order, will be sent an email with alternate fulfilment options and this order will be removed from your dashboard.": "On rejecting this order, { customerName } will be sent an email with alternate fulfilment options and this order will be removed from your dashboard.", "Online ATP": "Online ATP", + "on hand": "{ count } on hand", "Other stores inventory": "Other stores inventory", "Order": "Order", "Order delivered to": "Order delivered to { customerName }", @@ -113,8 +115,9 @@ "Orders Not Found": "Orders Not Found", "Order item rejection history": "Order item rejection history", "Order reservations": "Order reservations", - "order reservtions at the store": "{ count } order reservtions at the store", + "order reservations at": "{ count } order reservations at { store }", "Other stores": "Other stores", + "Other items": "Other items", "Packed": "Packed", "Packing Slip": "Packing Slip", "Packing slips help customer reconcile their order against the delivered items.": "Packing slips help customer reconcile their order against the delivered items.", @@ -128,7 +131,7 @@ "Product details": "Product details", "Product not found": "Product not found", "Products not found": "Products not found", - "Quantity on hands": "Quantity on hands", + "Quantity on hand": "Quantity on hand", "Re-route Fulfillment": "Re-route Fulfillment", "Ready for pickup": "Ready for pickup", "Ready to create an app?": "Ready to create an app?", @@ -197,6 +200,8 @@ "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", + "unit": "{ item } unit", "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..ec6171a2b 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -8,6 +8,7 @@ "Are you sure you want to change the time zone to?": "¿Estás seguro de que quieres cambiar la zona horaria a?", "Are you sure you want to update the notification preferences?": "¿Estás seguro de que deseas actualizar las preferencias de notificación?", "Arrived": "Llegó", + "ATP": "{ count } ATP", "Available to promise": "Available to promise", "Authenticating": "Autenticación", "Assign Pickers": "Asignar recolectores", @@ -90,6 +91,7 @@ "On rejecting this item, will be sent an email with alternate fulfillment options and this order item will be removed from your dashboard.": "Al rechazar este artículo, se enviará a {customerName} un correo electrónico con opciones de cumplimiento alternativas y este artículo del pedido se eliminará de su panel de control.", "On rejecting this order, will be sent an email with alternate fulfilment options and this order will be removed from your dashboard.": "Al rechazar este pedido, {customerName} recibirá un correo electrónico con opciones de cumplimiento alternativas y este pedido se eliminará de su panel.", "Online ATP": "Online ATP", + "on hand": "{ count } on hand", "Other stores inventory": "Inventario de otras tiendas", "Order": "Orden", "Order delivered to": "Orden entregada a {customerName}", @@ -110,8 +112,9 @@ "Orders Not Found": "Órdenes no encontradas", "Order item rejection history": "Historial de rechazo de artículos de pedido", "Order reservations": "Order reservations", - "order reservtions at the store": "{ count } order reservtions at the store", + "order reservations at": "{ count } order reservations at { store }", "Other stores": "Otras tiendas", + "Other items": "Other items", "Packed": "Empacado", "Packing Slip": "Remisión de embalaje", "Packing slips help customer reconcile their order against the delivered items.": "Las remisiones de embalaje ayudan al cliente a conciliar su orden con los artículos entregados.", @@ -125,7 +128,7 @@ "Product details": "Detalles del producto", "Product not found": "Producto no encontrado", "Products not found": "Productos no encontrados", - "Quantity on hands": "Quantity on hands", + "Quantity on hand": "Quantity on hand", "Re-route Fulfillment": "Redireccionar cumplimiento", "Ready for pickup": "Listo para recoger", "Ready to create an app?": "¿Listo para crear una aplicación?", @@ -195,6 +198,8 @@ "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", + "unit": "{ item } unit", "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..c9f4c2535 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -8,6 +8,7 @@ "Are you sure you want to change the time zone to?": "タイムゾーンを変更してもよろしいですか?", "Are you sure you want to update the notification preferences?": "Are you sure you want to update the notification preferences?", "Arrived": "到着", + "ATP": "{ count } ATP", "Available to promise": "Available to promise", "Authenticating": "Authenticating", "Assign Pickers": "受け取り人の割当", @@ -90,6 +91,7 @@ "On rejecting this item, will be sent an email with alternate fulfillment options and this order item will be removed from your dashboard.": "On rejecting this item, { customerName } will be sent an email with alternate fulfillment options and this order item will be removed from your dashboard.", "On rejecting this order, will be sent an email with alternate fulfilment options and this order will be removed from your dashboard.": "On rejecting this order, { customerName } will be sent an email with alternate fulfilment options and this order will be removed from your dashboard.", "Online ATP": "Online ATP", + "on hand": "{ count } on hand", "Other stores inventory": "その他店舗在庫", "Order": "注文", "Order delivered to": "注文は { customerName }様 に配達されました", @@ -110,8 +112,9 @@ "Orders Not Found": "注文が見つかりません", "Order item rejection history": "Order item rejection history", "Order reservations": "Order reservations", - "order reservtions at the store": "{ count } order reservtions at the store", + "order reservations at": "{ count } order reservations at { store }", "Other stores": "Other stores", + "Other items": "Other items", "Packed": "梱包済み", "Packing Slip": "納品書", "Packing slips help customer reconcile their order against the delivered items.": "内容明細票はお客様が注文と配送された商品を確認(照合)する際に役立ちます。", @@ -125,7 +128,7 @@ "Product details": "商品詳細", "Product not found": "商品が見つかりません", "Products not found": "商品が見つかりません", - "Quantity on hands": "Quantity on hands", + "Quantity on hand": "Quantity on hand", "Re-route Fulfillment": "リルート(受取方法や受取場所の変更)", "Ready for pickup": "ピックアップの準備ができました", "Ready to create an app?": "アプリを作成する準備はできましたか?", @@ -194,6 +197,8 @@ "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", + "unit": "{ item } unit", "View shipping orders along with pickup orders.": "店舗受取の注文と一緒に配送注文を表示します", "You do not have permission to access this page": "このページにアクセスする権限がありません", "Zipcode": "郵便番号" diff --git a/src/services/OrderService.ts b/src/services/OrderService.ts index 2e3a1fda1..2eee06c73 100644 --- a/src/services/OrderService.ts +++ b/src/services/OrderService.ts @@ -13,6 +13,14 @@ const getOpenOrders = async (payload: any): Promise => { }); } +const fetchOrderItems = async (payload: any): Promise => { + return api({ + url: "solr-query", + method: "post", + data: payload + }); +} + const getOrderDetails = async (payload: any): Promise => { return api({ url: "solr-query", @@ -259,6 +267,7 @@ const getShippingPhoneNumber = async (orderId: string): Promise => { } export const OrderService = { + fetchOrderItems, fetchOrderPaymentPreferences, getOpenOrders, getOrderDetails, diff --git a/src/services/StockService.ts b/src/services/StockService.ts index 8941484ac..d16500bc1 100644 --- a/src/services/StockService.ts +++ b/src/services/StockService.ts @@ -16,7 +16,16 @@ const getInventoryAvailableByFacility = async (query: any): Promise => { }); } +const fetchInventoryCount = async (payload: any ): Promise => { + return api({ + url: 'performFind', + method: 'post', + data: payload + }); +} + export const StockService = { checkInventory, - getInventoryAvailableByFacility + getInventoryAvailableByFacility, + fetchInventoryCount } \ No newline at end of file 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..2b488c355 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; + orders: any; } diff --git a/src/store/modules/order/actions.ts b/src/store/modules/order/actions.ts index 44a972658..f4936f21c 100644 --- a/src/store/modules/order/actions.ts +++ b/src/store/modules/order/actions.ts @@ -12,6 +12,100 @@ import { prepareOrderQuery } from "@/utils/solrHelper"; import logger from "@/logger"; const actions: ActionTree ={ + + async getOrderDetails({ dispatch, commit }, payload ) { + + let resp; + const orderQueryPayload = prepareOrderQuery({ + ...payload, + orderStatusId: 'ORDER_APPROVED', + orderTypeId: 'SALES_ORDER', + '-fulfillmentStatus': '(Cancelled OR Rejected OR Completed)', + }) + + try { + resp = await OrderService.fetchOrderItems(orderQueryPayload); + if (!hasError(resp) && resp.data.grouped?.orderId?.ngroups > 0) { + const orderIds = resp.data.grouped?.orderId?.groups.map((order: any) => order.doclist.docs[0].orderId); + dispatch('fetchOrderItems', {...payload, orderIds}); + } else { + commit(types.ORDER_INFO_UPDATED, { orders: {} }) + } + } catch(err) { + logger.error(err) + commit(types.ORDER_INFO_UPDATED, { orders: {} }) + } + return resp; + }, + + async fetchOrderItems({ commit }, payload) { + + let resp; + const { productId, orderIds, ...params } = payload; + const orderQueryPayload = prepareOrderQuery({ + ...params, + orderIds, + orderStatusId: 'ORDER_APPROVED', + orderTypeId: 'SALES_ORDER', + }) + + try { + resp = await OrderService.fetchOrderItems(orderQueryPayload); + if (!hasError(resp) && resp.data.grouped?.orderId?.ngroups > 0) { + const productIds: any = [] + const orders = resp.data.grouped?.orderId?.groups.map((order: any) => { + const orderItem = order.doclist.docs[0] + let currentItem: any = {}; + let currentItemQty = 0; + const otherItemsObj: any = {}; + order.doclist.docs.map((item: any) => { + if (item.productId == productId) { + currentItemQty += item.itemQuantity; + if(!currentItem.productId) { + currentItem = item; + } + } else { + if (!otherItemsObj[item.productId]) { + otherItemsObj[item.productId] = { ...item, quantity: 0 }; + productIds.push(item.productId); + } + otherItemsObj[item.productId].quantity += item.itemQuantity; + } + }); + + currentItem = { ...currentItem, quantity: currentItemQty }; + const otherItems = Object.values(otherItemsObj); + + return { + orderId: orderItem.orderId, + orderName: orderItem.orderName, + customer: { + partyId: orderItem.customerId, + name: orderItem.customerName + }, + shipmentMethod: { + shipmentMethodTypeDesc: orderItem.shipmentMethodTypeDesc, + shipmentMethodTypeId: orderItem.shipmentMethodTypeId + }, + otherItems: otherItems, + currentItem: currentItem + } + }) + productIds.push(productId) + + this.dispatch('product/fetchProducts', { productIds: productIds }); + commit(types.ORDER_INFO_UPDATED, { orders }) + } else { + commit(types.ORDER_INFO_UPDATED, { orders: {} }) + } + } + catch(err) { + logger.error(err) + commit(types.ORDER_INFO_UPDATED, { orders: {} }) + } + 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..969ec7ca1 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 = { + getOrders: (state) => { + return state.orders; + }, getOpenOrders: (state) => { return state.open.list; }, diff --git a/src/store/modules/order/index.ts b/src/store/modules/order/index.ts index 44d9a6e6e..3cdcc0b57 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 }, + orders: {}, packed: { list: {}, total: 0 diff --git a/src/store/modules/order/mutation-types.ts b/src/store/modules/order/mutation-types.ts index 862b8047e..bfebbab6e 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 ORDER_INFO_UPDATED = SN_ORDER + '/INFO_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..a2ba4e2e8 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.ORDER_INFO_UPDATED] (state, payload){ + state.orders = 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/StockState.ts b/src/store/modules/stock/StockState.ts index 128855bc6..5f6c9aad7 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; + inventoryInformation: 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..b70a4d696 100644 --- a/src/store/modules/stock/actions.ts +++ b/src/store/modules/stock/actions.ts @@ -7,12 +7,14 @@ import { hasError } from '@/adapter' import { showToast } 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 = { async fetchStock({ commit }, { productId }) { try { const payload = { - productId, + productId: productId, facilityId: this.state.user.currentFacility.facilityId } @@ -26,6 +28,67 @@ const actions: ActionTree = { logger.error(err) showToast(translate('No data available!')) } + }, + + async fetchInventoryCount({ commit, state }, { productId }) { + const facilityId = this.state.user.currentFacility.facilityId; + if (state.inventoryInformation[productId] && state.inventoryInformation[productId][facilityId]) { + return; + } + + try { + const params = { + "entityName": "ProductFacility", + "inputFields": { + "productId": productId, + "facilityId": facilityId + }, + "fieldList": ["minimumStock", "computedLastInventoryCount"], + "viewSize": 1 + } as any + + const resp: any = await StockService.fetchInventoryCount(params); + if (!hasError(resp) && resp.data.docs.length > 0) { + commit(types.STOCK_ADD_PRODUCT_INFORMATION, { productId: productId, facilityId: facilityId, payload: { minimumStock: resp.data.docs[0].minimumStock, onlineAtp: resp.data.docs[0].computedLastInventoryCount }}) + } else { + throw resp.data; + } + } + catch (err) { + logger.error(err) + } + }, + + async fetchReservedQuantity({ commit, state }, { productId }) { + const facilityId = this.state.user.currentFacility.facilityId; + if (state.inventoryInformation[productId] && state.inventoryInformation[productId][facilityId]?.reservedQuantity) { + return; + } + + const payload = prepareOrderQuery({ + viewSize: "0", // passing viewSize as 0, as we don't want to fetch any data + defType: "edismax", + filters: { + facilityId: facilityId, + productId: productId, + '-fulfillmentStatus': '(Cancelled OR Rejected OR Completed)', + }, + facet: { + "reservedQuantityFacet": "sum(itemQuantity)" + } + }) + + try { + const resp = await UtilService.fetchReservedQuantity(payload) + if (!hasError(resp) && resp.data.facets.count) { + const reservedQuantity = resp.data.facets.count + commit(types.STOCK_ADD_PRODUCT_INFORMATION, { productId, facilityId: facilityId, payload: { reservedQuantity }}); + } else { + throw resp.data + } + } catch(err) { + logger.error('Failed to fetch reserved quantity', err) + } } } 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..3d9a4e392 100644 --- a/src/store/modules/stock/getters.ts +++ b/src/store/modules/stock/getters.ts @@ -7,6 +7,10 @@ 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] : {} : {} + }, + getInventoryInformation: (state) => (productId: any) => { + const facilityId = store.state.user?.currentFacility?.facilityId + return state.inventoryInformation[productId] ? state.inventoryInformation[productId][facilityId] ? state.inventoryInformation[productId][facilityId] : {} : {}; } } 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..3fcfbc64c 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: {}, + inventoryInformation: {}, }, getters, actions, diff --git a/src/store/modules/stock/mutation-types.ts b/src/store/modules/stock/mutation-types.ts index 3937ac90e..e7a5390d7 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 STOCK_ADD_PRODUCT_INFORMATION = SN_STOCK + '/ADD_PRODUCT_INFORMATION' \ No newline at end of file diff --git a/src/store/modules/stock/mutations.ts b/src/store/modules/stock/mutations.ts index cc2f3329d..0f871dc77 100644 --- a/src/store/modules/stock/mutations.ts +++ b/src/store/modules/stock/mutations.ts @@ -11,6 +11,20 @@ const mutations: MutationTree = { [payload.facilityId]: payload.stock } } + }, + [types.STOCK_ADD_PRODUCT_INFORMATION] (state, { productId, facilityId, payload }) { + if (!state.inventoryInformation[productId]) { + state.inventoryInformation[productId] = { + [facilityId]: payload + } + return; + } + // If the inventory information for the productId exists update the information for the specific facilityId + state.inventoryInformation[productId][facilityId] = { + ...state.inventoryInformation[productId][facilityId], + ...payload + } } } + export default mutations; \ No newline at end of file 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/Catalog.vue b/src/views/Catalog.vue index 8b491d638..1e27ebeda 100644 --- a/src/views/Catalog.vue +++ b/src/views/Catalog.vue @@ -12,8 +12,8 @@ -

{{ getProductIdentificationValue(productIdentificationPref.primaryId, product) }}

- {{ getProductIdentificationValue(productIdentificationPref.secondaryId, product) }} +

{{ getProductIdentificationValue(productIdentificationPref.primaryId, product) }}

+

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, product) }}

diff --git a/src/views/OtherStoresInventoryModal.vue b/src/views/OtherStoresInventoryModal.vue index 56a97f608..3cc393db3 100644 --- a/src/views/OtherStoresInventoryModal.vue +++ b/src/views/OtherStoresInventoryModal.vue @@ -10,11 +10,11 @@ - - - - {{ details.facilityName }} - {{ details.stock }} + + + + {{ storeInventory.facilityName }} + {{ translate('ATP', { count: storeInventory.stock}) }}
@@ -34,9 +34,11 @@ import { IonLabel, IonList, IonNote, + IonSearchbar, IonTitle, IonToolbar, - modalController } from "@ionic/vue"; + modalController +} from "@ionic/vue"; import { defineComponent } from "vue"; import { close } from "ionicons/icons"; import { useStore } from "@/store"; @@ -54,13 +56,32 @@ export default defineComponent({ IonLabel, IonList, IonNote, + IonSearchbar, IonTitle, IonToolbar }, props: ["otherStoresInventory"], + data() { + return{ + queryString: "", + storesInventory: [] as any + } + }, + mounted() { + // Create a copy of otherStoresInventory on mount + this.storesInventory = this.otherStoresInventory.slice(); + }, methods: { closeModal() { modalController.dismiss({ dismissed: true }); + }, + searchFacilities(){ + if (this.queryString.trim() !== "") { + this.storesInventory = this.otherStoresInventory.filter((facility: any) => facility.facilityName.toLowerCase().includes(this.queryString.toLowerCase())); + } else { + // Reset storesInventory when query is empty + this.storesInventory = this.otherStoresInventory.slice(); + } } }, setup() { diff --git a/src/views/ProductDetail.vue b/src/views/ProductDetail.vue index da4eb833f..7a9ba5bfb 100644 --- a/src/views/ProductDetail.vue +++ b/src/views/ProductDetail.vue @@ -48,7 +48,7 @@
- + In Store @@ -59,100 +59,74 @@ - {{ translate("Quantity on hands")}} - 10 + {{ translate("Quantity on hand")}} + {{ getProductStock(currentVariant.productId).quantityOnHandTotal ?? '0' }} {{ translate("Safety stock")}} - 10 + {{ getInventoryInformation(currentVariant.productId).minimumStock ?? '0' }} {{ translate("Order reservations")}} - 20 + {{ getInventoryInformation(currentVariant.productId).reservedQuantity ?? '0' }} {{ translate("Available to promise")}} - 70 + {{ getInventoryInformation(currentVariant.productId).onlineAtp ?? '0' }} - + {{ translate("Other stores")}} - 100 ATP + {{ translate('ATP', { count: otherStoresInventory}) }} {{ translate("Warehouse")}} - 100 ATP + {{ translate('ATP', { count: warehouseInventory}) }}
- -
-

{{ translate({ },"order reservtions at the store")}}

+ +
+

{{ translate('order reservations at', { count: getInventoryInformation(currentVariant.productId).reservedQuantity ?? '0', store: currentFacility.facilityName }) }}

- - - - Order ID -

Customer name

-
- Open -
+ - - - -

BRAND

-

Virtual name

+

{{ order.customer.name }}

+

{{ order.orderName ? order.orderName : order.orderId }}

- 2 units + + {{ order.shipmentMethod.shipmentMethodTypeDesc ? order.shipmentMethod.shipmentMethodTypeDesc : order.shipmentMethod.shipmentMethodTypeId }} +
- - Order items - - + + - + - -

BRAND

-

Virtual name

-
-
-
- - - - Order ID -

Customer name

-
- Packed -
- - - - - -

BRAND

-

Virtual name

+ +

{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(order.currentItem.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(order.currentItem.productId)) : order.currentItem.productId }}

+

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(order.currentItem.productId)) }}

- 2 units + {{ translate(order.currentItem.quantity == 1 ? "unit" : "units", { item: order.currentItem.quantity }) }}
- - Order items + + + {{ translate("Other items")}} - + - + -

BRAND

-

Virtual name

+

{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : item.productId }}

+

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}

+ {{ translate(item.quantity == 1 ? "unit" : "units", { item: item.quantity }) }}
@@ -165,7 +139,9 @@