Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/hotwax/fulfillment-pwa into…
Browse files Browse the repository at this point in the history
… main
  • Loading branch information
ravilodhi committed Oct 20, 2023
2 parents 7a0f416 + f126d8a commit 175ec28
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 21 deletions.
1 change: 0 additions & 1 deletion src/components/OrderActionsPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export default defineComponent({
return assignPickerModal.present();
},
async viewOrder() {
console.log(this.order)
this.store.dispatch('order/updateCurrent', this.order).then(() => {
this.closePopover();
this.$router.push({ path: `/order-detail/${this.order.orderId}` })
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"Order ID": "Order ID",
"Order packed successfully": "Order packed successfully",
"Order packed successfully. Document generation in process": "Order packed successfully. Document generation in process",
"Other shipments in this order": "Other shipments in this order",
"Order shipped successfully": "Order shipped successfully",
"Order Shipment ID": "Order Shipment ID",
"Order unpacked successfully": "Order unpacked successfully",
Expand All @@ -176,6 +177,7 @@
"Pack using default packaging": "Pack using default packaging",
"Packed Orders": "Packed Orders",
"Password": "Password",
"Pending allocation": "Pending allocation",
"Phone Number": "Phone Number",
"Pick order": "Pick order",
"Pickers successfully replaced in the picklist with the new selections.": "Pickers successfully replaced in the picklist with the new selections.",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"Order ID": "ID del Pedido",
"Order packed successfully": "Pedido empacado exitosamente",
"Order packed successfully. Document generation in process": "Order packed successfully. Document generation in process",
"Other shipments in this order": "Other shipments in this order",
"Order shipped successfully": "Pedido enviado exitosamente",
"Order Shipment ID": "ID de Envío del Pedido",
"Order unpacked successfully": "Pedido desempacado exitosamente",
Expand All @@ -176,6 +177,7 @@
"Pack using default packaging": "Empacar utilizando el empaque predeterminado",
"Packed Orders": "Pedidos Empacados",
"Password": "Contraseña",
"Pending allocation": "Pending allocation",
"Phone Number": "Phone Number",
"Pickers successfully replaced in the picklist with the new selections.": "Pickers successfully replaced in the picklist with the new selections.",
"picklists": "{count} picklists",
Expand Down
20 changes: 14 additions & 6 deletions src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as types from './mutation-types'
import { prepareOrderQuery } from '@/utils/solrHelper'
import { UtilService } from '@/services/UtilService'
import logger from '@/logger'
import { getOrderCategory } from '@/utils/order'


const actions: ActionTree<OrderState, RootState> = {
Expand Down Expand Up @@ -541,12 +542,13 @@ const actions: ActionTree<OrderState, RootState> = {
commit(types.ORDER_OPEN_QUERY_UPDATED, payload)
},

async fetchShipGroupForOrder({ dispatch }, orderId) {
async fetchShipGroupForOrder({ dispatch }, order) {
const params = {
groupBy: 'shipGroupSeqId',
filters: {
'-shipGroupSeqId': { value: order.items[0].shipGroupSeqId },
'-shipmentMethodTypeId': { value: 'STOREPICKUP' },
orderId: { value: orderId }
orderId: { value: order.orderId }
},
docType: 'ORDER'
}
Expand Down Expand Up @@ -590,19 +592,19 @@ const actions: ActionTree<OrderState, RootState> = {
this.dispatch('util/fetchFacilityTypeInformation', facilityTypeIds)

// fetching reservation information for shipGroup from OISGIR doc
// return dispatch('fetchAdditionalShipGroupForOrder', { shipGroups, orderId });
return await dispatch('fetchAdditionalShipGroupForOrder', { shipGroups, orderId });
await dispatch('fetchAdditionalShipGroupForOrder', { shipGroups, order });
},

async fetchAdditionalShipGroupForOrder({ commit }, payload) {
const shipGroupSeqIds = payload.shipGroups.map((shipGroup: any) => shipGroup.shipGroupSeqId)
const orderId = payload.orderId
const orderId = payload.order.orderId

const params = {
groupBy: 'shipGroupSeqId',
filters: {
'shipGroupSeqId': { value: shipGroupSeqIds },
'-shipmentMethodTypeId': { value: 'STOREPICKUP' },
'-fulfillmentStatus': { value: ['Rejected', 'Cancelled'] },
orderId: { value: orderId }
}
}
Expand Down Expand Up @@ -630,9 +632,10 @@ const actions: ActionTree<OrderState, RootState> = {

return reservedShipGroup ? {
...shipGroup,
items: reservedShipGroupForOrder.doclist.docs,
carrierPartyId: reservedShipGroup.carrierPartyId,
shipmentId: reservedShipGroup.shipmentId,
groupCategory: '', // category defines that the order is in which state like open, inProgress or completed
groupCategory: getOrderCategory(payload.order), // category defines that the order is in which state like open, inProgress or completed
} : {
...shipGroup
}
Expand Down Expand Up @@ -662,13 +665,18 @@ const actions: ActionTree<OrderState, RootState> = {
logger.error('Failed to fetch information for ship groups', err)
}

payload.order['shipGroups'] = shipGroups

commit(types.ORDER_CURRENT_UPDATED, { order: payload.order })

return shipGroups;
},

// TODO clear current on logout
async updateCurrent ({ commit, dispatch }, payload) {
commit(types.ORDER_CURRENT_UPDATED, { order: payload })
await dispatch('fetchShippingAddress', payload);
dispatch('fetchShipGroupForOrder', payload)
},
}

Expand Down
32 changes: 18 additions & 14 deletions src/views/OrderDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,28 +153,28 @@

<ShippingDetails />

<ion-label>{{ 'Other shipments in this order' }}</ion-label>
<ion-card v-for="shipGroup in shipGroups" :key="shipGroup.shipmentId">
<ion-item lines="none">
<ion-label v-if="order.shipGroups?.length">{{ translate('Other shipments in this order') }}</ion-label>
<ion-card v-for="shipGroup in order.shipGroups" :key="shipGroup.shipmentId">
<ion-card-header>
<div>
<p>{{ getfacilityTypeDesc(shipGroup.facilityTypeId) }}</p>
<h2>{{ shipGroup.facilityName }}</h2>
<ion-card-subtitle class="overline">{{ getfacilityTypeDesc(shipGroup.facilityTypeId) }}</ion-card-subtitle>
<ion-card-title>{{ shipGroup.facilityName }}</ion-card-title>
</div>
<ion-badge :color="shipGroup.category ? 'primary' : 'medium'" slot="end">{{ shipGroup.category ? shipGroup.category : 'Pending allocation' }}</ion-badge>
</ion-item>
<ion-badge :color="shipGroup.category ? 'primary' : 'medium'">{{ shipGroup.category ? shipGroup.category : translate('Pending allocation') }}</ion-badge>
</ion-card-header>

<!-- TODO: add if check for carrierPartyId, not added now just to check the UI -->
<ion-item>
<ion-label>{{ shipGroup.carrierPartyId ? getPartyName(shipGroup.carrierPartyId) : '_NA_' }}</ion-label>
<ion-item v-if="shipGroup.carrierPartyId">
<ion-label>{{ getPartyName(shipGroup.carrierPartyId) }}</ion-label>
{{ shipGroup.trackingCode }}
<ion-icon :icon="locateOutline" />
</ion-item>

<!-- TODO: add if check for shipping instructions, not added now just to check the UI -->
<ion-item color="light" lines="none">
<ion-item v-if="shipGroup.shippingInstructions" color="light" lines="none">
<ion-label class="ion-text-wrap">
<p class="overline">{{ translate("Handling Instructions") }}</p>
<p>{{ shipGroup.shippingInstructions ? shipGroup.shippingInstructions : 'Sample Handling instructions' }}</p>
<p>{{ shipGroup.shippingInstructions }}</p>
</ion-label>
</ion-item>

Expand Down Expand Up @@ -214,6 +214,9 @@ import {
IonBackButton,
IonButton,
IonCard,
IonCardHeader,
IonCardSubtitle,
IonCardTitle,
IonChip,
IonContent,
IonHeader,
Expand Down Expand Up @@ -279,6 +282,9 @@ export default defineComponent({
IonButton,
IonCard,
IonChip,
IonCardHeader,
IonCardSubtitle,
IonCardTitle,
IonContent,
IonHeader,
IonIcon,
Expand Down Expand Up @@ -318,13 +324,11 @@ export default defineComponent({
picklists: [] as any,
addingBoxForOrderIds: [] as any,
defaultShipmentBoxType: '',
itemsIssueSegmentSelected: [] as any,
shipGroups: [] as any
itemsIssueSegmentSelected: [] as any
}
},
async ionViewDidEnter() {
this.orderCategory = getOrderCategory(this.order.items[0])
this.shipGroups = await this.store.dispatch('order/fetchShipGroupForOrder', this.order.orderId) as any;
},
methods: {
async openShipmentBoxPopover(ev: Event, item: any, order: any) {
Expand Down

0 comments on commit 175ec28

Please sign in to comment.