diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/biz-lic-app-submit-request.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/biz-lic-app-submit-request.ts index 60ad6b3fc..74ce32dd5 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/biz-lic-app-submit-request.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/biz-lic-app-submit-request.ts @@ -32,6 +32,7 @@ export interface BizLicAppSubmitRequest { reprint?: boolean | null; serviceTypeCode?: ServiceTypeCode; soleProprietorSWLAppId?: string | null; + soleProprietorSWLAppOriginTypeCode?: ApplicationOriginTypeCode; submittedByPortalUserId?: string | null; useDogs?: boolean | null; } diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/biz-lic-app-upsert-request.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/biz-lic-app-upsert-request.ts index 4d9558a84..8269b8f25 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/biz-lic-app-upsert-request.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/biz-lic-app-upsert-request.ts @@ -32,6 +32,7 @@ export interface BizLicAppUpsertRequest { privateInvestigatorSwlInfo?: PrivateInvestigatorSwlContactInfo; serviceTypeCode?: ServiceTypeCode; soleProprietorSWLAppId?: string | null; + soleProprietorSWLAppOriginTypeCode?: ApplicationOriginTypeCode; submittedByPortalUserId?: string | null; useDogs?: boolean | null; } diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/licence-response.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/licence-response.ts index 06233f5c6..71abbe0a2 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/licence-response.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/licence-response.ts @@ -31,6 +31,8 @@ export interface LicenceResponse { licenceNumber?: string | null; licenceStatusCode?: LicenceStatusCode; licenceTermCode?: LicenceTermCode; + linkedSoleProprietorExpiryDate?: string | null; + linkedSoleProprietorLicenceId?: string | null; nameOnCard?: string | null; permitOtherRequiredReason?: string | null; rationalDocumentInfos?: Array | null; diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/components/base-wizard-step.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/components/base-wizard-step.component.ts index a4b1f5667..e0409a781 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/components/base-wizard-step.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/components/base-wizard-step.component.ts @@ -51,10 +51,6 @@ export class BaseWizardStepComponent implements LicenceStepperStepComponent { this.cancelAndExit.emit(true); } - onExit(): void { - this.commonApplicationService.cancelAndLoseChanges(); - } - onNextReview(formNumber: number): void { const isValid = this.dirtyForm(formNumber); if (!isValid) return; diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/constants/constants.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/constants/constants.ts index 5908e0474..6c005d058 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/constants/constants.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/constants/constants.ts @@ -78,7 +78,9 @@ export const SPD_CONSTANTS = { requestForFingerprintingForm: './assets/files/SPD Request for Fingerprinting Form.pdf', }, address: { - provinceBC: 'British Columbia', + provinceBC: 'BC', + provinceBritishColumbia: 'British Columbia', + countryCA: 'CA', countryCanada: 'Canada', }, }; diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/application.service.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/application.service.ts index 470a1b82d..438a7d92b 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/application.service.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/application.service.ts @@ -61,7 +61,7 @@ export interface MainApplicationResponse extends LicenceAppListResponse { isExpiryWarning: boolean; isExpiryError: boolean; isControllingMemberWarning?: boolean; - isSoleProprietorSimultaneousFlow?: boolean; + isSimultaneousFlow: boolean; } export interface MainLicenceResponse extends LicenceResponse { @@ -79,6 +79,7 @@ export interface MainLicenceResponse extends LicenceResponse { dogAuthorizationExpiryDate: string | null; restraintAuthorization: boolean; restraintAuthorizationExpiryDate: string | null; + isSimultaneousFlow: boolean; } @Injectable({ @@ -253,13 +254,7 @@ export class ApplicationService { const apis: Observable[] = []; basicLicenceResps.forEach((resp: LicenceBasicResponse) => { - if ( - resp.licenceStatusCode === LicenceStatusCode.Active && - resp.categoryCodes && - resp.categoryCodes.findIndex( - (item: WorkerCategoryTypeCode) => item === WorkerCategoryTypeCode.SecurityGuard - ) >= 0 - ) { + if (resp.licenceStatusCode === LicenceStatusCode.Active) { apis.push( this.licenceService.apiLicencesLicenceIdGet({ licenceId: resp.licenceId!, @@ -340,7 +335,7 @@ export class ApplicationService { .pipe( switchMap((resp: BizLicAppResponse) => { response.forEach((item: MainApplicationResponse) => { - item.isSoleProprietorSimultaneousFlow = !!resp.soleProprietorSWLAppId; // TODO populate Simultaneous + item.isSimultaneousFlow = !!resp.soleProprietorSWLAppId; // TODO populate Simultaneous }); return of(response); @@ -386,13 +381,7 @@ export class ApplicationService { const apis: Observable[] = []; basicLicenceResps.forEach((resp: LicenceBasicResponse) => { - if ( - resp.licenceStatusCode === LicenceStatusCode.Active && - resp.categoryCodes && - resp.categoryCodes.findIndex( - (item: WorkerCategoryTypeCode) => item === WorkerCategoryTypeCode.SecurityGuard - ) >= 0 - ) { + if (resp.licenceStatusCode === LicenceStatusCode.Active) { apis.push( this.licenceService.apiLicencesLicenceIdGet({ licenceId: resp.licenceId!, @@ -866,6 +855,7 @@ export class ApplicationService { licence.isRenewalPeriod = false; licence.isUpdatePeriod = false; licence.isReplacementPeriod = false; + licence.isSimultaneousFlow = false; const today = moment().startOf('day'); @@ -880,24 +870,28 @@ export class ApplicationService { (item: WorkerCategoryTypeCode) => item === WorkerCategoryTypeCode.SecurityGuard ) >= 0; - if (licence.hasSecurityGuardCategory && matchingLicence) { - licence.dogAuthorization = matchingLicence.useDogs ?? false; - if (licence.dogAuthorization) { - const dogDocumentInfos = licence.dogDocumentInfos ?? []; - if (dogDocumentInfos.length > 0) { - // get first document with an expiry date - const doc = dogDocumentInfos.find((item: Document) => item.expiryDate); - licence.dogAuthorizationExpiryDate = doc?.expiryDate ?? null; + if (matchingLicence) { + licence.isSimultaneousFlow = matchingLicence.linkedSoleProprietorExpiryDate === licence.expiryDate; + + if (licence.hasSecurityGuardCategory) { + licence.dogAuthorization = matchingLicence.useDogs ?? false; + if (licence.dogAuthorization) { + const dogDocumentInfos = licence.dogDocumentInfos ?? []; + if (dogDocumentInfos.length > 0) { + // get first document with an expiry date + const doc = dogDocumentInfos.find((item: Document) => item.expiryDate); + licence.dogAuthorizationExpiryDate = doc?.expiryDate ?? null; + } } - } - licence.restraintAuthorization = matchingLicence.carryAndUseRestraints ?? false; - if (licence.restraintAuthorization) { - const restraintsDocumentInfos = licence.restraintsDocumentInfos ?? []; - if (restraintsDocumentInfos.length > 0) { - // get first document with an expiry date - const doc = restraintsDocumentInfos.find((item: Document) => item.expiryDate); - licence.restraintAuthorizationExpiryDate = doc?.expiryDate ?? null; + licence.restraintAuthorization = matchingLicence.carryAndUseRestraints ?? false; + if (licence.restraintAuthorization) { + const restraintsDocumentInfos = licence.restraintsDocumentInfos ?? []; + if (restraintsDocumentInfos.length > 0) { + // get first document with an expiry date + const doc = restraintsDocumentInfos.find((item: Document) => item.expiryDate); + licence.restraintAuthorizationExpiryDate = doc?.expiryDate ?? null; + } } } } diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/business-application.helper.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/business-application.helper.ts index ef12fa239..d840830e0 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/business-application.helper.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/business-application.helper.ts @@ -270,8 +270,14 @@ export abstract class BusinessApplicationHelper extends ApplicationHelper { province: new FormControl('', [ FormControlValidators.required, FormControlValidators.requiredValue(SPD_CONSTANTS.address.provinceBC), + FormControlValidators.requiredValue(SPD_CONSTANTS.address.provinceBritishColumbia), + ]), + country: new FormControl('', [ + FormControlValidators.required, + FormControlValidators.requiredValue(SPD_CONSTANTS.address.countryCA), + FormControlValidators.required, + FormControlValidators.requiredValue(SPD_CONSTANTS.address.countryCanada), ]), - country: new FormControl('', [FormControlValidators.required, FormControlValidators.requiredValue('Canada')]), }); branchesInBcFormGroup: FormGroup = this.formBuilder.group({ @@ -315,6 +321,7 @@ export abstract class BusinessApplicationHelper extends ApplicationHelper { province: new FormControl('', [ FormControlValidators.required, FormControlValidators.requiredValue(SPD_CONSTANTS.address.provinceBC), + FormControlValidators.requiredValue(SPD_CONSTANTS.address.provinceBritishColumbia), ]), country: new FormControl('', [FormControlValidators.required, FormControlValidators.requiredValue('Canada')]), branchManager: new FormControl('', [FormControlValidators.required]), @@ -470,6 +477,7 @@ export abstract class BusinessApplicationHelper extends ApplicationHelper { const bizId = businessModelFormValue.bizId; const licenceAppId = businessModelFormValue.licenceAppId; const soleProprietorSWLAppId = businessModelFormValue.soleProprietorSWLAppId; + const soleProprietorSWLAppOriginTypeCode = businessModelFormValue.soleProprietorSWLAppOriginTypeCode; const serviceTypeData = { ...businessModelFormValue.serviceTypeData }; const applicationTypeData = { ...businessModelFormValue.applicationTypeData }; const expiredLicenceData = { ...businessModelFormValue.expiredLicenceData }; @@ -548,6 +556,7 @@ export abstract class BusinessApplicationHelper extends ApplicationHelper { bizTypeCode, licenceAppId, soleProprietorSWLAppId, + soleProprietorSWLAppOriginTypeCode, latestApplicationId: businessModelFormValue.latestApplicationId, applicationTypeCode: applicationTypeData.applicationTypeCode, serviceTypeCode: serviceTypeData.serviceTypeCode, diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/business-application.service.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/business-application.service.ts index eae943104..4aa390ab1 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/business-application.service.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/business-application.service.ts @@ -86,6 +86,7 @@ export class BusinessApplicationService extends BusinessApplicationHelper { isControllingMembersWithoutSwlExist: new FormControl(), soleProprietorSWLAppId: new FormControl(), // placeholder for sole proprietor flow + soleProprietorSWLAppOriginTypeCode: new FormControl(), // placeholder for sole proprietor flow isSoleProprietorSimultaneousSWLAnonymous: new FormControl(), // placeholder for sole proprietor flow isSoleProprietorSimultaneousFlow: new FormControl(), // placeholder for sole proprietor flow - whether or not user can return to swl @@ -147,6 +148,8 @@ export class BusinessApplicationService extends BusinessApplicationHelper { .subscribe((_resp: any) => { if (this.initialized) { const bizTypeCode = this.businessModelFormGroup.get('businessInformationData.bizTypeCode')?.value; + const isBusinessLicenceSoleProprietor = this.isSoleProprietor(bizTypeCode); + const isAddressTheSame = this.businessModelFormGroup.get('businessAddressData.isAddressTheSame')?.value; const province = isAddressTheSame ? this.businessModelFormGroup.get('businessMailingAddressData.province')?.value @@ -154,11 +157,10 @@ export class BusinessApplicationService extends BusinessApplicationHelper { const country = isAddressTheSame ? this.businessModelFormGroup.get('businessMailingAddressData.country')?.value : this.businessModelFormGroup.get('businessAddressData.country')?.value; + const isBcBusinessAddress = this.utilService.isBcAddress(province, country); - const isBusinessLicenceSoleProprietor = this.isSoleProprietor(bizTypeCode); let isControllingMembersWithoutSwlExist = false; - if (!isBusinessLicenceSoleProprietor) { const membersWithoutSwl = this.businessModelFormGroup.get('controllingMembersData.membersWithoutSwl')?.value ?? []; @@ -708,13 +710,13 @@ export class BusinessApplicationService extends BusinessApplicationHelper { * Either create an empty licence or continue with the existing business lic app * @returns */ - getBusinessLicenceWithSwlCombinedFlow( + getNewBusinessLicenceWithSwlCombinedFlow( soleProprietorSWLAppId: string | null | undefined, // one of these two must have a value soleProprietorBizAppId: string | null | undefined // one of these two must have a value ): Observable { - const bizId = this.authUserBceidService.bceidUserProfile?.bizId!; - if (soleProprietorSWLAppId) { + const bizId = this.authUserBceidService.bceidUserProfile?.bizId!; + return this.bizProfileService.apiBizIdGet({ id: bizId }).pipe( switchMap((businessProfile: BizProfileResponse) => { return this.createEmptyBusinessLicenceWithSwlCombinedFlow({ @@ -749,6 +751,32 @@ export class BusinessApplicationService extends BusinessApplicationHelper { ); } + /** + * Either create an empty licence or continue with the existing business lic app + * @returns + */ + getRenewBusinessLicenceWithSwlCombinedFlow(soleProprietorSWLAppId: string): Observable { + const bizId = this.authUserBceidService.bceidUserProfile?.bizId!; + + return this.bizProfileService.apiBizIdGet({ id: bizId }).pipe( + switchMap((businessProfile: BizProfileResponse) => { + return this.createEmptyBusinessLicenceWithSwlCombinedFlow({ + soleProprietorSWLAppId, + businessProfile, + }).pipe( + tap((_resp: any) => { + this.setAsInitialized(); + + this.commonApplicationService.setApplicationTitle( + ServiceTypeCode.SecurityBusinessLicence, + ApplicationTypeCode.Renewal + ); + }) + ); + }) + ); + } + /** * Create an empty licence * @returns @@ -1716,12 +1744,18 @@ export class BusinessApplicationService extends BusinessApplicationHelper { } const soleProprietorSWLAppId = businessLicenceAppl.soleProprietorSWLAppId ?? null; - const isSoleProprietorSimultaneousFlow = soleProprietorSWLAppId - ? !!businessLicenceAppl.soleProprietorSWLAppId - : null; - const isSoleProprietorSimultaneousSWLAnonymous = isSoleProprietorSimultaneousFlow - ? businessLicenceAppl.soleProprietorSWLAppOriginTypeCode != ApplicationOriginTypeCode.Portal - : null; // TODO populate Simultaneous + + let isSoleProprietorSimultaneousFlow: boolean | null = null; + let isSoleProprietorSimultaneousSWLAnonymous: boolean | null = null; + + if (associatedLicence) { + isSoleProprietorSimultaneousFlow = associatedLicence.isSimultaneousFlow; + } else { + isSoleProprietorSimultaneousFlow = !!soleProprietorSWLAppId; + isSoleProprietorSimultaneousSWLAnonymous = isSoleProprietorSimultaneousFlow + ? businessLicenceAppl.soleProprietorSWLAppOriginTypeCode != ApplicationOriginTypeCode.Portal + : null; + } this.businessModelFormGroup.patchValue( { @@ -1974,10 +2008,10 @@ export class BusinessApplicationService extends BusinessApplicationHelper { this.businessModelFormGroup.patchValue( { soleProprietorSWLAppId: licenceAppId, + soleProprietorSWLAppOriginTypeCode: resp.applicationOriginTypeCode, isSoleProprietorSimultaneousFlow: true, isSoleProprietorSimultaneousSWLAnonymous: resp.applicationOriginTypeCode != ApplicationOriginTypeCode.Portal, - isBusinessLicenceSoleProprietor, businessInformationData, categoryData, diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/util.service.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/util.service.ts index 17d55f207..b3d380c1b 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/util.service.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/util.service.ts @@ -333,7 +333,10 @@ export class UtilService { } public isBcAddress(province: string | null | undefined, country: string | null | undefined): boolean { - return province === SPD_CONSTANTS.address.provinceBC && country === SPD_CONSTANTS.address.countryCanada; + return ( + (province === SPD_CONSTANTS.address.provinceBC || province === SPD_CONSTANTS.address.provinceBritishColumbia) && + (country === SPD_CONSTANTS.address.countryCA || country === SPD_CONSTANTS.address.countryCanada) + ); } public getPermitShowAdditionalGovIdData( diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/worker-application.service.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/worker-application.service.ts index 4376e465d..3d544d019 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/worker-application.service.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/worker-application.service.ts @@ -70,6 +70,7 @@ export class WorkerApplicationService extends WorkerApplicationHelper { latestApplicationId: new FormControl(), // placeholder for id soleProprietorBizAppId: new FormControl(), // placeholder for Simultaneous flow + isSoleProprietorSimultaneousFlow: new FormControl(), // placeholder for Simultaneous flow originalLicenceData: this.originalLicenceFormGroup, @@ -426,7 +427,7 @@ export class WorkerApplicationService extends WorkerApplicationHelper { * Partial Save - Save the licence data as is. * @returns StrictHttpResponse */ - submitSoleProprietorSimultaneousFlow(): Observable> { + submitNewSoleProprietorSimultaneousFlow(): Observable> { const licenceModelFormValue = this.workerModelFormGroup.getRawValue(); const body = this.getSaveBodyBaseAuthenticated(licenceModelFormValue) as WorkerLicenceAppUpsertRequest; @@ -578,9 +579,9 @@ export class WorkerApplicationService extends WorkerApplicationHelper { */ getLicenceWithSelectionAuthenticated( applicationTypeCode: ApplicationTypeCode, - licence: MainLicenceResponse + associatedLicence: MainLicenceResponse ): Observable { - return this.getLicenceOfTypeAuthenticated(applicationTypeCode, licence).pipe( + return this.getLicenceOfTypeAuthenticated(applicationTypeCode, associatedLicence).pipe( tap((_resp: any) => { this.initialized = true; @@ -805,7 +806,7 @@ export class WorkerApplicationService extends WorkerApplicationHelper { private loadExistingLicenceWithLatestAuthenticated( applicantId: string, - licence: MainLicenceResponse + associatedLicence: MainLicenceResponse ): Observable { this.reset(); @@ -821,7 +822,7 @@ export class WorkerApplicationService extends WorkerApplicationHelper { const workerLicenceAppl = resps[0]; const applicantProfile = resps[1]; - return this.loadLicenceAppAndProfile(workerLicenceAppl, applicantProfile, licence); + return this.loadLicenceAppAndProfile(workerLicenceAppl, applicantProfile, associatedLicence); }) ); } @@ -875,7 +876,7 @@ export class WorkerApplicationService extends WorkerApplicationHelper { */ private getLicenceOfTypeAuthenticated( applicationTypeCode: ApplicationTypeCode, - licence: MainLicenceResponse + associatedLicence: MainLicenceResponse ): Observable { const applicantId = this.authUserBcscService.applicantLoginProfile?.applicantId!; @@ -883,8 +884,8 @@ export class WorkerApplicationService extends WorkerApplicationHelper { case ApplicationTypeCode.Renewal: case ApplicationTypeCode.Update: { return forkJoin([ - this.loadExistingLicenceWithLatestAuthenticated(applicantId, licence), - this.licenceService.apiLicencesLicencePhotoLicenceIdGet({ licenceId: licence?.licenceId! }), + this.loadExistingLicenceWithLatestAuthenticated(applicantId, associatedLicence), + this.licenceService.apiLicencesLicencePhotoLicenceIdGet({ licenceId: associatedLicence?.licenceId! }), ]).pipe( catchError((error) => of(error)), switchMap((resps: any[]) => { @@ -892,18 +893,18 @@ export class WorkerApplicationService extends WorkerApplicationHelper { const photoOfYourself = resps[1]; if (applicationTypeCode === ApplicationTypeCode.Renewal) { - return this.applyRenewalDataUpdatesToModel(latestApplication, true, licence, photoOfYourself); + return this.applyRenewalDataUpdatesToModel(latestApplication, true, associatedLicence, photoOfYourself); } - return this.applyUpdateDataUpdatesToModel(latestApplication, licence, photoOfYourself); + return this.applyUpdateDataUpdatesToModel(latestApplication, associatedLicence, photoOfYourself); }) ); } default: { // ApplicationTypeCode.Replacement - return this.loadExistingLicenceWithLatestAuthenticated(applicantId, licence).pipe( + return this.loadExistingLicenceWithLatestAuthenticated(applicantId, associatedLicence).pipe( switchMap((_resp: any) => { - return this.applyReplacementDataUpdatesToModel(_resp, licence); + return this.applyReplacementDataUpdatesToModel(_resp, associatedLicence); }) ); } @@ -1410,11 +1411,22 @@ export class WorkerApplicationService extends WorkerApplicationHelper { const serviceTypeData = { serviceTypeCode: workerLicenceAppl.serviceTypeCode }; const applicationTypeData = { applicationTypeCode: workerLicenceAppl.applicationTypeCode }; + const originalLicenceData = this.originalLicenceFormGroup.value; + originalLicenceData.originalBizTypeCode = workerLicenceAppl.bizTypeCode; + + const isSoleProprietor = workerLicenceAppl.bizTypeCode === BizTypeCode.None; const soleProprietorData = { - isSoleProprietor: workerLicenceAppl.bizTypeCode === BizTypeCode.None ? BooleanTypeCode.No : BooleanTypeCode.Yes, + isSoleProprietor: this.utilService.booleanToBooleanType(isSoleProprietor), bizTypeCode: workerLicenceAppl.bizTypeCode, }; + let isSoleProprietorSimultaneousFlow: boolean | null = null; + if (associatedLicence) { + isSoleProprietorSimultaneousFlow = associatedLicence.isSimultaneousFlow; + } else { + isSoleProprietorSimultaneousFlow = isSoleProprietor; + } + const hasExpiredLicence = workerLicenceAppl.hasExpiredLicence ?? false; const expiredLicenceData = this.getExpiredLicenceData( this.utilService.booleanToBooleanType(hasExpiredLicence), @@ -1809,10 +1821,12 @@ export class WorkerApplicationService extends WorkerApplicationHelper { latestApplicationId: workerLicenceAppl.licenceAppId, caseNumber: workerLicenceAppl.caseNumber, soleProprietorBizAppId: workerLicenceAppl.soleProprietorBizAppId, + isSoleProprietorSimultaneousFlow, serviceTypeData, applicationTypeData, soleProprietorData, expiredLicenceData, + originalLicenceData, licenceTermData, bcDriversLicenceData, fingerprintProofData, diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/business-licence-application-routing.module.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/business-licence-application-routing.module.ts index d8595e994..696fd3166 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/business-licence-application-routing.module.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/business-licence-application-routing.module.ts @@ -1,5 +1,6 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { BusinessLicenceApplicationRoutes } from './business-license-application-routes'; import { BusinessControllingMembersAndEmployeesComponent } from './components/business-controlling-members-and-employees.component'; import { BusinessFirstTimeUserTermsOfUseComponent } from './components/business-first-time-user-terms-of-use.component'; import { BusinessLicenceApplicationBaseComponent } from './components/business-licence-application-base.component'; @@ -19,7 +20,6 @@ import { BusinessProfileComponent } from './components/business-profile.componen import { BusinessUserApplicationsComponent } from './components/business-user-applications.component'; import { StepBusinessLicenceProfileComponent } from './components/step-business-licence-profile.component'; import { StepBusinessLicenceUpdateTermsComponent } from './components/step-business-licence-update-terms.component'; -import { BusinessLicenceApplicationRoutes } from './business-license-application-routes'; const routes: Routes = [ { @@ -42,6 +42,10 @@ const routes: Routes = [ path: BusinessLicenceApplicationRoutes.BUSINESS_NEW_SOLE_PROPRIETOR, component: BusinessLicenceWizardNewSwlSoleProprietorComponent, }, + { + path: BusinessLicenceApplicationRoutes.BUSINESS_RENEW_SOLE_PROPRIETOR, + component: BusinessLicenceWizardNewSwlSoleProprietorComponent, + }, { path: BusinessLicenceApplicationRoutes.BUSINESS_RENEWAL, component: BusinessLicenceWizardRenewalComponent, diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/business-license-application-routes.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/business-license-application-routes.ts index c21c91b5a..e8b5b1fda 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/business-license-application-routes.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/business-license-application-routes.ts @@ -3,7 +3,8 @@ export class BusinessLicenceApplicationRoutes { public static readonly BUSINESS_FIRST_TIME_USER_TERMS = 'terms-and-conditions'; - public static readonly BUSINESS_NEW_SOLE_PROPRIETOR = 'business-licence-new-sp'; // should contain url parameters for licenceAppId & isSoleProprietorSimultaneousSWLAnonymous + public static readonly BUSINESS_NEW_SOLE_PROPRIETOR = 'business-licence-new-sp'; // should contain url parameters for licenceAppId + public static readonly BUSINESS_RENEW_SOLE_PROPRIETOR = 'business-licence-renew-sp'; // should contain url parameters for licenceAppId public static readonly BUSINESS_LICENCE_UPDATE_TERMS = 'business-licence-update-terms'; public static readonly BUSINESS_LICENCE_APP_PROFILE = 'app-profile'; diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-licence-application-base.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-licence-application-base.component.ts index 47d2b7113..092d3129f 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-licence-application-base.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-licence-application-base.component.ts @@ -38,8 +38,6 @@ export class BusinessLicenceApplicationBaseComponent implements OnInit { const defaultBizId: string | undefined = queryParams['bizId']; const swlLicAppId: string | undefined = queryParams['swlLicAppId']; const bizLicAppId: string | undefined = queryParams['bizLicAppId']; - const isSoleProprietorSimultaneousSWLAnonymous: string | undefined = - queryParams['isSoleProprietorSimultaneousSWLAnonymous']; console.debug('BusinessLicenceApplicationBaseComponent queryParams', queryParams); @@ -47,8 +45,6 @@ export class BusinessLicenceApplicationBaseComponent implements OnInit { if (defaultBizId) params.set('bizId', defaultBizId); if (swlLicAppId) params.set('swlLicAppId', swlLicAppId); if (bizLicAppId) params.set('bizLicAppId', bizLicAppId); - if (isSoleProprietorSimultaneousSWLAnonymous) - params.set('isSoleProprietorSimultaneousSWLAnonymous', isSoleProprietorSimultaneousSWLAnonymous); const currentPath = location.pathname; let redirectComponentRoute: string | undefined; @@ -79,7 +75,7 @@ export class BusinessLicenceApplicationBaseComponent implements OnInit { ) { // handle new business licence creation from swl - for sole proprietor this.businessApplicationService - .getBusinessLicenceWithSwlCombinedFlow(swlLicAppId, bizLicAppId) + .getNewBusinessLicenceWithSwlCombinedFlow(swlLicAppId, bizLicAppId) .pipe( tap((_resp: any) => { this.router.navigateByUrl( @@ -94,6 +90,28 @@ export class BusinessLicenceApplicationBaseComponent implements OnInit { return; } + if ( + swlLicAppId && + loginInfo.returnRoute?.includes(BusinessLicenceApplicationRoutes.BUSINESS_RENEW_SOLE_PROPRIETOR) && + loginInfo.state + ) { + // handle renew business licence creation from swl - for sole proprietor + this.businessApplicationService + .getRenewBusinessLicenceWithSwlCombinedFlow(swlLicAppId) + .pipe( + tap((_resp: any) => { + this.router.navigateByUrl( + `${BusinessLicenceApplicationRoutes.pathBusinessLicence( + BusinessLicenceApplicationRoutes.BUSINESS_RENEW_SOLE_PROPRIETOR + )}?${loginInfo.state}` + ); + }), + take(1) + ) + .subscribe(); + return; + } + // If the user is navigating to a payment page, the service does not have to be initialized const path = this.router.url; if ( diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-licence-list-current.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-licence-list-current.component.ts index be8b2c386..acdf7d92e 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-licence-list-current.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-licence-list-current.component.ts @@ -17,7 +17,7 @@ import { MainLicenceResponse } from '@app/core/services/application.service';
- {{ licence.serviceTypeCode | options : 'ServiceTypes' }} + {{ licence.serviceTypeCode | options: 'ServiceTypes' }}
@@ -28,13 +28,13 @@ import { MainLicenceResponse } from '@app/core/services/application.service';
Licence Term
-
{{ licence.licenceTermCode | options : 'LicenceTermTypes' }}
+
{{ licence.licenceTermCode | options: 'LicenceTermTypes' }}
Expiry Date
- {{ licence.licenceExpiryDate | formatDate : formalDateFormat }} + {{ licence.licenceExpiryDate | formatDate: formalDateFormat }}
@@ -53,7 +53,7 @@ import { MainLicenceResponse } from '@app/core/services/application.service';
    -
  • {{ catCode | options : 'WorkerCategoryTypes' }}
  • +
  • {{ catCode | options: 'WorkerCategoryTypes' }}
@@ -70,7 +70,7 @@ import { MainLicenceResponse } from '@app/core/services/application.service';
Expiry Date
- {{ licence.dogAuthorizationExpiryDate | formatDate : formalDateFormat }} + {{ licence.dogAuthorizationExpiryDate | formatDate: formalDateFormat }}
@@ -82,7 +82,7 @@ import { MainLicenceResponse } from '@app/core/services/application.service';
The following updates have a - {{ licence.licenceReprintFee | currency : 'CAD' : 'symbol-narrow' : '1.0' }} licence reprint fee: + {{ licence.licenceReprintFee | currency: 'CAD' : 'symbol-narrow' : '1.0' }} licence reprint fee:
  • add or remove branch
  • change to business trade name
  • @@ -93,25 +93,30 @@ import { MainLicenceResponse } from '@app/core/services/application.service';
- - +
+
+ + To renew your {{ licence.serviceTypeCode | options: 'ServiceTypes' }}, please renew your + {{ swlServiceTypeCode | options: 'ServiceTypes' }} first. + +
- This {{ licence.serviceTypeCode | options : 'ServiceTypes' }} cannot be renewed, updated or replaced - while an application is in progress + This {{ licence.serviceTypeCode | options: 'ServiceTypes' }} cannot be renewed, updated or replaced + while an application is in progress.
@@ -169,7 +174,7 @@ export class BusinessLicenceListCurrentComponent { formalDateFormat = SPD_CONSTANTS.date.formalDateFormat; contactSpdUrl = SPD_CONSTANTS.urls.contactSpdUrl; - serviceTypeCodes = ServiceTypeCode; + swlServiceTypeCode = ServiceTypeCode.SecurityWorkerLicence; @Input() activeLicences!: Array; @Input() applicationIsInProgress!: boolean; diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-licence-wizard-update.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-licence-wizard-update.component.ts index 609ecf50c..60e3f2ce0 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-licence-wizard-update.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-licence-wizard-update.component.ts @@ -2,12 +2,10 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { StepperSelectionEvent } from '@angular/cdk/stepper'; import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { MatStepper } from '@angular/material/stepper'; -import { Router } from '@angular/router'; import { ApplicationTypeCode, ServiceTypeCode } from '@app/api/models'; import { BaseWizardComponent } from '@app/core/components/base-wizard.component'; import { ApplicationService } from '@app/core/services/application.service'; import { BusinessApplicationService } from '@app/core/services/business-application.service'; -import { HotToastService } from '@ngxpert/hot-toast'; import { Subscription, distinctUntilChanged } from 'rxjs'; import { StepBusinessLicenceConfirmationComponent } from './step-business-licence-confirmation.component'; @@ -97,8 +95,6 @@ export class BusinessLicenceWizardUpdateComponent extends BaseWizardComponent im constructor( override breakpointObserver: BreakpointObserver, - private router: Router, - private hotToastService: HotToastService, private commonApplicationService: ApplicationService, private businessApplicationService: BusinessApplicationService ) { diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-user-applications.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-user-applications.component.ts index 35bad5388..7cd2de696 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-user-applications.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/business-licence-application/components/business-user-applications.component.ts @@ -32,7 +32,7 @@ import { Observable, forkJoin, switchMap, take, tap } from 'rxjs';