Skip to content

Commit

Permalink
Merge pull request #334 from severinbeauvais/PRC-1019
Browse files Browse the repository at this point in the history
PRC-1019: derive unique applicants for display
  • Loading branch information
NickPhura authored Jan 22, 2019
2 parents 88072bb + 91ed0b6 commit d3d3ff9
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ <h1><span class="text-muted">Crown land File: {{application['clFile']}} &nbsp;&r
<div class="form-group">
<label>Applicant(s)</label>
<div class="applicant-display">
{{application.client || 'No Applicant on this File'}}
{{application['applicants'] || 'No Applicant on this File'}}
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ <h2>Description</h2>
<h2>Details</h2>
<ul class="nv-list">
<li>
<span class="name">Applicant:</span>
<span class="value">{{application.client || 'No Applicant on this File'}}</span>
<span class="name">Applicant(s):</span>
<span class="value">{{application['applicants'] || 'No Applicant on this File'}}</span>
</li>
<li>
<span class="name">Purpose/Subpurpose:</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h2>Crown Lands Applications in British Columbia</h2>
<table class="table application-table">
<thead class="application-table__sort-header">
<tr>
<th class="application-table__name-col sortable" (click)="sort('client')">Client Name
<th class="application-table__name-col sortable" (click)="sort('client')">Applicant(s)
<i class="sort" [ngClass]="{'sort-asc': (column == 'client' && direction < 0), 'sort-desc': (column == 'client' && direction > 0) }" aria-hidden="true"></i>
</th>
<th class="application-table__cl_file-col sortable" (click)="sort('cl_file')">CL File
Expand Down Expand Up @@ -54,7 +54,7 @@ <h2>Crown Lands Applications in British Columbia</h2>
<i class="material-icons open-icon">arrow_drop_down</i>
<i class="material-icons close-icon">arrow_drop_up</i>
</a>
<span class="accordion__collapse-header--column application-table__name-col">{{app.client || '-'}}</span>
<span class="accordion__collapse-header--column application-table__name-col">{{app['applicants'] || '-'}}</span>
<span class="accordion__collapse-header--column application-table__cl_file-col">
<a [routerLink]="['/a', app._id]">{{app['clFile'] || '-'}}</a>
</span>
Expand Down
7 changes: 7 additions & 0 deletions src/app/applications/application-resolver.service.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -45,6 +46,12 @@ export class ApplicationDetailResolver implements Resolve<Application> {
// 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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> = [
'cl_file',
Expand Down
2 changes: 1 addition & 1 deletion src/app/search/search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h2 *ngIf="ranSearch && !searching && count > 0">
<td class="disp">
<strong>{{application.tantalisID}}</strong>
</td>
<td [innerHTML]="application.client ? (application.client | titlecase) : '<em>No Applicant on this File</em>'"></td>
<td [innerHTML]="application['applicants'] ? (application['applicants'] | titlecase) : '<em>No Applicant on this File</em>'"></td>
<td>
{{application.purpose | titlecase}} / {{application.subpurpose | titlecase}}
</td>
Expand Down
6 changes: 6 additions & 0 deletions src/app/services/application.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
20 changes: 20 additions & 0 deletions src/app/services/search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit d3d3ff9

Please sign in to comment.