From 5d22fad753b6f60a27d831ebad3570231fe14345 Mon Sep 17 00:00:00 2001 From: kj1352 Date: Sat, 26 Oct 2019 11:13:14 +0530 Subject: [PATCH] cart page UI changes --- src/app/cart/cart.page.html | 40 ++++++++++++++----------------------- src/app/cart/cart.page.scss | 23 ++++++++++++++++----- src/app/cart/cart.page.ts | 19 +++++++++++++++--- 3 files changed, 49 insertions(+), 33 deletions(-) diff --git a/src/app/cart/cart.page.html b/src/app/cart/cart.page.html index ea4da37..43f01b6 100644 --- a/src/app/cart/cart.page.html +++ b/src/app/cart/cart.page.html @@ -16,19 +16,23 @@
@@ -145,11 +140,6 @@ -
- -
{{ getItemCount(item.id) }}
- -
diff --git a/src/app/cart/cart.page.scss b/src/app/cart/cart.page.scss index dbc95b0..c50d417 100644 --- a/src/app/cart/cart.page.scss +++ b/src/app/cart/cart.page.scss @@ -90,12 +90,10 @@ ul { .cart-item-list { width: 90%; margin: 0 auto; - padding-bottom: 15px; border-bottom: 1px solid #efefef; .cart-item { display: none; - margin-top: 20px; &.show { display: block; @@ -109,12 +107,14 @@ ul { justify-content: space-between; font-weight: bold; color: dimgrey; + width: 95%; + margin: 0 auto; &.outlet { background-color: #efefef; color: var(--brand-grey); - margin-bottom: -10px; padding: 5px 10px; + width: 100%; } ion-button { @@ -133,7 +133,13 @@ ul { font-size: 10px; margin: 0; height: 25px; - margin-top: 10px; + margin-top: 0px; + margin-bottom: 10px; + display: none; + + &.show { + display: inline-block; + } } } @@ -141,12 +147,19 @@ ul { color: var(--brand-dark-grey); font-size: 12px; font-weight: 500; + width: 95%; + margin: 0 auto; + padding: 7px 0; li { display: flex; justify-content: space-between; align-items: center; - margin: 1px auto; + width: 100%; + + &.hidden { + display: none; + } } ion-button { diff --git a/src/app/cart/cart.page.ts b/src/app/cart/cart.page.ts index 37d6bb1..e64c72a 100644 --- a/src/app/cart/cart.page.ts +++ b/src/app/cart/cart.page.ts @@ -59,7 +59,7 @@ export class CartPage implements OnInit { this.cartService.getAllCartItems().then((cart_items: Array) => { this.cart_items = cart_items; - let i: number, j: number; + let i: number; for (i = 0; i < this.cart_items.length; i += 1) { let mall = this.all_malls.find(mall => mall.id === this.cart_items[i].mall_id); @@ -76,6 +76,19 @@ export class CartPage implements OnInit { }); } + isMaxDeliveryTime(outlet_id: string) { + let pricing = this.cart_items.filter((item => item.outlet_id === outlet_id)); + if (pricing.length > 0) { + let max = pricing.reduce((prev, current) => { + return (prev.pickup_time > current.pickup_time) ? prev : current + }); + return max; + } else { + return 0; + } + + } + openInstantMenu(item: any) { this.instant_menu = true; this.mallService.getMallByID(item.mall_id).then((data: IMall) => { @@ -107,8 +120,7 @@ export class CartPage implements OnInit { } decreaseCartItemCount(item: any) { - console.log(item); - let i: number, cart_items; + let i: number, cart_items : any; for (i = 0; i < this.cart_items.length; i += 1) { if (this.cart_items[i].menu_item === item.menu_item) { this.cart_items[i].quantity -= 1; @@ -238,6 +250,7 @@ export class CartPage implements OnInit { this.orderService.createOrder(this.cart_items, calculated_total, this.selected_promocode).then(() => { this.presentToast('Order has been created! :-)', 'dark'); this.cartService.clearCartItems(); + document.querySelector('.menu-icon-holder').classList.remove('hide'); this.router.navigate(['/profile']); }, () => { this.presentToast('Failed to create the order, We\'re sorry for the inconvenience', 'danger');