From 25b0c058ffc4575ab50ae0e866da7442d23875d4 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Thu, 7 Feb 2019 15:29:39 +0530 Subject: [PATCH] pd maps tooltipe directive changes --- .../allocation-view-more.component.html | 13 +++- .../allocation-view-more.component.ts | 18 ++++- .../map-pd-view/map-pd-view.component.html | 15 +++- .../map-pd-view/map-pd-view.component.ts | 72 ++++++++++++------- .../pd-located-map-view.directive.ts | 4 +- .../view-location.component.html | 24 ++++--- .../view-location/view-location.component.ts | 18 ++++- .../pd-service/pd-triger.service.ts | 13 +++- 8 files changed, 131 insertions(+), 46 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 b9fbd2746..ac8dd3731 100755 --- 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,17 @@
- - + + + +
+

{{getMap.applicant_details | titlecase}}

+
+
+

{{getMap.lender_details}}

+
+
+
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 6a781ae52..a885fc270 100755 --- 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 @@ -31,7 +31,9 @@ export class AllocationViewMoreComponent implements OnInit { 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) + response.results[0].applicant_details = element.applicant_name + ' ( Id:'+element.pd_id+')'; + response.results[0].lender_details = element.lender_short_name + '( Id:'+element.lender_applicant_id+')'; + this.mapDetails.push(response.results[0]) } // else if (response.status == 'ZERO_RESULTS') { // console.log('geocodingAPIService', 'ZERO_RESULTS', response.status); @@ -40,9 +42,19 @@ export class AllocationViewMoreComponent implements OnInit { // } }); } - - }); } + // this is for map tooltip open + onMouseOver(infoWindow, gm) { + + if (gm.lastOpen != null) { + gm.lastOpen.close(); + } + + gm.lastOpen = infoWindow; + + infoWindow.open(); +} + } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.html index f8b2e10b0..a87650eee 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.html @@ -27,7 +27,6 @@
- @@ -75,8 +74,18 @@
- - + + + +
+

{{getMap.applicant_details | titlecase}}

+
+
+

{{getMap.lender_details}}

+
+ +
+
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.ts index 802fe08e3..72f07f851 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/map-pd-view/map-pd-view.component.ts @@ -60,32 +60,43 @@ pdList:any[] = []; ngOnInit() { this.ListPdComponent.showListView(false); this.recordStatus=false - this.loadPdDetails(); + this.loadPdDetails(this.pdStatusCheck.TRIGGERED,this.pdStatusCheck.ALLOCATED); } ngAfterViewInit() { this.dataSource.paginator = this.paginator; this.dataSource.sort = this.sort; } - loadPdDetails(){ - this._pd.getPdDetails() - .subscribe( - data => { - if (data.status == 200) { - let filterdList = data.records.filter(item=>item.pd_status!=this.pdStatusCheck.DRAFT) - this.pdList = filterdList; - this.pdListData = filterdList; - this.dataLength = filterdList.length; + loadPdDetails(triStatus,allocStatus){ + this._pd.getPdMapList(triStatus,allocStatus).subscribe(responseList => { + if(responseList.length>0){ + if(responseList[0].dataStatus===true){ + let filterValue=responseList[0].records.filter(val=>val.fk_pd_type !='3') + this.pdList= this.pdList.concat.apply(this.pdList, filterValue); + } + if(responseList[1].dataStatus===true){ + let filterValue=responseList[1].records.filter(val=>val.fk_pd_type !='3') + this.pdList= this.pdList.concat.apply(this.pdList, filterValue); + } + if(this.pdList.length>0){ + this.pdListData = this.pdList; + this.dataLength = this.pdList.length; this.dataSource.data = this.pdListData; this.getMapViewLocations(this.pdList); - - } - else{ - this.pdList=[]; - this.dataLength = null; - this.recordStatus=true; - } - }, error => this.errorMessage = error); + } + else { + this.pdList=[]; + this.dataLength = null; + this.recordStatus=true; + } + + } + else { + this.pdList=[]; + this.dataLength = null; + this.recordStatus=true; + } + },error => this.errorMessage = error); } @@ -97,7 +108,9 @@ pdList:any[] = []; 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) + response.results[0].applicant_details = element.applicant_name + ' ( Id:'+element.pd_id+')'; + response.results[0].lender_details = element.lender_short_name + '( Id:'+element.lender_applicant_id+')'; + this.mapDetails.push(response.results[0]); } // else if (response.status == 'ZERO_RESULTS') { // console.log('geocodingAPIService', 'ZERO_RESULTS', response.status); @@ -133,7 +146,7 @@ pdList:any[] = []; dialogRef.afterClosed() .subscribe(dataresult => { // this.notifier.notify('success', 'Successfully allocated.!'); - this.loadPdDetails(); + this.loadPdDetails(this.pdStatusCheck.TRIGGERED,this.pdStatusCheck.ALLOCATED); }); } else if(pdData.fk_pd_type == 2){ @@ -146,8 +159,8 @@ pdList:any[] = []; dialogRef.afterClosed() .subscribe(dataresult => { // this.notifier.notify('success', 'Successfully allocated.!'); - this.loadPdDetails(); - }); + this.loadPdDetails(this.pdStatusCheck.TRIGGERED,this.pdStatusCheck.ALLOCATED); + }); } else if(pdData.fk_pd_type == 3){ const dialogRef = this.dialog.open(TelePdAllocationComponent, { @@ -160,7 +173,7 @@ pdList:any[] = []; .subscribe(dataresult => { // this.notifier.notify('success', 'Successfully allocated.!'); - this.loadPdDetails(); + this.loadPdDetails(this.pdStatusCheck.TRIGGERED,this.pdStatusCheck.ALLOCATED); }); } @@ -177,7 +190,7 @@ pdList:any[] = []; dialogSchedule.afterClosed() .subscribe(dataresult => { // this.notifier.notify('success', 'Successfully allocated.!'); - this.loadPdDetails(); + this.loadPdDetails(this.pdStatusCheck.TRIGGERED,this.pdStatusCheck.ALLOCATED); }); } ngOnDestroy(): void { @@ -190,5 +203,16 @@ pdList:any[] = []; filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches this.dataSource.filter = filterValue; } + // this is for map tooltip open + onMouseOver(infoWindow, gm) { + + if (gm.lastOpen != null) { + gm.lastOpen.close(); + } + + gm.lastOpen = infoWindow; + + infoWindow.open(); +} } diff --git a/ng6-seed/src/app/personal-discussion/pd-directive/pd-located-map-view.directive.ts b/ng6-seed/src/app/personal-discussion/pd-directive/pd-located-map-view.directive.ts index b4cab5324..c60aa1abd 100644 --- a/ng6-seed/src/app/personal-discussion/pd-directive/pd-located-map-view.directive.ts +++ b/ng6-seed/src/app/personal-discussion/pd-directive/pd-located-map-view.directive.ts @@ -27,10 +27,12 @@ export class PdLocatedMapViewDirective { this._geolocation.findLocations(this.value.addressline1,this.value.pincode,this.value.state_name,this.value.city_name) .subscribe(response => { if (response.status == 'OK') { + let address_content: string = this.value.addressline1.toUpperCase() + ','+this.value.city_name.toUpperCase()+ ','+this.value.state_name.toUpperCase(); + address_content = this.value.pincode_id=='1' ? address_content+'-'+this.value.other_pincode : address_content+'-'+this.value.pincode this.lat = response.results[0].geometry.location.lat; this.lang = response.results[0].geometry.location.lng; const dialogRef = this.dialog.open(ViewLocationComponent, { - data: {"lat": this.lat, "lang":this.lang}, + data: {"lat": this.lat, "lang":this.lang,"content":address_content}, disableClose: false, minWidth:'30%', maxWidth:'30%', diff --git a/ng6-seed/src/app/personal-discussion/pd-directive/view-location/view-location.component.html b/ng6-seed/src/app/personal-discussion/pd-directive/view-location/view-location.component.html index 1c59c9300..dfa7a821e 100644 --- a/ng6-seed/src/app/personal-discussion/pd-directive/view-location/view-location.component.html +++ b/ng6-seed/src/app/personal-discussion/pd-directive/view-location/view-location.component.html @@ -1,6 +1,6 @@

