270
270
</ion-label >
271
271
</ion-item >
272
272
273
- <ion-item lines =" none" v-for =" item in shipGroup.items" :key =" item" >
273
+ <ion-item lines =" none" v-for =" item in shipGroup? .items" :key =" item" >
274
274
<ion-thumbnail slot =" start" >
275
275
<DxpShopifyImg :src =" getProduct(item.productId).mainImageUrl" size =" small" />
276
276
</ion-thumbnail >
305
305
</ion-fab >
306
306
<ion-fab v-else-if =" orderType === 'packed' && order?.orderId" class =" ion-hide-md-up" vertical =" bottom" horizontal =" end" slot =" fixed" >
307
307
<ion-fab-button :disabled =" !hasPermission(Actions.APP_ORDER_UPDATE) || order.handovered || order.shipped || order.cancelled" @click =" deliverShipment(order)" >
308
- <ion-icon :icon =" order.part?.shipmentMethodEnum?.shipmentMethodEnumId === 'STOREPICKUP' ? accessibilityOutline : checkmarkOutline " />
308
+ <ion-icon :icon =" checkmarkDoneOutline " />
309
309
</ion-fab-button >
310
310
</ion-fab >
311
311
</ion-content >
@@ -345,15 +345,13 @@ import {
345
345
import { computed , defineComponent } from " vue" ;
346
346
import { mapGetters , useStore } from " vuex" ;
347
347
import {
348
- accessibilityOutline ,
349
348
callOutline ,
350
349
cashOutline ,
351
350
copyOutline ,
352
351
closeOutline ,
353
352
closeCircleOutline ,
354
353
checkmarkCircleOutline ,
355
354
checkmarkDoneOutline ,
356
- checkmarkOutline ,
357
355
cubeOutline ,
358
356
giftOutline ,
359
357
informationCircleOutline ,
@@ -478,9 +476,31 @@ export default defineComponent({
478
476
return assignPickerModal .present ();
479
477
},
480
478
async deliverShipment(order : any ) {
481
- await this .store .dispatch (' order/deliverShipment' , order )
482
- // Update the order timeline once the order is delivered/handovered
483
- this .prepareOrderTimeline ();
479
+ const pickup = order .part ?.shipmentMethodEnum ?.shipmentMethodEnumId === ' STOREPICKUP' ;
480
+ const header = pickup ? translate (" Handover" ) : translate (" Ship" );
481
+ const message = pickup ? translate (" Verify that the items in the package are valid and the customer has received their order. Once the order is handed over to the customer it cannot be undone." , { space: ' <br/><br/>' }) : ' ' ;
482
+
483
+ const alert = await alertController
484
+ .create ({
485
+ header ,
486
+ message ,
487
+ buttons: [{
488
+ text: translate (' Cancel' ),
489
+ role: ' cancel'
490
+ }, {
491
+ text: translate (header ),
492
+ handler : async () => {
493
+ await this .store .dispatch (' order/deliverShipment' , order ).then ((resp : any ) => {
494
+ if (! hasError (resp )) {
495
+ // Update order timeline once the order is completed
496
+ // Sending statusId explicitly as we do not fetch the order info again on handover
497
+ this .prepareOrderTimeline ({ statusId: " ORDER_COMPLETED" });
498
+ }
499
+ })
500
+ }
501
+ }]
502
+ });
503
+ return alert .present ();
484
504
},
485
505
async openOrderItemRejHistoryModal() {
486
506
const orderItemRejHistoryModal = await modalController .create ({
@@ -1005,13 +1025,16 @@ export default defineComponent({
1005
1025
return a [sortOnField ] - b [sortOnField ]
1006
1026
})
1007
1027
},
1008
- async prepareOrderTimeline() {
1028
+ async prepareOrderTimeline(paramsToUpdate ? : any ) {
1009
1029
const timeline = []
1010
1030
1011
1031
const {orderRouteSegment, shipmentStatusInfo} = await this .fetchOrderRouteSegmentInfo ();
1012
1032
1013
1033
// Get order status using utility method
1014
- this .orderStatus = this .getOrderStatus (this .order , this .order .part , orderRouteSegment )
1034
+ this .orderStatus = this .getOrderStatus ({
1035
+ ... this .order ,
1036
+ ... paramsToUpdate
1037
+ }, this .order .part , orderRouteSegment )
1015
1038
1016
1039
let orderChangeHistory = await this .fetchOrderChangeHistory ();
1017
1040
const orderPickupEmailCommnicationEvent = await this .fetchOrderCommunicationEvent ();
@@ -1186,9 +1209,9 @@ export default defineComponent({
1186
1209
1187
1210
if (this .orderType === " packed" ) {
1188
1211
this .fetchJobs ();
1189
- this .hasCancelledItems = this .order .part .items .some ((item : any ) => item .cancelReason );
1212
+ this .hasCancelledItems = this .order .part ? .items .some ((item : any ) => item .cancelReason );
1190
1213
} else if (this .orderType === " open" ) {
1191
- this .hasRejectedItems = this .order .part .items .some ((item : any ) => item .rejectReason );
1214
+ this .hasRejectedItems = this .order .part ? .items .some ((item : any ) => item .rejectReason );
1192
1215
}
1193
1216
1194
1217
await this .prepareOrderTimeline ();
@@ -1205,7 +1228,6 @@ export default defineComponent({
1205
1228
1206
1229
return {
1207
1230
Actions ,
1208
- accessibilityOutline ,
1209
1231
bagCheckOutline ,
1210
1232
bagHandleOutline ,
1211
1233
bagRemoveOutline ,
@@ -1218,7 +1240,6 @@ export default defineComponent({
1218
1240
closeOutline ,
1219
1241
checkmarkCircleOutline ,
1220
1242
checkmarkDoneOutline ,
1221
- checkmarkOutline ,
1222
1243
chevronUpOutline ,
1223
1244
cubeOutline ,
1224
1245
currentFacility ,
0 commit comments