Commit 8f326880 by Adarsh K

changes

parent 4ba5e826
......@@ -120,12 +120,14 @@ export class NearbyPage implements OnInit {
mapReady(map) {
map.addListener('dragend', () => {
console.log(this.newCenterLat, this.newCenterLng);
this.getAddress(this.newCenterLat, this.newCenterLng);
});
}
centerChange(e) {
console.log(e);
this.newCenterLat = e.lat;
this.newCenterLng = e.lng;
this.getAddress(this.newCenterLat, this.newCenterLng);
}
goToPage(path, data = null) {
......
......@@ -42,7 +42,8 @@ export class AddressService {
defaultVal: item.defaultVal,
building: item.building,
landmark: item.landmark,
addressId: item.addressId
addressId: item.addressId,
nearest: false
};
this.addressList.push(address);
});
......@@ -72,7 +73,8 @@ export class AddressService {
defaultVal: item.defaultVal,
building: item.building,
landmark: item.landmark,
addressId: item.addressId
addressId: item.addressId,
nearest: false
};
this.defaultAdd = address;
console.log(this.defaultAdd);
......@@ -203,7 +205,8 @@ export class AddressService {
defaultVal: item.defaultVal,
building: item.building,
landmark: item.landmark,
addressId: item.addressId
addressId: item.addressId,
nearest: true
};
this.nearestList.push(address);
});
......@@ -212,6 +215,23 @@ export class AddressService {
} else {
// alert('No Orders Found');
}
if (this.addressList.length > 0 && this.nearestList.length > 0) {
this.addressList.forEach((address) => {
const index = this.nearestList.findIndex(x => x.addressId === address.addressId);
if (index >= 0) {
address.nearest = true;
}
});
}
console.log(this.addressList);
this.addressList = this.addressList.sort((a: any, b: any) => {
return b.nearest - a.nearest;
});
console.log(this.addressList);
});
} else {
console.log('No such document!');
......
......@@ -22,4 +22,5 @@ export interface AddressList {
building: string;
latLng: any;
landmark: string;
nearest: boolean;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment