| @@ -43,7 +43,7 @@ | |||||
| }, | }, | ||||
| "devDependencies": { | "devDependencies": { | ||||
| "@angular-devkit/architect": "~0.801.2", | "@angular-devkit/architect": "~0.801.2", | ||||
| "@angular-devkit/build-angular": "^0.803.24", | |||||
| "@angular-devkit/build-angular": "^0.803.25", | |||||
| "@angular-devkit/core": "~8.1.2", | "@angular-devkit/core": "~8.1.2", | ||||
| "@angular-devkit/schematics": "~8.1.2", | "@angular-devkit/schematics": "~8.1.2", | ||||
| "@angular/cli": "~8.1.2", | "@angular/cli": "~8.1.2", | ||||
| @@ -77,10 +77,8 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <ion-button shape="round" expand="block" class="pay-button" (click)="placeOrder()" | |||||
| [disabled]="userCart.orderedlist.length === 0"> Pay Now </ion-button> | |||||
| <ion-button shape="round" expand="block" class="pay-button" (click)="requestInvoice()"> Testing Payment gateway </ion-button> | |||||
| <ion-button shape="round" [disabled]="userCart.orderedlist.length === 0" expand="block" | |||||
| class="pay-button" (click)="requestInvoice()"> Pay Now </ion-button> | |||||
| <div class="common-semi-modal filter-holder with-border" [ngClass]="{'active' : show_promocodes }"> | <div class="common-semi-modal filter-holder with-border" [ngClass]="{'active' : show_promocodes }"> | ||||
| <header> | <header> | ||||
| @@ -81,7 +81,7 @@ | |||||
| <div class="offer"> | <div class="offer"> | ||||
| <span *ngIf="outlet.outlet_type"> <ion-icon name="restaurant"></ion-icon> Food </span> | <span *ngIf="outlet.outlet_type"> <ion-icon name="restaurant"></ion-icon> Food </span> | ||||
| <span *ngIf="!outlet.outlet_type"> <ion-icon name="basket"></ion-icon> Shopping </span> | <span *ngIf="!outlet.outlet_type"> <ion-icon name="basket"></ion-icon> Shopping </span> | ||||
| Offers: <strong> {{ outlet.offers.length }} </strong> | |||||
| Offers: <strong> {{ outlet.offers ? outlet.offers.length : 0 }} </strong> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </ion-label> | </ion-label> | ||||
| @@ -1,5 +1,6 @@ | |||||
| import { Component, OnInit, ViewChild,ElementRef } from '@angular/core'; | import { Component, OnInit, ViewChild,ElementRef } from '@angular/core'; | ||||
| import { MallService } from '../services/mall.service'; | import { MallService } from '../services/mall.service'; | ||||
| import { ToastService } from '../services/toast.service'; | |||||
| import { Router } from '@angular/router'; | import { Router } from '@angular/router'; | ||||
| @Component({ | @Component({ | ||||
| @@ -19,11 +20,12 @@ export class MallsPage implements OnInit { | |||||
| constructor( | constructor( | ||||
| private mallService: MallService, | private mallService: MallService, | ||||
| private router: Router | |||||
| private router: Router, | |||||
| private toastService: ToastService | |||||
| ) { } | ) { } | ||||
| ngOnInit() { | ngOnInit() { | ||||
| this.storeAllMalls(); | |||||
| this.getMallsByLocation(); | |||||
| } | } | ||||
| toggleSearchBar() { | toggleSearchBar() { | ||||
| @@ -48,7 +50,29 @@ export class MallsPage implements OnInit { | |||||
| } | } | ||||
| } | } | ||||
| storeAllMalls() { | |||||
| getMallsByLocation() { | |||||
| if (navigator.geolocation) { | |||||
| this.toastService.presentToast("Getting malls based on your location...", "dark"); | |||||
| navigator.geolocation.getCurrentPosition((position) => { | |||||
| this.mallService.mallsByLocation(position.coords.latitude, position.coords.longitude).then((response: any) => { | |||||
| if (response.length > 0) { | |||||
| localStorage.allMalls = JSON.stringify(response); | |||||
| this.allMalls = JSON.parse(localStorage.allMalls); | |||||
| this.tempMalls = JSON.parse(localStorage.allMalls); | |||||
| } else { | |||||
| this.toastService.presentToast("No malls near you your location, Getting all the malls...", "warning"); | |||||
| this.getAllMalls(); | |||||
| } | |||||
| }, () => { | |||||
| this.toastService.presentToast("Failed to fetch malls for your location", "danger"); | |||||
| }); | |||||
| }); | |||||
| } else { | |||||
| this.getAllMalls(); | |||||
| } | |||||
| } | |||||
| getAllMalls() { | |||||
| this.mallService.allMalls().then((response) => { | this.mallService.allMalls().then((response) => { | ||||
| localStorage.allMalls = JSON.stringify(response); | localStorage.allMalls = JSON.stringify(response); | ||||
| this.allMalls = JSON.parse(localStorage.allMalls); | this.allMalls = JSON.parse(localStorage.allMalls); | ||||
| @@ -21,7 +21,7 @@ export class MallService { | |||||
| }) | }) | ||||
| }; | }; | ||||
| return await this.http.get(URL + '/api/maioraservice/mall/v1/latitude/28.6569551/longitude/77.2122032/check/', httpOptions).toPromise(); | |||||
| return await this.http.get(URL + '/api/maioraservice/mall/v1/latitude/' + latitude + '/longitude/' + longitude + '/check/', httpOptions).toPromise(); | |||||
| } | } | ||||
| async allMalls() { | async allMalls() { | ||||