- PD Location + PD Address
@@ -9,18 +9,22 @@
- - - - + + + + +

{{message_content}}

+
+ +
-
-
- diff --git a/ng6-seed/src/app/personal-discussion/pd-directive/view-location/view-location.component.ts b/ng6-seed/src/app/personal-discussion/pd-directive/view-location/view-location.component.ts index b9704ac89..61023b11e 100644 --- a/ng6-seed/src/app/personal-discussion/pd-directive/view-location/view-location.component.ts +++ b/ng6-seed/src/app/personal-discussion/pd-directive/view-location/view-location.component.ts @@ -7,10 +7,24 @@ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA , DialogPosition} from '@angul styleUrls: ['./view-location.component.scss'] }) export class ViewLocationComponent implements OnInit { - - constructor(@Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef) { } + message_content: String; + constructor(@Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef) { + this.message_content=this.data.content; + } ngOnInit() { } + // this is for map tooltip open + onMouseOver(infoWindow, gm) { + + if (gm.lastOpen != null) { + gm.lastOpen.close(); + } + + gm.lastOpen = infoWindow; + + infoWindow.open(); +} + } diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index 057387d01..fa1a819eb 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -3,7 +3,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs';//for Datatables import { HttpClient, HttpParams } from '@angular/common/http'; import { catchError, map } from 'rxjs/operators'; -import { of } from 'rxjs'; +import { of, forkJoin } from 'rxjs'; /** Imported Service Files Are., */ import { AwsService } from '../../AwsService/aws.service'; @@ -566,6 +566,17 @@ export class PdTrigerService { catchError(this.handleError('operation', [])) ) } + + // this is for pd map details only for triggered/ allocated status + getPdMapList(triggeredStatus, allocatedStatus): Observable { + const firstStatus = triggeredStatus ? + { params: new HttpParams().set('status', triggeredStatus) } : {}; + let response1 = this._http.get(this.apiUrl + "listLessPDDetails/get", firstStatus); + const secondStatus = allocatedStatus ? + { params: new HttpParams().set('status', allocatedStatus) } : {}; + let response2 = this._http.get(this.apiUrl + "listLessPDDetails/get", secondStatus); + return forkJoin([response1, response2]); + } }