From 91ed0b601b9a9ebdbeada60fe190fd678da314a4 Mon Sep 17 00:00:00 2001 From: Severin Beauvais Date: Fri, 18 Jan 2019 16:54:40 -0800 Subject: [PATCH] PRC-1019: derive unique applicants for display --- .../application-add-edit.component.html | 2 +- .../application-detail.component.html | 4 ++-- .../application-list.component.html | 4 ++-- .../application-resolver.service.ts | 7 +++++++ .../review-comments.component.ts | 4 ++-- src/app/search/search.component.html | 2 +- src/app/services/application.service.ts | 6 ++++++ src/app/services/search.service.ts | 20 +++++++++++++++++++ 8 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/app/applications/application-add-edit/application-add-edit.component.html b/src/app/applications/application-add-edit/application-add-edit.component.html index 829e6212..3ca0878c 100644 --- a/src/app/applications/application-add-edit/application-add-edit.component.html +++ b/src/app/applications/application-add-edit/application-add-edit.component.html @@ -83,7 +83,7 @@

Crown land File: {{application['clFile']}}  &r
- {{application.client || 'No Applicant on this File'}} + {{application['applicants'] || 'No Applicant on this File'}}
diff --git a/src/app/applications/application-detail/application-detail.component.html b/src/app/applications/application-detail/application-detail.component.html index 2e9cc152..ae21488c 100644 --- a/src/app/applications/application-detail/application-detail.component.html +++ b/src/app/applications/application-detail/application-detail.component.html @@ -60,8 +60,8 @@

Description

Details

  • - Applicant: - {{application.client || 'No Applicant on this File'}} + Applicant(s): + {{application['applicants'] || 'No Applicant on this File'}}
  • Purpose/Subpurpose: diff --git a/src/app/applications/application-list/application-list.component.html b/src/app/applications/application-list/application-list.component.html index 472b6933..b8afd746 100644 --- a/src/app/applications/application-list/application-list.component.html +++ b/src/app/applications/application-list/application-list.component.html @@ -24,7 +24,7 @@

    Crown Lands Applications in British Columbia

    - - + diff --git a/src/app/services/application.service.ts b/src/app/services/application.service.ts index e83d103a..72aaa5ec 100644 --- a/src/app/services/application.service.ts +++ b/src/app/services/application.service.ts @@ -197,6 +197,12 @@ export class ApplicationService { // derive region code application.region = this.getRegionCode(application.businessUnit); + // derive unique applicants + if (application.client) { + const clients = application.client.split(', '); + application['applicants'] = _.uniq(clients).join(', '); + } + // finally update the object and return return application; }); diff --git a/src/app/services/search.service.ts b/src/app/services/search.service.ts index 0b61fddb..a22e027f 100644 --- a/src/app/services/search.service.ts +++ b/src/app/services/search.service.ts @@ -82,12 +82,22 @@ export class SearchService { tantalisID: +result.DISPOSITION_TRANSACTION_SID, client: clientString }); + // 7-digit CL File number for display app['clFile'] = result.CROWN_LANDS_FILE.padStart(7, '0'); + // user-friendly application status app.appStatus = this.applicationService.getLongStatusString(this.applicationService.getStatusCode(result.TENURE_STATUS)); + // derive region code app.region = this.applicationService.getRegionCode(app.businessUnit); + + // derive unique applicants + if (app.client) { + const clients = app.client.split(', '); + app['applicants'] = _.uniq(clients).join(', '); + } + results.push(app); }); @@ -154,12 +164,22 @@ export class SearchService { tantalisID: +searchResults.DISPOSITION_TRANSACTION_SID, client: clientString }); + // 7-digit CL File number for display app['clFile'] = searchResults.CROWN_LANDS_FILE.padStart(7, '0'); + // user-friendly application status app.appStatus = this.applicationService.getLongStatusString(this.applicationService.getStatusCode(searchResults.TENURE_STATUS)); + // derive region code app.region = this.applicationService.getRegionCode(app.businessUnit); + + // derive unique applicants + if (app.client) { + const clients = app.client.split(', '); + app['applicants'] = _.uniq(clients).join(', '); + } + results.push(app); }
    Client Name + Applicant(s) CL File @@ -54,7 +54,7 @@

    Crown Lands Applications in British Columbia

    arrow_drop_down arrow_drop_up - {{app.client || '-'}} + {{app['applicants'] || '-'}} {{app['clFile'] || '-'}} diff --git a/src/app/applications/application-resolver.service.ts b/src/app/applications/application-resolver.service.ts index 336386b1..31553322 100644 --- a/src/app/applications/application-resolver.service.ts +++ b/src/app/applications/application-resolver.service.ts @@ -1,6 +1,7 @@ import { Injectable } from '@angular/core'; import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { Observable } from 'rxjs/Observable'; +import * as _ from 'lodash'; import { ApplicationService } from 'app/services/application.service'; import { Application } from 'app/models/application'; @@ -45,6 +46,12 @@ export class ApplicationDetailResolver implements Resolve { // derive region code application.region = this.applicationService.getRegionCode(application.businessUnit); + // derive unique applicants + if (application.client) { + const clients = application.client.split(', '); + application['applicants'] = _.uniq(clients).join(', '); + } + return of(application); } diff --git a/src/app/applications/review-comments/review-comments.component.ts b/src/app/applications/review-comments/review-comments.component.ts index efc0cadb..a70303d9 100644 --- a/src/app/applications/review-comments/review-comments.component.ts +++ b/src/app/applications/review-comments/review-comments.component.ts @@ -159,13 +159,13 @@ export class ReviewCommentsComponent implements OnInit, OnDestroy { delete document.isDeleted; }); // add necessary properties - // comment['client'] = this.application.client; // FUTURE + // comment['applicants'] = this.application['applicants']; // FUTURE comment['cl_file'] = this.application['clFile']; return this.flatten_fastest(comment); }); const excelFileName = 'comments-' - + this.application.client.replace(/\s/g, '_') + + this.application['applicants'].replace(/\s/g, '_') + moment(new Date()).format('-YYYYMMDD'); const columnOrder: Array = [ 'cl_file', diff --git a/src/app/search/search.component.html b/src/app/search/search.component.html index 73fe7738..512183db 100644 --- a/src/app/search/search.component.html +++ b/src/app/search/search.component.html @@ -45,7 +45,7 @@

    {{application.tantalisID}} {{application.purpose | titlecase}} / {{application.subpurpose | titlecase}}