Rev=move order when last Item is deleted

This commit is contained in:
Rene V. Vergara A. 2022-08-01 19:41:47 -05:00
parent 2daf62e8f3
commit 75cc66dfef

View file

@ -124,7 +124,7 @@ export class OrderComponent implements OnInit{
this.notifierService
.showNotification("Order successfully cancelled!",
"Close","success");
});;
});
} else {
console.log('Returning to page');
}
@ -227,6 +227,12 @@ export class OrderComponent implements OnInit{
// + " => (" + item.name +")");
this.orderService.updateOrder(item.line_id,lines);
this.orderService.getOrder();
if ( this.order.lines.length == 0 ) {
this.orderService.cancelOrder(this.order._id!)
.subscribe((response) => {
this.orderService.getOrder();
});
}
} else {
console.log('Returning to order');