From 75cc66dfef54df240528e52532ec4b350a1dbd22 Mon Sep 17 00:00:00 2001 From: Rene Vergara A Date: Mon, 1 Aug 2022 19:41:47 -0500 Subject: [PATCH] Rev=move order when last Item is deleted --- src/app/order/order.component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/order/order.component.ts b/src/app/order/order.component.ts index 3b408c6..6f74da7 100644 --- a/src/app/order/order.component.ts +++ b/src/app/order/order.component.ts @@ -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');