Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] anonymous permit update flow and term updates #1713

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,9 @@ export abstract class PermitApplicationHelper extends CommonApplicationHelper {
country: new FormControl('', [FormControlValidators.required]),
});

reprintLicenceFormGroup: FormGroup = this.formBuilder.group(
{
reprintLicence: new FormControl(''),
},
{
validators: [
FormGroupValidators.conditionalRequiredValidator(
'reprintLicence',
(_form) =>
!!(
this.personalInformationFormGroup?.get('hasLegalNameChanged')?.value ||
this.personalInformationFormGroup?.get('hasBcscNameChanged')?.value
)
),
],
}
);
reprintLicenceFormGroup: FormGroup = this.formBuilder.group({
reprintLicence: new FormControl('', [FormControlValidators.required]),
});

override citizenshipFormGroup: FormGroup = this.formBuilder.group(
{
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,14 @@ export abstract class WorkerApplicationHelper extends CommonApplicationHelper {
});
}

let reprint = false;
if (
applicationTypeCode === ApplicationTypeCode.Update &&
(updatePhoto || personalInformationData.hasLegalNameChanged)
) {
reprint = true;
}

const documentExpiredInfos: Array<DocumentExpiredInfo> =
documentInfos
.filter((doc) => doc.expiryDate)
Expand Down Expand Up @@ -1010,6 +1018,8 @@ export abstract class WorkerApplicationHelper extends CommonApplicationHelper {
policeOfficerRoleCode,
otherOfficerRole,
//-----------------------------------
reprint,
//-----------------------------------
categoryCodes: [...categoryCodes],
documentExpiredInfos: [...documentExpiredInfos],
documentInfos: [...documentInfos],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,10 +709,6 @@ export class WorkerApplicationService extends WorkerApplicationHelper {

const body = bodyUpsert as WorkerLicenceAppSubmitRequest;

if (body.applicationTypeCode === ApplicationTypeCode.Update) {
body.reprint = true;
}

const documentsToSave = this.getDocsToSaveBlobs(licenceModelFormValue, false);

const consentData = this.consentAndDeclarationFormGroup.getRawValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { CommonBusinessProfileComponent } from './common-business-profile.compon
</div>

<mat-divider class="mat-divider-main mb-3"></mat-divider>
<app-alert type="warning" icon="warning"> {{ alertText }}</app-alert>
<div class="fs-6 fw-bold my-3">{{ alertText }}</div>

<app-common-business-profile
[businessInformationFormGroup]="businessInformationFormGroup"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ import { StepsWorkerLicenceReviewAnonymousComponent } from './worker-licence-wiz
<ng-template matStepLabel>Review & Confirm</ng-template>
<app-steps-worker-licence-review-anonymous
[applicationTypeCode]="applicationTypeCode"
[licenceCost]="newLicenceCost"
[licenceCost]="updateLicenceCost"
(previousStepperStep)="onPreviousStepperStep(stepper)"
(nextSubmitStep)="onSubmitStep()"
(nextPayStep)="onNextPayStep()"
Expand All @@ -103,7 +103,7 @@ export class WorkerLicenceWizardAnonymousUpdateComponent extends BaseWizardCompo
step3Complete = false;

newLicenceAppId: string | null = null;
newLicenceCost = 0;
updateLicenceCost = 0;

@ViewChild(StepsWorkerLicenceSelectionComponent)
stepLicenceSelectionComponent!: StepsWorkerLicenceSelectionComponent;
Expand All @@ -124,8 +124,6 @@ export class WorkerLicenceWizardAnonymousUpdateComponent extends BaseWizardCompo
showCitizenshipStep = false;
showPhotographOfYourself = true;
hasGenderChanged = false;
hasLegalNameChanged = false;
showReprint = false;
policeOfficerRoleCode: string | null = null;

private licenceModelChangedSubscription!: Subscription;
Expand Down Expand Up @@ -175,16 +173,6 @@ export class WorkerLicenceWizardAnonymousUpdateComponent extends BaseWizardCompo
'personalInformationData.hasGenderChanged'
)?.value;

// for Update flow: only show unauthenticated user option to upload a new photo
// if they changed their sex selection earlier in the application
this.hasLegalNameChanged = !!this.workerApplicationService.workerModelFormGroup.get(
'personalInformationData.hashasLegalNameChangedGenderChanged'
)?.value;

// for Update flow: only show unauthenticated user option to upload a new photo
// if they changed their sex selection earlier in the application and name change
this.showReprint = this.hasGenderChanged || this.hasLegalNameChanged;

this.showPhotographOfYourself = this.hasGenderChanged;

this.updateCompleteStatus();
Expand Down Expand Up @@ -272,7 +260,7 @@ export class WorkerLicenceWizardAnonymousUpdateComponent extends BaseWizardCompo

onSubmitStep(): void {
if (this.newLicenceAppId) {
if (this.newLicenceCost > 0) {
if (this.updateLicenceCost > 0) {
this.stepReviewLicenceComponent?.onGoToLastStep();
} else {
this.router.navigateByUrl(
Expand All @@ -286,9 +274,9 @@ export class WorkerLicenceWizardAnonymousUpdateComponent extends BaseWizardCompo

// save this locally just in application payment fails
this.newLicenceAppId = workerLicenceCommandResponse.licenceAppId!;
this.newLicenceCost = workerLicenceCommandResponse.cost ?? 0;
this.updateLicenceCost = workerLicenceCommandResponse.cost ?? 0;

if (this.newLicenceCost > 0) {
if (this.updateLicenceCost > 0) {
this.stepReviewLicenceComponent?.onGoToLastStep();
} else {
this.hotToastService.success('Your licence update has been successfully submitted');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { PersonalLicenceApplicationRoutes } from '@app/modules/personal-licence-
</div>

<mat-divider class="mat-divider-main mb-3"></mat-divider>
<app-alert type="warning" icon="warning"> {{ alertText }}</app-alert>
<div class="fs-6 fw-bold my-3">{{ alertText }}</div>

<section>
<app-common-user-profile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ import { UtilService } from '@app/core/services/util.service';
</li>
<li>attempt to collect any information about other users of the Services; or</li>
<li>
decompile, disassemble, reverse engineer, or otherwise copy any source code associated with the Site
decompile, disassemble, reverse engineer or otherwise copy any source code associated with the Site
or any Associated Service.
</li>
</ol>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ import { PermitApplicationService } from '@app/core/services/permit-application.
<div class="col-md-6 col-sm-12 mt-md-2">
<div class="payment__text">{{ 0 | currency: 'CAD' : 'symbol-narrow' : '1.0' }}</div>
</div>
<!--
// For an Update with reprint, we only have the old case number... so hide it for now
<div class="col-md-6 col-sm-12 mt-2">
<div class="d-block payment__text-label text-md-end">Case Number</div>
</div>
<div class="col-md-6 col-sm-12 mt-md-2">
<div class="payment__text">{{ caseNumber }}</div>
</div>
</div>
-->
</div>

<div class="no-print d-flex justify-content-end">
Expand Down Expand Up @@ -106,7 +109,7 @@ export class PermitUpdateReceivedSuccessComponent implements OnInit {
get licenceTermCode(): LicenceTermCode | null {
return this.permitApplicationService.getSummarylicenceTermCode(this.permitModelData);
}
get caseNumber(): string {
return this.permitApplicationService.getSummarycaseNumber(this.permitModelData);
}
// get caseNumber(): string {
// return this.permitApplicationService.getSummarycaseNumber(this.permitModelData);
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { WorkerApplicationService } from '@app/core/services/worker-application.
<app-step-section [title]="title" [subtitle]="subtitle">
<div class="row">
<div class="col-md-8 col-sm-12 mx-auto">
<app-address [form]="form"></app-address>
<app-address [form]="form" [isWideView]="true"></app-address>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { CommonUserProfileComponent } from '@app/modules/personal-licence-applic
</div>

<mat-divider class="mat-divider-main mb-3"></mat-divider>
<app-alert type="warning" icon="warning"> {{ alertText }}</app-alert>
<div class="fs-6 fw-bold my-3">{{ alertText }}</div>

<app-common-user-profile
[personalInformationFormGroup]="personalInformationFormGroup"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ import { UtilService } from '@app/core/services/util.service';
</li>
<li>attempt to collect any information about other users of the Services; or</li>
<li>
decompile, disassemble, reverse engineer, or otherwise copy any source code associated with the Site
decompile, disassemble, reverse engineer or otherwise copy any source code associated with the Site
or any Associated Service.
</li>
</ol>
Expand Down
Binary file not shown.