pd allocation map view changes

This commit is contained in:
gandhimathi 2018-11-29 11:42:02 +05:30
parent 7f00423bb1
commit 2cc206ed44
2 changed files with 31 additions and 5 deletions

View File

@ -13,8 +13,8 @@
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="60" fxFlex.xl="60"> <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="60" fxFlex.xl="60">
<mat-card> <mat-card>
<mat-card-content> <mat-card-content>
<agm-map [latitude]="lat" [longitude]="lng"> <agm-map [latitude]="lat" [longitude]="lng">
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker> <agm-marker *ngFor="let getMap of mapDetails" [latitude]="getMap.lat" [longitude]="getMap.lng"></agm-marker>
</agm-map> </agm-map>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>

View File

@ -1,5 +1,6 @@
import { Component, OnInit, Inject } from '@angular/core'; import { Component, OnInit, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { GetGeometricLocationService } from './../../../location-service/get-geometric-location.service';
@Component({ @Component({
selector: 'app-allocation-view-more', selector: 'app-allocation-view-more',
@ -7,16 +8,41 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
styleUrls: ['./allocation-view-more.component.scss'] styleUrls: ['./allocation-view-more.component.scss']
}) })
export class AllocationViewMoreComponent implements OnInit { export class AllocationViewMoreComponent implements OnInit {
lat = -34.397; lat:string
lng = 150.644; lng:string
mapDetails:any[] = [];
allocated_color: string = '#ffa500'; allocated_color: string = '#ffa500';
scheduled_color: string = '#3f51b5'; scheduled_color: string = '#3f51b5';
inprogress_color: string = '#4caf50'; inprogress_color: string = '#4caf50';
constructor(private dialogRef: MatDialogRef<AllocationViewMoreComponent>, constructor(private dialogRef: MatDialogRef<AllocationViewMoreComponent>,
@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() { 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);
// }
});
}
});
}
} }