Skip to content

Commit

Permalink
Merge pull request #787 from amansinghbais/#786
Browse files Browse the repository at this point in the history
Fixed: issue revolving around the void label state management (#786)
  • Loading branch information
ravilodhi authored Sep 25, 2024
2 parents e404388 + 6583f17 commit 4979ddd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/services/OrderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ const fetchShipmentPackages = async (shipmentIds: Array<string>, isTrackingRequi
if(!isTrackingRequired) {
trackingCodeFilters = {
"trackingCode_op": "empty",
"trackingCode_grp": "1",
"fetchShipmentPackages_op": "SHRSCS_VOIDED",
"fetchShipmentPackages_grp": "2"
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/order/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ const actions: ActionTree<OrderState, RootState> = {
}, []);

// If there is any shipment package with missing tracking code, retry shipping label
const missingLabelImage = this.state.util.productStoreShipmentMethCount > 0 ? currentShipmentPackages.some((shipmentPackage:any) => shipmentPackage.trackingCode === null) : false;
const missingLabelImage = this.state.util.productStoreShipmentMethCount > 0 ? currentShipmentPackages.some((shipmentPackage:any) => shipmentPackage.trackingCode === null || shipmentPackage.trackingCode === '') : false;

return {
...order,
Expand Down
11 changes: 10 additions & 1 deletion src/store/modules/orderLookup/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ const actions: ActionTree<OrderLookupState, RootState> = {
return orderSegmentInfo
}, {}) : []

let orderShipmentPackages = []
let orderShipmentPackages = [] as any
const shipmentIds = Object.values(orderRouteSegmentInfo).flatMap((routes: any) => routes.map((route: any) => route.shipmentId));

try {
Expand All @@ -359,6 +359,15 @@ const actions: ActionTree<OrderLookupState, RootState> = {
return shipment;
}, {});

Object.values(orderRouteSegmentInfo).map((segments: any) => {
segments.map((segment: any) => {
const currentPackage = orderShipmentPackages.find((shipmentPackage: any) => shipmentPackage.shipmentId === segment.shipmentId)
if(currentPackage && currentPackage.carrierServiceStatusId === "SHRSCS_VOIDED") {
segment.trackingIdNumber = ""
}
})
})

order["shipmentPackages"] = shipmentPackages;
const carrierPartyIds = [] as any;

Expand Down
12 changes: 2 additions & 10 deletions src/views/OrderLookupDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
<p v-if="shipGroups[0].facilityId !== '_NA_'">{{ getShipmentMethodDesc(shipGroups[0].shipmentMethodTypeId) || shipGroups[0].shipmentMethodTypeId }}</p>
</ion-label>
<ion-label slot="end" v-if="shipGroups[0].trackingIdNumber">{{ translate("Tracking Code") }}{{ ":" }} {{ shipGroups[0].trackingIdNumber }}</ion-label>
<ion-button :disabled="order.hasMissingInfo" slot="end" fill="clear" color="medium" @click="shippingLabelActionPopover($event, shipGroups[0])" v-if="shipGroups[0].trackingIdNumber && isEligibleForVoiding(shipGroups[0])">
<ion-button :disabled="order.hasMissingInfo" slot="end" fill="clear" color="medium" @click="shippingLabelActionPopover($event, shipGroups[0])" v-if="shipGroups[0].trackingIdNumber">
<ion-icon slot="icon-only" :icon="ellipsisVerticalOutline" />
</ion-button>
</ion-item>
Expand Down Expand Up @@ -270,18 +270,14 @@ import {
IonThumbnail,
IonTitle,
IonToolbar,
alertController,
popoverController
} from "@ionic/vue";
import { defineComponent } from "vue";
import { translate } from '@hotwax/dxp-components';
import { cubeOutline, golfOutline, callOutline, cashOutline, closeCircleOutline, ellipsisVerticalOutline, informationCircleOutline, ribbonOutline, mailOutline, ticketOutline, timeOutline, pulseOutline, storefrontOutline, sunnyOutline, checkmarkDoneOutline, downloadOutline } from "ionicons/icons";
import { mapGetters, useStore } from "vuex";
import { DateTime } from "luxon";
import { formatCurrency, getColorByDesc, showToast } from "@/utils"
import { OrderService } from "@/services/OrderService";
import { hasError } from "@/adapter";
import logger from "@/logger";
import { formatCurrency, getColorByDesc } from "@/utils"
import OrderLookupLabelActionsPopover from '@/components/OrderLookupLabelActionsPopover.vue';
export default defineComponent({
Expand Down Expand Up @@ -351,10 +347,6 @@ export default defineComponent({
await this.store.dispatch('stock/fetchStock', { productId, facilityId })
this.isFetchingStock = false
},
isEligibleForVoiding(shipGroup: any) {
const twentyFourHoursInMillis = 24 * 60 * 60 * 1000; // 24 hours in milliseconds
return (DateTime.now().toMillis() - shipGroup.orderDate >= twentyFourHoursInMillis);
},
async shippingLabelActionPopover(ev: Event, shipGroup: any) {
const popover = await popoverController.create({
component: OrderLookupLabelActionsPopover,
Expand Down

0 comments on commit 4979ddd

Please sign in to comment.