Skip to content

Commit

Permalink
[BUG][NRPTI-1233] Amalgamated permits not showing in BCMI (#1243)
Browse files Browse the repository at this point in the history
* unrelated minor fixes

* Add getPermitType method to PermitUtils

* Add support for Amalgamated Permit code

* Revert datasource.js

* Fix typo

* created migration that updates the type field based on the typeCode of the associate records

* linting fixes

* Replace ternary operators with function calls

* Replace ternary operator with function call in add component

* moved permitName to utils and refactored to support

* removed minePermitNames from individual files as they are now in recordUtils

* added minePermitNames to recordUtils

* Fix mine permit bugs due to typos

* linting fix 3: The Revenge of Lint

---------

Co-authored-by: acatchpole <adamantiumite@gmail.com>
Co-authored-by: acatchpole <113044739+acatchpole@users.noreply.github.com>
  • Loading branch information
3 people committed Jul 17, 2024
1 parent e93e177 commit 3e60735
Show file tree
Hide file tree
Showing 15 changed files with 343 additions and 233 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug
about: An undesirable behaviour that needs correction
title: ''
labels: Spike
labels: Bug
assignees: ''

---
Expand Down
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">
{{ typeCode === 'OGP' ? 'Original Permit' : 'Permit Amendment' }}
<option *ngFor="let typeCode of recordUtils.minePermitTypes" [ngValue]="typeCode">
{{ recordUtils.minePermitName(typeCode) }}
</option>
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export class MinesRecordAddComponent implements OnInit, OnDestroy {
return item.displayName;
})
.sort();
public permitTypes = ['OGP', 'AMD'];

// Documents
public documents = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ <h2 class="border-0 mb-0">Record Information</h2>
<div class="flex-container mb-2">
<label for="type" class="med mr-2">Permit Type:</label>
<span id="type" name="type">
{{
record && record.typeCode && record.typeCode === 'OGP'
? 'Original Permit'
: record && record.typeCode && record.typeCode === 'AMD'
? 'Permit Amendment'
: '-'
}}
{{ this.permitType(record) }}
</span>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ export class MinesRecordDetailComponent implements OnInit, OnDestroy {
return agencyDataService.displayNameFull(agency);
}

permitType(record) {
if (record && record.typeCode) {
switch (record.typeCode) {
case 'OGP':
return 'Original Permit';
case 'AMD':
return 'Permit Amendment';
case 'ALG':
return 'Amalgamated Permit';
default:
return '-';
}
}
return '-';
}

ngOnDestroy() {
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">
{{ typeCode === 'OGP' ? 'Original Permit' : 'Permit Amendment' }}
<option *ngFor="let typeCode of recordUtils.minePermitTypes" [ngValue]="typeCode">
{{ recordUtils.minePermitName(typeCode) }}
</option>
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export class MinesRecordsEditComponent implements OnInit {
return item.displayName;
})
.sort();
public permitTypes = ['OGP', 'AMD'];

public recordAgencies = Picklists.collectionAgencyCodePicklist;

Expand Down
Loading

0 comments on commit 3e60735

Please sign in to comment.