Skip to content

Commit

Permalink
moved permitName to utils and refactored to support
Browse files Browse the repository at this point in the history
  • Loading branch information
acatchpole committed Jun 20, 2024
1 parent 4b0711c commit 05d5ce7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<span class="red-asterisk">*</span>
</label>
<select name="typeCode" id="typeCode" formControlName="typeCode" class="form-control">
<option *ngFor="let typeCode of permitTypes" [ngValue]="typeCode">
{{ this.permitType(record) }}
<option *ngFor="let typeCode of recordUtils.minePermitTypes" [ngValue]="typeCode">
{{ recordUtils.permitType(record) }}
</option>
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,6 @@ export class MinesRecordAddComponent implements OnInit, OnDestroy {
return agencyDataService.displayNameFull(agency);
}

permitName(typeCode) {
switch (typeCode) {
case 'OGP':
return 'Permit';
case 'ALG':
return 'Amalgamated Permit';
default:
return 'Permit Amendment' //AMD
}
}

ngOnDestroy(): void {
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ <h2 class="border-0 mb-0">Edit record</h2>
<div class="label-pair" *ngIf="myForm.get('recordType').value === 'Permit'">
<label for="typeCode">Permit Type</label>
<select name="typeCode" id="typeCode" formControlName="typeCode" class="form-control">
<option *ngFor="let typeCode of permitTypes" [ngValue]="typeCode">
{{ this.permitName(typeCode) }}
<option *ngFor="let typeCode of recordUtils.minePermitTypes" [ngValue]="typeCode">
{{ recordUtils.permitName(typeCode) }}
</option>
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,6 @@ export class MinesRecordsEditComponent implements OnInit {
return agencyDataService.displayNameFull(agency);
}

permitName(typeCode) {
switch (typeCode) {
case 'OGP':
return 'Permit';
case 'ALG':
return 'Amalgamated Permit';
default:
return 'Permit Amendment' //AMD
}
}

/**
* Cancel editing.
*
Expand Down
11 changes: 11 additions & 0 deletions angular/projects/admin-nrpti/src/app/records/utils/record-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,15 @@ export class RecordUtils {
const actTitle = dataservice.displayActTitleFull(actCode);
return actTitle;
}

permitName(typeCode: string): string {
switch (typeCode) {
case 'OGP':
return 'Permit';
case 'ALG':
return 'Amalgamated Permit';
default:
return 'Permit Amendment'; // AMD
}
}
}

0 comments on commit 05d5ce7

Please sign in to comment.