| @@ -1,79 +1,2 @@ | |||
| <ion-content> | |||
| <div class="header-bar active"> | |||
| <div class="heading-holder"> | |||
| <button (click)="back()"> <ion-icon name="arrow-back"></ion-icon> </button> | |||
| <h3> Bookmarks </h3> | |||
| </div> | |||
| </div> | |||
| <div class="tabs-holder" [ngClass]="{ 'right' : selected_tab === 'outlets' }"> | |||
| <button class="tab" [ngClass]="{ 'active' : selected_tab === 'malls' }" | |||
| (click)="selected_tab = 'malls'"> MALLS </button> | |||
| <button class="tab" [ngClass]="{ 'active' : selected_tab === 'outlets' }" | |||
| (click)="selected_tab = 'outlets'"> OUTLETS </button> | |||
| </div> | |||
| <div *ngIf="selected_tab === 'malls'"> | |||
| <div class="results-utilities-holder"> | |||
| <h5 *ngIf="malls"> {{ bookmarked_malls }} MALLS </h5> | |||
| </div> | |||
| <ion-list lines="none" class="result-list"> | |||
| <ion-item *ngFor="let mall of malls" (click)="showMallDetails(mall)" [ngClass]="{'show' : mall.is_bookmarked }"> | |||
| <img src="{{ mall.image_url }}" slot="start"> | |||
| <ion-label> | |||
| <h3> {{ mall.name }} <ion-icon name="bookmark" [ngClass]="{'active' : mall.is_bookmarked }"></ion-icon> </h3> | |||
| <p class="description"> {{ mall.description }} </p> | |||
| <div class="offers-holder"> | |||
| <div class="offer"> | |||
| <ion-icon src="assets/custom/restaurant.svg"></ion-icon> | |||
| Food Offers: <strong> {{ mall.offers.length }} </strong> | |||
| </div> | |||
| <div class="offer"> | |||
| <ion-icon src="assets/custom/shopping-purse-icon.svg"></ion-icon> | |||
| Shopping Offers: <strong> {{ mall.offers.length }} </strong> | |||
| </div> | |||
| </div> | |||
| </ion-label> | |||
| </ion-item> | |||
| </ion-list> | |||
| </div> | |||
| <div *ngIf="selected_tab === 'outlets'"> | |||
| <div class="results-utilities-holder"> | |||
| <h5 *ngIf="malls"> {{ bookmarked_outlets }} OUTLETS </h5> | |||
| </div> | |||
| <ion-list lines="none" class="result-list"> | |||
| <div *ngFor="let mall of malls"> | |||
| <ion-item *ngFor="let outlet of mall.outlets" [ngClass]="{'show' : outlet.is_bookmarked }" | |||
| (click)="outletDetails(mall.id, outlet.id)"> | |||
| <img src="{{ outlet.image_url }}" slot="start"> | |||
| <ion-label> | |||
| <h3> | |||
| {{ outlet.name }} | |||
| <div class="rating-holder"> | |||
| <ion-icon name="star"></ion-icon> {{ outlet.rating }} | |||
| </div> | |||
| <ion-icon name="bookmark" [ngClass]="{'active' : outlet.is_bookmarked }"></ion-icon> | |||
| </h3> | |||
| <p class="description"> | |||
| {{ outlet.description }} | |||
| <button class="share-button"> | |||
| <ion-icon name="share"></ion-icon> | |||
| </button> | |||
| </p> | |||
| <div class="offers-holder"> | |||
| <div class="offer"> | |||
| <span *ngIf="outlet.outlet_type === 'FOOD'"> <ion-icon name="restaurant"></ion-icon> Food </span> | |||
| <span *ngIf="outlet.outlet_type === 'SHOP'"> <ion-icon name="basket"></ion-icon> Shopping </span> | |||
| Offers: <strong> {{ outlet.offers.length }} </strong> | |||
| </div> | |||
| </div> | |||
| </ion-label> | |||
| </ion-item> | |||
| </div> | |||
| </ion-list> | |||
| </div> | |||
| </ion-content> | |||
| @@ -1,8 +1,6 @@ | |||
| import { Component, OnInit } from '@angular/core'; | |||
| import { Router } from '@angular/router'; | |||
| import { Location } from '@angular/common'; | |||
| import { IMall } from '../models/mall'; | |||
| import { MallService } from '../services/mall.service'; | |||
| @Component({ | |||
| selector: 'app-bookmark', | |||
| @@ -10,52 +8,21 @@ import { MallService } from '../services/mall.service'; | |||
| styleUrls: ['./bookmark.page.scss'], | |||
| }) | |||
| export class BookmarkPage implements OnInit { | |||
| selected_tab: string = 'malls'; | |||
| malls: Array<IMall> = []; | |||
| bookmarked_malls: number = 0; | |||
| bookmarked_outlets: number = 0; | |||
| constructor( | |||
| private router: Router, | |||
| private location: Location, | |||
| private mallService: MallService, | |||
| ) { } | |||
| ngOnInit() { | |||
| } | |||
| ionViewDidEnter() { | |||
| this.bookmarked_outlets = 0; | |||
| this.mallService.getAllMalls().then((data: Array<IMall>) => { | |||
| this.malls = data; | |||
| this.bookmarked_malls = this.malls.filter((mall => { | |||
| return mall.is_bookmarked; | |||
| })).length; | |||
| let i: number, j: number; | |||
| for (i = 0; i < this.malls.length; i += 1) { | |||
| for (j = 0; j < this.malls[i].outlets.length; j += 1) { | |||
| if (this.malls[i].outlets[j].is_bookmarked) { | |||
| this.bookmarked_outlets += 1; | |||
| } | |||
| } | |||
| } | |||
| }); | |||
| } | |||
| back() { | |||
| this.location.back(); | |||
| } | |||
| showMallDetails(mall: IMall) { | |||
| this.router.navigate(['/mall-details', { mall_id: mall.id }]); | |||
| } | |||
| outletDetails(mall_id: string, outlet_id: string) { | |||
| this.router.navigate(['/outlet-details', { mall_id: mall_id, outlet_id: outlet_id }]); | |||
| } | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| <ion-content> | |||
| <!-- <ion-content> | |||
| <div class="header-bar"> | |||
| <div class="heading-holder"> | |||
| <button (click)="back()"> <ion-icon name="arrow-back"></ion-icon> </button> | |||
| @@ -146,4 +146,4 @@ | |||
| </section> | |||
| </div> | |||
| </ion-content> | |||
| </ion-content> --> | |||
| @@ -1,12 +1,8 @@ | |||
| import { Component, OnInit } from '@angular/core'; | |||
| import { Location } from '@angular/common'; | |||
| import CartItem from '../models/cart-item'; | |||
| import { CartItemService } from '../services/cart-item.service'; | |||
| import { MallService } from '../services/mall.service'; | |||
| import { IMall } from '../models/mall'; | |||
| import * as moment from 'moment'; | |||
| import { Router } from '@angular/router'; | |||
| import { IOutlet } from '../models/outlet'; | |||
| import { OrderService } from '../services/order.service'; | |||
| import { ToastController } from '@ionic/angular'; | |||
| @@ -16,20 +12,6 @@ import { ToastController } from '@ionic/angular'; | |||
| styleUrls: ['./cart.page.scss'], | |||
| }) | |||
| export class CartPage implements OnInit { | |||
| show_order_details: boolean = false; | |||
| cart_items: any = []; | |||
| all_malls: Array<IMall> = []; | |||
| total_cart_amount: number = 0; | |||
| show_promocodes: boolean = false; | |||
| selected_promocode: string = ''; | |||
| total_savings: number = 0; | |||
| temp_outlet_details: IOutlet; | |||
| instant_menu: boolean = false; | |||
| mall_details: IMall; | |||
| outlet_details: IOutlet; | |||
| new_pickup_time: Date; | |||
| cart_outlets: any = []; | |||
| constructor( | |||
| private location: Location, | |||
| private cartService: CartItemService, | |||
| @@ -41,235 +23,4 @@ export class CartPage implements OnInit { | |||
| ngOnInit() {} | |||
| ionViewDidEnter() { | |||
| document.querySelector('.menu-icon-holder').classList.add('hide'); | |||
| this.refresh(); | |||
| } | |||
| refresh() { | |||
| this.show_order_details = false; | |||
| this.cart_items = []; | |||
| this.all_malls= []; | |||
| this.total_cart_amount = 0; | |||
| this.mallService.getAllMalls().then((malls: Array<IMall>) => { | |||
| this.all_malls = malls; | |||
| }); | |||
| this.cartService.getAllCartItems().then((cart_items: Array<CartItem>) => { | |||
| this.cart_items = cart_items; | |||
| 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); | |||
| let outlet = mall.outlets.find(outlet => outlet.id === this.cart_items[i].outlet_id); | |||
| this.cart_items[i].menu_details = outlet.menu_items.find(item => item.id === this.cart_items[i].menu_item); | |||
| this.total_cart_amount += this.cart_items[i].total_price; | |||
| if (this.cart_outlets.filter((cart_outlet: any) => cart_outlet.id === this.cart_items[i].outlet_id).length === 0) { | |||
| this.cart_outlets.push({id: this.cart_items[i].outlet_id, name: outlet.name}); | |||
| } | |||
| } | |||
| console.log(this.cart_outlets); | |||
| }); | |||
| } | |||
| 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) => { | |||
| this.mall_details = data; | |||
| this.outlet_details = this.mall_details.outlets.find((outlet) => outlet.id === item.outlet_id); | |||
| this.temp_outlet_details = JSON.parse(JSON.stringify(this.outlet_details)); | |||
| }); | |||
| } | |||
| ngOnDestroy() { | |||
| document.querySelector('.menu-icon-holder').classList.remove('hide'); | |||
| } | |||
| increaseCartItemCount(item: any) { | |||
| 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; | |||
| this.cart_items[i].total_price = this.calculateDiscount(item.menu_details.price, item.menu_details.discount) * this.cart_items[i].quantity; | |||
| this.total_cart_amount = this.total_cart_amount + this.calculateDiscount(item.menu_details.price, item.menu_details.discount); | |||
| } | |||
| } | |||
| cart_items = JSON.parse(JSON.stringify(this.cart_items)); | |||
| for (i = 0; i < cart_items.length; i += 1) { | |||
| delete cart_items[i]['menu_details']; | |||
| } | |||
| this.calculateTotalAfterPromo(); | |||
| this.cartService.updateCartItems(cart_items); | |||
| } | |||
| decreaseCartItemCount(item: any) { | |||
| 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; | |||
| this.cart_items[i].total_price = this.calculateDiscount(item.menu_details.price, item.menu_details.discount) * this.cart_items[i].quantity; | |||
| this.total_cart_amount = this.total_cart_amount - this.calculateDiscount(item.menu_details.price, item.menu_details.discount); | |||
| if (this.cart_items[i].quantity === 0) { | |||
| this.cart_items.splice(i, 1); | |||
| } | |||
| } | |||
| } | |||
| cart_items = JSON.parse(JSON.stringify(this.cart_items)); | |||
| for (i = 0; i < cart_items.length; i += 1) { | |||
| delete cart_items[i]['menu_details']; | |||
| } | |||
| this.calculateTotalAfterPromo(); | |||
| this.cartService.updateCartItems(cart_items); | |||
| } | |||
| getPickupTimeFormat(date: Date) { | |||
| return moment(date).calendar(); | |||
| } | |||
| back() { | |||
| this.location.back(); | |||
| } | |||
| goToOutlet(mall_id: string, outlet_id: string) { | |||
| this.router.navigate(['/outlet-details', { mall_id: mall_id, outlet_id: outlet_id }]); | |||
| } | |||
| calculateDiscount(price: number, discount: number) { | |||
| return price - (price * discount / 100); | |||
| } | |||
| calculateTotalAfterPromo() { | |||
| switch(this.selected_promocode) { | |||
| case 'SAVE100': | |||
| if (this.total_cart_amount > 100) { | |||
| this.total_cart_amount = this.total_cart_amount - 100; | |||
| this.total_savings = 100; | |||
| } | |||
| break; | |||
| case 'SAVE10PER': this.total_cart_amount = this.total_cart_amount - ((this.total_cart_amount * 10) / 100); | |||
| this.total_savings = (this.total_cart_amount * 10) / 100; | |||
| break; | |||
| } | |||
| } | |||
| removePromocode() { | |||
| this.total_savings = 0; | |||
| this.total_cart_amount = 0; | |||
| this.selected_promocode = ''; | |||
| 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); | |||
| let outlet = mall.outlets.find(outlet => outlet.id === this.cart_items[i].outlet_id); | |||
| this.cart_items[i].menu_details = outlet.menu_items.find(item => item.id === this.cart_items[i].menu_item); | |||
| this.total_cart_amount += this.cart_items[i].total_price; | |||
| } | |||
| } | |||
| checkIfPresentInCart(id: string) { | |||
| let i: number; | |||
| for (i = 0; i < this.cart_items.length; i += 1) { | |||
| if (this.cart_items[i].menu_item === id) { | |||
| return true; | |||
| } | |||
| } | |||
| return false; | |||
| } | |||
| getItemCount(id: string) { | |||
| let i: number; | |||
| for (i = 0; i < this.cart_items.length; i += 1) { | |||
| if (this.cart_items[i].menu_item === id) { | |||
| return this.cart_items[i].quantity; | |||
| } | |||
| } | |||
| return 0; | |||
| } | |||
| addToCart(item: any) { | |||
| this.cart_items.push({ | |||
| menu_item: item.id, | |||
| quantity: 1, | |||
| pickup_time: new Date(new Date().setMinutes(new Date().getMinutes() + item.wait_duration)), | |||
| outlet_id: this.outlet_details.id, | |||
| mall_id: this.mall_details.id, | |||
| take_away: true, | |||
| total_price: this.calculateDiscount(item.price, item.discount) | |||
| }); | |||
| this.cartService.updateCartItems(this.cart_items).then(() => { | |||
| this.refresh(); | |||
| }); | |||
| } | |||
| decreaseInstantCartItemCount(item: any) { | |||
| let i: number; | |||
| for (i = 0; i < this.cart_items.length; i += 1) { | |||
| if (this.cart_items[i].menu_item === item.id) { | |||
| this.cart_items[i].quantity -= 1; | |||
| this.cart_items[i].total_price = this.calculateDiscount(item.price, item.discount) * this.cart_items[i].quantity; | |||
| if (this.cart_items[i].quantity === 0) { | |||
| this.cart_items.splice(i, 1); | |||
| } | |||
| } | |||
| } | |||
| this.cartService.updateCartItems(this.cart_items); | |||
| } | |||
| increaseInstantCartItemCount(item: any) { | |||
| let i: number; | |||
| for (i = 0; i < this.cart_items.length; i += 1) { | |||
| if (this.cart_items[i].menu_item === item.id) { | |||
| this.cart_items[i].quantity += 1; | |||
| this.cart_items[i].total_price = this.calculateDiscount(item.price, item.discount) * this.cart_items[i].quantity; | |||
| } | |||
| } | |||
| this.cartService.updateCartItems(this.cart_items); | |||
| } | |||
| placeOrder() { | |||
| let calculated_total = (this.total_cart_amount + 20) + ((this.total_cart_amount + 20) * (18 / 100)); | |||
| 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'); | |||
| }); | |||
| } | |||
| async presentToast(text: string, color: string) { | |||
| const toast = await this.toastController.create({ | |||
| message: text, | |||
| position: 'bottom', | |||
| duration: 4000, | |||
| color: color, | |||
| buttons: [ | |||
| { | |||
| text: 'Done', | |||
| } | |||
| ] | |||
| }); | |||
| toast.present(); | |||
| } | |||
| } | |||
| @@ -22,7 +22,6 @@ export class MallDetailsPage implements OnInit { | |||
| ngOnInit() { | |||
| this.mallDetails = JSON.parse(this.route.snapshot.paramMap.get('mall')); | |||
| console.log(this.mallDetails); | |||
| } | |||
| back() { | |||
| @@ -38,7 +37,10 @@ export class MallDetailsPage implements OnInit { | |||
| } | |||
| outletDetails(outlet: any) { | |||
| this.router.navigate(['/outlet-details', { outlet: JSON.stringify(outlet) }]); | |||
| this.router.navigate(['/outlet-details', { | |||
| outlet: JSON.stringify(outlet), | |||
| mallId: this.mallDetails.mall.mall_id | |||
| }]); | |||
| } | |||
| sortBy(type: string) { | |||
| @@ -1,52 +0,0 @@ | |||
| import Mall from '../models/mall'; | |||
| import { OUTLETS } from './outlets'; | |||
| export const MALLS: Mall[] = [new Mall({ | |||
| id: '0001', | |||
| name: 'Gopalan Arcade Mall', | |||
| address: 'Mysore Road, Bangalore', | |||
| is_bookmarked: true, | |||
| is_archived: false, | |||
| image_url: 'https://www.gopalanmall.com/images/mall-arcade-01.jpg', | |||
| description: 'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', | |||
| outlets: OUTLETS.map((outlet) => outlet.id), | |||
| offers: [], | |||
| rating: 4.1, | |||
| distance: 2, | |||
| location: { | |||
| latitude: 12.903903292, | |||
| longitude: 34.940349039 | |||
| } | |||
| }), new Mall({ | |||
| id: '0002', | |||
| name: 'Gopalan Cinemas', | |||
| address: 'Kenchana Halli', | |||
| is_bookmarked: false, | |||
| is_archived: false, | |||
| image_url: 'https://www.gopalanmall.com/images/mall-arcade-01.jpg', | |||
| description: 'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', | |||
| outlets: [], | |||
| offers: [], | |||
| rating: 4.5, | |||
| distance: 2, | |||
| location: { | |||
| latitude: 12.903903292, | |||
| longitude: 34.940349039 | |||
| } | |||
| }), new Mall({ | |||
| id: '0003', | |||
| name: 'Gopalan Mall', | |||
| address: 'Mysore Road, Bangalore', | |||
| is_bookmarked: true, | |||
| is_archived: false, | |||
| image_url: 'https://www.gopalanmall.com/images/mall-arcade-01.jpg', | |||
| description: 'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', | |||
| outlets: [], | |||
| offers: [], | |||
| rating: 4.3, | |||
| distance: 2, | |||
| location: { | |||
| latitude: 12.903903292, | |||
| longitude: 34.940349039 | |||
| } | |||
| })]; | |||
| @@ -1,60 +0,0 @@ | |||
| import MenuItem from '../models/menu-item'; | |||
| export const MENU_ITEMS_1 = [new MenuItem({ | |||
| id: '0001', | |||
| name: 'McSpicy Paneer', | |||
| image_url: 'https://www.mcdonalds.com.my/images/nasi_lemak/burger/burger.jpg?id=bb965dd67df3afa52033', | |||
| description: 'the patties are very unique and is prepared mainly with mashed potatoes and green peas. the flagship mcaloo tikki recipe from McDonalds involves a special sauce which is basically a combination of tomato sauce and mayonnaise. aloo tikki burger recipe.', | |||
| is_vegeterian: true, | |||
| wait_duration: 10, | |||
| price: 120, | |||
| discount: 10, | |||
| rating: 4, | |||
| tags: ['burger', 'breakfast'] | |||
| }), new MenuItem({ | |||
| id: '0002', | |||
| name: 'McChicken Tikki', | |||
| image_url: 'https://www.mcdonalds.com.my/images/nasi_lemak/burger/burger.jpg?id=bb965dd67df3afa52033', | |||
| description: 'the patties are very unique and is prepared mainly with mashed potatoes and green peas. the flagship McChicken tikki recipe from McDonalds involves a special sauce which is basically a combination of tomato sauce and mayonnaise. Chicken Tikka burger recipe.', | |||
| is_vegeterian: false, | |||
| wait_duration: 20, | |||
| price: 180, | |||
| discount: 5, | |||
| rating: 4.5, | |||
| tags: ['burger', 'spicy', 'chicken'] | |||
| })]; | |||
| export const MENU_ITEMS_2 = [new MenuItem({ | |||
| id: '0004', | |||
| name: 'Margherita Pizza', | |||
| image_url: 'https://content3.jdmagicbox.com/comp/def_content_category/cafe-coffee-day/cafe-coffee-day-584-bbho1.jpg', | |||
| description: 'Cheese pizza topped with tomato sauce, garlic sauce and fresh basil.', | |||
| is_vegeterian: true, | |||
| wait_duration: 25, | |||
| price: 150, | |||
| discount: 0, | |||
| rating: 3.5, | |||
| tags: ['pizza', 'hot'] | |||
| }), new MenuItem({ | |||
| id: '0005', | |||
| name: 'Espresso Shot', | |||
| image_url: 'https://www.cafecoffeeday.com/sites/default/files/Espresso_0.jpg', | |||
| description: 'Coffee at its simplest best. Without milk, served with cold water on the side. We call it a simple big-shot.', | |||
| is_vegeterian: true, | |||
| wait_duration: 5, | |||
| price: 80, | |||
| discount: 0, | |||
| rating: 4.5, | |||
| tags: ['hot', 'beverage'] | |||
| }), new MenuItem({ | |||
| id: '0006', | |||
| name: 'The Coffee Gola', | |||
| image_url: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT7jlUBBFU3_3mUQuQ9Lol1uPs1ZkJkxqrdmSHEIIBtTODTB0nSew', | |||
| description: 'The perfect blend of coffee, almonds and a rich vanilla gola. Sure to give you an exotic kulfi experience.', | |||
| is_vegeterian: true, | |||
| wait_duration: 15, | |||
| price: 200, | |||
| discount: 10, | |||
| rating: 4.9, | |||
| tags: ['cold', 'beverage'] | |||
| })]; | |||
| @@ -1,8 +0,0 @@ | |||
| import Offer from '../models/offer'; | |||
| export const OFFERS = [new Offer({ | |||
| id: '0002', | |||
| name: 'McDonalds Offer', | |||
| description: 'Get 25% offer on you first meal', | |||
| coupon_code: 'MCD25F', | |||
| })]; | |||
| @@ -1,38 +0,0 @@ | |||
| import Outlet, { IOutlet, OutletType } from '../models/outlet'; | |||
| import { MENU_ITEMS_1, MENU_ITEMS_2 } from './menu-items'; | |||
| import { OFFERS } from './offers'; | |||
| export const OUTLETS: Outlet[] = [new Outlet({ | |||
| id: '0001', | |||
| image_url: 'https://images.markets.businessinsider.com/image/5a74835585cdd489228b47be-900/shutterstock643079686.jpg', | |||
| name: 'McDonalds', | |||
| description: 'Veg / Non-Veg Food Restaurant, Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', | |||
| tags: ['dinner', 'spicy', 'chicken', 'pork'], | |||
| menu_items: MENU_ITEMS_1.map((menu_item) => menu_item.id), | |||
| offers: OFFERS.map((offer) => offer.id), | |||
| outlet_type: OutletType.FOOD, | |||
| is_bookmarked: true, | |||
| rating: 3.5, | |||
| }), new Outlet({ | |||
| id: '0002', | |||
| image_url: 'https://pbs.twimg.com/profile_images/354890582/symbol.jpg', | |||
| name: 'Shopper\'s stop, Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', | |||
| description: 'Clothing store', | |||
| offers: [], | |||
| tags: [], | |||
| menu_items: [], | |||
| outlet_type: OutletType.SHOP, | |||
| is_bookmarked: false, | |||
| rating: 4.8, | |||
| }), new Outlet({ | |||
| id: '0003', | |||
| image_url: 'https://www.mbarendezvous.com/images/top-stories-img/bannerimage_1463407053.jpg', | |||
| name: 'Cafe Coffee Day', | |||
| description: 'Veg / Non-Veg Cafe, Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', | |||
| tags: ['hot', 'cold', 'pizza', 'beverage'], | |||
| menu_items: MENU_ITEMS_2.map((menu_item) => menu_item.id), | |||
| offers: [], | |||
| outlet_type: OutletType.FOOD, | |||
| is_bookmarked: false, | |||
| rating: 4, | |||
| })]; | |||
| @@ -1,54 +0,0 @@ | |||
| import MenuItem from './menu-item'; | |||
| export default class CartItem { | |||
| menu_item: string; | |||
| quantity: number; | |||
| pickup_time: Date; | |||
| outlet_id: string; | |||
| mall_id: string; | |||
| take_away: boolean; | |||
| total_price: number; | |||
| constructor(initializationObject: any) { | |||
| if (!initializationObject.hasOwnProperty('menu_item')) { | |||
| throw new Error('Missing Menu item'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('quantity')) { | |||
| throw new Error('Missing quantity'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('pickup_time')) { | |||
| throw new Error('Missing Pickup time'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('outlet_id')) { | |||
| throw new Error('Missing Outlet ID'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('mall_id')) { | |||
| throw new Error('Missing Mall ID'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('take_away')) { | |||
| throw new Error('Missing Parcel Flag'); | |||
| } | |||
| this.menu_item = initializationObject.menu_item; | |||
| this.quantity = initializationObject.quantity; | |||
| this.pickup_time = initializationObject.pickup_time; | |||
| this.outlet_id = initializationObject.outlet_id; | |||
| this.mall_id = initializationObject.mall_id; | |||
| this.take_away = initializationObject.take_away; | |||
| this.total_price = initializationObject.total_price; | |||
| } | |||
| } | |||
| export interface ICartItem { | |||
| menu_item: MenuItem; | |||
| quantity: number; | |||
| pickup_time: Date; | |||
| outlet_id: string; | |||
| mall_id: string; | |||
| take_away: boolean; | |||
| total_price: number; | |||
| } | |||
| @@ -1,86 +0,0 @@ | |||
| import Offer from '../models/offer'; | |||
| import { CoOrdinates } from '../shared/common-types'; | |||
| import { IOutlet } from '../models/outlet'; | |||
| export default class Mall { | |||
| id: string; | |||
| name: string; | |||
| is_bookmarked: boolean; | |||
| is_archived: boolean; | |||
| image_url?: string; | |||
| description: string; | |||
| offers: Array<string>; | |||
| outlets: Array<string>; | |||
| rating: number; | |||
| distance: number; | |||
| location: CoOrdinates; | |||
| address: string; | |||
| constructor(initializationObject: any) { | |||
| if (!initializationObject.hasOwnProperty('id')) { | |||
| throw new Error('Missing id'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('name')) { | |||
| throw new Error('Missing name'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('is_bookmarked')) { | |||
| throw new Error('Missing is_bookmarked'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('is_archived')) { | |||
| throw new Error('Missing is_archived'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('description')) { | |||
| throw new Error('Missing description'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('offers')) { | |||
| throw new Error('Missing offers'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('outlets')) { | |||
| throw new Error('Missing outlets'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('rating')) { | |||
| throw new Error('Missing rating'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('distance')) { | |||
| throw new Error('Missing distance'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('location')) { | |||
| throw new Error('Missing location'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('address')) { | |||
| throw new Error('Missing address'); | |||
| } | |||
| this.id = initializationObject.id; | |||
| this.name = initializationObject.name; | |||
| this.is_bookmarked = initializationObject.is_bookmarked; | |||
| this.is_archived = initializationObject.is_archived; | |||
| this.description = initializationObject.description; | |||
| this.offers = initializationObject.offers; | |||
| this.outlets = initializationObject.outlets; | |||
| this.rating = initializationObject.rating; | |||
| this.distance = initializationObject.distance; | |||
| this.location = initializationObject.location; | |||
| this.address = initializationObject.address; | |||
| if (initializationObject.hasOwnProperty('image_url')) { | |||
| this.image_url = initializationObject.image_url; | |||
| } | |||
| } | |||
| } | |||
| export interface IMall { | |||
| id: string; | |||
| name: string; | |||
| is_bookmarked: boolean; | |||
| is_archived: boolean; | |||
| image_url?: string; | |||
| description: string; | |||
| offers: Array<Offer>; | |||
| outlets: Array<IOutlet>; | |||
| rating: number; | |||
| distance: number; | |||
| location: CoOrdinates; | |||
| address: string; | |||
| } | |||
| @@ -1,58 +0,0 @@ | |||
| export class MenuItem { | |||
| id: string; | |||
| name: string; | |||
| image_url?: string; | |||
| description: string; | |||
| is_vegeterian: boolean; | |||
| wait_duration: number; | |||
| price: number; | |||
| discount: number; | |||
| rating: number; | |||
| tags: Array<string>; | |||
| constructor(initializationObject: any) { | |||
| if (!initializationObject.hasOwnProperty('id')) { | |||
| throw new Error('Missing id') | |||
| } | |||
| if (!initializationObject.hasOwnProperty('name')) { | |||
| throw new Error('Missing name') | |||
| } | |||
| if (!initializationObject.hasOwnProperty('description')) { | |||
| throw new Error('Missing description') | |||
| } | |||
| if (!initializationObject.hasOwnProperty('is_vegeterian')) { | |||
| throw new Error('Missing is_vegeterian') | |||
| } | |||
| if (!initializationObject.hasOwnProperty('wait_duration')) { | |||
| throw new Error('Missing wait_duration') | |||
| } | |||
| if (!initializationObject.hasOwnProperty('price')) { | |||
| throw new Error('Missing price') | |||
| } | |||
| if (!initializationObject.hasOwnProperty('discount')) { | |||
| throw new Error('Missing discount') | |||
| } | |||
| if (!initializationObject.hasOwnProperty('rating')) { | |||
| throw new Error('Missing rating') | |||
| } | |||
| if (!initializationObject.hasOwnProperty('tags')) { | |||
| throw new Error('Missing tags') | |||
| } | |||
| this.id = initializationObject.id; | |||
| this.name = initializationObject.name; | |||
| this.description = initializationObject.description; | |||
| this.is_vegeterian = initializationObject.is_vegeterian; | |||
| this.wait_duration = initializationObject.wait_duration; | |||
| this.price = initializationObject.price; | |||
| this.discount = initializationObject.discount; | |||
| this.rating = initializationObject.rating; | |||
| this.tags = initializationObject.tags; | |||
| if (initializationObject.hasOwnProperty('image_url')) { | |||
| this.image_url = initializationObject.image_url; | |||
| } | |||
| } | |||
| }; | |||
| export default MenuItem; | |||
| @@ -1,37 +0,0 @@ | |||
| class Offer { | |||
| id: string; | |||
| name: string; | |||
| description: string; | |||
| coupon_code: string; | |||
| image_url?: string; | |||
| constructor(initializationObject: any) { | |||
| // Check if object has the required fields | |||
| if (!initializationObject.hasOwnProperty('id')) { | |||
| throw new Error('The offer needs a id'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('name')) { | |||
| throw new Error('The offer needs a name'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('description')) { | |||
| throw new Error('The offer needs a description'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('coupon_code')) { | |||
| throw new Error('The offer needs a coupon_code'); | |||
| } | |||
| this.name = initializationObject.name; | |||
| this.description = initializationObject.description; | |||
| this.coupon_code = initializationObject.coupon_code; | |||
| if (initializationObject.hasOwnProperty('image_url')) { | |||
| this.image_url = initializationObject.image_url; | |||
| } | |||
| } | |||
| } | |||
| export default Offer; | |||
| @@ -1,87 +0,0 @@ | |||
| import Offer from './offer'; | |||
| import MenuItem from './menu-item'; | |||
| export enum OutletType { | |||
| FOOD = 'FOOD', | |||
| SHOP = 'SHOP', | |||
| }; | |||
| class Outlet { | |||
| id: string; | |||
| image_url?: string; | |||
| name: string; | |||
| description: string; | |||
| offers: Array<string>; | |||
| tags: Array<string>; | |||
| menu_items: Array<string>; | |||
| outlet_type: OutletType; | |||
| is_bookmarked: boolean; | |||
| rating: number; | |||
| constructor(initializationObject: any) { | |||
| if (!initializationObject.hasOwnProperty('id')) { | |||
| throw new Error('Missing ID'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('name')) { | |||
| throw new Error('Missing name'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('description')) { | |||
| throw new Error('Missing description'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('offers')) { | |||
| throw new Error('Missing Offers'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('tags')) { | |||
| throw new Error('Missing tags'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('menu_items')) { | |||
| throw new Error('Missing Menu Items'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('outlet_type')) { | |||
| throw new Error('Missing Outlet type'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('is_bookmarked')) { | |||
| throw new Error('Missing Bookmarked flag'); | |||
| } | |||
| if (!initializationObject.hasOwnProperty('rating')) { | |||
| throw new Error('Missing Rating'); | |||
| } | |||
| this.id = initializationObject.id; | |||
| this.name = initializationObject.name; | |||
| this.description = initializationObject.description; | |||
| this.offers = initializationObject.offers; | |||
| this.tags = initializationObject.tags; | |||
| this.menu_items = initializationObject.menu_items; | |||
| this.outlet_type = initializationObject.outlet_type; | |||
| this.is_bookmarked = initializationObject.is_bookmarked; | |||
| this.rating = initializationObject.rating; | |||
| if (initializationObject.hasOwnProperty('image_url')) { | |||
| this.image_url = initializationObject.image_url; | |||
| } | |||
| } | |||
| } | |||
| export interface IOutlet { | |||
| id: string; | |||
| image_url?: string; | |||
| name: string; | |||
| description: string; | |||
| offers: Array<Offer>; | |||
| tags: Array<string>; | |||
| menu_items: Array<MenuItem>; | |||
| outlet_type: OutletType; | |||
| is_bookmarked: boolean; | |||
| rating: number; | |||
| }; | |||
| export default Outlet; | |||
| @@ -1,4 +1,4 @@ | |||
| <div class="heading-holder"> | |||
| <!-- <div class="heading-holder"> | |||
| <div class="name"> MY ORDERS </div> | |||
| <ion-button fill="clear"> SORT / FILTER </ion-button> | |||
| </div> | |||
| @@ -62,4 +62,4 @@ | |||
| <textarea placeholder="Please tell something about the food..."></textarea> | |||
| </div> | |||
| <ion-button size="block" shape="round"> Submit Feedback </ion-button> | |||
| </section> | |||
| </section> --> | |||
| @@ -1,10 +1,7 @@ | |||
| import { Component, OnInit } from '@angular/core'; | |||
| import { OrderService } from '../services/order.service'; | |||
| import { MallService } from '../services/mall.service'; | |||
| import { IMall } from '../models/mall'; | |||
| import { IOutlet } from '../models/outlet'; | |||
| import { OutletService } from '../services/outlet.service'; | |||
| import * as moment from 'moment'; | |||
| @Component({ | |||
| selector: 'app-orders', | |||
| @@ -13,10 +10,6 @@ import * as moment from 'moment'; | |||
| }) | |||
| export class OrdersComponent implements OnInit { | |||
| orders: any = []; | |||
| all_malls: Array<IMall> = []; | |||
| all_outlets: Array<IOutlet> = []; | |||
| selected_rating: number = 0; | |||
| show_rate_modal: boolean = false; | |||
| constructor( | |||
| private orderService: OrderService, | |||
| @@ -25,50 +18,6 @@ export class OrdersComponent implements OnInit { | |||
| ) { } | |||
| ngOnInit() { | |||
| this.orderService.getCreatedOrders().then((data: any) => { | |||
| this.orders = data.reverse(); | |||
| console.log(this.orders); | |||
| }); | |||
| this.mallService.getAllMalls().then((malls: Array<IMall>) => { | |||
| this.all_malls = malls; | |||
| }); | |||
| this.outletService.getAllOutlets().then((outlets: Array<IOutlet>) => { | |||
| this.all_outlets = outlets; | |||
| }); | |||
| } | |||
| setRating() { | |||
| let i: number, j:number, stars: any; | |||
| stars = document.querySelectorAll('.star-holder ion-icon'); | |||
| for (i = 0; i < stars.length ; i += 1) { | |||
| stars[i].classList.remove('active'); | |||
| } | |||
| for (i = 0; i < this.selected_rating ; i += 1) { | |||
| stars[i].classList.add('active'); | |||
| } | |||
| } | |||
| getFormattedDate(date : Date, format: string) { | |||
| return moment(date).format(format); | |||
| } | |||
| getMallName(id: string) { | |||
| return this.all_malls.find((mall) => { | |||
| return mall.id === id; | |||
| }).name; | |||
| } | |||
| getOutletName(id: string) { | |||
| return this.all_outlets.find((mall) => { | |||
| return mall.id === id; | |||
| }).name; | |||
| } | |||
| getRating() { | |||
| } | |||
| @@ -30,7 +30,7 @@ export class OutletDetailsPage implements OnInit { | |||
| ionViewDidEnter() { | |||
| this.outlet_details = JSON.parse(this.route.snapshot.paramMap.get('outlet')); | |||
| console.log(this.outlet_details); | |||
| // console.log(this.route.snapshot.paramMap.get('mallId')); | |||
| } | |||
| back() { | |||
| @@ -1,35 +1,12 @@ | |||
| import { Injectable } from '@angular/core'; | |||
| import CartItem from '../models/cart-item'; | |||
| import { Storage } from '@ionic/storage'; | |||
| @Injectable({ | |||
| providedIn: 'root' | |||
| }) | |||
| export class CartItemService { | |||
| cart_items: Array<CartItem> = []; | |||
| constructor( | |||
| private storage: Storage | |||
| ) { } | |||
| async updateCartItems(cart_items: Array<CartItem>) { | |||
| this.cart_items = cart_items; | |||
| this.storage.set('cart_items', JSON.stringify(this.cart_items)); | |||
| return await this.cart_items; | |||
| } | |||
| async getAllCartItems() { | |||
| return await this.storage.get('cart_items').then((data: string) => { | |||
| if (data) { | |||
| return JSON.parse(data); | |||
| } else { | |||
| return []; | |||
| } | |||
| }); | |||
| } | |||
| async clearCartItems() { | |||
| return await this.storage.set('cart_items', '[]'); | |||
| } | |||
| } | |||
| @@ -1,8 +1,4 @@ | |||
| import { Injectable } from '@angular/core'; | |||
| import { MALLS } from '../mocks/malls'; | |||
| import Mall, { IMall } from '../models/mall'; | |||
| import { OfferService } from './offer.service'; | |||
| import { OutletService } from './outlet.service'; | |||
| import { HttpClient, HttpHeaders } from '@angular/common/http'; | |||
| import { TOKEN, URL } from '../mocks/url'; | |||
| @@ -11,15 +7,10 @@ import { TOKEN, URL } from '../mocks/url'; | |||
| providedIn: 'root' | |||
| }) | |||
| export class MallService { | |||
| malls: Array<IMall> = []; | |||
| constructor( | |||
| private offerService: OfferService, | |||
| private outletService: OutletService, | |||
| private http: HttpClient | |||
| ) { | |||
| this.fetchMalls(); | |||
| } | |||
| ) { } | |||
| async mallsByLocation(latitude: number, longitude: number) { | |||
| const httpOptions = { | |||
| @@ -44,40 +35,4 @@ export class MallService { | |||
| return await this.http.get(URL + '/api/maioraservice/mall/getallmalls/', httpOptions).toPromise(); | |||
| } | |||
| private getDenormalizedMall = async (mall: Mall) => { | |||
| const offers = await Promise.all(mall.offers.map(offer_id => this.offerService.getOfferByID(offer_id))); | |||
| const outlets = await Promise.all(mall.outlets.map(outlet_id => this.outletService.getOutletByID(outlet_id))); | |||
| return { | |||
| ...mall, | |||
| offers, | |||
| outlets, | |||
| }; | |||
| } | |||
| public async getAllMalls() { | |||
| return this.malls; | |||
| } | |||
| private async fetchMalls() { | |||
| this.malls = await Promise.all(MALLS.map(this.getDenormalizedMall)); | |||
| } | |||
| public async getMallByID(id: string) { | |||
| if (this.malls.length <= 0) { | |||
| await this.fetchMalls(); | |||
| return this.malls.find((mall) => mall.id === id); | |||
| } else { | |||
| return this.malls.find((mall) => mall.id === id); | |||
| } | |||
| } | |||
| async updateMall(data: IMall) { | |||
| for (let i = 0; i < this.malls.length; i += 1) { | |||
| if (data.id === this.malls[i].id) { | |||
| this.malls[i] = data; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -1,16 +1,8 @@ | |||
| import { Injectable } from '@angular/core'; | |||
| import { MENU_ITEMS_1, MENU_ITEMS_2 } from '../mocks/menu-items'; | |||
| import MenuItem from '../models/menu-item'; | |||
| @Injectable({ | |||
| providedIn: 'root' | |||
| }) | |||
| export class MenuItemService { | |||
| menu_items: Array<MenuItem> = MENU_ITEMS_1.concat(MENU_ITEMS_2); | |||
| constructor() { } | |||
| public async getMenuItemByID(id: string) { | |||
| return this.menu_items.find((menu_item) => menu_item.id === id); | |||
| } | |||
| } | |||
| @@ -1,19 +1,11 @@ | |||
| import { Injectable } from '@angular/core'; | |||
| import { OFFERS } from '../mocks/offers'; | |||
| import Offer from '../models/offer'; | |||
| @Injectable({ | |||
| providedIn: 'root' | |||
| }) | |||
| export class OfferService { | |||
| offers: Array<Offer>; | |||
| constructor() { | |||
| this.offers = OFFERS; | |||
| } | |||
| public async getOfferByID(id: string) { | |||
| return this.offers.find((offer) => offer.id === id); | |||
| } | |||
| } | |||
| @@ -1,7 +1,4 @@ | |||
| import { Injectable } from '@angular/core'; | |||
| import { Storage } from '@ionic/storage'; | |||
| import * as uuid from 'uuid'; | |||
| import CartItem from '../models/cart-item'; | |||
| @Injectable({ | |||
| providedIn: 'root' | |||
| @@ -10,46 +7,5 @@ export class OrderService { | |||
| orders: any = []; | |||
| constructor( | |||
| private storage: Storage | |||
| ) { } | |||
| async createOrder(cart_items: Array<CartItem>, calculated_total: number, promocode: string) { | |||
| return this.storage.get('orders').then((data: string) => { | |||
| if (data === null) { | |||
| this.orders.push({ | |||
| id: uuid(), | |||
| calculated_total: calculated_total, | |||
| promocode: promocode, | |||
| creation_time: new Date(), | |||
| order_items: cart_items | |||
| }); | |||
| this.storage.set('orders', JSON.stringify(this.orders)).then((data) => { | |||
| console.log(data); | |||
| }); | |||
| } else { | |||
| this.orders = JSON.parse(data); | |||
| this.orders.push({ | |||
| id: uuid(), | |||
| calculated_total: calculated_total, | |||
| promocode: promocode, | |||
| creation_time: new Date(), | |||
| order_items: cart_items | |||
| }); | |||
| this.storage.set('orders', JSON.stringify(this.orders)); | |||
| } | |||
| }, () => { | |||
| console.log("failed"); | |||
| }); | |||
| } | |||
| async getCreatedOrders() { | |||
| return await this.storage.get('orders').then((data: string) => { | |||
| if (data === null) { | |||
| return []; | |||
| } else { | |||
| return JSON.parse(data); | |||
| } | |||
| }); | |||
| } | |||
| } | |||
| @@ -1,46 +1,8 @@ | |||
| import { Injectable } from '@angular/core'; | |||
| import Outlet, { IOutlet } from '../models/outlet'; | |||
| import { OUTLETS } from '../mocks/outlets'; | |||
| import { OfferService } from './offer.service'; | |||
| import { MenuItemService } from './menu-item.service'; | |||
| @Injectable({ | |||
| providedIn: 'root' | |||
| }) | |||
| export class OutletService { | |||
| outlets: Array<IOutlet> | |||
| constructor( | |||
| private offerService: OfferService, | |||
| private menuItemService: MenuItemService | |||
| ) { | |||
| this.fetchOutlets(); | |||
| } | |||
| private getDenormalizedOutlet = async (outlet: Outlet) => { | |||
| const offers = await Promise.all(outlet.offers.map(offer_id => { | |||
| return this.offerService.getOfferByID(offer_id); | |||
| })); | |||
| const menu_items = await Promise.all(outlet.menu_items.map(menu_item_id => this.menuItemService.getMenuItemByID(menu_item_id))); | |||
| return { | |||
| ...outlet, | |||
| offers, | |||
| menu_items, | |||
| }; | |||
| } | |||
| public async fetchOutlets() { | |||
| this.outlets = await Promise.all(OUTLETS.map(this.getDenormalizedOutlet)); | |||
| } | |||
| async getAllOutlets() { | |||
| this.outlets = await Promise.all(OUTLETS.map(this.getDenormalizedOutlet)); | |||
| return this.outlets; | |||
| } | |||
| public async getOutletByID(id: string) { | |||
| await this.fetchOutlets(); | |||
| return this.outlets.find((outlet) => outlet.id === id); | |||
| } | |||
| constructor() { } | |||
| } | |||