Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented: Functional UI to Display Inventory Computation for Order Items(#386) #392

Merged
merged 38 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
02f00ed
Updated: added searchbar functionality on the otherInventoryModal(#386)
R-Sourabh May 10, 2024
bcc09ee
Implemented: API for fetcting the minimumStock & lastInventoryCount(#…
R-Sourabh May 13, 2024
b2f2a07
Implemneted: Functional UI to Display Inventory Computation for Order…
R-Sourabh May 15, 2024
d1262c0
Merge remote-tracking branch 'upstream/main' into #386
R-Sourabh May 17, 2024
2f5f4d9
Update ProductDetail.vue
R-Sourabh May 17, 2024
e46378c
Updated: added check Order section on product details page(#386)
R-Sourabh May 17, 2024
e1e829c
Improved: changed indentations, nomenclature, locales, and code refac…
R-Sourabh May 20, 2024
e04bf31
Updated: the prop struture as the api is failing when popover opens(…
R-Sourabh May 20, 2024
564c59f
Updated: the alphabetical order of ion imports(#386)
R-Sourabh May 20, 2024
adc1639
Improved: the fetching logic of various inventory information(#386)
R-Sourabh May 20, 2024
62661cf
Updated: remove the optionals, update logic of Inventory Information …
R-Sourabh May 21, 2024
13c2edf
Update mutations.ts
R-Sourabh May 21, 2024
cad494f
Updated: usage of productId from currentVarient object(#386)
R-Sourabh May 21, 2024
8806923
Updated: the response logic for reservedQuantity(#386)
R-Sourabh May 21, 2024
66682cf
Update actions.ts
R-Sourabh May 21, 2024
5af5532
Updated: the position of loader in order/action(#386)
R-Sourabh May 21, 2024
3549586
Updated: removed the 'in progress' orders and update 'open' order che…
R-Sourabh May 21, 2024
a4f32c4
Updated: update static words & locale, added checks in stock actions(…
R-Sourabh May 21, 2024
b8ca631
Updated: remove the static color and size tag(#386)
R-Sourabh May 21, 2024
e615e5f
Updated: the api call in ProductListItem(#386)
R-Sourabh May 21, 2024
17e10a6
Improved: the logic for fetching the order and order items(#386)
R-Sourabh May 22, 2024
21cd134
Update actions.ts
R-Sourabh May 22, 2024
789ef84
Updated: change the service name and popover function(#386)
R-Sourabh May 22, 2024
042b566
Updated: added import, locales and change the productListItem logic(#…
R-Sourabh May 22, 2024
ea7c21a
Update ProductListItem.vue
R-Sourabh May 22, 2024
aa13a1f
Updated: added image src for other items in orders(#386)
R-Sourabh May 22, 2024
395aeb1
Updated: change fetching logic of brandName & virtualName(#386)
R-Sourabh May 22, 2024
b8352f6
Updated: optimise the logic of fetching productIds of orders(#386)
R-Sourabh May 23, 2024
f6cfa63
Updated: Added check on fulfillmentStatus while fetching orders & res…
R-Sourabh May 23, 2024
c54bcc6
Removed: order.ts file which previously returning order status(#386)
R-Sourabh May 23, 2024
a9817ad
Improved: action for fetching order and otherItems .Order card now co…
R-Sourabh May 23, 2024
7666910
Updated: added static ATP at OtherStoreInventory modal, change orders…
R-Sourabh May 23, 2024
3a2c3f6
Improved: the fetchOrderItems action of order(#386)
R-Sourabh May 23, 2024
8640777
Updated: catalog page products productIdentifier(#586)
R-Sourabh May 23, 2024
f6988af
Updated: remove the backdrop of inventoryInformation popover(#386)
R-Sourabh May 24, 2024
c207736
Updated: added locale, remove unwanted code, added some text(#386)
R-Sourabh May 24, 2024
79a6901
Updated: replace ATP count with QOH on ProductListItem(#386)
R-Sourabh May 24, 2024
157d75b
Updated: added slot property on ProductListItem's div(#386)
R-Sourabh May 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 29 additions & 30 deletions src/components/InventoryDetailsPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
<ion-list-header>{{ translate("Inventory computation")}}</ion-list-header>
<ion-item>
<ion-label class="ion-text-wrap">{{ translate("Quantity on hands")}}</ion-label>
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
<ion-note slot="end">52</ion-note>
<ion-note slot="end">{{ getProductStock(item.productId).quantityOnHandTotal ?? '0' }}</ion-note>
</ion-item>
<ion-item>
<ion-label class="ion-text-wrap">{{ translate("Safety stock")}}</ion-label>
<ion-note slot="end">4</ion-note>
<ion-note slot="end">{{ getInventoryInformation(item.productId).minimumStock ?? '0' }}</ion-note>
</ion-item>
<ion-item>
<ion-label class="ion-text-wrap">{{ translate("Order reservations")}}</ion-label>
<ion-note slot="end">1</ion-note>
<ion-note slot="end">{{ getInventoryInformation(item.productId).reservedQuantity ?? '0' }}</ion-note>
</ion-item>
<ion-item lines="none">
<ion-label class="ion-text-wrap">{{ translate("Online ATP")}}</ion-label>
<ion-badge slot="end" color="success">52</ion-badge>
<ion-badge slot="end" color="success">{{ getInventoryInformation(item.productId).onlineAtp ?? '0' }}</ion-badge>
</ion-item>
</ion-list>
</ion-content>
Expand All @@ -25,56 +25,55 @@
<script lang="ts">
import {
IonBadge,
IonButtons,
IonContent,
IonHeader,
IonItem,
IonLabel,
IonList,
IonNote,
IonTitle,
IonToolbar
IonListHeader,
IonNote
} from '@ionic/vue'

import { defineComponent } from 'vue';
import { useStore } from 'vuex';
import { useStore, mapGetters } from 'vuex';
import { translate } from '@hotwax/dxp-components';

export default defineComponent({
export default defineComponent({
name: 'InventoryDetailsPopover',
component:{
components:{
IonBadge,
IonButtons,
IonContent,
IonHeader,
IonItem,
IonLabel,
IonList,
IonListHeader,
IonNote,
IonTitle,
IonToolbar
},
props: {
},
data () {
return {

}
},
props: ['item'],
computed: {

...mapGetters({
product: "product/getCurrent",
getProductStock: 'stock/getProductStock',
getInventoryInformation: 'stock/getInventoryInformation',
currentFacility: 'user/getCurrentFacility',
})
},
async beforeMount () {
const productId = this.item?.productId;
await this.store.dispatch('stock/fetchStock', { productId })
this.fetchReservedQuantity( this.item.productId );
},
methods: {

async fetchReservedQuantity(productId: any){
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
await this.store.dispatch('stock/fetchReservedQuantity', { productId });
},
},

setup () {
const store = useStore();
return {
store,
translate
};


store,
translate
}
}
})
</script>
21 changes: 10 additions & 11 deletions src/components/ProductListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ion-icon color="medium" slot="icon-only" :icon="cubeOutline" />
</ion-button>
<div v-else-if="showInfoIcon" class="atp-info">
<ion-note slot="end"> 50 ATP </ion-note>
<ion-note slot="end"> {{ getInventoryInformation(item.productId).onlineAtp ?? '0' }} </ion-note>
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
<ion-button fill="clear" @click.stop="getInventoryComputationDetails($event)">
<ion-icon slot="icon-only" :icon="informationCircleOutline" color="medium" />
</ion-button>
Expand Down Expand Up @@ -52,20 +52,20 @@ 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",
getInventoryInformation: 'stock/getInventoryInformation',
currentFacility: 'user/getCurrentFacility',
})
},
async beforeMount () {
await this.store.dispatch('stock/fetchInventoryCount', { productId: this.item.productId });
},
methods: {

async fetchProductStock(productId: string) {
this.isFetchingStock = true
await this.store.dispatch('stock/fetchStock', { productId })
Expand All @@ -76,10 +76,9 @@ export default defineComponent({
const popover = await popoverController.create({
component: InventoryDetailsPopover,
event: Event,
// componentProps: { otherStoresInventory: this.otherStoresInventoryDetails }
componentProps: { item: this.item }
});
await popover.present();

},
updateColor(stock: number) {
return stock ? stock < 10 ? 'warning' : 'success' : 'danger';
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "郵便番号"
Expand Down
11 changes: 10 additions & 1 deletion src/services/StockService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ const getInventoryAvailableByFacility = async (query: any): Promise <any> => {
});
}

const getInventoryComputation = async (payload: any ): Promise<any> => {
return api({
url: 'performFind',
method: 'post',
data: payload
});
}

export const StockService = {
checkInventory,
getInventoryAvailableByFacility
getInventoryAvailableByFacility,
getInventoryComputation
}
11 changes: 10 additions & 1 deletion src/services/UtilService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,18 @@ const resetPicker = async (payload: any): Promise<any> => {
})
}

const fetchReservedQuantity = async (query: any): Promise <any> => {
return api({
url: "solr-query",
method: "post",
data: query
});
}

export const UtilService = {
fetchPaymentMethodTypeDesc,
fetchRejectReasons,
fetchStatusDesc,
resetPicker
resetPicker,
fetchReservedQuantity
}
3 changes: 2 additions & 1 deletion src/store/modules/order/OrderState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ export default interface OrderState {
current: any;
packed: any;
completed: any;
shipToStore: any
shipToStore: any;
otherItem: any;
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
}
102 changes: 102 additions & 0 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,110 @@
import store from "@/store";
import { prepareOrderQuery } from "@/utils/solrHelper";
import logger from "@/logger";
import { getOrderCategory } from "@/utils/order";

const actions: ActionTree<OrderState , RootState> ={

async getOrderDetails({commit}, payload ) {

Check warning on line 17 in src/store/modules/order/actions.ts

View workflow job for this annotation

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

'commit' is defined but never used

Check warning on line 17 in src/store/modules/order/actions.ts

View workflow job for this annotation

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

'commit' is defined but never used
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
// 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;

Check warning on line 32 in src/store/modules/order/actions.ts

View workflow job for this annotation

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

'productId' is assigned a value but never used

Check warning on line 32 in src/store/modules/order/actions.ts

View workflow job for this annotation

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

'productId' is assigned a value but never used
this.dispatch('order/getOtherOrderItem', {...params, orderIds});
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
emitter.emit("dismissLoader");
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
} 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) {
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
// 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);
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
if (resp.status === 200 && !hasError(resp) && resp.data.grouped?.orderId?.ngroups > 0) {
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
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<any>, item: any) => {
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
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)
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
commit(types.OTHER_ITEM_UPDATED, { orders })
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
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");
Expand Down Expand Up @@ -413,7 +515,7 @@
return resp;
},

async packDeliveryItems ({ commit }, shipmentId) {

Check warning on line 518 in src/store/modules/order/actions.ts

View workflow job for this annotation

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

'commit' is defined but never used

Check warning on line 518 in src/store/modules/order/actions.ts

View workflow job for this annotation

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

'commit' is defined but never used
const params = {
shipmentId: shipmentId,
statusId: 'SHIPMENT_PACKED'
Expand Down Expand Up @@ -529,7 +631,7 @@
}).catch(err => err);
},

async rejectOrderItems ({ commit }, order) {

Check warning on line 634 in src/store/modules/order/actions.ts

View workflow job for this annotation

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

'commit' is defined but never used

Check warning on line 634 in src/store/modules/order/actions.ts

View workflow job for this annotation

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

'commit' is defined but never used
const payload = {
'orderId': order.orderId
}
Expand Down
3 changes: 3 additions & 0 deletions src/store/modules/order/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import OrderState from "./OrderState"
import RootState from "../../RootState";

const getters: GetterTree<OrderState , RootState> = {
getOtherItem: (state) => {
R-Sourabh marked this conversation as resolved.
Show resolved Hide resolved
return state.otherItem;
},
getOpenOrders: (state) => {
return state.open.list;
},
Expand Down
1 change: 1 addition & 0 deletions src/store/modules/order/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const orderModule: Module<OrderState, RootState> = {
list: {},
total: 0
},
otherItem:{},
packed: {
list: {},
total: 0
Expand Down
1 change: 1 addition & 0 deletions src/store/modules/order/mutation-types.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
5 changes: 4 additions & 1 deletion src/store/modules/order/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import ProductState from './OrderState'
import * as types from './mutation-types'

const mutations: MutationTree <ProductState> = {
[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
Expand Down Expand Up @@ -35,4 +38,4 @@ const mutations: MutationTree <ProductState> = {
}
}

export default mutations;
export default mutations;
1 change: 1 addition & 0 deletions src/store/modules/stock/StockState.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export default interface StockState {
products: any;
inventoryInformation: any;
}
Loading
Loading