Skip to content

Commit

Permalink
Merge branch 'main' into peggy/s3-delete
Browse files Browse the repository at this point in the history
  • Loading branch information
peggy-quartech authored Jan 26, 2024
2 parents 8160992 + e57c05a commit cc3c13d
Show file tree
Hide file tree
Showing 35 changed files with 733 additions and 652 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ export const RestraintDocumentTypeCode: Record<RestraintDocumentTypeCodeSubset,
// ============================================================

export const WorkerLicenceTypes: SelectOptions[] = [
// { desc: 'Security Business Licence', code: WorkerLicenceTypeCode.SecurityBusinessLicence },
{ desc: 'Security Worker Licence', code: WorkerLicenceTypeCode.SecurityWorkerLicence },
{ desc: 'Armoured Vehicle Permit', code: WorkerLicenceTypeCode.ArmouredVehiclePermit },
{ desc: 'Body Armour Permit', code: WorkerLicenceTypeCode.BodyArmourPermit },
Expand Down Expand Up @@ -198,7 +197,7 @@ export const LicenceTermTypes: SelectOptions[] = [
{ desc: '1 Year', code: LicenceTermCode.OneYear },
{ desc: '2 Years', code: LicenceTermCode.TwoYears },
{ desc: '3 Years', code: LicenceTermCode.ThreeYears },
// { desc: '5 Years', code: LicenceTermCode.FiveYears },
{ desc: '5 Years', code: LicenceTermCode.FiveYears },
];

export const RestraintDocumentTypes: SelectOptions[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { StepsPermitContactComponent } from './permit-wizard-steps/steps-permit-
import { StepsPermitDetailsComponent } from './permit-wizard-steps/steps-permit-details.component';
import { StepsPermitIdentificationComponent } from './permit-wizard-steps/steps-permit-identification.component';
import { StepsPermitPurposeComponent } from './permit-wizard-steps/steps-permit-purpose.component';
import { StepsPermitReviewAnonymousComponent } from './permit-wizard-steps/steps-permit-review-anonymous.component';

@Component({
selector: 'app-permit-wizard-anonymous-renewal',
Expand Down Expand Up @@ -66,20 +67,18 @@ import { StepsPermitPurposeComponent } from './permit-wizard-steps/steps-permit-
></app-steps-permit-contact>
</mat-step>
<!--
<mat-step completed="false">
<ng-template matStepLabel>Review & Confirm</ng-template>
<ng-template matStepContent>
<app-steps-review-licence-anonymous
(previousStepperStep)="onPreviousStepperStep(stepper)"
(nextStepperStep)="onNextStepperStep(stepper)"
(nextPayStep)="onNextPayStep()"
(scrollIntoView)="onScrollIntoView()"
(goToStep)="onGoToStep($event)"
></app-steps-review-licence-anonymous>
</ng-template>
</mat-step> -->
<mat-step completed="false">
<ng-template matStepLabel>Review & Confirm</ng-template>
<ng-template matStepContent>
<app-steps-permit-review-anonymous
(previousStepperStep)="onPreviousStepperStep(stepper)"
(nextStepperStep)="onNextStepperStep(stepper)"
(nextPayStep)="onNextPayStep()"
(scrollIntoView)="onScrollIntoView()"
(goToStep)="onGoToStep($event)"
></app-steps-permit-review-anonymous>
</ng-template>
</mat-step>
<mat-step completed="false">
<ng-template matStepLabel>Pay</ng-template>
Expand Down Expand Up @@ -112,8 +111,8 @@ export class PermitWizardAnonymousRenewalComponent extends BaseWizardComponent i
@ViewChild(StepsPermitContactComponent)
stepsPermitContactComponent!: StepsPermitContactComponent;

// @ViewChild(StepsReviewLicenceAuthenticatedComponent)
// stepReviewLicenceComponent!: StepsReviewLicenceAuthenticatedComponent;
@ViewChild(StepsPermitReviewAnonymousComponent)
stepReviewLicenceComponent!: StepsPermitReviewAnonymousComponent;

constructor(
override breakpointObserver: BreakpointObserver,
Expand Down Expand Up @@ -147,9 +146,9 @@ export class PermitWizardAnonymousRenewalComponent extends BaseWizardComponent i
case this.STEP_CONTACT_INFORMATION:
this.stepsPermitContactComponent?.onGoToFirstStep();
break;
// case this.STEP_REVIEW_AND_CONFIRM:
// this.stepReviewLicenceComponent?.onGoToFirstStep();
// break;
case this.STEP_REVIEW_AND_CONFIRM:
this.stepReviewLicenceComponent?.onGoToFirstStep();
break;
}

super.onStepSelectionChange(event);
Expand Down Expand Up @@ -216,12 +215,6 @@ export class PermitWizardAnonymousRenewalComponent extends BaseWizardComponent i
}

onGoToStep(step: number) {
// if (step == 99) {
// this.stepper.selectedIndex = this.STEP_IDENTIFICATION;
// this.stepIdentificationComponent.onGoToContactStep();
// return;
// }

this.stepsPermitDetailsComponent?.onGoToFirstStep();
this.stepsPermitPurposeComponent?.onGoToFirstStep();
this.stepsPermitIdentificationComponent?.onGoToFirstStep();
Expand All @@ -243,7 +236,7 @@ export class PermitWizardAnonymousRenewalComponent extends BaseWizardComponent i
this.step2Complete = this.permitApplicationService.isStepPurposeAndRationaleComplete();
this.step3Complete = this.permitApplicationService.isStepIdentificationComplete();
this.step4Complete = this.permitApplicationService.isStepContactComplete();
console.debug('iscomplete', this.step1Complete, this.step2Complete, this.step3Complete); //, this.step4Complete);
console.debug('iscomplete', this.step1Complete, this.step2Complete, this.step3Complete, this.step4Complete);
}

onChildNextStep() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,34 +57,96 @@ import { FileUploadComponent } from 'src/app/shared/components/file-upload.compo
<div class="text-minor-heading mb-2">Select proof of Canadian citizenship to upload</div>
</ng-container>
<ng-template #notCanadianCitizenHeading>
<div class="text-minor-heading mb-2">Select proof of ability to work in Canada</div>
<div class="text-minor-heading mb-2">Select proof of residency</div>
</ng-template>
<ng-container>
<div class="row my-2" *ngIf="isCanadianCitizen.value === booleanTypeCodes.Yes; else notCanadianCitizen">
<div class="col-lg-7 col-md-12">
<mat-form-field>
<mat-label>Type of Proof</mat-label>
<mat-select formControlName="canadianCitizenProofTypeCode" [errorStateMatcher]="matcher">
<mat-option
class="proof-option"
*ngFor="let item of proofOfCanadianCitizenshipTypes"
[value]="item.code"
>
{{ item.desc }}
</mat-option>
</mat-select>
<mat-error *ngIf="form.get('canadianCitizenProofTypeCode')?.hasError('required')">
This is required
</mat-error>
</mat-form-field>
</div>
<div class="col-lg-5 col-md-12">
<mat-form-field>
<mat-label>Document Expiry Date</mat-label>
<input
matInput
[matDatepicker]="picker"
formControlName="expiryDate"
[errorStateMatcher]="matcher"
/>
<mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker startView="multi-year"></mat-datepicker>
<mat-error *ngIf="form.get('expiryDate')?.hasError('required')"> This is required </mat-error>
</mat-form-field>
</div>
</div>
<ng-template #notCanadianCitizen>
<div class="row my-2">
<div class="col-lg-7 col-md-12">
<ng-container *ngIf="isCanadianCitizen.value === booleanTypeCodes.Yes; else notCanadianCitizen">
<mat-radio-group aria-label="Select an option" formControlName="isResidentOfCanada">
<mat-radio-button [value]="booleanTypeCodes.Yes">I am a resident of Canada</mat-radio-button>
<mat-radio-button [value]="booleanTypeCodes.No">I am not a Canadian resident</mat-radio-button>
</mat-radio-group>
<mat-error
class="mat-option-error"
*ngIf="
(form.get('isResidentOfCanada')?.dirty || form.get('isResidentOfCanada')?.touched) &&
form.get('isResidentOfCanada')?.invalid &&
form.get('isResidentOfCanada')?.hasError('required')
"
>This is required</mat-error
>
</div>
</div>
</ng-template>
<ng-container *ngIf="isCanadianCitizen.value === booleanTypeCodes.No && isResidentOfCanada.value">
<div class="row my-2">
<div class="col-lg-7 col-md-12">
<ng-container *ngIf="isResidentOfCanada.value === booleanTypeCodes.Yes; else notResidentOfCanada">
<mat-form-field>
<mat-label>Proof of Canadian citizenship</mat-label>
<mat-select formControlName="canadianCitizenProofTypeCode" [errorStateMatcher]="matcher">
<mat-option *ngFor="let item of proofOfCanadianCitizenshipTypes" [value]="item.code">
<mat-label>Proof of resident status</mat-label>
<mat-select formControlName="proofOfResidentStatusCode" [errorStateMatcher]="matcher">
<mat-option
class="proof-option"
*ngFor="let item of proofOfAbilityToWorkInCanadaTypes"
[value]="item.code"
>
{{ item.desc }}
</mat-option>
</mat-select>
<mat-error *ngIf="form.get('canadianCitizenProofTypeCode')?.hasError('required')">
<mat-error *ngIf="form.get('proofOfResidentStatusCode')?.hasError('required')">
This is required
</mat-error>
</mat-form-field>
</ng-container>
<ng-template #notCanadianCitizen>
<ng-template #notResidentOfCanada>
<mat-form-field>
<mat-label>Proof of ability to work in Canada</mat-label>
<mat-select formControlName="notCanadianCitizenProofTypeCode" [errorStateMatcher]="matcher">
<mat-option *ngFor="let item of proofOfAbilityToWorkInCanadaTypes" [value]="item.code">
<mat-label>Proof of citizenship</mat-label>
<mat-select formControlName="proofOfCitizenshipCode" [errorStateMatcher]="matcher">
<mat-option
class="proof-option"
*ngFor="let item of proofOfAbilityToWorkInCanadaTypes"
[value]="item.code"
>
{{ item.desc }}
</mat-option>
</mat-select>
<mat-error *ngIf="form.get('notCanadianCitizenProofTypeCode')?.hasError('required')">
<mat-error *ngIf="form.get('proofOfCitizenshipCode')?.hasError('required')">
This is required
</mat-error>
</mat-form-field>
Expand All @@ -105,50 +167,54 @@ import { FileUploadComponent } from 'src/app/shared/components/file-upload.compo
</mat-form-field>
</div>
</div>
<div
*ngIf="
(isCanadianCitizen.value === booleanTypeCodes.Yes && canadianCitizenProofTypeCode.value) ||
(isCanadianCitizen.value === booleanTypeCodes.No && notCanadianCitizenProofTypeCode.value)
"
@showHideTriggerSlideAnimation
>
<div class="row mb-2">
<div class="col-12">
<ng-container
*ngIf="isCanadianCitizen.value === booleanTypeCodes.Yes; else notCanadianCitizenTitle"
>
<div class="text-minor-heading mb-2">Upload a photo of your proof of Canadian citizenship:</div>
</ng-container>
<ng-template #notCanadianCitizenTitle>
<div class="text-minor-heading mb-2">Upload a photo of your selected document type:</div>
</ng-template>
<app-file-upload
(fileUploaded)="onFileUploaded($event)"
(fileRemoved)="onFileRemoved()"
[control]="attachments"
[maxNumberOfFiles]="10"
[files]="attachments.value"
></app-file-upload>
<mat-error
class="mat-option-error"
*ngIf="
(form.get('attachments')?.dirty || form.get('attachments')?.touched) &&
form.get('attachments')?.invalid &&
form.get('attachments')?.hasError('required')
"
>This is required</mat-error
>
</div>
</ng-container>
<div
*ngIf="isCanadianCitizen.value === booleanTypeCodes.Yes || isResidentOfCanada.value"
@showHideTriggerSlideAnimation
>
<div class="row mb-2">
<div class="col-12">
<ng-container
*ngIf="isCanadianCitizen.value === booleanTypeCodes.Yes; else notCanadianCitizenTitle"
>
<div class="text-minor-heading mb-2">Upload a photo of your proof of Canadian citizenship:</div>
</ng-container>
<ng-template #notCanadianCitizenTitle>
<div class="text-minor-heading mb-2">Upload a photo of your selected document type:</div>
</ng-template>
<app-file-upload
(fileUploaded)="onFileUploaded($event)"
(fileRemoved)="onFileRemoved()"
[control]="attachments"
[maxNumberOfFiles]="1"
[files]="attachments.value"
></app-file-upload>
<mat-error
class="mat-option-error"
*ngIf="
(form.get('attachments')?.dirty || form.get('attachments')?.touched) &&
form.get('attachments')?.invalid &&
form.get('attachments')?.hasError('required')
"
>This is required</mat-error
>
</div>
</div>
</ng-container>
</div>
</div>
</div>
</form>
</div>
</section>
`,
styles: [],
styles: [
`
.proof-option {
padding-bottom: 12px;
}
`,
],
animations: [showHideTriggerSlideAnimation],
})
export class StepPermitCitizenshipComponent implements LicenceChildStepperStepComponent {
Expand All @@ -172,23 +238,23 @@ export class StepPermitCitizenshipComponent implements LicenceChildStepperStepCo
) {}

onFileUploaded(file: File): void {
if (this.authenticationService.isLoggedIn()) {
const proofTypeCode =
this.isCanadianCitizen.value == BooleanTypeCode.Yes
? this.canadianCitizenProofTypeCode.value
: this.notCanadianCitizenProofTypeCode.value;
this.permitApplicationService.addUploadDocument(proofTypeCode, file).subscribe({
next: (resp: any) => {
const matchingFile = this.attachments.value.find((item: File) => item.name == file.name);
matchingFile.documentUrlId = resp.body[0].documentUrlId;
},
error: (error: any) => {
console.log('An error occurred during file upload', error);
this.hotToastService.error('An error occurred during the file upload. Please try again.');
this.fileUploadComponent.removeFailedFile(file);
},
});
}
// if (this.authenticationService.isLoggedIn()) {
// const proofTypeCode =
// this.isCanadianCitizen.value == BooleanTypeCode.Yes
// ? this.canadianCitizenProofTypeCode.value
// : this.isResidentOfCanada.value;
// this.permitApplicationService.addUploadDocument(proofTypeCode, file).subscribe({
// next: (resp: any) => {
// const matchingFile = this.attachments.value.find((item: File) => item.name == file.name);
// matchingFile.documentUrlId = resp.body[0].documentUrlId;
// },
// error: (error: any) => {
// console.log('An error occurred during file upload', error);
// this.hotToastService.error('An error occurred during the file upload. Please try again.');
// this.fileUploadComponent.removeFailedFile(file);
// },
// });
// }
}

onFileRemoved(): void {
Expand All @@ -208,8 +274,16 @@ export class StepPermitCitizenshipComponent implements LicenceChildStepperStepCo
return this.form.get('canadianCitizenProofTypeCode') as FormControl;
}

get notCanadianCitizenProofTypeCode(): FormControl {
return this.form.get('notCanadianCitizenProofTypeCode') as FormControl;
get isResidentOfCanada(): FormControl {
return this.form.get('isResidentOfCanada') as FormControl;
}

get proofOfResidentStatusCode(): FormControl {
return this.form.get('proofOfResidentStatusCode') as FormControl;
}

get proofOfCitizenship(): FormControl {
return this.form.get('proofOfCitizenship') as FormControl;
}

get attachments(): FormControl {
Expand Down
Loading

0 comments on commit cc3c13d

Please sign in to comment.