Skip to content

Commit

Permalink
Improved: support to not show box type change popover when types are …
Browse files Browse the repository at this point in the history
…not available(#221)
  • Loading branch information
ymaheshwari1 committed Oct 12, 2023
1 parent ccee56a commit a1dd6d0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/views/InProgress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
<div class="box-type desktop-only" v-else-if="order.shipmentPackages">
<ion-button :disabled="addingBoxForOrderIds.includes(order.orderId)" @click="addShipmentBox(order)" fill="outline" shape="round" size="small"><ion-icon :icon="addOutline" />{{ $t("Add Box") }}</ion-button>
<ion-row>
<ion-chip v-for="shipmentPackage in order.shipmentPackages" v-show="shipmentPackage.shipmentBoxTypes.length" :key="shipmentPackage.shipmentId" @click="updateShipmentBoxType(shipmentPackage, order, $event)">
{{ `Box ${shipmentPackage?.packageName}` }} | {{ boxTypeDesc(getShipmentPackageType(shipmentPackage)) }}
<ion-chip v-for="shipmentPackage in order.shipmentPackages" :key="shipmentPackage.shipmentId" @click="updateShipmentBoxType(shipmentPackage, order, $event)">
{{ `Box ${shipmentPackage?.packageName}` }} {{ shipmentPackage.shipmentBoxTypes.length ? `| ${boxTypeDesc(getShipmentPackageType(shipmentPackage))}` : '' }}
<ion-icon :icon="caretDownOutline" />
</ion-chip>
</ion-row>
Expand Down Expand Up @@ -912,6 +912,12 @@ export default defineComponent({
},
async updateShipmentBoxType(shipmentPackage: any, order: any, ev: CustomEvent) {
// Don't open popover when not having shipmentBoxTypes available
if(!shipmentPackage.shipmentBoxTypes.length) {
console.error('Failed to fetch shipment box types')
return;
}
const popover = await popoverController.create({
component: ShipmentBoxTypePopover,
event: ev,
Expand Down

0 comments on commit a1dd6d0

Please sign in to comment.