From 2cc206ed44419ce2c49efd1764bbd2366a991dfc Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Thu, 29 Nov 2018 11:42:02 +0530 Subject: [PATCH] pd allocation map view changes --- .../allocation-view-more.component.html | 4 +-- .../allocation-view-more.component.ts | 32 +++++++++++++++++-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/allocation-view-more/allocation-view-more.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/allocation-view-more/allocation-view-more.component.html index 921e13bbe..13dece34f 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/allocation-view-more/allocation-view-more.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/allocation-view-more/allocation-view-more.component.html @@ -13,8 +13,8 @@
- - + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/allocation-view-more/allocation-view-more.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/allocation-view-more/allocation-view-more.component.ts index 8f11effeb..6a781ae52 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/allocation-view-more/allocation-view-more.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/allocation-view-more/allocation-view-more.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit, Inject } from '@angular/core'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; +import { GetGeometricLocationService } from './../../../location-service/get-geometric-location.service'; @Component({ selector: 'app-allocation-view-more', @@ -7,16 +8,41 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; styleUrls: ['./allocation-view-more.component.scss'] }) export class AllocationViewMoreComponent implements OnInit { - lat = -34.397; - lng = 150.644; + lat:string + lng:string + mapDetails:any[] = []; allocated_color: string = '#ffa500'; scheduled_color: string = '#3f51b5'; inprogress_color: string = '#4caf50'; constructor(private dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data: any) { + @Inject(MAT_DIALOG_DATA) public data: any, public _geolocation: GetGeometricLocationService) { + //load map details + this.getMapViewLocations(this.data.pd_details); } ngOnInit() { } + // get map view locations + getMapViewLocations(getData:any){ + getData.forEach(element => { + if(element.addressline1 && element.pincode && element.state_name && element.city_name){ + this._geolocation.findLocations(element.addressline1,element.pincode,element.state_name,element.city_name) + .subscribe(response => { + if (response.status == 'OK') { + this.lat = response.results[0].geometry.location.lat; + this.lng = response.results[0].geometry.location.lng; + this.mapDetails.push(response.results[0].geometry.location) + } + // else if (response.status == 'ZERO_RESULTS') { + // console.log('geocodingAPIService', 'ZERO_RESULTS', response.status); + // } else { + // console.log('geocodingAPIService', 'Other error', response.status); + // } + }); + } + + + }); + } }