diff --git a/angular/projects/admin-nrpti/src/app/records/administrative-penalties/administrative-penalty-detail/administrative-penalty-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/administrative-penalties/administrative-penalty-detail/administrative-penalty-detail.component.ts
index f5c4bfc24..b1c1ffa13 100644
--- a/angular/projects/admin-nrpti/src/app/records/administrative-penalties/administrative-penalty-detail/administrative-penalty-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/administrative-penalties/administrative-penalty-detail/administrative-penalty-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-administrative-penalty-detail',
@@ -60,7 +60,8 @@ export class AdministrativePenaltyDetailComponent extends RecordDetailComponent
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
navigateToEditPage() {
diff --git a/angular/projects/admin-nrpti/src/app/records/administrative-sanctions/administrative-sanction-add-edit/administrative-sanction-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/administrative-sanctions/administrative-sanction-add-edit/administrative-sanction-add-edit.component.ts
index c6cc1b37a..f6b1b280e 100644
--- a/angular/projects/admin-nrpti/src/app/records/administrative-sanctions/administrative-sanction-add-edit/administrative-sanction-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/administrative-sanctions/administrative-sanction-add-edit/administrative-sanction-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, LoggerService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-administrative-sanction-add-edit',
@@ -32,7 +33,7 @@ export class AdministrativeSanctionAddEditComponent implements OnInit, OnDestroy
public nrcedPublishSubtext = 'Not published';
// Pick lists
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
public authors = Picklists.authorPicklist;
private defaultAgency = '';
@@ -546,7 +547,8 @@ export class AdministrativeSanctionAddEditComponent implements OnInit, OnDestroy
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/administrative-sanctions/administrative-sanction-detail/administrative-sanction-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/administrative-sanctions/administrative-sanction-detail/administrative-sanction-detail.component.ts
index c51923589..e65052557 100644
--- a/angular/projects/admin-nrpti/src/app/records/administrative-sanctions/administrative-sanction-detail/administrative-sanction-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/administrative-sanctions/administrative-sanction-detail/administrative-sanction-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-administrative-sanction-detail',
@@ -60,7 +60,8 @@ export class AdministrativeSanctionDetailComponent extends RecordDetailComponent
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
navigateToEditPage() {
diff --git a/angular/projects/admin-nrpti/src/app/records/annual-reports/annual-report-add-edit/annual-report-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/annual-reports/annual-report-add-edit/annual-report-add-edit.component.ts
index ddac22488..0bf7fd1b9 100644
--- a/angular/projects/admin-nrpti/src/app/records/annual-reports/annual-report-add-edit/annual-report-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/annual-reports/annual-report-add-edit/annual-report-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, StoreService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-annual-report-add-edit',
@@ -30,7 +31,7 @@ export class AnnualReportAddEditComponent implements OnInit, OnDestroy {
public bcmiPublishSubtext = 'Not published';
// Pick lists
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
public datepickerMinDate = Constants.DatepickerMinDate;
public datepickerMaxDate = Constants.DatepickerMaxDate;
@@ -414,7 +415,8 @@ export class AnnualReportAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/annual-reports/annual-report-detail/annual-report-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/annual-reports/annual-report-detail/annual-report-detail.component.ts
index ac040825c..c85df69c0 100644
--- a/angular/projects/admin-nrpti/src/app/records/annual-reports/annual-report-detail/annual-report-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/annual-reports/annual-report-detail/annual-report-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-annual-report-detail',
@@ -64,7 +64,8 @@ export class AnnualReportDetailComponent extends RecordDetailComponent implement
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/certificate-amendments/certificate-amendments-add-edit/certificate-amendments-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/certificate-amendments/certificate-amendments-add-edit/certificate-amendments-add-edit.component.ts
index 7e97e1672..7ca86b85f 100644
--- a/angular/projects/admin-nrpti/src/app/records/certificate-amendments/certificate-amendments-add-edit/certificate-amendments-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/certificate-amendments/certificate-amendments-add-edit/certificate-amendments-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, StoreService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-certificate-amendment-add-edit',
@@ -33,7 +34,7 @@ export class CertificateAmendmentAddEditComponent implements OnInit, OnDestroy {
// Pick lists
public certificateSubtypes = Picklists.certificateSubtypePicklist;
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
public datepickerMinDate = Constants.DatepickerMinDate;
public datepickerMaxDate = Constants.DatepickerMaxDate;
@@ -482,7 +483,8 @@ export class CertificateAmendmentAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/certificate-amendments/certificate-amendments-detail/certificate-amendments-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/certificate-amendments/certificate-amendments-detail/certificate-amendments-detail.component.ts
index eaa68c522..ac4478584 100644
--- a/angular/projects/admin-nrpti/src/app/records/certificate-amendments/certificate-amendments-detail/certificate-amendments-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/certificate-amendments/certificate-amendments-detail/certificate-amendments-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-certificate-amendment-detail',
@@ -64,7 +64,8 @@ export class CertificateAmendmentDetailComponent extends RecordDetailComponent i
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/certificates/certificate-add-edit/certificate-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/certificates/certificate-add-edit/certificate-add-edit.component.ts
index 5950c2b68..70ea1dc4d 100644
--- a/angular/projects/admin-nrpti/src/app/records/certificates/certificate-add-edit/certificate-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/certificates/certificate-add-edit/certificate-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, StoreService, LoggerService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-certificate-add-edit',
@@ -31,7 +32,7 @@ export class CertificateAddEditComponent implements OnInit, OnDestroy {
// Pick lists
public certificateSubtypes = Picklists.certificateSubtypePicklist;
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
public datepickerMinDate = Constants.DatepickerMinDate;
public datepickerMaxDate = Constants.DatepickerMaxDate;
@@ -390,7 +391,8 @@ export class CertificateAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy(): void {
diff --git a/angular/projects/admin-nrpti/src/app/records/certificates/certificate-detail/certificate-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/certificates/certificate-detail/certificate-detail.component.ts
index 298668b27..9e3d02ffb 100644
--- a/angular/projects/admin-nrpti/src/app/records/certificates/certificate-detail/certificate-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/certificates/certificate-detail/certificate-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-certificate-detail',
@@ -64,7 +64,8 @@ export class CertificateDetailComponent extends RecordDetailComponent implements
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/construction-plans/construction-plan-add-edit/construction-plan-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/construction-plans/construction-plan-add-edit/construction-plan-add-edit.component.ts
index 39ad0bcb7..23b1814ef 100644
--- a/angular/projects/admin-nrpti/src/app/records/construction-plans/construction-plan-add-edit/construction-plan-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/construction-plans/construction-plan-add-edit/construction-plan-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, StoreService, LoggerService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-construction-plan-add-edit',
@@ -30,7 +31,7 @@ export class ConstructionPlanAddEditComponent implements OnInit, OnDestroy {
public lngPublishSubtext = 'Not published';
// Pick lists
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
// Documents
public documents = [];
@@ -305,7 +306,8 @@ export class ConstructionPlanAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/construction-plans/construction-plan-detail/construction-plan-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/construction-plans/construction-plan-detail/construction-plan-detail.component.ts
index 4781517cf..9d232f766 100644
--- a/angular/projects/admin-nrpti/src/app/records/construction-plans/construction-plan-detail/construction-plan-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/construction-plans/construction-plan-detail/construction-plan-detail.component.ts
@@ -6,7 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-construction-plan-detail',
@@ -54,7 +54,8 @@ export class ConstructionPlanDetailComponent extends RecordDetailComponent imple
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/correspondences/correspondence-add-edit/correspondence-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/correspondences/correspondence-add-edit/correspondence-add-edit.component.ts
index 293090893..3de9d0edc 100644
--- a/angular/projects/admin-nrpti/src/app/records/correspondences/correspondence-add-edit/correspondence-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/correspondences/correspondence-add-edit/correspondence-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, StoreService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-correspondence-add-edit',
@@ -32,7 +33,7 @@ export class CorrespondenceAddEditComponent implements OnInit, OnDestroy {
public bcmiPublishSubtext = 'Not published';
// Pick lists
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
// Documents
public documents = [];
@@ -477,7 +478,8 @@ export class CorrespondenceAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/correspondences/correspondence-detail/correspondence-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/correspondences/correspondence-detail/correspondence-detail.component.ts
index aea343150..e810532cb 100644
--- a/angular/projects/admin-nrpti/src/app/records/correspondences/correspondence-detail/correspondence-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/correspondences/correspondence-detail/correspondence-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-correspondence-detail',
@@ -64,7 +64,8 @@ export class CorrespondenceDetailComponent extends RecordDetailComponent impleme
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/court-convictions/court-conviction-add-edit/court-conviction-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/court-convictions/court-conviction-add-edit/court-conviction-add-edit.component.ts
index 6034f690d..72b417415 100644
--- a/angular/projects/admin-nrpti/src/app/records/court-convictions/court-conviction-add-edit/court-conviction-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/court-convictions/court-conviction-add-edit/court-conviction-add-edit.component.ts
@@ -9,6 +9,7 @@ import { Utils, LoadingScreenService, LoggerService, StoreService } from 'nrpti-
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { RecordUtils } from '../../utils/record-utils';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-court-conviction-add-edit',
@@ -33,7 +34,7 @@ export class CourtConvictionAddEditComponent implements OnInit, OnDestroy {
public bcmiPublishSubtext = 'Not published';
// Pick lists
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
public authors = Picklists.authorPicklist;
public courtConvictionSubtypes = Picklists.courtConvictionSubtypePicklist;
protected defaultAgency = '';
@@ -636,7 +637,8 @@ export class CourtConvictionAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/court-convictions/court-conviction-detail/court-conviction-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/court-convictions/court-conviction-detail/court-conviction-detail.component.ts
index bfb373cef..e2f64fb5f 100644
--- a/angular/projects/admin-nrpti/src/app/records/court-convictions/court-conviction-detail/court-conviction-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/court-convictions/court-conviction-detail/court-conviction-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-court-conviction-detail',
@@ -64,7 +64,8 @@ export class CourtConvictionDetailComponent extends RecordDetailComponent implem
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/dam-safety-inspections/dam-safety-inspection-add-edit/dam-safety-inspection-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/dam-safety-inspections/dam-safety-inspection-add-edit/dam-safety-inspection-add-edit.component.ts
index bb760afe2..5ebee5cd2 100644
--- a/angular/projects/admin-nrpti/src/app/records/dam-safety-inspections/dam-safety-inspection-add-edit/dam-safety-inspection-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/dam-safety-inspections/dam-safety-inspection-add-edit/dam-safety-inspection-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, StoreService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-dam-safety-inspection-add-edit',
@@ -32,7 +33,7 @@ export class DamSafetyInspectionAddEditComponent implements OnInit, OnDestroy {
public bcmiPublishSubtext = 'Not published';
// Pick lists
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
// Documents
public documents = [];
@@ -492,7 +493,8 @@ export class DamSafetyInspectionAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy(): void {
diff --git a/angular/projects/admin-nrpti/src/app/records/dam-safety-inspections/dam-safety-inspection-detail/dam-safety-inspection-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/dam-safety-inspections/dam-safety-inspection-detail/dam-safety-inspection-detail.component.ts
index 03505382a..58297c1e5 100644
--- a/angular/projects/admin-nrpti/src/app/records/dam-safety-inspections/dam-safety-inspection-detail/dam-safety-inspection-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/dam-safety-inspections/dam-safety-inspection-detail/dam-safety-inspection-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-dam-safety-inspection-detail',
@@ -64,7 +64,8 @@ export class DamSafetyInspectionDetailComponent extends RecordDetailComponent im
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/inspections/inspection-add-edit/inspection-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/inspections/inspection-add-edit/inspection-add-edit.component.ts
index 4b6a46a62..07a6cfd0f 100644
--- a/angular/projects/admin-nrpti/src/app/records/inspections/inspection-add-edit/inspection-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/inspections/inspection-add-edit/inspection-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, StoreService, LoggerService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-inspection-add-edit',
@@ -32,7 +33,7 @@ export class InspectionAddEditComponent implements OnInit, OnDestroy {
public nrcedPublishSubtext = 'Not published';
// Pick lists
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
public authors = Picklists.authorPicklist;
public outcomeStatuses = Picklists.outcomeStatusPicklist;
private defaultAgency = '';
@@ -515,7 +516,8 @@ export class InspectionAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/inspections/inspection-detail/inspection-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/inspections/inspection-detail/inspection-detail.component.ts
index 5903a178a..feb86b3ac 100644
--- a/angular/projects/admin-nrpti/src/app/records/inspections/inspection-detail/inspection-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/inspections/inspection-detail/inspection-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-inspection-detail',
@@ -23,7 +23,7 @@ export class InspectionDetailComponent extends RecordDetailComponent implements
public route: ActivatedRoute,
public router: Router,
public changeDetectionRef: ChangeDetectorRef,
- public factoryService: FactoryService
+ public factoryService: FactoryService,
) {
super(factoryService);
}
@@ -64,7 +64,8 @@ export class InspectionDetailComponent extends RecordDetailComponent implements
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/management-plans/management-plan-add-edit/management-plan-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/management-plans/management-plan-add-edit/management-plan-add-edit.component.ts
index 2c74fd446..1ccb362fb 100644
--- a/angular/projects/admin-nrpti/src/app/records/management-plans/management-plan-add-edit/management-plan-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/management-plans/management-plan-add-edit/management-plan-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, StoreService, LoggerService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-management-plan-add-edit',
@@ -30,7 +31,7 @@ export class ManagementPlanAddEditComponent implements OnInit, OnDestroy {
public lngPublishSubtext = 'Not published';
// Pick lists
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
// Documents
public documents = [];
@@ -306,7 +307,8 @@ export class ManagementPlanAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/management-plans/management-plan-detail/management-plan-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/management-plans/management-plan-detail/management-plan-detail.component.ts
index 895ac2ba6..8d40a3875 100644
--- a/angular/projects/admin-nrpti/src/app/records/management-plans/management-plan-detail/management-plan-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/management-plans/management-plan-detail/management-plan-detail.component.ts
@@ -5,7 +5,8 @@ import { Subject } from 'rxjs';
import { ActivatedRoute, Router } from '@angular/router';
import { RecordComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
+import { FactoryService } from '../../../services/factory.service';
@Component({
selector: 'app-management-plan-detail',
@@ -15,7 +16,8 @@ import { Utils } from 'nrpti-angular-components';
export class ManagementPlanDetailComponent extends RecordComponent implements OnInit, OnDestroy {
private ngUnsubscribe: Subject
= new Subject();
- constructor(public route: ActivatedRoute, public router: Router, public changeDetectionRef: ChangeDetectorRef) {
+ constructor(public route: ActivatedRoute, public router: Router, public changeDetectionRef: ChangeDetectorRef
+ , public factoryService: FactoryService) {
super();
}
@@ -46,7 +48,8 @@ export class ManagementPlanDetailComponent extends RecordComponent implements On
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
@@ -54,3 +57,4 @@ export class ManagementPlanDetailComponent extends RecordComponent implements On
this.ngUnsubscribe.complete();
}
}
+
diff --git a/angular/projects/admin-nrpti/src/app/records/orders/order-add-edit/order-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/orders/order-add-edit/order-add-edit.component.ts
index 68877ef24..c0d4511a9 100644
--- a/angular/projects/admin-nrpti/src/app/records/orders/order-add-edit/order-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/orders/order-add-edit/order-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, StoreService, LoggerService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-order-add-edit',
@@ -33,7 +34,7 @@ export class OrderAddEditComponent implements OnInit, OnDestroy {
// Pick lists
public orderSubtypePicklist = Picklists.orderSubtypePicklist;
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
public authors = Picklists.authorPicklist;
public outcomeStatuses = Picklists.outcomeStatusPicklist;
private defaultAgency = '';
@@ -55,7 +56,7 @@ export class OrderAddEditComponent implements OnInit, OnDestroy {
private logger: LoggerService,
private loadingScreenService: LoadingScreenService,
private utils: Utils,
- private _changeDetectionRef: ChangeDetectorRef
+ private _changeDetectionRef: ChangeDetectorRef,
) { }
ngOnInit() {
@@ -522,7 +523,8 @@ export class OrderAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/orders/order-detail/order-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/orders/order-detail/order-detail.component.ts
index 3abeeece7..f5412d01d 100644
--- a/angular/projects/admin-nrpti/src/app/records/orders/order-detail/order-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/orders/order-detail/order-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-order-detail',
@@ -64,7 +64,8 @@ export class OrderDetailComponent extends RecordDetailComponent implements OnIni
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/permits/permit-add-edit/permit-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/permits/permit-add-edit/permit-add-edit.component.ts
index b94839cae..924a48bf6 100644
--- a/angular/projects/admin-nrpti/src/app/records/permits/permit-add-edit/permit-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/permits/permit-add-edit/permit-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, StoreService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-permit-add-edit',
@@ -31,7 +32,7 @@ export class PermitAddEditComponent implements OnInit, OnDestroy {
// Pick lists
public permitSubtypes = Picklists.permitSubtypePicklist;
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
private defaultAgency = '';
// Documents
@@ -376,7 +377,8 @@ export class PermitAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/permits/permit-detail/permit-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/permits/permit-detail/permit-detail.component.ts
index f8162642a..682e1beb0 100644
--- a/angular/projects/admin-nrpti/src/app/records/permits/permit-detail/permit-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/permits/permit-detail/permit-detail.component.ts
@@ -8,7 +8,7 @@ import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
import { StoreService } from 'nrpti-angular-components';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-permit-detail',
@@ -68,7 +68,8 @@ export class PermitDetailComponent extends RecordDetailComponent implements OnIn
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/reports/report-add-edit/report-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/reports/report-add-edit/report-add-edit.component.ts
index 8ec105758..2921e8483 100644
--- a/angular/projects/admin-nrpti/src/app/records/reports/report-add-edit/report-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/reports/report-add-edit/report-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, StoreService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-report-add-edit',
@@ -32,7 +33,7 @@ export class ReportAddEditComponent implements OnInit, OnDestroy {
public bcmiPublishSubtext = 'Not published';
// Pick lists
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
// Documents
public documents = [];
@@ -479,7 +480,8 @@ export class ReportAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/reports/report-detail/report-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/reports/report-detail/report-detail.component.ts
index 78c8033da..76beee24b 100644
--- a/angular/projects/admin-nrpti/src/app/records/reports/report-detail/report-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/reports/report-detail/report-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-report-detail',
@@ -64,7 +64,8 @@ export class ReportDetailComponent extends RecordDetailComponent implements OnIn
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/restorative-justices/restorative-justice-add-edit/restorative-justice-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/restorative-justices/restorative-justice-add-edit/restorative-justice-add-edit.component.ts
index e014b2048..efb52c90e 100644
--- a/angular/projects/admin-nrpti/src/app/records/restorative-justices/restorative-justice-add-edit/restorative-justice-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/restorative-justices/restorative-justice-add-edit/restorative-justice-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, LoggerService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-restorative-justice-add-edit',
@@ -32,7 +33,7 @@ export class RestorativeJusticeAddEditComponent implements OnInit, OnDestroy {
public nrcedPublishSubtext = 'Not published';
// Pick lists
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
public authors = Picklists.authorPicklist;
private defaultAgency = '';
@@ -543,7 +544,8 @@ export class RestorativeJusticeAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/restorative-justices/restorative-justice-detail/restorative-justice-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/restorative-justices/restorative-justice-detail/restorative-justice-detail.component.ts
index ed8b7b143..5469f9a69 100644
--- a/angular/projects/admin-nrpti/src/app/records/restorative-justices/restorative-justice-detail/restorative-justice-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/restorative-justices/restorative-justice-detail/restorative-justice-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-restorative-justice-detail',
@@ -64,7 +64,8 @@ export class RestorativeJusticeDetailComponent extends RecordDetailComponent imp
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/self-reports/self-report-add-edit/self-report-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/self-reports/self-report-add-edit/self-report-add-edit.component.ts
index bae2505b7..dbd2c7449 100644
--- a/angular/projects/admin-nrpti/src/app/records/self-reports/self-report-add-edit/self-report-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/self-reports/self-report-add-edit/self-report-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, LoggerService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-self-report-add-edit',
@@ -30,7 +31,7 @@ export class SelfReportAddEditComponent implements OnInit, OnDestroy {
public lngPublishSubtext = 'Not published';
// Pick lists
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
public authors = Picklists.authorPicklist;
// Documents
@@ -358,7 +359,8 @@ export class SelfReportAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/self-reports/self-report-detail/self-report-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/self-reports/self-report-detail/self-report-detail.component.ts
index 0fab58896..c56a64f44 100644
--- a/angular/projects/admin-nrpti/src/app/records/self-reports/self-report-detail/self-report-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/self-reports/self-report-detail/self-report-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-self-report-detail',
@@ -64,7 +64,8 @@ export class SelfReportDetailComponent extends RecordDetailComponent implements
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/tickets/ticket-add-edit/ticket-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/tickets/ticket-add-edit/ticket-add-edit.component.ts
index 9086782c9..a8cbfd0af 100644
--- a/angular/projects/admin-nrpti/src/app/records/tickets/ticket-add-edit/ticket-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/tickets/ticket-add-edit/ticket-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, LoggerService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-ticket-add-edit',
@@ -32,7 +33,7 @@ export class TicketAddEditComponent implements OnInit, OnDestroy {
public nrcedPublishSubtext = 'Not published';
// Pick lists
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
public authors = Picklists.authorPicklist;
private defaultAgency = '';
@@ -541,7 +542,8 @@ export class TicketAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/tickets/ticket-detail/ticket-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/tickets/ticket-detail/ticket-detail.component.ts
index e3d38de6a..502f6dd11 100644
--- a/angular/projects/admin-nrpti/src/app/records/tickets/ticket-detail/ticket-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/tickets/ticket-detail/ticket-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-ticket-detail',
@@ -64,7 +64,8 @@ export class TicketDetailComponent extends RecordDetailComponent implements OnIn
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/records/warnings/warning-add-edit/warning-add-edit.component.ts b/angular/projects/admin-nrpti/src/app/records/warnings/warning-add-edit/warning-add-edit.component.ts
index 1509bdc6e..ed6a1ea2a 100644
--- a/angular/projects/admin-nrpti/src/app/records/warnings/warning-add-edit/warning-add-edit.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/warnings/warning-add-edit/warning-add-edit.component.ts
@@ -10,6 +10,7 @@ import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/uti
import { RecordUtils } from '../../utils/record-utils';
import { LoadingScreenService, LoggerService } from 'nrpti-angular-components';
import { Constants } from '../../../utils/constants/misc';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-warning-add-edit',
@@ -32,7 +33,7 @@ export class WarningAddEditComponent implements OnInit, OnDestroy {
public nrcedPublishSubtext = 'Not published';
// Pick lists
- public agencies = Picklists.agencyPicklist;
+ public agencies = Picklists.agencyCodePicklist;
public authors = Picklists.authorPicklist;
public outcomeStatuses = Picklists.outcomeStatusPicklist;
private defaultAgency = '';
@@ -474,7 +475,8 @@ export class WarningAddEditComponent implements OnInit, OnDestroy {
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
cancel() {
diff --git a/angular/projects/admin-nrpti/src/app/records/warnings/warning-detail/warning-detail.component.ts b/angular/projects/admin-nrpti/src/app/records/warnings/warning-detail/warning-detail.component.ts
index 17de72a6d..35b52b0d3 100644
--- a/angular/projects/admin-nrpti/src/app/records/warnings/warning-detail/warning-detail.component.ts
+++ b/angular/projects/admin-nrpti/src/app/records/warnings/warning-detail/warning-detail.component.ts
@@ -7,7 +7,7 @@ import { RecordDetailComponent } from '../../utils/record-component';
import { RecordUtils } from '../../utils/record-utils';
import { Utils as CommonUtils } from '../../../../../../common/src/app/utils/utils';
import { FactoryService } from '../../../services/factory.service';
-import { Utils } from 'nrpti-angular-components';
+import { AgencyDataService } from '../../../../../../../projects/global/src/lib/utils/agency-data-service';
@Component({
selector: 'app-warning-detail',
@@ -64,7 +64,8 @@ export class WarningDetailComponent extends RecordDetailComponent implements OnI
}
displayName(agency) {
- return Utils.displayNameFull(agency);
+ const agencyDataService = new AgencyDataService(this.factoryService);
+ return agencyDataService.displayNameFull(agency);
}
ngOnDestroy() {
diff --git a/angular/projects/admin-nrpti/src/app/services/application-agency.service.ts b/angular/projects/admin-nrpti/src/app/services/application-agency.service.ts
new file mode 100644
index 000000000..b172cd75d
--- /dev/null
+++ b/angular/projects/admin-nrpti/src/app/services/application-agency.service.ts
@@ -0,0 +1,51 @@
+import { Injectable } from '@angular/core';
+import { ConfigService } from 'nrpti-angular-components';
+import { Observable } from 'rxjs';
+import { HttpClient } from '@angular/common/http';
+
+/*
+Service Layer for fetching issuing agencies and storing them in app_initializer
+*/
+
+@Injectable()
+export class ApplicationAgencyService {
+ private api: string;
+ private agencies: { [key: string]: string } = {};
+
+ constructor(private configService: ConfigService, public http: HttpClient) {}
+
+ async init() {
+ this.api = `${this.configService.config['API_LOCATION']}${this.configService.config['API_PATH']}`;
+ await this.refreshAgencies().toPromise();
+ }
+
+ refreshAgencies(): Observable {
+ return new Observable(observer => {
+ const apiEndpoint = `${this.api}/list-agencies`;
+ const getAgencies = this.http.get<{ [key: string]: string }>(apiEndpoint);
+
+ getAgencies.subscribe(
+ response => {
+ // Data transformation to make the data easier to work with
+ const agencyList = {};
+ for (const record in response) {
+ if (response.hasOwnProperty(record)) {
+ agencyList[response[record]['agencyCode']] = response[record]['agencyName'];
+ }
+ }
+ this.agencies = agencyList;
+ observer.next();
+ observer.complete();
+ },
+ error => {
+ console.error('HTTP Request Error: ', error);
+ observer.error(error);
+ }
+ );
+ });
+ }
+
+ getAgencies(): { [key: string]: string } {
+ return this.agencies;
+ }
+}
diff --git a/angular/projects/admin-nrpti/src/app/services/factory.service.ts b/angular/projects/admin-nrpti/src/app/services/factory.service.ts
index 2f136d1b0..1c87a3759 100644
--- a/angular/projects/admin-nrpti/src/app/services/factory.service.ts
+++ b/angular/projects/admin-nrpti/src/app/services/factory.service.ts
@@ -13,6 +13,7 @@ import { NewsService } from './news.service';
import { CollectionService } from './collection.service';
import { MineService } from './mine.service';
import { MapLayerInfoService } from './map-layer-info.service';
+import { ApplicationAgencyService } from './application-agency.service';
/**
* Facade service for all admin-nrpti services.
@@ -35,6 +36,7 @@ export class FactoryService {
private _documentService: DocumentService;
private _configService: ConfigService;
private _mapLayerInfoService: MapLayerInfoService;
+ private _applicationAgencyService: ApplicationAgencyService;
constructor(private injector: Injector) {
// The following items are loaded by a file that is only present on cluster builds.
@@ -88,6 +90,20 @@ export class FactoryService {
return this._apiService;
}
+ /**
+ * Inject agency service if it hasn't already been injected.
+ *
+ * @readonly
+ * @type {ApiService}
+ * @memberof FactoryService
+ */
+ public get applicationAgencyService(): ApplicationAgencyService {
+ if (!this._applicationAgencyService) {
+ this._applicationAgencyService = this.injector.get(ApplicationAgencyService);
+ }
+ return this._applicationAgencyService;
+ }
+
/**
* Inject record service if it hasn't already been injected.
*
@@ -240,7 +256,6 @@ export class FactoryService {
}
isFlavourEditEnabled(requiredRoles: string[]) {
-
for (const role of requiredRoles) {
if (this.userInRole(role)) {
return true;
@@ -602,13 +617,13 @@ export class FactoryService {
return isInsert
? this.recordService
- .createRecord(dataPackage)
- .pipe(catchError(error => this.apiService.handleError(error)))
- .toPromise()
+ .createRecord(dataPackage)
+ .pipe(catchError(error => this.apiService.handleError(error)))
+ .toPromise()
: this.recordService
- .editRecord(dataPackage)
- .pipe(catchError(error => this.apiService.handleError(error)))
- .toPromise();
+ .editRecord(dataPackage)
+ .pipe(catchError(error => this.apiService.handleError(error)))
+ .toPromise();
}
public createConfigData(configData, application): Promise
diff --git a/angular/projects/admin-nrpti/src/app/sidebar/sidebar.component.spec.ts b/angular/projects/admin-nrpti/src/app/sidebar/sidebar.component.spec.ts
index 2bd67d897..a0810ab8c 100644
--- a/angular/projects/admin-nrpti/src/app/sidebar/sidebar.component.spec.ts
+++ b/angular/projects/admin-nrpti/src/app/sidebar/sidebar.component.spec.ts
@@ -16,7 +16,7 @@ describe('SidebarComponent', () => {
const mockStoreService = {
change: of(),
- toggleSideNave: () => { }
+ toggleSideNave: () => {}
};
const mockLoadingScreenService = {
@@ -27,23 +27,42 @@ describe('SidebarComponent', () => {
};
const mockKeyCloakService = {
- isMenuEnabled: (menuName) => {
+ isMenuEnabled: menuName => {
let retVal = false;
switch (menuName) {
- case Constants.Menus.ALL_MINES: retVal = true; break;
- case Constants.Menus.ALL_RECORDS: retVal = true; break;
- case Constants.Menus.NEWS_LIST: retVal = true; break;
- case Constants.Menus.ANALYTICS: retVal = false; break;
- case Constants.Menus.MAP: retVal = false; break;
- case Constants.Menus.ENTITIES: retVal = false; break;
- case Constants.Menus.IMPORTS: retVal = true; break;
- case Constants.Menus.COMMUNICATIONS: retVal = true; break;
+ case Constants.Menus.ALL_MINES:
+ retVal = true;
+ break;
+ case Constants.Menus.ALL_RECORDS:
+ retVal = true;
+ break;
+ case Constants.Menus.NEWS_LIST:
+ retVal = true;
+ break;
+ case Constants.Menus.ANALYTICS:
+ retVal = false;
+ break;
+ case Constants.Menus.MAP:
+ retVal = false;
+ break;
+ case Constants.Menus.ENTITIES:
+ retVal = false;
+ break;
+ case Constants.Menus.IMPORTS:
+ retVal = true;
+ break;
+ case Constants.Menus.COMMUNICATIONS:
+ retVal = true;
+ break;
+ case Constants.Menus.AGENCIES:
+ retVal = true;
+ break;
}
return retVal;
}
};
- beforeEach((() => {
+ beforeEach(() => {
TestBed.configureTestingModule({
imports: [RouterTestingModule],
declarations: [SidebarComponent],
@@ -54,7 +73,7 @@ describe('SidebarComponent', () => {
{ provide: KeycloakService, useValue: mockKeyCloakService }
]
}).compileComponents();
- }));
+ });
it('sidebar menu should render properly', () => {
const routerMock = TestBed.get(Router);
@@ -70,6 +89,7 @@ describe('SidebarComponent', () => {
expect(component.keycloakService.isMenuEnabled(Constants.Menus.ENTITIES)).toEqual(false);
expect(component.keycloakService.isMenuEnabled(Constants.Menus.IMPORTS)).toEqual(true);
expect(component.keycloakService.isMenuEnabled(Constants.Menus.COMMUNICATIONS)).toEqual(true);
+ expect(component.keycloakService.isMenuEnabled(Constants.Menus.AGENCIES)).toEqual(true);
expect(component.keycloakService.isMenuEnabled('Something Not Here')).toEqual(false);
expect(component).toBeTruthy();
diff --git a/angular/projects/admin-nrpti/src/app/utils/constants/ams-csv-constants.ts b/angular/projects/admin-nrpti/src/app/utils/constants/ams-csv-constants.ts
index e5ee5b936..d632a5d25 100644
--- a/angular/projects/admin-nrpti/src/app/utils/constants/ams-csv-constants.ts
+++ b/angular/projects/admin-nrpti/src/app/utils/constants/ams-csv-constants.ts
@@ -20,12 +20,7 @@ export const amsOrdersCsvRequiredHeaders = [
* Required fields for AMS Order csv.
*
*/
-export const amsOrdersCsvRequiredFields = [
- 'AuthNumber',
- 'ClientName',
- 'IssueDate',
- 'AuthorizationType',
-];
+export const amsOrdersCsvRequiredFields = ['AuthNumber', 'ClientName', 'IssueDate', 'AuthorizationType'];
/**
* Fields for AMS Order csv that have a required format.
diff --git a/angular/projects/admin-nrpti/src/app/utils/constants/misc.ts b/angular/projects/admin-nrpti/src/app/utils/constants/misc.ts
index 598862fb6..8c0be0fc5 100644
--- a/angular/projects/admin-nrpti/src/app/utils/constants/misc.ts
+++ b/angular/projects/admin-nrpti/src/app/utils/constants/misc.ts
@@ -48,7 +48,8 @@ export class Constants {
MAP: 'Map',
ENTITIES: 'Entities',
IMPORTS: 'Imports',
- COMMUNICATIONS: 'Communications'
+ COMMUNICATIONS: 'Communications',
+ AGENCIES: 'Agencies'
};
public static readonly RecordTypes: any = {
@@ -320,9 +321,7 @@ export class Constants {
public static readonly RoleAgencyPickList: any = {
[Constants.ApplicationRoles.ADMIN_WF]: ['BC Wildfire Service'],
- [Constants.ApplicationRoles.ADMIN_FLNRO]: [
- 'Ministry of Environment and Climate Change Strategy'
- ],
+ [Constants.ApplicationRoles.ADMIN_FLNRO]: ['Ministry of Environment and Climate Change Strategy'],
[Constants.ApplicationRoles.ADMIN_FLNR_NRO]: ['Natural Resource Officers'],
[Constants.ApplicationRoles.ADMIN_AGRI]: ['Ministry of Agriculture and Food'],
[Constants.ApplicationRoles.ADMIN_ENV_EPD]: ['Ministry of Environment and Climate Change Strategy'],
@@ -332,6 +331,18 @@ export class Constants {
[Constants.ApplicationRoles.ADMIN_WLRS]: ['Ministry of Water, Land and Resource Stewardship']
};
+ public static readonly RoleAgencyCodePickList: any = {
+ [Constants.ApplicationRoles.ADMIN_WF]: ['AGENCY_WF'],
+ [Constants.ApplicationRoles.ADMIN_FLNRO]: ['AGENCY_ENV'],
+ [Constants.ApplicationRoles.ADMIN_FLNR_NRO]: ['AGENCY_FLNR_NRO'],
+ [Constants.ApplicationRoles.ADMIN_AGRI]: ['AGENCY_AGRI'],
+ [Constants.ApplicationRoles.ADMIN_ENV_EPD]: ['AGENCY_ENV_EPD'],
+ [Constants.ApplicationRoles.ADMIN_ENV_COS]: ['AGENCY_ENV_COS'],
+ [Constants.ApplicationRoles.ADMIN_ENV_BCPARKS]: ['AGENCY_ENV_BCPARKS'],
+ [Constants.ApplicationRoles.ADMIN_ALC]: ['AGENCY_ALC'],
+ [Constants.ApplicationRoles.ADMIN_WLRS]: ['AGENCY_WLRS']
+ };
+
public static readonly LngSectionPickList: string[] = [
'Section 1',
'Section 2',
diff --git a/angular/projects/common/src/app/utils/record-constants.ts b/angular/projects/common/src/app/utils/record-constants.ts
index ecaaf8e1c..35c791f68 100644
--- a/angular/projects/common/src/app/utils/record-constants.ts
+++ b/angular/projects/common/src/app/utils/record-constants.ts
@@ -1,5 +1,7 @@
import { Utils } from './utils';
import { Legislation } from '../models/master/common-models/legislation';
+import { AgencyDataService } from '../../../../../projects/global/src/lib/utils/agency-data-service';
+import { FactoryService } from '../../../../../projects/admin-nrpti/src/app/services/factory.service';
export class EpicProjectIds {
public static readonly lngCanadaId = '588511d0aaecd9001b826192';
@@ -21,11 +23,9 @@ export class SearchSubsets {
}
export class Constants {
-
// Datepicker is off by one so add one to the desired year.
public static readonly DatepickerMinDate = new Date('1901');
public static readonly DatepickerMaxDate = new Date();
-
}
/**
* Schema lists for search.
@@ -162,20 +162,47 @@ export class Picklists {
public static readonly penaltyTypePicklist = ['Years', 'Days', 'Dollars', 'Hours', 'Other'];
public static readonly agencyPicklist = [
- 'Agricultural Land Commission',
- 'BC Energy Regulator',
- 'BC Parks',
- 'BC Wildfire Service',
- 'Climate Action Secretariat',
- 'Conservation Officer Service',
- 'Environmental Assessment Office',
- 'LNG Secretariat',
- 'Ministry of Agriculture and Food',
- 'Ministry of Energy Mines and Low Carbon Innovation',
- 'Ministry of Environment and Climate Change Strategy',
- 'Ministry of Forests',
- 'Ministry of Water, Land and Resource Stewardship',
- 'Natural Resource Officers',
+ 'Agricultural Land Commission 1',
+ 'BC Energy Regulator 1',
+ 'BC Parks 1',
+ 'BC Wildfire Service 1',
+ 'Climate Action Secretariat 1',
+ 'Conservation Officer Service 1',
+ 'Environmental Assessment Office 1',
+ 'LNG Secretariat 1',
+ 'Ministry of Agriculture and Food 1',
+ 'Ministry of Energy Mines and Low Carbon Innovation 1',
+ 'Ministry of Environment and Climate Change Strategy 1',
+ 'Ministry of Forests 1',
+ 'Ministry of Water, Land and Resource Stewardship 1',
+ 'Natural Resource Officers 1'
+ ];
+
+ public static getAgencyNames(factoryService: FactoryService) {
+ const agencyDataService = new AgencyDataService(factoryService);
+ return agencyDataService.getAgencyNames();
+ }
+
+ public static getAgencyCode(factoryService: FactoryService, agencyName) {
+ const agencyDataService = new AgencyDataService(factoryService);
+ return agencyDataService.getAgencyCode(agencyName);
+ }
+
+ public static readonly agencyCodePicklist = [
+ 'AGENCY_ALC',
+ 'AGENCY_OGC',
+ 'AGENCY_ENV_BCPARKS',
+ 'AGENCY_WF',
+ 'AGENCY_CAS',
+ 'AGENCY_ENV_COS',
+ 'AGENCY_EAO',
+ 'AGENCY_LNG',
+ 'AGENCY_AGRI',
+ 'AGENCY_EMLI',
+ 'AGENCY_ENV',
+ 'AGENCY_FLNRO',
+ 'AGENCY_WLRS',
+ 'AGENCY_FLNR_NRO'
];
public static readonly entityTypePicklist = ['Company', 'Individual'];
@@ -267,7 +294,11 @@ export class Picklists {
'Report'
];
- public static readonly collectionAgencyPicklist = ['Environmental Assessment Office', 'Ministry of Energy Mines and Low Carbon Innovation', 'Ministry of Environment and Climate Change Strategy'];
+ public static readonly collectionAgencyPicklist = [
+ 'Environmental Assessment Office',
+ 'Ministry of Energy Mines and Low Carbon Innovation',
+ 'Ministry of Environment and Climate Change Strategy'
+ ];
/**
* Contains a mapping of acts to regulations.
@@ -800,7 +831,7 @@ export class Picklists {
* @memberof Picklists
* @returns {string[]} sorted array of acts
*/
- public static getAllActs = function (): string[] {
+ public static getAllActs = function(): string[] {
return Object.keys(this.legislationActsMappedToRegulations).sort((a, b) => a.localeCompare(b));
};
@@ -811,7 +842,7 @@ export class Picklists {
* @memberof Picklists
* @returns {string[]} sorted array of regulations
*/
- public static getAllRegulations = function (): string[] {
+ public static getAllRegulations = function(): string[] {
const regulations = [];
Object.keys(this.legislationActsMappedToRegulations).forEach(act =>
@@ -835,7 +866,7 @@ export class Picklists {
* @memberof Picklists
* @returns {{ [key: string]: string[] }}
*/
- public static getLegislationRegulationsMappedToActs = function (): { [key: string]: string[] } {
+ public static getLegislationRegulationsMappedToActs = function(): { [key: string]: string[] } {
const regulations = {};
Object.keys(this.legislationActsMappedToRegulations).forEach(act =>
@@ -1242,8 +1273,7 @@ export class Picklists {
'Park Act': {
'9': {
'1': {
- description:
- 'For use of natural resource without valid park permit'
+ description: 'For use of natural resource without valid park permit'
}
},
'16': {
@@ -1920,12 +1950,12 @@ export class Picklists {
'Park Act': {
'17': {
description: 'Park Act Order'
- }, // nrpti-1085: Add new legislation description for orders
- 'Park, Conservancy and Recreation Area Regulation' : {
- '9': {
- description: 'Order to leave a park, conservancy or recreation area'
+ }, // nrpti-1085: Add new legislation description for orders
+ 'Park, Conservancy and Recreation Area Regulation': {
+ '9': {
+ description: 'Order to leave a park, conservancy or recreation area'
+ }
}
- }
},
'Wildfire Act': {
'7': {
@@ -2508,7 +2538,7 @@ export class Picklists {
},
'3': {
description: 'Fail to submit separate fee'
- },
+ }
},
'32': {
'1': {
@@ -2523,7 +2553,7 @@ export class Picklists {
},
d: {
description: 'Fail to ensure facility is of sound construction'
- },
+ }
},
'2': {
a: {
@@ -2531,7 +2561,7 @@ export class Picklists {
},
b: {
description: 'Fail to have adequate ventilation'
- },
+ }
},
'3': {
description: 'Fail to have appropriate waste disposal system'
@@ -2577,7 +2607,7 @@ export class Picklists {
},
f: {
description: 'Fail to review food safety plan annually or if required'
- },
+ }
},
'3': {
description: 'Fail to have a food safety plan in writing',
@@ -2598,7 +2628,7 @@ export class Picklists {
},
f: {
description: 'Fail to keep appropriate records'
- },
+ }
},
'4': {
description: 'Fail to change food safety plan as directed'
@@ -2625,7 +2655,7 @@ export class Picklists {
},
d: {
description: 'Fail to make sanitation plan/records available'
- },
+ }
},
'2': {
description: 'Fail to have sanitation plan in writing',
@@ -2634,7 +2664,7 @@ export class Picklists {
},
b: {
description: 'Fail to identify cleaning/sanitizing agents and pesticides used'
- },
+ }
}
},
'42': {
@@ -2644,7 +2674,7 @@ export class Picklists {
},
b: {
description: 'Fail to have pest proof containers'
- },
+ }
},
'43': {
'1': {
@@ -2656,14 +2686,14 @@ export class Picklists {
},
c: {
description: 'Conduct activities that lead to unsafe food'
- },
+ }
},
'2': {
description: 'Fail to ensure handwashing'
},
'3': {
description: 'Fail to ensure tobacco/vapour products not used in facility'
- },
+ }
},
'44': {
description: 'Permit food contact by ill persons'
@@ -2674,7 +2704,7 @@ export class Picklists {
},
b: {
description: 'Fail to keep fish as permitted by inspector'
- },
+ }
},
'46': {
a: {
@@ -2682,7 +2712,7 @@ export class Picklists {
},
b: {
description: 'Fail to label chemicals/cleaners'
- },
+ }
},
'47': {
description: 'Fail to properly store/label'
@@ -2699,7 +2729,7 @@ export class Picklists {
},
'2': {
description: 'Receive marine cultured fish from unacceptable source'
- },
+ }
},
'51': {
description: 'Process dead lobster/crab'
@@ -2731,7 +2761,7 @@ export class Picklists {
},
'3': {
description: 'Fail to properly label carton of sport caught fish'
- },
+ }
},
'55': {
'1': {
@@ -2746,7 +2776,7 @@ export class Picklists {
},
c: {
description: 'Fail to have system that verifies fish returned to sport fisher'
- },
+ }
}
},
'56': {
@@ -2817,7 +2847,7 @@ export class Picklists {
description: 'Fail to submit report'
}
}
- },
+ }
},
'Fisheries Act (Canada)': {
'Fishing (General) Regulations': {
@@ -5125,8 +5155,7 @@ export class Picklists {
* @static
* @returns {string} legislation description or null
*/
- public static getLegislationDescription = function (recordType: string, legislation: Legislation): string {
-
+ public static getLegislationDescription = function(recordType: string, legislation: Legislation): string {
if (!recordType || (!legislation && !legislation.act && !legislation.section)) {
return null;
}
@@ -5181,7 +5210,7 @@ export class Picklists {
* @param {string[]} paths properties to descend, in order, through the object.
* @returns the value found at the end of the path, or null
*/
- public static traverseObject = function (obj: object, paths: string[]) {
+ public static traverseObject = function(obj: object, paths: string[]) {
if (!obj || !paths || !paths.length) {
return null;
}
diff --git a/angular/projects/global/src/lib/utils/agency-data-service.ts b/angular/projects/global/src/lib/utils/agency-data-service.ts
new file mode 100644
index 000000000..777690e9d
--- /dev/null
+++ b/angular/projects/global/src/lib/utils/agency-data-service.ts
@@ -0,0 +1,45 @@
+import { FactoryService } from '../../../../admin-nrpti/src/app/services/factory.service';
+
+export class AgencyDataService {
+ constructor(
+ private factoryService: FactoryService,
+ ) {}
+
+ displayNameFull(agencyCode): string {
+ // Access cached agency data from FactoryService
+ const agencyService = this.factoryService.applicationAgencyService;
+ const agencyList = agencyService ? agencyService.getAgencies() : null;
+
+ return agencyList && agencyList[agencyCode] ? agencyList[agencyCode] : agencyCode;
+ }
+
+ getAgencyCodes(): string[] {
+ const agencyService = this.factoryService.applicationAgencyService;
+ const agencyList = agencyService ? agencyService.getAgencies() : null;
+
+ return agencyList ? Object.keys(agencyList) : [];
+ }
+
+ getAgencyNames(): string[] {
+ const agencyService = this.factoryService.applicationAgencyService;
+ const agencyList = agencyService ? agencyService.getAgencies() : null;
+
+ return agencyList ? Object.values(agencyList) : [];
+ }
+
+ getAgencyCode(agencyName: string): string {
+ const agencyService = this.factoryService.applicationAgencyService;
+ const agencyList = agencyService ? agencyService.getAgencies() : null;
+
+ if (agencyList) {
+ for (const key in agencyList) {
+ if (agencyList.hasOwnProperty(key) && agencyList[key] === agencyName) {
+ return key; // Return the key if the value matches
+ }
+ }
+ }
+ // Return a default value or handle the case where agencyList is undefined or empty
+ return '';
+ }
+
+}
diff --git a/angular/projects/global/src/lib/utils/utils.ts b/angular/projects/global/src/lib/utils/utils.ts
index c70929750..bc6bc7a0f 100644
--- a/angular/projects/global/src/lib/utils/utils.ts
+++ b/angular/projects/global/src/lib/utils/utils.ts
@@ -1,4 +1,4 @@
-const ApplicationAgencies = {
+const ApplicationAgencies: any = {
AGENCY_ALC: 'Agricultural Land Commission',
AGENCY_WF: 'BC Wildfire Service',
AGENCY_ENV_COS: 'Conservation Officer Service',
@@ -15,6 +15,22 @@ const ApplicationAgencies = {
AGENCY_WLRS: 'Ministry of Water, Land and Resource Stewardship',
};
+export const ApplicationAgencyList = {
+ AGENCY_ALC: 'Agricultural Land Commission',
+ AGENCY_WF: 'BC Wildfire Service',
+ AGENCY_ENV_COS: 'Conservation Officer Service',
+ AGENCY_EAO: 'Environmental Assessment Office',
+ AGENCY_EMLI: 'Ministry of Energy Mines and Low Carbon Innovation',
+ AGENCY_ENV: 'Ministry of Environment and Climate Change Strategy',
+ AGENCY_ENV_BCPARKS: 'BC Parks',
+ AGENCY_OGC: 'BC Energy Regulator',
+ AGENCY_ENV_EPD: 'Ministry of Environment and Climate Change Strategy',
+ AGENCY_LNG: 'LNG Secretariat',
+ AGENCY_AGRI: 'Ministry of Agriculture and Food',
+ AGENCY_FLNRO: 'Ministry of Forests',
+ AGENCY_FLNR_NRO: 'Natural Resource Officers',
+ AGENCY_WLRS: 'Ministry of Water, Land and Resource Stewardship',
+};
/**
* General purpose utils.
*
@@ -134,17 +150,9 @@ export class Utils {
}
- static displayNameFull(agency): string {
- switch (agency) {
- case ApplicationAgencies.AGENCY_AGRI:
- return 'Ministry of Agriculture and Food';
- case ApplicationAgencies.AGENCY_EMLI:
- return 'Ministry of Energy, Mines, and Low Carbon Innovation';
- case ApplicationAgencies.AGENCY_FLNRO:
- return 'Ministry of Forests';
- default:
- return agency;
- }
+ static displayNameFull(agencyCode): string {
+ const agencyList = ApplicationAgencyList;
+ return agencyList[agencyCode] || agencyCode;
}
static displayNameAcronym(agency): string {
diff --git a/angular/projects/public-nrpti/src/app/services/api.service.ts b/angular/projects/public-nrpti/src/app/services/api.service.ts
index 45625f980..623525c85 100644
--- a/angular/projects/public-nrpti/src/app/services/api.service.ts
+++ b/angular/projects/public-nrpti/src/app/services/api.service.ts
@@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import { Document } from '../../../../common/src/app/models/document';
-import { Utils, ConfigService , LoggerService} from 'nrpti-angular-components';
+import { Utils, ConfigService, LoggerService } from 'nrpti-angular-components';
/**
* TODO: populate this documentation
@@ -19,17 +19,12 @@ export class ApiService {
pathAPI: string;
env: 'local' | 'dev' | 'test' | 'prod';
- constructor(
- public http: HttpClient,
- private configService: ConfigService,
- private logger: LoggerService
- ) {
- this.isMS = window.navigator.msSaveOrOpenBlob ? true : false;
+ constructor(public http: HttpClient, private configService: ConfigService, private logger: LoggerService) {
+ this.isMS = window.navigator.msSaveOrOpenBlob ? true : false;
- this.env = this.configService.config['ENVIRONMENT'];
+ this.env = this.configService.config['ENVIRONMENT'];
- this.pathAPI = this.configService.config['API_LOCATION']
- + this.configService.config['API_PUBLIC_PATH'];
+ this.pathAPI = this.configService.config['API_LOCATION'] + this.configService.config['API_PUBLIC_PATH'];
}
/**
diff --git a/api/migrations/20230911220312-addApplicationAgenciesModel.js b/api/migrations/20230911220312-addApplicationAgenciesModel.js
new file mode 100644
index 000000000..b0d048a25
--- /dev/null
+++ b/api/migrations/20230911220312-addApplicationAgenciesModel.js
@@ -0,0 +1,88 @@
+'use strict';
+const ApplicationAgency = require('../src/models/master/applicationAgency');
+const mongoose = require('mongoose');
+
+var dbm;
+var type;
+var seed;
+
+/*
+Migration file for adding agency codes and agency values to the nrpti collection
+*/
+
+exports.setup = function(options, seedLink) {
+ dbm = options.dbmigrate;
+ type = dbm.dataType;
+ seed = seedLink;
+};
+
+exports.up = async function (db) {
+ console.log('**** Adding ApplicationAgencies constants to nrpti collection ****');
+
+ // Connect to the database
+ const mClient = await db.connection.connect(db.connectionString, {
+ native_parser: true,
+ });
+
+ const agencies = [
+ { agencyCode: "AGENCY_ALC", agencyName: 'Agricultural Land Commission' },
+ { agencyCode: "AGENCY_WF", agencyName: 'BC Wildfire Service' },
+ { agencyCode: "AGENCY_ENV_COS", agencyName: 'Conservation Officer Service' },
+ { agencyCode: "AGENCY_EAO", agencyName: 'Environmental Assessment Office' },
+ { agencyCode: "AGENCY_EMLI", agencyName: 'Ministry of Energy Mines and Low Carbon Innovation' },
+ { agencyCode: "AGENCY_ENV", agencyName: 'Ministry of Environment and Climate Change Strategy' },
+ { agencyCode: "AGENCY_ENV_BCPARKS", agencyName: 'BC Parks' },
+ { agencyCode: "AGENCY_OGC", agencyName: 'BC Energy Regulator' },
+ { agencyCode: "AGENCY_ENV_EPD", agencyName: 'Ministry of Environment and Climate Change Strategy' },
+ { agencyCode: "AGENCY_LNG", agencyName: 'LNG Secretariat' },
+ { agencyCode: "AGENCY_AGRI", agencyName: 'Ministry of Agriculture and Food' },
+ { agencyCode: "AGENCY_FLNRO", agencyName: 'Ministry of Forests' },
+ { agencyCode: "AGENCY_FLNR_NRO", agencyName: 'Natural Resource Officers' },
+ { agencyCode: "AGENCY_WLRS", agencyName: 'Ministry of Water, Land and Resource Stewardship' },
+ { agencyCode: "AGENCY_CAS", agencyName: 'Climate Action Secretariat' },
+ ]
+
+ try {
+ let currentCollection = await mClient.collection('nrpti');
+
+ for (const agency of agencies) {
+ const existingAgency = await currentCollection.findOne({ _schemaName: 'ApplicationAgency', agencyCode: agency['agencyCode'] });
+
+ if (!existingAgency) {
+ await currentCollection.insertOne(
+ {
+ _schemaName: 'ApplicationAgency',
+ agencyCode: agency['agencyCode'],
+ agencyName: agency['agencyName'],
+ read: ['sysadmin'],
+ write: ['sysadmin'],
+ dateAdded: new Date(),
+ dateUpdated: null,
+ addedBy: '',
+ updatedBy: '',
+ }
+ );
+ console.log(` **** Add the ApplicationAgency code ${agency['agencyCode']} into nrpti collection ****`);
+ } else {
+ console.log(' **** ApplicationAgency code already exists in nrpti collection ****')
+ }
+ }
+ } catch (err) {
+ console.log(` **** Error updating nrpti collection for agency: ${agency['agencyName']} ****`, err);
+ } finally {
+ if (mClient) {
+ console.log(' **** Closing connection to nrpti collection ****')
+ await mClient.close();
+ }
+ }
+
+ return null;
+};
+
+exports.down = function(db) {
+ return null;
+};
+
+exports._meta = {
+ "version": 1
+};
diff --git a/api/migrations/20230912181649-updateIssuingAgencyToCode.js b/api/migrations/20230912181649-updateIssuingAgencyToCode.js
new file mode 100644
index 000000000..b2a35065a
--- /dev/null
+++ b/api/migrations/20230912181649-updateIssuingAgencyToCode.js
@@ -0,0 +1,121 @@
+'use strict';
+
+var dbm;
+var seed;
+
+/**
+ * Migration file for updating all existing records to use agency code instead of agency value
+ */
+exports.setup = function (options, seedLink) {
+ dbm = options.dbmigrate;
+ seed = seedLink;
+};
+
+exports.up = async function (db) {
+ const mClient = await db.connection.connect(db.connectionString, {
+ native_parser: true,
+ });
+
+ const LegislationActs = {
+ ACT_Env_Management: 'Environmental Management Act',
+ ACT_Int_Pest_Management: 'Integrated Pest Management Act',
+ };
+
+ const agencies = [
+ { agencyCode: 'AGENCY_ALC', agencyName: 'Agricultural Land Commission' },
+ { agencyCode: 'AGENCY_WF', agencyName: 'BC Wildfire Service' },
+ { agencyCode: "AGENCY_ENV_COS", agencyName: 'Conservation Officer Service' },
+ { agencyCode: "AGENCY_EAO", agencyName: 'Environmental Assessment Office' },
+ { agencyCode: "AGENCY_EMLI", agencyName: 'Ministry of Energy Mines and Low Carbon Innovation' },
+ { agencyCode: "AGENCY_ENV", agencyName: 'Ministry of Environment and Climate Change Strategy' },
+ { agencyCode: "AGENCY_ENV_BCPARKS", agencyName: 'BC Parks' },
+ { agencyCode: "AGENCY_OGC", agencyName: 'BC Energy Regulator' },
+ { agencyCode: "AGENCY_ENV_EPD", agencyName: 'Ministry of Environment and Climate Change Strategy' },
+ { agencyCode: "AGENCY_LNG", agencyName: 'LNG Secretariat' },
+ { agencyCode: "AGENCY_AGRI", agencyName: 'Ministry of Agriculture and Food' },
+ { agencyCode: "AGENCY_FLNRO", agencyName: 'Ministry of Forests' },
+ { agencyCode: "AGENCY_FLNR_NRO", agencyName: 'Natural Resource Officers' },
+ { agencyCode: "AGENCY_WLRS", agencyName: 'Ministry of Water, Land and Resource Stewardship' },
+ { agencyCode: "AGENCY_CAS", agencyName: 'Climate Action Secretariat' }
+ ];
+
+ const collections = ['nrpti', 'redacted_record_subset'];
+
+ try {
+ for (let collection of collections) {
+ console.log(`***** Collection: ${collection} *****`);
+ console.log(`***** Updating ocers-csv records *****`);
+
+ try {
+ let currentCollection = await mClient.collection(collection);
+
+ // Update issuingAgency to 'AGENCY_ENV_EPD' for specific records
+ await currentCollection.updateMany(
+ {
+ $and: [
+ { issuingAgency: 'Ministry of Environment and Climate Change Strategy' },
+ { author: 'Ministry of Environment and Climate Change Strategy' },
+ { 'legislation.act': { $in: [LegislationActs.ACT_Env_Management, LegislationActs.ACT_Int_Pest_Management] } }
+ ]
+ },
+ { $set: { issuingAgency: 'AGENCY_ENV_EPD', author: 'AGENCY_ENV_EPD' } }
+ );
+
+ console.log(` ***** Updated records in collection: ${collection} *****`);
+ } catch (err) {
+ console.error(` ***** Error updating collection: ${collection} *****`, err);
+ }
+
+ console.log(`***** Updating all other records records *****`);
+ try {
+ let currentCollection = await mClient.collection(collection);
+
+ for (const agency of agencies) {
+ // Update issuingAgency and author fields for the agency
+ await currentCollection.updateMany(
+ {
+ $and: [
+ { issuingAgency: agency['agencyName'] },
+ { author: agency['agencyName'] }
+ ]
+ },
+ { $set: { issuingAgency: agency['agencyCode'], author: agency['agencyCode'] } }
+ );
+
+ console.log(` ***** Updated collection: ${collection} for agency: ${agency['agencyName']} *****`);
+ }
+ } catch (err) {
+ console.error(` ***** Error updating collection: ${collection} for agency: ${agency['agencyName']} *****`, err);
+ }
+ }
+ } catch (err) {
+ console.error('Error connecting to the database:', err);
+ } finally {
+ if (mClient) {
+ await mClient.close();
+ }
+ }
+
+ return null;
+};
+
+exports.down = function (db) {
+ return null;
+};
+
+exports._meta = {
+ version: 1
+};
+
+/**
+ * Update a record in the collection with a new agency code.
+ * @param {Collection} collection - MongoDB collection.
+ * @param {string} recordId - The ID of the record to update.
+ * @param {string} newAgencyCode - The new agency code.
+ */
+async function updateRecord(collection, recordId, newAgencyCode) {
+ await collection.updateOne(
+ { _id: recordId },
+ { $set: { 'legislation.act': newAgencyCode } }
+ );
+}
diff --git a/api/src/controllers/agencies.js b/api/src/controllers/agencies.js
new file mode 100644
index 000000000..dc224cfbe
--- /dev/null
+++ b/api/src/controllers/agencies.js
@@ -0,0 +1,83 @@
+const queryActions = require('../utils/query-actions');
+const mongodb = require('../utils/mongodb');
+const RECORD_TYPE = require('../utils/constants/record-type-enum');
+const defaultLog = require('../utils/logger')('record');
+
+/*
+APIs for Update Issuing Agency page
+Includes Get and Put apis to load and update agency names from the database
+*/
+
+exports.publicGet = async function(args, res, next) {
+ const db = mongodb.connection.db(process.env.MONGODB_DATABASE || 'nrpti-dev');
+ const collectionDB = db.collection('nrpti');
+
+ let agencyList;
+
+ try {
+ //Obtain documents with Application Agency Schema
+ let agencyDocuments = await collectionDB.find({ _schemaName: RECORD_TYPE.ApplicationAgency._schemaName }).toArray();
+ //Using map function to iterate through the original array and creates a new array with objects containing only the _id, agencyCode, and agencyName properties.
+ agencyList = agencyDocuments.map(item => ({
+ _id: item._id,
+ agencyCode: item.agencyCode,
+ agencyName: item.agencyName
+ }));
+ } catch (error) {
+ defaultLog.log(error);
+ throw error;
+ }
+
+ queryActions.sendResponse(res, 200, agencyList);
+};
+/**
+* @param {*} args
+* @param {*} res
+* @param {*} next
+* @param {*} incomingObj see example
+* @returns edited lng order record
+* Example of args.swagger.params.data.value
+ {
+ "agencies":
+ [
+ {
+ "agencyCode": "AGENCY_ALC",
+ "agencyName": "Agricultural Land Commission_1"
+ }
+ ]
+ }
+*/
+
+exports.protectedPut = async function(args, res, next) {
+ const db = mongodb.connection.db(process.env.MONGODB_DATABASE || 'nrpti-dev');
+ let promises = [];
+ let result = null;
+ let incomingObj = args.swagger.params.data.value;
+ const agencies = incomingObj['agencies'];
+ if (agencies && agencies.length > 0) {
+ const agencyCode = agencies[0]['agencyCode'];
+ const agencyName = agencies[0]['agencyName'];
+ const collectionDB = db.collection('nrpti');
+ promises.push(
+ collectionDB.findOneAndUpdate(
+ { agencyCode: agencyCode },
+ {
+ $set: {
+ agencyName: agencyName
+ }
+ }
+ )
+ );
+ }
+ try {
+ await Promise.all(promises);
+ result = 'Success';
+ } catch (error) {
+ defaultLog.info(`protectedPut - agencies controller - error updating record: ${incomingObj}`);
+ defaultLog.debug(error);
+ result = 'Error';
+ return queryActions.sendResponse(res, 400, {});
+ }
+ queryActions.sendResponse(res, 200, result);
+ next();
+};
diff --git a/api/src/models/master/applicationAgency.js b/api/src/models/master/applicationAgency.js
new file mode 100644
index 000000000..b5bebba03
--- /dev/null
+++ b/api/src/models/master/applicationAgency.js
@@ -0,0 +1,15 @@
+module.exports = require('../../utils/model-schema-generator')(
+ 'ApplicationAgencies',
+ {
+ _schemaName: { type: String, default: 'ApplicationAgency', index: true },
+ agencyCode: { type: String, default: null, unique: true },
+ agencyName: { type: String, default: null, required: true },
+ read: [{ type: String, trim: true, default: 'sysadmin' }],
+ write: [{ type: String, trim: true, default: 'sysadmin' }],
+ dateAdded: { type: Date, default: Date.now() },
+ dateUpdated: { type: Date, default: null },
+ addedBy: { type: String, default: '' },
+ updatedBy: { type: String, default: '' },
+ },
+ 'nrpti'
+ );
diff --git a/api/src/swagger/swagger.yaml b/api/src/swagger/swagger.yaml
index e2a463954..4dcf6156b 100644
--- a/api/src/swagger/swagger.yaml
+++ b/api/src/swagger/swagger.yaml
@@ -238,6 +238,9 @@ definitions:
message:
type: string
+ UpdateAgencyObject:
+ type: object
+
paths:
/config:
x-swagger-router-controller: config
@@ -2053,4 +2056,68 @@ paths:
'403':
description: 'Access Denied'
schema:
- $ref: '#/definitions/Error'
\ No newline at end of file
+ $ref: '#/definitions/Error'
+ /list-agencies:
+ x-swagger-router-controller: agencies
+ options:
+ tags:
+ - agencies-list
+ summary: 'list agencies'
+ operationId: publicGet
+ responses:
+ '200':
+ description: "Success"
+ '403':
+ description: 'Access Denied'
+ get:
+ tags:
+ - agencies-list
+ summary: 'list agencies'
+ operationId: publicGet
+ responses:
+ '200':
+ description: "Success"
+ '403':
+ description: 'Access Denied'
+ /update-agencies:
+ x-swagger-router-controller: agencies
+ options:
+ tags:
+ - agencies-update
+ summary: 'update agencies'
+ operationId: protectedPut
+ parameters:
+ - in: body
+ name: data
+ description: 'Agency info to be updated'
+ required: true
+ schema:
+ $ref: '#/definitions/UpdateAgencyObject'
+ responses:
+ '200':
+ description: "Success"
+ '403':
+ description: 'Access Denied'
+ put:
+ tags:
+ - agencies-update
+ summary: 'update agencies'
+ security:
+ - Bearer: []
+ x-security-scopes:
+ - sysadmin
+ - admin:lng
+ - admin:wlrs
+ operationId: protectedPut
+ parameters:
+ - in: body
+ name: data
+ description: 'Agency info to be updated'
+ required: true
+ schema:
+ $ref: '#/definitions/UpdateAgencyObject'
+ responses:
+ '200':
+ description: "Success"
+ '403':
+ description: 'Access Denied'
diff --git a/api/src/utils/constants/record-type-enum.js b/api/src/utils/constants/record-type-enum.js
index 58b976107..f1a4629bb 100644
--- a/api/src/utils/constants/record-type-enum.js
+++ b/api/src/utils/constants/record-type-enum.js
@@ -142,6 +142,12 @@ const RECORD_TYPE = Object.freeze({
displayName: 'Warning',
recordControllerName: 'warnings',
flavours: { lng: { _schemaName: 'WarningLNG' }, nrced: { _schemaName: 'WarningNRCED' } }
+ },
+ ApplicationAgency: {
+ _schemaName: 'ApplicationAgency',
+ displayName: 'ApplicationAgency',
+ recordControllerName: 'agencies',
+ flavours: {}
}
});
module.exports = RECORD_TYPE;