Skip to content

Commit

Permalink
Improved: condition for bulk ship button on completed page(hotwax#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymaheshwari1 committed Oct 30, 2023
1 parent 74ae56b commit 68a51e0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/views/Completed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</ion-item>
</div>
<div class="results">
<ion-button :disabled="!hasPermission(Actions.APP_FORCE_SHIP_ORDER)" expand="block" class="bulk-action desktop-only" fill="outline" size="large" @click="bulkShipOrders()">{{ translate("Ship") }}</ion-button>
<ion-button :disabled="!hasAnyPackedShipment() || hasAnyMissingInfo() || (hasAnyShipmentTrackingInfoMissing() && !hasPermission(Actions.APP_FORCE_SHIP_ORDER))" expand="block" class="bulk-action desktop-only" fill="outline" size="large" @click="bulkShipOrders()">{{ translate("Ship") }}</ion-button>
<ion-card class="order" v-for="(order, index) in getCompletedOrders()" :key="index">
<div class="order-header">
<div class="order-primary-info">
Expand Down Expand Up @@ -125,7 +125,7 @@
</div>
</div>
<ion-fab v-if="completedOrders.total" class="mobile-only" vertical="bottom" horizontal="end" slot="fixed">
<ion-fab-button :disabled="!hasAnyPackedShipment() || hasAnyMissingInfo() || !hasPermission(Actions.APP_FORCE_SHIP_ORDER)" @click="bulkShipOrders()">
<ion-fab-button :disabled="!hasAnyPackedShipment() || hasAnyMissingInfo() || (hasAnyShipmentTrackingInfoMissing() && !hasPermission(Actions.APP_FORCE_SHIP_ORDER))" @click="bulkShipOrders()">
<ion-icon :icon="checkmarkDoneOutline" />
</ion-fab-button>
</ion-fab>
Expand Down Expand Up @@ -626,11 +626,12 @@ export default defineComponent({
this.store.dispatch('stock/fetchStock', { productId })
},
isTrackingRequiredForAnyShipmentPackage(order: any) {
if (!order.shipmentPackages) {
return false
}
return order.shipmentPackages.some((shipmentPackage: any) => shipmentPackage.isTrackingRequired === 'Y')
return order.shipmentPackages?.some((shipmentPackage: any) => shipmentPackage.isTrackingRequired === 'Y')
},
hasAnyShipmentTrackingInfoMissing() {
return this.completedOrders.list.some((order: any) => {
return (order.shipmentPackages && order.shipmentPackages.some((shipmentPackage: any) => shipmentPackage.isTrackingRequired === 'Y')) && order.missingLabelImage;
})
}
},
setup() {
Expand Down

0 comments on commit 68a51e0

Please sign in to comment.