| @@ -1,36 +1,36 @@ | |||||
| <ion-content [scrollEvents]="true" *ngIf="mall_details" (ionScroll)="onScroll($event)"> | |||||
| <ion-content [scrollEvents]="true" *ngIf="mallDetails" (ionScroll)="onScroll($event)"> | |||||
| <div class="overlay" [ngClass]="{ 'active' : show_sort_popup }"></div> | <div class="overlay" [ngClass]="{ 'active' : show_sort_popup }"></div> | ||||
| <div class="header-bar" [ngClass]="{'active' : show_top_bar }"> | <div class="header-bar" [ngClass]="{'active' : show_top_bar }"> | ||||
| <div class="heading-holder"> | <div class="heading-holder"> | ||||
| <button (click)="back()"> <ion-icon name="arrow-back"></ion-icon> </button> | <button (click)="back()"> <ion-icon name="arrow-back"></ion-icon> </button> | ||||
| <h3> {{ mall_details.mall_name }} </h3> | |||||
| <h3> {{ mallDetails.mall.mall_name }} </h3> | |||||
| </div> | </div> | ||||
| <div class="stats-holder"> | <div class="stats-holder"> | ||||
| <div class="stat"> <ion-icon name="star"></ion-icon> {{ mall_details.rating }} </div> | |||||
| <div class="stat"> <ion-icon name="pin"></ion-icon> {{ mall_details.mall_distance }} km</div> | |||||
| <div class="stat"> <ion-icon name="star"></ion-icon> {{ mallDetails.mall.rating }} </div> | |||||
| <div class="stat"> <ion-icon name="pin"></ion-icon> {{ mallDetails.mall.mall_distance }} km</div> | |||||
| </div> | </div> | ||||
| <div class="utilities-buttons-holder"> | <div class="utilities-buttons-holder"> | ||||
| <button [ngClass]="{'active' : mall_details.is_bookmarked }"> <ion-icon name="bookmark"></ion-icon> </button> | |||||
| <button [ngClass]="{'active' : mallDetails.mall.is_bookmarked }"> <ion-icon name="bookmark"></ion-icon> </button> | |||||
| <button> <ion-icon name="share"></ion-icon> </button> | <button> <ion-icon name="share"></ion-icon> </button> | ||||
| <a target="_blank" href="https://maps.google.com/?q="> | |||||
| <a target="_blank" href="https://maps.google.com/?q={{ mallDetails.latitude }},{{ mallDetails.longitude }}"> | |||||
| <ion-icon name="navigate"></ion-icon> | <ion-icon name="navigate"></ion-icon> | ||||
| </a> | </a> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="upfold-holder"> | <div class="upfold-holder"> | ||||
| <img [src]="mall_details.image_url"> | |||||
| <img [src]="mallDetails.mall.image_url"> | |||||
| <div class="icons-holder"> | <div class="icons-holder"> | ||||
| <div> | <div> | ||||
| <button (click)="back()"> <ion-icon name="arrow-back"></ion-icon> </button> | <button (click)="back()"> <ion-icon name="arrow-back"></ion-icon> </button> | ||||
| </div> | </div> | ||||
| <div class="action-buttons-holder"> | <div class="action-buttons-holder"> | ||||
| <button [ngClass]="{'active' : mall_details.is_bookmarked }"> | |||||
| <button [ngClass]="{'active' : mallDetails.mall.is_bookmarked }"> | |||||
| <ion-icon name="bookmark"></ion-icon> | <ion-icon name="bookmark"></ion-icon> | ||||
| </button> | </button> | ||||
| <button> <ion-icon name="share"></ion-icon> </button> | <button> <ion-icon name="share"></ion-icon> </button> | ||||
| <a target="_blank" href="https://maps.google.com/?q="> | |||||
| <a target="_blank" href="https://maps.google.com/?q={{ mallDetails.latitude }},{{ mallDetails.longitude }}"> | |||||
| <ion-icon name="navigate"></ion-icon> | <ion-icon name="navigate"></ion-icon> | ||||
| </a> | </a> | ||||
| </div> | </div> | ||||
| @@ -38,13 +38,13 @@ | |||||
| </div> | </div> | ||||
| <div class="card-holder"> | <div class="card-holder"> | ||||
| <div class="card"> | <div class="card"> | ||||
| <h3> {{ mall_details.mall_name }} </h3> | |||||
| <p> {{ mall_details.mall_address }} </p> | |||||
| <h3> {{ mallDetails.mall.mall_name }} </h3> | |||||
| <p> {{ mallDetails.mall.mall_address }} </p> | |||||
| <div class="stats-holder"> | <div class="stats-holder"> | ||||
| <div class="stat"> <ion-icon name="star"></ion-icon> {{ mall_details.rating }} </div> | |||||
| <div class="stat"> <ion-icon name="pin"></ion-icon> {{ mall_details.mall_distance }} km</div> | |||||
| <div class="stat"> <ion-icon name="star"></ion-icon> {{ mallDetails.mall.rating }} </div> | |||||
| <div class="stat"> <ion-icon name="pin"></ion-icon> {{ mallDetails.mall.mall_distance }} km</div> | |||||
| </div> | </div> | ||||
| <p> {{ mall_details.description }} </p> | |||||
| <p> {{ mallDetails.mall.description }} </p> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -56,12 +56,12 @@ | |||||
| </div> | </div> | ||||
| <div class="results-utilities-holder"> | <div class="results-utilities-holder"> | ||||
| <h5 *ngIf="mall_details"> {{ mall_details.outlet.length }} OUTLETS </h5> | |||||
| <h5 *ngIf="mallDetails"> {{ mallDetails.mall.outlet.length }} OUTLETS </h5> | |||||
| <ion-button color="default" fill="clear" (click)="togglePopup()"> SORT / FILTER </ion-button> | <ion-button color="default" fill="clear" (click)="togglePopup()"> SORT / FILTER </ion-button> | ||||
| </div> | </div> | ||||
| <ion-list lines="none" class="result-list" *ngIf="selected_tab === 'food'"> | <ion-list lines="none" class="result-list" *ngIf="selected_tab === 'food'"> | ||||
| <ion-item *ngFor="let outlet of mall_details.outlet" (click)="outletDetails(outlet)"> | |||||
| <ion-item *ngFor="let outlet of mallDetails.mall.outlet" (click)="outletDetails(outlet)"> | |||||
| <img src="{{ outlet.image_url }}" slot="start"> | <img src="{{ outlet.image_url }}" slot="start"> | ||||
| <ion-label> | <ion-label> | ||||
| <h3> | <h3> | ||||
| @@ -8,7 +8,7 @@ import { Location } from '@angular/common'; | |||||
| styleUrls: ['./mall-details.page.scss'], | styleUrls: ['./mall-details.page.scss'], | ||||
| }) | }) | ||||
| export class MallDetailsPage implements OnInit { | export class MallDetailsPage implements OnInit { | ||||
| mall_details: any; | |||||
| mallDetails: any; | |||||
| selected_tab: string = 'food'; | selected_tab: string = 'food'; | ||||
| show_top_bar: boolean = false; | show_top_bar: boolean = false; | ||||
| show_sort_popup: boolean = false; | show_sort_popup: boolean = false; | ||||
| @@ -21,8 +21,8 @@ export class MallDetailsPage implements OnInit { | |||||
| ) { } | ) { } | ||||
| ngOnInit() { | ngOnInit() { | ||||
| this.mall_details = JSON.parse(this.route.snapshot.paramMap.get('mall')); | |||||
| console.log(this.mall_details); | |||||
| this.mallDetails = JSON.parse(this.route.snapshot.paramMap.get('mall')); | |||||
| console.log(this.mallDetails); | |||||
| } | } | ||||
| back() { | back() { | ||||
| @@ -44,13 +44,13 @@ export class MallDetailsPage implements OnInit { | |||||
| sortBy(type: string) { | sortBy(type: string) { | ||||
| this.selected_sort = type; | this.selected_sort = type; | ||||
| switch(this.selected_sort) { | switch(this.selected_sort) { | ||||
| case 'name': this.mall_details.outlet.sort(function(a: any, b: any){ | |||||
| case 'name': this.mallDetails.mall.outlet.sort(function(a: any, b: any){ | |||||
| if(a.outlet_name < b.outlet_name) { return -1; } | if(a.outlet_name < b.outlet_name) { return -1; } | ||||
| if(a.outlet_name > b.outlet_name) { return 1; } | if(a.outlet_name > b.outlet_name) { return 1; } | ||||
| return 0; | return 0; | ||||
| }); | }); | ||||
| break; | break; | ||||
| case 'rating': this.mall_details.outlet.sort(function(a: any, b: any){ | |||||
| case 'rating': this.mallDetails.mall.outlet.sort(function(a: any, b: any){ | |||||
| if(a.rating < b.rating) { return -1; } | if(a.rating < b.rating) { return -1; } | ||||
| if(a.rating > b.rating) { return 1; } | if(a.rating > b.rating) { return 1; } | ||||
| return 0; | return 0; | ||||
| @@ -37,24 +37,24 @@ | |||||
| </div> | </div> | ||||
| <ion-list lines="none" class="result-list"> | <ion-list lines="none" class="result-list"> | ||||
| <ion-item *ngFor="let mall of tempMalls" (click)="showMallDetails(mall)"> | |||||
| <img src="{{ mall.image_url }}" slot="start"> | |||||
| <ion-item *ngFor="let mallData of tempMalls" (click)="showMallDetails(mallData)"> | |||||
| <img src="{{ mallData.mall.image_url }}" slot="start"> | |||||
| <ion-label> | <ion-label> | ||||
| <h3> {{ mall.mall_name }} <ion-icon name="bookmark" [ngClass]="{'active' : mall.is_bookmarked }"></ion-icon> </h3> | |||||
| <p class="description"> {{ mall.description }} </p> | |||||
| <h3> {{ mallData.mall.mall_name }} <ion-icon name="bookmark" [ngClass]="{'active' : mallData.mall.is_bookmarked }"></ion-icon> </h3> | |||||
| <p class="description"> {{ mallData.mall.description }} </p> | |||||
| <div class="offers-holder"> | <div class="offers-holder"> | ||||
| <div class="offer"> | <div class="offer"> | ||||
| <ion-icon src="assets/custom/restaurant.svg"></ion-icon> | <ion-icon src="assets/custom/restaurant.svg"></ion-icon> | ||||
| Food Offers: <strong> {{ mall.offers_count }} </strong> | |||||
| Food Offers: <strong> {{ mallData.mall.offers_count }} </strong> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="utilities-holder"> | <div class="utilities-holder"> | ||||
| <div class="container"> | <div class="container"> | ||||
| <div class="utility"> | <div class="utility"> | ||||
| <ion-icon name="star"></ion-icon> {{ mall.rating }} | |||||
| <ion-icon name="star"></ion-icon> {{ mallData.mall.rating }} | |||||
| </div> | </div> | ||||
| <div class="utility"> | <div class="utility"> | ||||
| <ion-icon name="pin"></ion-icon> {{ mall.mall_distance }} km | |||||
| <ion-icon name="pin"></ion-icon> {{ mallData.mall.mall_distance }} km | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -63,7 +63,7 @@ | |||||
| <ion-icon name="share"></ion-icon> | <ion-icon name="share"></ion-icon> | ||||
| </button> | </button> | ||||
| <a class="utility-button" target="_blank" | <a class="utility-button" target="_blank" | ||||
| href="https://maps.google.com/?q="> | |||||
| href="https://maps.google.com/?q={{ mallData.latitude }},{{ mallData.longitude }}"> | |||||
| <ion-icon name="navigate"></ion-icon> | <ion-icon name="navigate"></ion-icon> | ||||
| </a> | </a> | ||||
| </div> | </div> | ||||
| @@ -73,11 +73,11 @@ | |||||
| </ion-list> | </ion-list> | ||||
| <section class="advertisement" *ngIf="tempMalls.length > 0"> | <section class="advertisement" *ngIf="tempMalls.length > 0"> | ||||
| <div *ngIf="tempMalls[0].advertisement[0]"> | |||||
| <div *ngIf="tempMalls[0].mall.advertisement[0]"> | |||||
| <div class="heading-holder"> | <div class="heading-holder"> | ||||
| <img [src]="tempMalls[0].advertisement[0].image"> | |||||
| <img [src]="tempMalls[0].mall.advertisement[0].image"> | |||||
| <header> | <header> | ||||
| {{ tempMalls[0].advertisement[0].mallname }} - <span> Get your food faster then any others </span> | |||||
| {{ tempMalls[0].mall.advertisement[0].mallname }} - <span> Get your food faster then any others </span> | |||||
| </header> | </header> | ||||
| </div> | </div> | ||||
| <p class="description"> | <p class="description"> | ||||
| @@ -35,8 +35,8 @@ export class MallsPage implements OnInit { | |||||
| searchAllMalls() { | searchAllMalls() { | ||||
| if (this.searchTerm.trim().length > 0) { | if (this.searchTerm.trim().length > 0) { | ||||
| this.tempMalls = this.allMalls.filter((mall: any) => { | |||||
| return mall.mall_name.toLowerCase().includes(this.searchTerm.toLowerCase()); | |||||
| this.tempMalls = this.allMalls.filter((mallData: any) => { | |||||
| return mallData.mall.mall_name.toLowerCase().includes(this.searchTerm.toLowerCase()); | |||||
| }); | }); | ||||
| } else { | } else { | ||||
| this.tempMalls = JSON.parse(JSON.stringify(this.allMalls)); | this.tempMalls = JSON.parse(JSON.stringify(this.allMalls)); | ||||
| @@ -61,14 +61,14 @@ export class MallsPage implements OnInit { | |||||
| this.selected_sort = type; | this.selected_sort = type; | ||||
| switch(this.selected_sort) { | switch(this.selected_sort) { | ||||
| case 'name': this.tempMalls.sort(function(a: any, b: any){ | case 'name': this.tempMalls.sort(function(a: any, b: any){ | ||||
| if(a.mall_name < b.mall_name) { return -1; } | |||||
| if(a.mall_name > b.mall_name) { return 1; } | |||||
| if(a.mall.mall_name < b.mall.mall_name) { return -1; } | |||||
| if(a.mall.mall_name > b.mall.mall_name) { return 1; } | |||||
| return 0; | return 0; | ||||
| }); | }); | ||||
| break; | break; | ||||
| case 'rating': this.tempMalls.sort(function(a: any, b: any){ | case 'rating': this.tempMalls.sort(function(a: any, b: any){ | ||||
| if(a.rating < b.rating) { return -1; } | |||||
| if(a.rating > b.rating) { return 1; } | |||||
| if(a.mall.rating < b.mall.rating) { return -1; } | |||||
| if(a.mall.rating > b.mall.rating) { return 1; } | |||||
| return 0; | return 0; | ||||
| }).reverse(); | }).reverse(); | ||||
| break; | break; | ||||
| @@ -64,19 +64,19 @@ export class OutletDetailsPage implements OnInit { | |||||
| sortBy(type: string) { | sortBy(type: string) { | ||||
| this.selected_sort = type; | this.selected_sort = type; | ||||
| switch(this.selected_sort) { | switch(this.selected_sort) { | ||||
| case 'name': this.outlet_details.menuitems.sort(function(a, b){ | |||||
| case 'name': this.outlet_details.menuitems.sort(function(a: any, b: any){ | |||||
| if(a.menu_item_name < b.menu_item_name) { return -1; } | if(a.menu_item_name < b.menu_item_name) { return -1; } | ||||
| if(a.menu_item_name > b.menu_item_name) { return 1; } | if(a.menu_item_name > b.menu_item_name) { return 1; } | ||||
| return 0; | return 0; | ||||
| }); | }); | ||||
| break; | break; | ||||
| case 'rating': this.outlet_details.menuitems.sort(function(a, b){ | |||||
| case 'rating': this.outlet_details.menuitems.sort(function(a: any, b: any){ | |||||
| if(a.rating < b.rating) { return -1; } | if(a.rating < b.rating) { return -1; } | ||||
| if(a.rating > b.rating) { return 1; } | if(a.rating > b.rating) { return 1; } | ||||
| return 0; | return 0; | ||||
| }).reverse(); | }).reverse(); | ||||
| break; | break; | ||||
| case 'price': this.outlet_details.menuitems.sort(function(a, b){ | |||||
| case 'price': this.outlet_details.menuitems.sort(function(a: any, b: any){ | |||||
| if((a.item_price - a.item_discount) < (b.item_price - b.item_discount)) { return -1; } | if((a.item_price - a.item_discount) < (b.item_price - b.item_discount)) { return -1; } | ||||
| if((a.item_price - a.item_discount) > (b.item_price - b.item_discount)) { return 1; } | if((a.item_price - a.item_discount) > (b.item_price - b.item_discount)) { return 1; } | ||||
| return 0; | return 0; | ||||