Skip to content

Commit

Permalink
Licensing updates (#648)
Browse files Browse the repository at this point in the history
# Description

This PR includes the following proposed change(s):

- Licensing updates
  • Loading branch information
carolcarpenter authored Dec 21, 2023
1 parent 32d0114 commit 1a41122
Show file tree
Hide file tree
Showing 43 changed files with 1,622 additions and 759 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class BaseWizardStepComponent implements LicenceStepperStepComponent {
@Output() childNextStep: EventEmitter<boolean> = new EventEmitter<boolean>();
@Output() saveAndExit: EventEmitter<boolean> = new EventEmitter<boolean>();
@Output() nextReview: EventEmitter<boolean> = new EventEmitter<boolean>();
@Output() nextPayStep: EventEmitter<boolean> = new EventEmitter<boolean>();

onStepSelectionChange(_event: StepperSelectionEvent) {
this.scrollIntoView.emit(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { LicenceApplicationRoutes } from '../../licence-application-routing.modu
<section class="step-section">
<div class="row">
<div class="col-xl-8 col-lg-12 col-md-12 col-sm-12 mx-auto">
<h2 class="my-3 fw-normal">Security Licences & Permits</h2>
<h2 class="fs-3 mb-3">Security Licences & Permits</h2>
<mat-divider class="mat-divider-main mb-3"></mat-divider>
<app-alert type="info" icon="info">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class StepLicenceConfirmationComponent implements OnInit {
const fee = this.licenceApplicationService.licenceFeeTermCodes?.filter(
(item) => item.licenceTermCode == this.licenceTermCode
);
if (fee) {
if (fee?.length > 0) {
this.feeAmount = `$${fee[0].amount}`;
} else {
this.feeAmount = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ import { LicenceApplicationService } from '@app/modules/licence-application/serv
</section>
<div class="row mt-4">
<div class="col-lg-3 col-md-4 col-sm-6 mx-auto">
<div class="col-xxl-2 col-xl-3 col-lg-3 col-md-4 col-sm-6 mx-auto">
<button mat-flat-button color="primary" class="large mb-2" (click)="onStepNext()">Next</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { Component, EventEmitter, Output, ViewChild, ViewEncapsulation } from '@angular/core';
import { Router } from '@angular/router';
import { LicenceApplicationRoutes } from '@app/modules/licence-application/licence-application-routing.module';
import { LicenceApplicationService } from '@app/modules/licence-application/services/licence-application.service';
import { HotToastService } from '@ngneat/hot-toast';
import { BaseWizardStepComponent } from 'src/app/core/components/base-wizard-step.component';
import { AuthenticationService } from 'src/app/core/services/authentication.service';
import { StepConsentAndDeclarationComponent } from '../../shared/wizard-child-steps/step-consent-and-declaration.component';
import { StepSummaryReviewLicenceAnonymousComponent } from './step-summary-review-licence-anonymous.component';

Expand Down Expand Up @@ -51,33 +46,15 @@ export class StepsReviewLicenceAnonymousComponent extends BaseWizardStepComponen
summaryReviewComponent!: StepSummaryReviewLicenceAnonymousComponent;
@ViewChild(StepConsentAndDeclarationComponent) consentAndDeclarationComponent!: StepConsentAndDeclarationComponent;

constructor(
private router: Router,
private licenceApplicationService: LicenceApplicationService,
private authenticationService: AuthenticationService,
private hotToastService: HotToastService
) {
constructor() {
super();
}

onPayNow(): void {
const isValid = this.consentAndDeclarationComponent.isFormValid();
if (!isValid) return;

this.licenceApplicationService.submitLicence().subscribe({
next: (_resp: any) => {
this.hotToastService.success('Your licence has been successfully submitted');
if (this.authenticationService.isLoggedIn()) {
this.router.navigateByUrl(LicenceApplicationRoutes.pathUserApplications());
} else {
this.router.navigateByUrl(LicenceApplicationRoutes.pathSecurityWorkerLicenceAnonymous());
}
},
error: (error: any) => {
console.log('An error occurred during save', error);
this.hotToastService.error('An error occurred during the save. Please try again.');
},
});
this.nextPayStep.emit();
}

onGoToStep(step: number): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ import { Component, OnInit, ViewChild } from '@angular/core';
import { MatStepper } from '@angular/material/stepper';
import { Router } from '@angular/router';
import { LicenceApplicationService } from '@app/modules/licence-application/services/licence-application.service';
import { HotToastService } from '@ngneat/hot-toast';
import { distinctUntilChanged } from 'rxjs';
import { BaseWizardComponent } from 'src/app/core/components/base-wizard.component';
import { LicenceApplicationRoutes } from '../../licence-application-routing.module';
import { StepsReviewLicenceAuthenticatedComponent } from '../authenticated/wizard-steps/steps-review-licence-authenticated.component';
import { StepsBackgroundComponent } from '../shared/wizard-steps/steps-background.component';
import { StepsLicenceSelectionComponent } from '../shared/wizard-steps/steps-licence-selection.component';
import { BaseWizardComponent } from '@app/core/components/base-wizard.component';
import { LicenceApplicationRoutes } from '@app/modules/licence-application/licence-application-routing.module';
import { StepsReviewLicenceAuthenticatedComponent } from '@app/modules/licence-application/components/authenticated/wizard-steps/steps-review-licence-authenticated.component';
import { StepsBackgroundComponent } from '@app/modules/licence-application/components/shared/wizard-steps/steps-background.component';
import { StepsLicenceSelectionComponent } from '@app/modules/licence-application/components/shared/wizard-steps/steps-licence-selection.component';
import { StepsIdentificationAnonymousComponent } from './wizard-steps/steps-identification-anonymous.component';

@Component({
selector: 'app-worker-licence-new-wizard-anonymous',
selector: 'app-worker-licence-wizard-anonymous-new',
template: `
<div class="row">
<div class="col-12">
Expand All @@ -29,7 +30,6 @@ import { StepsIdentificationAnonymousComponent } from './wizard-steps/steps-iden
<app-steps-licence-selection
(childNextStep)="onChildNextStep()"
(nextReview)="onGoToReview()"
(previousStepperStep)="onPreviousStepperStep(stepper)"
(nextStepperStep)="onNextStepperStep(stepper)"
(scrollIntoView)="onScrollIntoView()"
></app-steps-licence-selection>
Expand Down Expand Up @@ -63,6 +63,7 @@ import { StepsIdentificationAnonymousComponent } from './wizard-steps/steps-iden
<app-steps-review-licence-anonymous
(previousStepperStep)="onPreviousStepperStep(stepper)"
(nextStepperStep)="onNextStepperStep(stepper)"
(nextPayStep)="onNextPayStep()"
(scrollIntoView)="onScrollIntoView()"
(goToStep)="onGoToStep($event)"
></app-steps-review-licence-anonymous>
Expand All @@ -78,7 +79,7 @@ import { StepsIdentificationAnonymousComponent } from './wizard-steps/steps-iden
`,
styles: [],
})
export class WorkerLicenceNewWizardAnonymousComponent extends BaseWizardComponent implements OnInit {
export class WorkerLicenceWizardAnonymousNewComponent extends BaseWizardComponent implements OnInit {
readonly STEP_LICENCE_SELECTION = 0; // needs to be zero based because 'selectedIndex' is zero based
readonly STEP_BACKGROUND = 1;
readonly STEP_IDENTIFICATION = 2;
Expand All @@ -103,6 +104,7 @@ export class WorkerLicenceNewWizardAnonymousComponent extends BaseWizardComponen
constructor(
override breakpointObserver: BreakpointObserver,
private router: Router,
private hotToastService: HotToastService,
private licenceApplicationService: LicenceApplicationService
) {
super(breakpointObserver);
Expand Down Expand Up @@ -141,11 +143,12 @@ export class WorkerLicenceNewWizardAnonymousComponent extends BaseWizardComponen

switch (stepper.selectedIndex) {
case this.STEP_LICENCE_SELECTION:
this.router.navigateByUrl(
LicenceApplicationRoutes.pathSecurityWorkerLicenceAnonymous(
LicenceApplicationRoutes.LICENCE_APPLICATION_TYPE_ANONYMOUS
)
);
this.stepLicenceSelectionComponent?.onGoToLastStep();
// this.router.navigateByUrl(
// LicenceApplicationRoutes.pathSecurityWorkerLicenceAnonymous(
// LicenceApplicationRoutes.LICENCE_APPLICATION_TYPE_ANONYMOUS
// )
// );
break;
case this.STEP_BACKGROUND:
this.stepBackgroundComponent?.onGoToLastStep();
Expand All @@ -156,6 +159,40 @@ export class WorkerLicenceNewWizardAnonymousComponent extends BaseWizardComponen
}
}

onNextPayStep(): void {
this.licenceApplicationService.submitLicence().subscribe({
next: (_resp: any) => {
this.hotToastService.success('Your licence has been successfully submitted');
this.router.navigateByUrl(LicenceApplicationRoutes.pathSecurityWorkerLicenceAnonymous());
},
error: (error: any) => {
console.log('An error occurred during save', error);
this.hotToastService.error('An error occurred during the save. Please try again.');
},
});
}

// onPayNow(application: PaymentResponse): void {
// const orgId = this.authUserService.bceidUserInfoProfile?.orgId;
// const body: PaymentLinkCreateRequest = {
// applicationId: application.id!,
// paymentMethod: PaymentMethodCode.CreditCard,
// description: `Payment for Case ID: ${application.applicationNumber}`,
// };
// this.paymentService
// .apiOrgsOrgIdApplicationsApplicationIdPaymentLinkPost({
// orgId: orgId!,
// applicationId: application.id!,
// body,
// })
// .pipe()
// .subscribe((res: PaymentLinkResponse) => {
// if (res.paymentLinkUrl) {
// window.location.assign(res.paymentLinkUrl);
// }
// });
// }

onNextStepperStep(stepper: MatStepper): void {
this.updateCompleteStatus();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { Component, OnInit, ViewChild } from '@angular/core';
import { MatStepper } from '@angular/material/stepper';
import { LicenceApplicationService } from '@app/modules/licence-application/services/licence-application.service';
import { distinctUntilChanged } from 'rxjs';
import { BaseWizardComponent } from 'src/app/core/components/base-wizard.component';
import { StepsReviewLicenceAuthenticatedComponent } from '../authenticated/wizard-steps/steps-review-licence-authenticated.component';
import { StepsBackgroundComponent } from '../shared/wizard-steps/steps-background.component';
import { StepsLicenceSelectionComponent } from '../shared/wizard-steps/steps-licence-selection.component';
import { BaseWizardComponent } from '@app/core/components/base-wizard.component';
import { StepsReviewLicenceAuthenticatedComponent } from '@app/modules/licence-application/components/authenticated/wizard-steps/steps-review-licence-authenticated.component';
import { StepsBackgroundRenewAndUpdateComponent } from '@app/modules/licence-application/components/shared/wizard-steps/steps-background-renew-and-update.component';
import { StepsLicenceSelectionComponent } from '@app/modules/licence-application/components/shared/wizard-steps/steps-licence-selection.component';
import { StepsIdentificationAnonymousComponent } from './wizard-steps/steps-identification-anonymous.component';

@Component({
selector: 'app-worker-licence-renewal-wizard-anonymous',
selector: 'app-worker-licence-wizard-anonymous-renewal',
template: `
<div class="row">
<div class="col-12">
Expand All @@ -27,21 +27,20 @@ import { StepsIdentificationAnonymousComponent } from './wizard-steps/steps-iden
<app-steps-licence-selection
(childNextStep)="onChildNextStep()"
(nextReview)="onGoToReview()"
(previousStepperStep)="onPreviousStepperStep(stepper)"
(nextStepperStep)="onNextStepperStep(stepper)"
(scrollIntoView)="onScrollIntoView()"
></app-steps-licence-selection>
</mat-step>
<mat-step [completed]="step2Complete">
<ng-template matStepLabel>Background</ng-template>
<app-steps-background
<app-steps-background-renew-and-update
(childNextStep)="onChildNextStep()"
(nextReview)="onGoToReview()"
(previousStepperStep)="onPreviousStepperStep(stepper)"
(nextStepperStep)="onNextStepperStep(stepper)"
(scrollIntoView)="onScrollIntoView()"
></app-steps-background>
></app-steps-background-renew-and-update>
</mat-step>
<mat-step [completed]="step3Complete">
Expand Down Expand Up @@ -76,7 +75,7 @@ import { StepsIdentificationAnonymousComponent } from './wizard-steps/steps-iden
`,
styles: [],
})
export class WorkerLicenceRenewalWizardAnonymousComponent extends BaseWizardComponent implements OnInit {
export class WorkerLicenceWizardAnonymousRenewalComponent extends BaseWizardComponent implements OnInit {
readonly STEP_LICENCE_SELECTION = 0; // needs to be zero based because 'selectedIndex' is zero based
readonly STEP_BACKGROUND = 1;
readonly STEP_IDENTIFICATION = 2;
Expand All @@ -89,8 +88,8 @@ export class WorkerLicenceRenewalWizardAnonymousComponent extends BaseWizardComp
@ViewChild(StepsLicenceSelectionComponent)
stepLicenceSelectionComponent!: StepsLicenceSelectionComponent;

@ViewChild(StepsBackgroundComponent)
stepBackgroundComponent!: StepsBackgroundComponent;
@ViewChild(StepsBackgroundRenewAndUpdateComponent)
stepBackgroundComponent!: StepsBackgroundRenewAndUpdateComponent;

@ViewChild(StepsIdentificationAnonymousComponent)
stepIdentificationComponent!: StepsIdentificationAnonymousComponent;
Expand All @@ -100,7 +99,6 @@ export class WorkerLicenceRenewalWizardAnonymousComponent extends BaseWizardComp

constructor(
override breakpointObserver: BreakpointObserver,
// private router: Router,
private licenceApplicationService: LicenceApplicationService
) {
super(breakpointObserver);
Expand Down Expand Up @@ -139,11 +137,7 @@ export class WorkerLicenceRenewalWizardAnonymousComponent extends BaseWizardComp

switch (stepper.selectedIndex) {
case this.STEP_LICENCE_SELECTION:
// this.router.navigateByUrl(
// LicenceApplicationRoutes.pathSecurityWorkerLicenceAnonymous(
// LicenceApplicationRoutes.LICENCE_ACCESS_CODE_ANONYMOUS
// )
// );
this.stepLicenceSelectionComponent?.onGoToLastStep();
break;
case this.STEP_BACKGROUND:
this.stepBackgroundComponent?.onGoToLastStep();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { Component, OnInit, ViewChild } from '@angular/core';
import { ApplicationTypeCode } from '@app/api/models';
import { distinctUntilChanged } from 'rxjs';
import { BaseWizardComponent } from 'src/app/core/components/base-wizard.component';
import { LicenceApplicationService } from '../../services/licence-application.service';
import { StepMailingAddressComponent } from '../shared/wizard-child-steps/step-mailing-address.component';
import { BaseWizardComponent } from '@app/core/components/base-wizard.component';
import { LicenceApplicationService } from '@app/modules/licence-application/services/licence-application.service';
import { StepMailingAddressComponent } from '@app/modules/licence-application/components/shared/wizard-child-steps/step-mailing-address.component';

@Component({
selector: 'app-worker-licence-replacement-wizard-anonymous',
selector: 'app-worker-licence-wizard-anonymous-replacement',
template: `
<div class="row">
<div class="col-12">
Expand All @@ -17,7 +17,7 @@ import { StepMailingAddressComponent } from '../shared/wizard-child-steps/step-m
<app-step-licence-confirmation [applicationTypeCode]="applicationTypeCode"></app-step-licence-confirmation>
<div class="row mt-4">
<div class="col-lg-3 col-md-4 col-sm-6 mx-auto">
<div class="col-xxl-2 col-xl-3 col-lg-3 col-md-4 col-sm-6 mx-auto">
<button mat-flat-button color="primary" class="large mb-2" matStepperNext>Next</button>
</div>
</div>
Expand Down Expand Up @@ -48,7 +48,7 @@ import { StepMailingAddressComponent } from '../shared/wizard-child-steps/step-m
`,
styles: [],
})
export class WorkerLicenceReplacementWizardAnonymousComponent extends BaseWizardComponent implements OnInit {
export class WorkerLicenceWizardAnonymousReplacementComponent extends BaseWizardComponent implements OnInit {
applicationTypeCode = ApplicationTypeCode.Replacement;

@ViewChild(StepMailingAddressComponent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { MatStepper } from '@angular/material/stepper';
import { Router } from '@angular/router';
import { LicenceApplicationService } from '@app/modules/licence-application/services/licence-application.service';
import { distinctUntilChanged } from 'rxjs';
import { BaseWizardComponent } from 'src/app/core/components/base-wizard.component';
import { StepsReviewLicenceAuthenticatedComponent } from '../authenticated/wizard-steps/steps-review-licence-authenticated.component';
import { StepsBackgroundComponent } from '../shared/wizard-steps/steps-background.component';
import { StepsLicenceSelectionComponent } from '../shared/wizard-steps/steps-licence-selection.component';
import { BaseWizardComponent } from '@app/core/components/base-wizard.component';
import { StepsReviewLicenceAuthenticatedComponent } from '@app/modules/licence-application/components/authenticated/wizard-steps/steps-review-licence-authenticated.component';
import { StepsBackgroundRenewAndUpdateComponent } from '@app/modules/licence-application/components/shared/wizard-steps/steps-background-renew-and-update.component';
import { StepsLicenceSelectionComponent } from '@app/modules/licence-application/components/shared/wizard-steps/steps-licence-selection.component';
import { StepsIdentificationAnonymousComponent } from './wizard-steps/steps-identification-anonymous.component';

@Component({
selector: 'app-worker-licence-update-wizard-anonymous',
selector: 'app-worker-licence-wizard-anonymous-update',
template: `
<div class="row">
<div class="col-12">
Expand All @@ -28,21 +28,20 @@ import { StepsIdentificationAnonymousComponent } from './wizard-steps/steps-iden
<app-steps-licence-selection
(childNextStep)="onChildNextStep()"
(nextReview)="onGoToReview()"
(previousStepperStep)="onPreviousStepperStep(stepper)"
(nextStepperStep)="onNextStepperStep(stepper)"
(scrollIntoView)="onScrollIntoView()"
></app-steps-licence-selection>
</mat-step>
<mat-step [completed]="step2Complete">
<ng-template matStepLabel>Background</ng-template>
<app-steps-background
<app-steps-background-renew-and-update
(childNextStep)="onChildNextStep()"
(nextReview)="onGoToReview()"
(previousStepperStep)="onPreviousStepperStep(stepper)"
(nextStepperStep)="onNextStepperStep(stepper)"
(scrollIntoView)="onScrollIntoView()"
></app-steps-background>
></app-steps-background-renew-and-update>
</mat-step>
<mat-step [completed]="step3Complete">
Expand Down Expand Up @@ -77,7 +76,7 @@ import { StepsIdentificationAnonymousComponent } from './wizard-steps/steps-iden
`,
styles: [],
})
export class WorkerLicenceUpdateWizardAnonymousComponent extends BaseWizardComponent implements OnInit {
export class WorkerLicenceWizardAnonymousUpdateComponent extends BaseWizardComponent implements OnInit {
readonly STEP_LICENCE_SELECTION = 0; // needs to be zero based because 'selectedIndex' is zero based
readonly STEP_BACKGROUND = 1;
readonly STEP_IDENTIFICATION = 2;
Expand All @@ -90,8 +89,8 @@ export class WorkerLicenceUpdateWizardAnonymousComponent extends BaseWizardCompo
@ViewChild(StepsLicenceSelectionComponent)
stepLicenceSelectionComponent!: StepsLicenceSelectionComponent;

@ViewChild(StepsBackgroundComponent)
stepBackgroundComponent!: StepsBackgroundComponent;
@ViewChild(StepsBackgroundRenewAndUpdateComponent)
stepBackgroundComponent!: StepsBackgroundRenewAndUpdateComponent;

@ViewChild(StepsIdentificationAnonymousComponent)
stepIdentificationComponent!: StepsIdentificationAnonymousComponent;
Expand Down Expand Up @@ -191,7 +190,6 @@ export class WorkerLicenceUpdateWizardAnonymousComponent extends BaseWizardCompo
onChildNextStep() {
switch (this.stepper.selectedIndex) {
case this.STEP_LICENCE_SELECTION:
// applicationTypeCode !== applicationTypeCodes.Update
this.stepLicenceSelectionComponent?.onGoToNextStep();
break;
case this.STEP_BACKGROUND:
Expand Down
Loading

0 comments on commit 1a41122

Please sign in to comment.