diff --git a/src/app/malls/malls.page.html b/src/app/malls/malls.page.html
index 39169a0..75430c7 100644
--- a/src/app/malls/malls.page.html
+++ b/src/app/malls/malls.page.html
@@ -32,29 +32,25 @@
SORT / FILTER
-
-
-
+
-
+
diff --git a/src/app/malls/malls.page.ts b/src/app/malls/malls.page.ts
index 8d40d15..1f21b0b 100644
--- a/src/app/malls/malls.page.ts
+++ b/src/app/malls/malls.page.ts
@@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { MallService } from '../services/mall.service';
-import { IMall } from '../models/mall';
import { Router } from '@angular/router';
@Component({
@@ -10,7 +9,7 @@ import { Router } from '@angular/router';
})
export class MallsPage implements OnInit {
selected_tab: string = 'you';
- malls: Array;
+ malls: any = [];
show_sort_popup: boolean = false;
selected_sort: string = null;
@@ -20,33 +19,43 @@ export class MallsPage implements OnInit {
) { }
ngOnInit() {
- this.mallService.mallsByLocation(10.998264, 77.032465).then((response) => {
- console.log(response);
- }, (error) => {
- console.log(error);
- });
+ if (navigator.geolocation) {
+ navigator.geolocation.getCurrentPosition((position) => {
+ this.fetchMallsByLocation(position.coords.latitude, position.coords.longitude);
+ });
+ }
}
ionViewDidEnter() {
}
- showMallDetails(mall: IMall) {
- this.router.navigate(['/mall-details', { mall_id: mall.id }]);
+ fetchMallsByLocation(lat: number, lng: number) {
+ console.log(lat + ' ' + lng);
+ this.mallService.mallsByLocation(28.6569551, 77.2122032).then((response) => {
+ this.malls = response;
+ console.log(this.malls);
+ }, (error) => {
+ console.log(error);
+ });
+ }
+
+ showMallDetails(mall: any) {
+ this.router.navigate(['/mall-details', { mall: JSON.stringify(mall) }]);
}
sortBy(type: string) {
this.selected_sort = type;
switch(this.selected_sort) {
case 'name': this.malls.sort(function(a, b){
- if(a.name < b.name) { return -1; }
- if(a.name > b.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;
});
break;
case 'rating': this.malls.sort(function(a, b){
- 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;
}).reverse();
break;
@@ -57,8 +66,4 @@ export class MallsPage implements OnInit {
this.show_sort_popup = !this.show_sort_popup;
}
- outletDetails(mall_id: string, outlet_id: string) {
- this.router.navigate(['/outlet-details', { mall_id: mall_id, outlet_id: outlet_id }]);
- }
-
}
diff --git a/src/app/mocks/url.ts b/src/app/mocks/url.ts
index af31e22..87d5968 100644
--- a/src/app/mocks/url.ts
+++ b/src/app/mocks/url.ts
@@ -1,3 +1,3 @@
-export const URL: string = 'http://13.126.110.70:8080/mall-aggregator/';
+export const URL: string = 'http://13.126.110.70:8080/mall-aggregator';
export const TOKEN: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
diff --git a/src/app/services/mall.service.ts b/src/app/services/mall.service.ts
index 60b4d12..0c0b423 100644
--- a/src/app/services/mall.service.ts
+++ b/src/app/services/mall.service.ts
@@ -24,12 +24,13 @@ export class MallService {
async mallsByLocation(latitude: number, longitude: number) {
const httpOptions = {
headers: new HttpHeaders({
+ 'Access-Control-Allow-Origin': '*',
'Content-Type': 'application/json',
'Authorization': 'Token ' + TOKEN
})
};
- return await this.http.get(URL + '/api/maioraservice/mall/v1/latitude/' + latitude + '/longitude/' + longitude + '/', httpOptions).toPromise();
+ return await this.http.get('http://13.126.110.70:8080/mall-aggregator/api/maioraservice/mall/v1/latitude/28.6569551/longitude/77.2122032/check/', httpOptions).toPromise();
}
private getDenormalizedMall = async (mall: Mall) => {
diff --git a/src/global.scss b/src/global.scss
index 2c992a5..90736ac 100644
--- a/src/global.scss
+++ b/src/global.scss
@@ -31,6 +31,7 @@ p {
font-family: 'Roboto', sans-serif;
text-transform: none;
outline: none;
+ font-weight: 500;
}
h1,
h2,
@@ -185,7 +186,7 @@ figure {
display: flex;
padding: 15px;
flex-wrap: wrap;
- justify-content: space-between;
+ justify-content: space-around;
position: relative;
button {
background-color: transparent;