Skip to content

Commit

Permalink
Merge branch 'test'
Browse files Browse the repository at this point in the history
  • Loading branch information
neophyte57 committed Jan 30, 2024
2 parents 3a2456a + 9430f42 commit af889e0
Show file tree
Hide file tree
Showing 28 changed files with 38,489 additions and 409 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,5 @@ jobs:
-p WEB_PORT=8080 \
-p HPR_URL=healthpractitionerregistration.apps.silver.devops.gov.bc.ca \
-p MAUTH_URL=prod-mauth-${{secrets.OPENSHIFT_LICENSE_PLATE}}-prod.apps.silver.devops.gov.bc.ca \
-p DOCMAN_VOLUME_CAPACITY=6Gi \
-n ${{secrets.OPENSHIFT_LICENSE_PLATE}}-${{secrets.OPENSHIFT_ENVIRONMENT}} | oc apply -n ${{secrets.OPENSHIFT_LICENSE_PLATE}}-${{secrets.OPENSHIFT_ENVIRONMENT}} -f -
2 changes: 2 additions & 0 deletions prime-angular-frontend/src/app/config/config.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class Config<T> {

export interface CollegeConfig extends PracticeConfig {
collegeLicenses: CollegeLicenseConfig[];
weight: number;
}

export interface PracticeConfig extends Config<number> {
Expand All @@ -53,6 +54,7 @@ export interface CollegeLicenseConfig {
collegeCode: number;
licenseCode: number;
collegeLicenseGroupingCode: number;
discontinued: boolean;
}

export class CollegeLicenseGroupingConfig extends Config<number> implements IWeightedConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
class="pl-2"
*matCellDef="let row;">
{{ row.licenseCode | configCode: 'licenses' | default }}
{{ row.discontinued ? " - *Discontinued*" : ""}}
</td>
</ng-container>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class LicenseClassesMaintenancePageComponent implements OnInit {
return {
collegeName: college.name,
licenseCode: collegeLicense.licenseCode,
discontinued: collegeLicense.discontinued,
...license
} as LicenseMaintenanceConfig;
}).sort(this.utilsService.sortByKey<LicenseMaintenanceConfig>('weight'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export class OverviewComponent extends BaseEnrolmentPage implements OnInit {
&& !enrolment.enrolleeHealthAuthorities?.some(ha => ha.healthAuthorityCode),
expiredCertification: enrolment.certifications.some(cert => moment(cert.renewalDate).isBefore(moment())),
requiresLicenceUpdate: enrolment.certifications.some((cert: CollegeCertification) =>
!this.configService.licenses.some(l => l.code === cert.licenseCode && l.collegeLicenses.some(cl => cl.collegeCode === cert.collegeCode))),
this.configService.licenses.some(l => l.code === cert.licenseCode && l.collegeLicenses.some(cl => cl.collegeCode === cert.collegeCode && cl.discontinued))),
requireRedoSelfDeclaration: enrolment.requireRedoSelfDeclaration,
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { FormArray, FormBuilder, FormGroup, FormControl } from '@angular/forms';
import { CollegeCertification } from '@enrolment/shared/models/college-certification.model';

import { CollegeConfig } from '@config/config.model';
import { AbstractFormState } from '@lib/classes/abstract-form-state.class';
import { ConfigService } from '@config/config.service';
import { CollegeLicenceClassEnum } from '@shared/enums/college-licence-class.enum';

import { EnrolmentRegulatoryForm } from './enrolment-regulatory-form.model';
export class RegulatoryFormState extends AbstractFormState<EnrolmentRegulatoryForm> {
public colleges: CollegeConfig[];

public constructor(
protected fb: FormBuilder,
protected configService: ConfigService
) {
super();
this.buildForm();
this.colleges = this.configService.colleges;
}

public get certifications(): FormArray {
Expand Down Expand Up @@ -53,7 +57,7 @@ export class RegulatoryFormState extends AbstractFormState<EnrolmentRegulatoryFo

const { certifications: rawCertifications, deviceProviderId, deviceProviderRoleCode, certificationNumber } = this.formInstance.getRawValue();
let certifications = rawCertifications.map(c => {
const { nurseCategory, ...collegeCertification } = c;
const { category, ...collegeCertification } = c;
return collegeCertification;
});

Expand Down Expand Up @@ -101,7 +105,7 @@ export class RegulatoryFormState extends AbstractFormState<EnrolmentRegulatoryFo
return this.fb.group({
// Force selection of "None" on new certifications
collegeCode: ['', []],
nurseCategory: [null, []],
category: [null, []],
licenseCode: [null, []],
// Validators are applied at the component-level when
// fields are made visible to allow empty submissions
Expand All @@ -118,16 +122,16 @@ export class RegulatoryFormState extends AbstractFormState<EnrolmentRegulatoryFo
if (collegeCertification) {
// Nursing category is a derived field for BCCNM, which is used to filter the
// results for the verbose number of available licence codes for nurses
const nurseCategory = (collegeCertification.collegeCode === CollegeLicenceClassEnum.BCCNM)
const category = this.collegeHasGrouping(collegeCertification.collegeCode)
? this.configService.colleges
.find(c => c.code === CollegeLicenceClassEnum.BCCNM)
.find(c => c.code === collegeCertification.collegeCode)
.collegeLicenses
.filter(cl => cl.collegeCode === collegeCertification.collegeCode && cl.licenseCode === collegeCertification.licenseCode)
.shift()
.collegeLicenseGroupingCode
: null;

certification.patchValue({ ...collegeCertification, nurseCategory });
certification.patchValue({ ...collegeCertification, category });
}

this.certifications.push(certification);
Expand All @@ -136,4 +140,12 @@ export class RegulatoryFormState extends AbstractFormState<EnrolmentRegulatoryFo
public removeCollegeCertifications() {
this.certifications.clear();
}

public collegeHasGrouping(collegeCode: number): boolean {
if (collegeCode === 0) {
return false;
}
const college = this.colleges.find((c) => c.code === collegeCode);
return college ? college.collegeLicenses.some((l) => l.collegeLicenseGroupingCode) : false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class RegulatoryFormState extends BaseRegulatoryPageFormState {
} = this.formInstance.getRawValue();

const certifications = rawCertifications.map(c => {
const { nurseCategory, ...collegeCertification } = c;
const { category, ...collegeCertification } = c;
return collegeCertification;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class RegulatoryFormState extends AbstractFormState<RegulatoryForm> {
return this.fb.group({
// Force selection of "None" on new certifications
collegeCode: ['', [Validators.required]],
nurseCategory: [null, []],
category: [null, []],
licenseCode: [null, []],
// Validators are applied at the component-level when
// fields are made visible to allow empty submissions
Expand All @@ -87,7 +87,7 @@ export class RegulatoryFormState extends AbstractFormState<RegulatoryForm> {
if (collegeCertification) {
// Nursing category is a derived field for BCCNM, which is used to filter the
// results for the verbose number of available licence codes for nurses
const nurseCategory = (collegeCertification.collegeCode === CollegeLicenceClassEnum.BCCNM)
const category = (collegeCertification.collegeCode === CollegeLicenceClassEnum.BCCNM)
? this.configService.colleges
.find(c => c.code === CollegeLicenceClassEnum.BCCNM)
.collegeLicenses
Expand All @@ -96,7 +96,7 @@ export class RegulatoryFormState extends AbstractFormState<RegulatoryForm> {
.collegeLicenseGroupingCode
: null;

certification.patchValue({ ...collegeCertification, nurseCategory });
certification.patchValue({ ...collegeCertification, category });
}

this.certifications.push(certification);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
<app-alert *ngIf="licenseClassDiscontinued"
type="danger"
icon="warning"
class="mb-4">
<ng-container #alertContent
class="alert-content">
{{ this.collegeDiscontinued ?
"The name of your college has changed. Please select the new name from the dropdown list for college name, " +
"then " : "Your previous licence class is no longer available, please " }}
use the dropdown menu to select the licence you currently hold.
</ng-container>
</app-alert>

<ng-container [formGroup]="form">

<app-form-icon-group [show]="total > 1"
(event)="removeCertification()">

<ng-template #collegeLicences>
<mat-form-field class="w-100">
<mat-label>College Licences</mat-label>
<mat-label>College</mat-label>
<mat-select formControlName="collegeCode">
<mat-option *ngIf="!condensed && defaultOption"
value="">
Expand Down Expand Up @@ -38,22 +51,22 @@
</div>

<div class="col-sm-12">
<ng-container *ngIf="!condensed && collegeCode?.value === CollegeLicenceClassEnum.BCCNM">
<ng-container *ngIf="!condensed && collegeHasGrouping(collegeCode?.value)">
<mat-form-field class="w-100">
<mat-label>Nurse Category</mat-label>
<mat-select formControlName="nurseCategory">
<mat-option *ngFor="let group of nurseGroups"
<mat-label>Category</mat-label>
<mat-select formControlName="category">
<mat-option *ngFor="let group of getGrouping(collegeCode?.value)"
[value]="group.code">
{{ group.name }}
</mat-option>
</mat-select>
<mat-error *ngIf="nurseCategory.hasError('required')">Required</mat-error>
<mat-error *ngIf="category.hasError('required')">Required</mat-error>
</mat-form-field>
</ng-container>
</div>

<ng-container
*ngIf="collegeCode.value !== CollegeLicenceClassEnum.BCCNM && collegeCode.value || collegeCode.value === CollegeLicenceClassEnum.BCCNM && (condensed || nurseCategory?.value)">
*ngIf="!collegeHasGrouping(collegeCode?.value) && collegeCode.value || collegeHasGrouping(collegeCode?.value) && (condensed || category?.value)">
<div *ngIf="showLicenceClass()"
class="col-sm-12 pl-5">

Expand Down
Loading

0 comments on commit af889e0

Please sign in to comment.