From 699e7c323215d0647e57f1f57fffca42acf691b7 Mon Sep 17 00:00:00 2001 From: Carol Carpenter Date: Tue, 10 Jun 2025 15:34:09 -0700 Subject: [PATCH 1/7] wip --- .../ClientApp/src/app/api/api.module.ts | 2 + .../fn/mdra/api-mdra-registrations-post.ts | 38 ++++ .../ClientApp/src/app/api/models.ts | 2 + .../mdra-registration-command-response.ts | 7 + .../api/models/mdra-registration-request.ts | 26 +++ .../ClientApp/src/app/api/services.ts | 1 + .../src/app/api/services/mdra.service.ts | 61 +++++++ .../metal-dealers-application.helper.ts | 168 +++++++++++++++--- .../step-mdra-business-manager.component.ts | 28 +-- .../step-mdra-business-owner.component.ts | 17 +- .../components/step-mdra-summary.component.ts | 12 +- 11 files changed, 299 insertions(+), 63 deletions(-) create mode 100644 src/Spd.Presentation.Licensing/ClientApp/src/app/api/fn/mdra/api-mdra-registrations-post.ts create mode 100644 src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-command-response.ts create mode 100644 src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-request.ts create mode 100644 src/Spd.Presentation.Licensing/ClientApp/src/app/api/services/mdra.service.ts diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/api.module.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/api.module.ts index cbe09519d9..c6ba94b6fd 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/api.module.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/api.module.ts @@ -19,6 +19,7 @@ import { LicenceAppService } from './services/licence-app.service'; import { LicenceAppDocumentService } from './services/licence-app-document.service'; import { LicenceFeeService } from './services/licence-fee.service'; import { LoginService } from './services/login.service'; +import { MdraService } from './services/mdra.service'; import { PaymentService } from './services/payment.service'; import { PermitService } from './services/permit.service'; import { SecurityWorkerLicensingService } from './services/security-worker-licensing.service'; @@ -44,6 +45,7 @@ import { SecurityWorkerLicensingService } from './services/security-worker-licen LicenceAppDocumentService, LicenceFeeService, LoginService, + MdraService, PaymentService, PermitService, SecurityWorkerLicensingService, diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/fn/mdra/api-mdra-registrations-post.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/fn/mdra/api-mdra-registrations-post.ts new file mode 100644 index 0000000000..f2a1ee8fe0 --- /dev/null +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/fn/mdra/api-mdra-registrations-post.ts @@ -0,0 +1,38 @@ +/* tslint:disable */ +/* eslint-disable */ +/* Code generated by ng-openapi-gen DO NOT EDIT. */ + +import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { filter, map } from 'rxjs/operators'; +import { StrictHttpResponse } from '../../strict-http-response'; +import { RequestBuilder } from '../../request-builder'; + +import { MdraRegistrationCommandResponse } from '../../models/mdra-registration-command-response'; +import { MdraRegistrationRequest } from '../../models/mdra-registration-request'; + +export interface ApiMdraRegistrationsPost$Params { + + /** + * MDRARegistrationRequest data + */ + body: MdraRegistrationRequest +} + +export function apiMdraRegistrationsPost(http: HttpClient, rootUrl: string, params: ApiMdraRegistrationsPost$Params, context?: HttpContext): Observable> { + const rb = new RequestBuilder(rootUrl, apiMdraRegistrationsPost.PATH, 'post'); + if (params) { + rb.body(params.body, 'application/*+json'); + } + + return http.request( + rb.build({ responseType: 'json', accept: 'application/json', context }) + ).pipe( + filter((r: any): r is HttpResponse => r instanceof HttpResponse), + map((r: HttpResponse) => { + return r as StrictHttpResponse; + }) + ); +} + +apiMdraRegistrationsPost.PATH = '/api/mdra-registrations'; diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models.ts index 921ea2d445..5d835264e9 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models.ts @@ -63,6 +63,8 @@ export type { LicenceResponse } from './models/licence-response'; export { LicenceStatusCode } from './models/licence-status-code'; export { LicenceTermCode } from './models/licence-term-code'; export type { MailingAddress } from './models/mailing-address'; +export type { MdraRegistrationCommandResponse } from './models/mdra-registration-command-response'; +export type { MdraRegistrationRequest } from './models/mdra-registration-request'; export type { Members } from './models/members'; export type { MembersRequest } from './models/members-request'; export type { NonSwlContactInfo } from './models/non-swl-contact-info'; diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-command-response.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-command-response.ts new file mode 100644 index 0000000000..6fe87a59b2 --- /dev/null +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-command-response.ts @@ -0,0 +1,7 @@ +/* tslint:disable */ +/* eslint-disable */ +/* Code generated by ng-openapi-gen DO NOT EDIT. */ + +export interface MdraRegistrationCommandResponse { + orgRegistrationId?: string | null; +} diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-request.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-request.ts new file mode 100644 index 0000000000..00454cfad1 --- /dev/null +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-request.ts @@ -0,0 +1,26 @@ +/* tslint:disable */ +/* eslint-disable */ +/* Code generated by ng-openapi-gen DO NOT EDIT. */ + +import { Address } from '../models/address'; +import { ApplicationOriginTypeCode } from '../models/application-origin-type-code'; +import { ApplicationTypeCode } from '../models/application-type-code'; +import { BranchInfo } from '../models/branch-info'; +export interface MdraRegistrationRequest { + applicationOriginTypeCode?: ApplicationOriginTypeCode; + applicationTypeCode?: ApplicationTypeCode; + bizAddress?: Address; + bizEmailAddress?: string | null; + bizLegalName?: string | null; + bizMailingAddress?: Address; + bizManagerFirstName?: string | null; + bizManagerLastName?: string | null; + bizManagerMiddleName?: string | null; + bizOwnerFirstName?: string | null; + bizOwnerLastName?: string | null; + bizOwnerMiddleName?: string | null; + bizPhoneNumber?: string | null; + bizTradeName?: string | null; + branches?: Array | null; + documentKeyCodes?: Array | null; +} diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/services.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/services.ts index 8608a3c051..7bf726cfad 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/services.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/services.ts @@ -15,6 +15,7 @@ export { LicenceAppService } from './services/licence-app.service'; export { LicenceAppDocumentService } from './services/licence-app-document.service'; export { LicenceFeeService } from './services/licence-fee.service'; export { LoginService } from './services/login.service'; +export { MdraService } from './services/mdra.service'; export { PaymentService } from './services/payment.service'; export { PermitService } from './services/permit.service'; export { SecurityWorkerLicensingService } from './services/security-worker-licensing.service'; diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/services/mdra.service.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/services/mdra.service.ts new file mode 100644 index 0000000000..f539c463db --- /dev/null +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/services/mdra.service.ts @@ -0,0 +1,61 @@ +/* tslint:disable */ +/* eslint-disable */ +/* Code generated by ng-openapi-gen DO NOT EDIT. */ + +import { HttpClient, HttpContext } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; + +import { BaseService } from '../base-service'; +import { ApiConfiguration } from '../api-configuration'; +import { StrictHttpResponse } from '../strict-http-response'; + +import { apiMdraRegistrationsPost } from '../fn/mdra/api-mdra-registrations-post'; +import { ApiMdraRegistrationsPost$Params } from '../fn/mdra/api-mdra-registrations-post'; +import { MdraRegistrationCommandResponse } from '../models/mdra-registration-command-response'; + +@Injectable({ providedIn: 'root' }) +export class MdraService extends BaseService { + constructor(config: ApiConfiguration, http: HttpClient) { + super(config, http); + } + + /** Path part for operation `apiMdraRegistrationsPost()` */ + static readonly ApiMdraRegistrationsPostPath = '/api/mdra-registrations'; + + /** + * Submit MDRA registration Anonymously + * After fe done with the uploading files, then fe do post with json payload, inside payload, it needs to contain an array of keycode for the files. + * The session keycode is stored in the cookies. + * + * + * + * This method provides access to the full `HttpResponse`, allowing access to response headers. + * To access only the response body, use `apiMdraRegistrationsPost()` instead. + * + * This method sends `application/*+json` and handles request body of type `application/*+json`. + */ + apiMdraRegistrationsPost$Response(params: ApiMdraRegistrationsPost$Params, context?: HttpContext): Observable> { + return apiMdraRegistrationsPost(this.http, this.rootUrl, params, context); + } + + /** + * Submit MDRA registration Anonymously + * After fe done with the uploading files, then fe do post with json payload, inside payload, it needs to contain an array of keycode for the files. + * The session keycode is stored in the cookies. + * + * + * + * This method provides access only to the response body. + * To access the full response (for headers, for example), `apiMdraRegistrationsPost$Response()` instead. + * + * This method sends `application/*+json` and handles request body of type `application/*+json`. + */ + apiMdraRegistrationsPost(params: ApiMdraRegistrationsPost$Params, context?: HttpContext): Observable { + return this.apiMdraRegistrationsPost$Response(params, context).pipe( + map((r: StrictHttpResponse): MdraRegistrationCommandResponse => r.body) + ); + } + +} diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts index f2b6f2cfd6..4ffc01189f 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts @@ -1,4 +1,5 @@ import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; +import { Address, ApplicationOriginTypeCode, BranchInfo } from '@app/api/models'; import { CommonApplicationHelper } from '@app/core/services/common-application.helper'; import { ConfigService } from '@app/core/services/config.service'; import { FileUtilService } from '@app/core/services/file-util.service'; @@ -9,19 +10,16 @@ import { SPD_CONSTANTS } from '../constants/constants'; export abstract class MetalDealersApplicationHelper extends CommonApplicationHelper { businessOwnerFormGroup: FormGroup = this.formBuilder.group({ - legalBusinessName: new FormControl('', [FormControlValidators.required]), - tradeName: new FormControl(''), + bizLegalName: new FormControl('', [FormControlValidators.required]), + bizTradeName: new FormControl(''), givenName: new FormControl(''), - middleName: new FormControl(''), surname: new FormControl('', [FormControlValidators.required]), emailAddress: new FormControl('', [FormControlValidators.required, FormControlValidators.email]), attachments: new FormControl([], [Validators.required]), }); businessManagerFormGroup: FormGroup = this.formBuilder.group({ - givenName: new FormControl(''), - middleName: new FormControl(''), - surname: new FormControl('', [FormControlValidators.required]), + fullName: new FormControl('', [FormControlValidators.required]), phoneNumber: new FormControl(''), emailAddress: new FormControl('', [FormControlValidators.email]), }); @@ -122,18 +120,145 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel super(formBuilder); } - getFullNameWithMiddle( - givenName: string | null | undefined, - middleName: string | null | undefined, - surname: string | null | undefined - ): string { + /** + * Get the form group data into the correct structure + * @returns + */ + private getSaveBodyBase(mdraModelFormValue: any): any { + const licenceAppId = mdraModelFormValue.licenceAppId; + const originalLicenceData = mdraModelFormValue.originalLicenceData; + const serviceTypeData = mdraModelFormValue.serviceTypeData; + const applicationTypeData = mdraModelFormValue.applicationTypeData; + const expiredLicenceData = mdraModelFormValue.expiredLicenceData; + const businessOwnerData = mdraModelFormValue.businessOwnerData; + const businessManagerData = mdraModelFormValue.businessManagerData; + const businessAddressData = mdraModelFormValue.businessAddressData; + const businessMailingAddressData = mdraModelFormValue.businessMailingAddressData; + const branchesData = mdraModelFormValue.branchesData; + + const bizAddress: Address = { + addressLine1: businessAddressData.addressLine1, + addressLine2: businessAddressData.addressLine2, + city: businessAddressData.city, + postalCode: businessAddressData.postalCode, + province: businessAddressData.province, + country: businessAddressData.country, + }; + + let bizMailingAddress: Address = bizAddress; + + if (!businessMailingAddressData.isAddressTheSame) { + bizMailingAddress = { + addressLine1: businessMailingAddressData.addressLine1, + addressLine2: businessMailingAddressData.addressLine2, + city: businessMailingAddressData.city, + postalCode: businessMailingAddressData.postalCode, + province: businessMailingAddressData.province, + country: businessMailingAddressData.country, + }; + } + + const branches: Array = []; + branchesData.branches.forEach((item: any) => { + const branchAddress: Address = { + addressLine1: item.addressLine1, + addressLine2: item.addressLine2, + city: item.city, + country: item.country, + postalCode: item.postalCode, + province: item.province, + }; + const branch: BranchInfo = { + branchId: item.branchId, + branchEmailAddr: item.branchEmailAddr, + branchManager: item.branchManager, + branchPhoneNumber: item.branchPhoneNumber, + branchAddress, + }; + branches.push(branch); + }); + + const documentInfos: Array = []; + + // const isCanadianCitizen = this.utilService.booleanTypeToBoolean(citizenshipData.isCanadianCitizen); + + // citizenshipData.attachments?.forEach((doc: any) => { + // let licenceDocumentTypeCode = citizenshipData.canadianCitizenProofTypeCode; + // if (!isCanadianCitizen) { + // if (citizenshipData.isCanadianResident == BooleanTypeCode.Yes) { + // licenceDocumentTypeCode = citizenshipData.proofOfResidentStatusCode; + // } else { + // licenceDocumentTypeCode = citizenshipData.proofOfCitizenshipCode; + // } + // } + + // documentInfos.push({ + // documentUrlId: doc.documentUrlId, + // expiryDate: this.utilService.dateToDbDate(citizenshipData.expiryDate), + // documentIdNumber: citizenshipData.documentIdNumber, + // licenceDocumentTypeCode, + // }); + // }); + + // } + + // const documentRelatedInfos: Array = + // documentInfos + // .filter((doc) => doc.expiryDate || doc.documentIdNumber) + // .map((doc: Document) => { + // return { + // expiryDate: doc.expiryDate, + // documentIdNumber: doc.documentIdNumber, + // licenceDocumentTypeCode: doc.licenceDocumentTypeCode, + // } as DocumentRelatedInfo; + // }) ?? []; + + // const hasExpiredLicence = expiredLicenceData.hasExpiredLicence == BooleanTypeCode.Yes; + // const expiredLicenceId = hasExpiredLicence ? expiredLicenceData.expiredLicenceId : null; + // if (!hasExpiredLicence) { + // this.clearExpiredLicenceModelData(); + // } + + const body = { + applicationOriginTypeCode: ApplicationOriginTypeCode.Portal, + applicationTypeCode: applicationTypeData.applicationTypeCode, + bizOwnerFirstName: businessOwnerData.givenName, + bizOwnerLastName: businessOwnerData.surname, + bizOwnerMiddleName: businessOwnerData.middleName, + bizEmailAddress: businessOwnerData.emailAddress, + bizLegalName: businessOwnerData.bizLegalName, + bizTradeName: businessOwnerData.bizTradeName, + bizManagerFirstName: businessManagerData.givenName, + bizManagerLastName: businessManagerData.surname, + bizManagerMiddleName: businessManagerData.middleName, + bizPhoneNumber: businessManagerData.phoneNumber, + bizAddress, + bizMailingAddress, + branches, + // documentKeyCodes: Array | null; + + // licenceAppId, + // originalApplicationId: originalLicenceData.originalApplicationId, + // originalLicenceId: originalLicenceData.originalLicenceId, + // applicationTypeCode: applicationTypeData.applicationTypeCode, + // serviceTypeCode: serviceTypeData.serviceTypeCode, + // //----------------------------------- + // hasExpiredLicence, + // expiredLicenceId, + // //----------------------------------- + // documentRelatedInfos: documentRelatedInfos, + // documentInfos: isAuthenticated ? documentInfos : undefined, + }; + + console.debug('[getSaveBodyBase] body returned', body); + return body; + } + + getFullNameWithMiddle(givenName: string | null | undefined, surname: string | null | undefined): string { const userNameArray: string[] = []; if (givenName) { userNameArray.push(givenName); } - if (middleName) { - userNameArray.push(middleName); - } if (surname) { userNameArray.push(surname); } @@ -143,26 +268,21 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel getSummarybusinessOwnerDataname(metalDealersModelData: any): string { return this.getFullNameWithMiddle( metalDealersModelData.businessOwnerData.givenName, - metalDealersModelData.businessOwnerData.middleName, metalDealersModelData.businessOwnerData.surname ); } - getSummarybusinessOwnerDatalegalBusinessName(metalDealersModelData: any): string { - return metalDealersModelData.businessOwnerData.legalBusinessName ?? ''; + getSummarybusinessOwnerDatabizLegalName(metalDealersModelData: any): string { + return metalDealersModelData.businessOwnerData.bizLegalName ?? ''; } - getSummarybusinessOwnerDatatradeName(metalDealersModelData: any): string { - return metalDealersModelData.businessOwnerData.tradeName ?? ''; + getSummarybusinessOwnerDatabizTradeName(metalDealersModelData: any): string { + return metalDealersModelData.businessOwnerData.bizTradeName ?? ''; } getSummarybusinessOwnerDataattachments(metalDealersModelData: any): File[] { return metalDealersModelData.businessOwnerData.attachments ?? []; } getSummarybusinessManagerDataname(metalDealersModelData: any): string { - return this.getFullNameWithMiddle( - metalDealersModelData.businessManagerData.givenName, - metalDealersModelData.businessManagerData.middleName, - metalDealersModelData.businessManagerData.surname - ); + return metalDealersModelData.businessManagerData.fullName; } getSummarybusinessManagerDataphoneNumber(metalDealersModelData: any): string { return metalDealersModelData.businessManagerData.phoneNumber ?? ''; diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-manager.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-manager.component.ts index 022da73959..a33e8e7f69 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-manager.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-manager.component.ts @@ -12,32 +12,18 @@ import { FormErrorStateMatcher } from '@app/shared/directives/form-error-state-m subtitle="The business manager is the person responsible for the day to day management of the business." >
-
+
-
+
- Given Name - + Full Name + + This is required
-
- - Middle Name (optional) - - -
- -
- - Surname - - This is required - -
- -
+
Phone Number
-
+
Email Address (if any)
- Given Name - - -
- -
- - Middle Name (optional) - + Given Name(s) +
@@ -54,15 +47,15 @@ import { FormErrorStateMatcher } from '@app/shared/directives/form-error-state-m
Legal Business Name - - This is required + + This is required
Trade or 'Doing Business As' Name - + This is the name commonly used to refer to your business
diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts index b26ca4c8af..96df70914f 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts @@ -47,13 +47,13 @@ import { MetalDealersAndRecyclersBranchResponse } from './modal-mdra-branch.comp
Legal Business Name
- {{ businessOwnerDatalegalBusinessName | default }} + {{ businessOwnerDatabizLegalName | default }}
Trade or 'Doing Business As' Name
- {{ businessOwnerDatatradeName | default }} + {{ businessOwnerDatabizTradeName | default }}
@@ -227,11 +227,11 @@ export class StepMdraSummaryComponent implements OnInit, LicenceChildStepperStep get businessOwnerDataname(): string { return this.metalDealersApplicationService.getSummarybusinessOwnerDataname(this.metalDealersModelData); } - get businessOwnerDatalegalBusinessName(): string { - return this.metalDealersApplicationService.getSummarybusinessOwnerDatalegalBusinessName(this.metalDealersModelData); + get businessOwnerDatabizLegalName(): string { + return this.metalDealersApplicationService.getSummarybusinessOwnerDatabizLegalName(this.metalDealersModelData); } - get businessOwnerDatatradeName(): string { - return this.metalDealersApplicationService.getSummarybusinessOwnerDatatradeName(this.metalDealersModelData); + get businessOwnerDatabizTradeName(): string { + return this.metalDealersApplicationService.getSummarybusinessOwnerDatabizTradeName(this.metalDealersModelData); } get businessManagerDataname(): string { From 9f2e9a84bc5108ca9892ba02c0efbecbc2b216a3 Mon Sep 17 00:00:00 2001 From: Carol Carpenter Date: Wed, 11 Jun 2025 09:49:23 -0700 Subject: [PATCH 2/7] wip --- .../api/models/licence-document-type-code.ts | 3 +- .../api/models/mdra-registration-request.ts | 10 +- .../metal-dealers-application.helper.ts | 147 +++++++++--------- .../metal-dealers-application.service.ts | 146 ++++++++++++++++- .../form-mdra-branches.component.ts | 25 +-- .../mdra-wizard-new-renewal.component.ts | 17 +- .../components/modal-mdra-branch.component.ts | 42 ++--- .../step-mdra-business-manager.component.ts | 20 +-- .../step-mdra-business-owner.component.ts | 42 +++-- .../components/step-mdra-summary.component.ts | 104 ++++++++----- 10 files changed, 371 insertions(+), 185 deletions(-) diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/licence-document-type-code.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/licence-document-type-code.ts index c2dee5cbe0..ea09df4510 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/licence-document-type-code.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/licence-document-type-code.ts @@ -66,5 +66,6 @@ export enum LicenceDocumentTypeCode { VeterinarianConfirmationForSpayedNeuteredDog = 'VeterinarianConfirmationForSpayedNeuteredDog', DogTrainingCurriculumCertificateSupportingDocument = 'DogTrainingCurriculumCertificateSupportingDocument', GdsdPracticeHoursLog = 'GDSDPracticeHoursLog', - GdsdCertificate = 'GDSDCertificate' + GdsdCertificate = 'GDSDCertificate', + BusinessLicenceDocuments = 'BusinessLicenceDocuments' } diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-request.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-request.ts index 00454cfad1..15537dedc7 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-request.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-request.ts @@ -13,12 +13,10 @@ export interface MdraRegistrationRequest { bizEmailAddress?: string | null; bizLegalName?: string | null; bizMailingAddress?: Address; - bizManagerFirstName?: string | null; - bizManagerLastName?: string | null; - bizManagerMiddleName?: string | null; - bizOwnerFirstName?: string | null; - bizOwnerLastName?: string | null; - bizOwnerMiddleName?: string | null; + bizManagerEmailAddress?: string | null; + bizManagerFullName?: string | null; + bizOwnerGivenNames?: string | null; + bizOwnerSurname?: string | null; bizPhoneNumber?: string | null; bizTradeName?: string | null; branches?: Array | null; diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts index 4ffc01189f..ee57272a58 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts @@ -1,27 +1,28 @@ import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; -import { Address, ApplicationOriginTypeCode, BranchInfo } from '@app/api/models'; +import { Address, ApplicationOriginTypeCode, BranchInfo, Document, LicenceDocumentTypeCode } from '@app/api/models'; import { CommonApplicationHelper } from '@app/core/services/common-application.helper'; import { ConfigService } from '@app/core/services/config.service'; -import { FileUtilService } from '@app/core/services/file-util.service'; -import { UtilService } from '@app/core/services/util.service'; +import { FileUtilService, SpdFile } from '@app/core/services/file-util.service'; +import { LicenceDocumentsToSave, UtilService } from '@app/core/services/util.service'; import { FormControlValidators } from '@app/core/validators/form-control.validators'; import { FormGroupValidators } from '@app/core/validators/form-group.validators'; +import { BooleanTypeCode } from '../code-types/model-desc.models'; import { SPD_CONSTANTS } from '../constants/constants'; export abstract class MetalDealersApplicationHelper extends CommonApplicationHelper { businessOwnerFormGroup: FormGroup = this.formBuilder.group({ bizLegalName: new FormControl('', [FormControlValidators.required]), bizTradeName: new FormControl(''), - givenName: new FormControl(''), - surname: new FormControl('', [FormControlValidators.required]), - emailAddress: new FormControl('', [FormControlValidators.required, FormControlValidators.email]), + bizOwnerGivenNames: new FormControl(''), + bizOwnerSurname: new FormControl('', [FormControlValidators.required]), + bizEmailAddress: new FormControl('', [FormControlValidators.required, FormControlValidators.email]), attachments: new FormControl([], [Validators.required]), }); businessManagerFormGroup: FormGroup = this.formBuilder.group({ - fullName: new FormControl('', [FormControlValidators.required]), - phoneNumber: new FormControl(''), - emailAddress: new FormControl('', [FormControlValidators.email]), + bizManagerFullName: new FormControl('', [FormControlValidators.required]), + bizPhoneNumber: new FormControl(''), + bizManagerEmailAddress: new FormControl('', [FormControlValidators.email]), }); businessAddressFormGroup: FormGroup = this.formBuilder.group({ @@ -120,14 +121,29 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel super(formBuilder); } + getDocsToSaveBlobs(mdraModelFormValue: any): Array { + const documents: Array = []; + + const businessOwnerData = mdraModelFormValue.businessOwnerData; + if (businessOwnerData.attachments) { + const docs: Array = []; + businessOwnerData.attachments.forEach((doc: SpdFile) => { + docs.push(doc); + }); + documents.push({ licenceDocumentTypeCode: LicenceDocumentTypeCode.BusinessLicenceDocuments, documents: docs }); + } + + return documents; + } + /** * Get the form group data into the correct structure * @returns */ - private getSaveBodyBase(mdraModelFormValue: any): any { - const licenceAppId = mdraModelFormValue.licenceAppId; - const originalLicenceData = mdraModelFormValue.originalLicenceData; - const serviceTypeData = mdraModelFormValue.serviceTypeData; + getSaveBodyBase(mdraModelFormValue: any): any { + // const licenceAppId = mdraModelFormValue.licenceAppId; + // const originalLicenceData = mdraModelFormValue.originalLicenceData; + // const serviceTypeData = mdraModelFormValue.serviceTypeData; const applicationTypeData = mdraModelFormValue.applicationTypeData; const expiredLicenceData = mdraModelFormValue.expiredLicenceData; const businessOwnerData = mdraModelFormValue.businessOwnerData; @@ -176,62 +192,37 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel branchAddress, }; branches.push(branch); + console.log('**************** item', item); + console.log('**************** branch', branch); }); + console.log('**************** branches', branches); const documentInfos: Array = []; - // const isCanadianCitizen = this.utilService.booleanTypeToBoolean(citizenshipData.isCanadianCitizen); - - // citizenshipData.attachments?.forEach((doc: any) => { - // let licenceDocumentTypeCode = citizenshipData.canadianCitizenProofTypeCode; - // if (!isCanadianCitizen) { - // if (citizenshipData.isCanadianResident == BooleanTypeCode.Yes) { - // licenceDocumentTypeCode = citizenshipData.proofOfResidentStatusCode; - // } else { - // licenceDocumentTypeCode = citizenshipData.proofOfCitizenshipCode; - // } - // } - - // documentInfos.push({ - // documentUrlId: doc.documentUrlId, - // expiryDate: this.utilService.dateToDbDate(citizenshipData.expiryDate), - // documentIdNumber: citizenshipData.documentIdNumber, - // licenceDocumentTypeCode, - // }); - // }); - - // } - - // const documentRelatedInfos: Array = - // documentInfos - // .filter((doc) => doc.expiryDate || doc.documentIdNumber) - // .map((doc: Document) => { - // return { - // expiryDate: doc.expiryDate, - // documentIdNumber: doc.documentIdNumber, - // licenceDocumentTypeCode: doc.licenceDocumentTypeCode, - // } as DocumentRelatedInfo; - // }) ?? []; + businessOwnerData.attachments?.forEach((doc: any) => { + documentInfos.push({ + documentUrlId: doc.documentUrlId, + licenceDocumentTypeCode: LicenceDocumentTypeCode.BusinessLicenceDocuments, + }); + }); - // const hasExpiredLicence = expiredLicenceData.hasExpiredLicence == BooleanTypeCode.Yes; - // const expiredLicenceId = hasExpiredLicence ? expiredLicenceData.expiredLicenceId : null; - // if (!hasExpiredLicence) { - // this.clearExpiredLicenceModelData(); - // } + const hasExpiredLicence = expiredLicenceData.hasExpiredLicence == BooleanTypeCode.Yes; + const expiredLicenceId = hasExpiredLicence ? expiredLicenceData.expiredLicenceId : null; + if (!hasExpiredLicence) { + this.clearExpiredLicenceModelData(); + } const body = { applicationOriginTypeCode: ApplicationOriginTypeCode.Portal, - applicationTypeCode: applicationTypeData.applicationTypeCode, - bizOwnerFirstName: businessOwnerData.givenName, - bizOwnerLastName: businessOwnerData.surname, - bizOwnerMiddleName: businessOwnerData.middleName, - bizEmailAddress: businessOwnerData.emailAddress, + // applicationTypeCode: applicationTypeData.applicationTypeCode, + bizOwnerGivenNames: businessOwnerData.bizOwnerGivenNames, + bizOwnerSurname: businessOwnerData.bizOwnerSurname, + bizEmailAddress: businessOwnerData.bizEmailAddress, bizLegalName: businessOwnerData.bizLegalName, bizTradeName: businessOwnerData.bizTradeName, - bizManagerFirstName: businessManagerData.givenName, - bizManagerLastName: businessManagerData.surname, - bizManagerMiddleName: businessManagerData.middleName, - bizPhoneNumber: businessManagerData.phoneNumber, + bizManagerFullName: businessManagerData.bizManagerFullName, + bizPhoneNumber: businessManagerData.bizPhoneNumber, + bizManagerEmailAddress: businessManagerData.bizManagerEmailAddress, bizAddress, bizMailingAddress, branches, @@ -242,14 +233,12 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel // originalLicenceId: originalLicenceData.originalLicenceId, // applicationTypeCode: applicationTypeData.applicationTypeCode, // serviceTypeCode: serviceTypeData.serviceTypeCode, - // //----------------------------------- - // hasExpiredLicence, - // expiredLicenceId, - // //----------------------------------- - // documentRelatedInfos: documentRelatedInfos, - // documentInfos: isAuthenticated ? documentInfos : undefined, + //----------------------------------- + hasExpiredLicence, + expiredLicenceId, + //----------------------------------- + documentInfos, }; - console.debug('[getSaveBodyBase] body returned', body); return body; } @@ -265,10 +254,19 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel return userNameArray.join(' '); } + getSummaryhasExpiredLicence(metalDealersModelData: any): string { + return metalDealersModelData.expiredLicenceData.hasExpiredLicence ?? ''; + } + getSummaryexpiredLicenceNumber(metalDealersModelData: any): string { + return metalDealersModelData.expiredLicenceData.expiredLicenceNumber ?? ''; + } + getSummaryexpiredLicenceExpiryDate(metalDealersModelData: any): string { + return metalDealersModelData.expiredLicenceData.expiredLicenceExpiryDate ?? ''; + } getSummarybusinessOwnerDataname(metalDealersModelData: any): string { return this.getFullNameWithMiddle( - metalDealersModelData.businessOwnerData.givenName, - metalDealersModelData.businessOwnerData.surname + metalDealersModelData.businessOwnerData.bizOwnerGivenNames, + metalDealersModelData.businessOwnerData.bizOwnerSurname ); } getSummarybusinessOwnerDatabizLegalName(metalDealersModelData: any): string { @@ -277,18 +275,21 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel getSummarybusinessOwnerDatabizTradeName(metalDealersModelData: any): string { return metalDealersModelData.businessOwnerData.bizTradeName ?? ''; } + getSummarybusinessOwnerDatabizEmailAddress(metalDealersModelData: any): string { + return metalDealersModelData.businessOwnerData.bizEmailAddress ?? ''; + } getSummarybusinessOwnerDataattachments(metalDealersModelData: any): File[] { return metalDealersModelData.businessOwnerData.attachments ?? []; } getSummarybusinessManagerDataname(metalDealersModelData: any): string { - return metalDealersModelData.businessManagerData.fullName; + return metalDealersModelData.businessManagerData.bizManagerFullName; } - getSummarybusinessManagerDataphoneNumber(metalDealersModelData: any): string { - return metalDealersModelData.businessManagerData.phoneNumber ?? ''; + getSummarybusinessManagerDatabizPhoneNumber(metalDealersModelData: any): string { + return metalDealersModelData.businessManagerData.bizPhoneNumber ?? ''; } - getSummarybusinessManagerDataemailAddress(metalDealersModelData: any): string { - return metalDealersModelData.businessManagerData.emailAddress ?? ''; + getSummarybusinessManagerDatabizManagerEmailAddress(metalDealersModelData: any): string { + return metalDealersModelData.businessManagerData.bizManagerEmailAddress ?? ''; } getSummarybranchesDatabranches(metalDealersModelData: any): Array { return metalDealersModelData.branchesData.branches ?? []; diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.service.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.service.ts index f20671435b..cfc2175735 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.service.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.service.ts @@ -1,12 +1,32 @@ import { Injectable } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; -import { ApplicationTypeCode, ServiceTypeCode } from '@app/api/models'; -import { BehaviorSubject, debounceTime, distinctUntilChanged, Observable, of, Subscription, tap } from 'rxjs'; +import { + ApplicationTypeCode, + GoogleRecaptcha, + IActionResult, + MdraRegistrationCommandResponse, + MdraRegistrationRequest, + ServiceTypeCode, +} from '@app/api/models'; +import { LicenceAppDocumentService, MdraService } from '@app/api/services'; +import { StrictHttpResponse } from '@app/api/strict-http-response'; +import { + BehaviorSubject, + debounceTime, + distinctUntilChanged, + forkJoin, + Observable, + of, + Subscription, + switchMap, + take, + tap, +} from 'rxjs'; import { CommonApplicationService } from './common-application.service'; import { ConfigService } from './config.service'; -import { FileUtilService } from './file-util.service'; +import { FileUtilService, SpdFile } from './file-util.service'; import { MetalDealersApplicationHelper } from './metal-dealers-application.helper'; -import { UtilService } from './util.service'; +import { LicenceDocumentsToSave, UtilService } from './util.service'; @Injectable({ providedIn: 'root', @@ -16,6 +36,7 @@ export class MetalDealersApplicationService extends MetalDealersApplicationHelpe metalDealersModelFormGroup: FormGroup = this.formBuilder.group({ applicationTypeData: this.applicationTypeFormGroup, + expiredLicenceData: this.expiredLicenceFormGroup, businessOwnerData: this.businessOwnerFormGroup, businessManagerData: this.businessManagerFormGroup, businessAddressData: this.businessAddressFormGroup, @@ -31,7 +52,9 @@ export class MetalDealersApplicationService extends MetalDealersApplicationHelpe configService: ConfigService, utilService: UtilService, fileUtilService: FileUtilService, - private commonApplicationService: CommonApplicationService + private commonApplicationService: CommonApplicationService, + private licenceAppDocumentService: LicenceAppDocumentService, + private mdraService: MdraService ) { super(formBuilder, configService, utilService, fileUtilService); @@ -119,4 +142,117 @@ export class MetalDealersApplicationService extends MetalDealersApplicationHelpe console.debug('RESET', this.initialized, this.metalDealersModelFormGroup.value); } + + /** + * Submit the application data for anonymous new + */ + submitLicenceAnonymous(): Observable> { + const metalDealersModelFormValue = this.metalDealersModelFormGroup.getRawValue(); + const body = this.getSaveBodyBase(metalDealersModelFormValue); + const documentsToSave = this.getDocsToSaveBlobs(metalDealersModelFormValue); + + const { existingDocumentIds, documentsToSaveApis } = this.getDocumentData(documentsToSave); + delete body.documentInfos; + + const consentData = this.consentAndDeclarationFormGroup.getRawValue(); + const googleRecaptcha = { recaptchaCode: consentData.captchaFormGroup.token }; + + return this.submitLicenceAnonymousDocuments( + googleRecaptcha, + existingDocumentIds, + documentsToSaveApis.length > 0 ? documentsToSaveApis : null, + body + ); + } + + /** + * Submit the application data for anonymous renewal or replacement including documents + * @returns + */ + private submitLicenceAnonymousDocuments( + googleRecaptcha: GoogleRecaptcha, + existingDocumentIds: Array, + documentsToSaveApis: Observable[] | null, + body: any // MdraRegistrationRequest + ): Observable> { + if (documentsToSaveApis) { + return this.licenceAppDocumentService + .apiLicenceApplicationDocumentsAnonymousKeyCodePost({ body: googleRecaptcha }) + .pipe( + switchMap((_resp: IActionResult) => { + return forkJoin(documentsToSaveApis); + }), + switchMap((resps: string[]) => { + // pass in the list of document key codes + body.documentKeyCodes = [...resps]; + + // pass in the list of document ids that were in the original + // application and are still being used + body.previousDocumentIds = [...existingDocumentIds]; + + return this.postSubmitAnonymous(body); + }) + ) + .pipe(take(1)); + } else { + // pass in the list of document ids that were in the original + // application and are still being used + body.previousDocumentIds = [...existingDocumentIds]; + + return this.licenceAppDocumentService + .apiLicenceApplicationDocumentsAnonymousKeyCodePost({ body: googleRecaptcha }) + .pipe( + switchMap((_resp: IActionResult) => { + return this.postSubmitAnonymous(body); + }) + ) + .pipe(take(1)); + } + } + + private getDocumentData(documentsToSave: Array): { + existingDocumentIds: Array; + documentsToSaveApis: Observable[]; + } { + // Get the keyCode for the existing documents to save. + const existingDocumentIds: Array = []; + + const documentsToSaveApis: Observable[] = []; + documentsToSave.forEach((docBody: LicenceDocumentsToSave) => { + // Only pass new documents and get a keyCode for each of those. + const newDocumentsOnly: Array = []; + docBody.documents.forEach((doc: any) => { + const spdFile: SpdFile = doc as SpdFile; + if (spdFile.documentUrlId) { + existingDocumentIds.push(spdFile.documentUrlId); + } else { + newDocumentsOnly.push(doc); + } + }); + + // should always be at least one new document + if (newDocumentsOnly.length > 0) { + documentsToSaveApis.push( + this.licenceAppDocumentService.apiLicenceApplicationDocumentsAnonymousFilesPost({ + body: { + documents: newDocumentsOnly, + licenceDocumentTypeCode: docBody.licenceDocumentTypeCode, + }, + }) + ); + } + }); + + return { existingDocumentIds, documentsToSaveApis }; + } + + private postSubmitAnonymous( + body: MdraRegistrationRequest + ): Observable> { + // if (body.applicationTypeCode == ApplicationTypeCode.New) { + return this.mdraService.apiMdraRegistrationsPost$Response({ body }); + // } + + // return this.mdraService.apiMdraRegistrationsChangePost$Response({ body }); + } } diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/form-mdra-branches.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/form-mdra-branches.component.ts index 27ac2bc9d3..81fbb7e364 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/form-mdra-branches.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/form-mdra-branches.component.ts @@ -17,7 +17,7 @@ import { MetalDealersAndRecyclersBranchResponse, ModalMdraBranchComponent } from Branch Manager Manager: - {{ branch | fullname | default }} + {{ branch.branchManager | default }} @@ -134,6 +134,11 @@ export class FormMdraBranchesComponent implements OnInit, LicenceChildStepperSte } } + refreshTable(): void { + this.dataSource = new MatTableDataSource(this.branchesArray.value); + this.branchesExist = this.dataSource.data.length > 0; + } + onEditBranch(branch: MetalDealersAndRecyclersBranchResponse): void { this.branchDialog(branch, false); } @@ -173,7 +178,7 @@ export class FormMdraBranchesComponent implements OnInit, LicenceChildStepperSte this.dialog .open(ModalMdraBranchComponent, { - width: '1200px', + width: '900px', data: dialogOptions, autoFocus: true, }) @@ -204,11 +209,9 @@ export class FormMdraBranchesComponent implements OnInit, LicenceChildStepperSte postalCode: [branchData.postalCode], province: [branchData.province], country: [branchData.country], - givenName: [branchData.givenName], - middleName: [branchData.middleName], - surname: [branchData.surname], - phoneNumber: [branchData.phoneNumber], - emailAddress: [branchData.emailAddress], + branchManager: [branchData.branchManager], + branchPhoneNumber: [branchData.branchPhoneNumber], + branchEmailAddr: [branchData.branchEmailAddr], }); } @@ -224,11 +227,9 @@ export class FormMdraBranchesComponent implements OnInit, LicenceChildStepperSte postalCode: branchData.postalCode, province: branchData.province, country: branchData.country, - givenName: branchData.givenName, - middleName: branchData.middleName, - surname: branchData.surname, - phoneNumber: branchData.phoneNumber, - emailAddress: branchData.emailAddress, + branchManager: branchData.branchManager, + branchPhoneNumber: branchData.branchPhoneNumber, + branchEmailAddr: branchData.branchEmailAddr, }); } diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/mdra-wizard-new-renewal.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/mdra-wizard-new-renewal.component.ts index a4fb80d04d..5b4a77fb48 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/mdra-wizard-new-renewal.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/mdra-wizard-new-renewal.component.ts @@ -2,10 +2,13 @@ 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 { ApplicationTypeCode } from '@app/api/models'; +import { Router } from '@angular/router'; +import { ApplicationTypeCode, MdraRegistrationCommandResponse } from '@app/api/models'; +import { StrictHttpResponse } from '@app/api/strict-http-response'; import { BaseWizardComponent } from '@app/core/components/base-wizard.component'; import { MetalDealersApplicationService } from '@app/core/services/metal-dealers-application.service'; import { distinctUntilChanged, Subscription } from 'rxjs'; +import { MetalDealersAndRecyclersRoutes } from '../metal-dealers-and-recyclers-routes'; import { StepsMdraBranchesComponent } from './steps-mdra-branches.component'; import { StepsMdraBusinessInfoComponent } from './steps-mdra-business-info.component'; import { StepsMdraDetailsComponent } from './steps-mdra-details.component'; @@ -103,6 +106,7 @@ export class MdraWizardNewRenewalComponent extends BaseWizardComponent implement constructor( override breakpointObserver: BreakpointObserver, + private router: Router, private metalDealersApplicationService: MetalDealersApplicationService ) { super(breakpointObserver); @@ -131,7 +135,16 @@ export class MdraWizardNewRenewalComponent extends BaseWizardComponent implement } onSubmit(): void { - // TODO mdra submit + this.metalDealersApplicationService.submitLicenceAnonymous().subscribe({ + next: (_resp: StrictHttpResponse) => { + this.router.navigateByUrl( + MetalDealersAndRecyclersRoutes.path(MetalDealersAndRecyclersRoutes.MDRA_REGISTRATION_RECEIVED) + ); + }, + error: (error: any) => { + console.log('An error occurred during save', error); + }, + }); } override onStepSelectionChange(event: StepperSelectionEvent) { diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/modal-mdra-branch.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/modal-mdra-branch.component.ts index 20b74e0aec..c5a5490e7c 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/modal-mdra-branch.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/modal-mdra-branch.component.ts @@ -14,11 +14,9 @@ export interface MetalDealersAndRecyclersBranchResponse { country?: null | string; postalCode?: null | string; province?: null | string; - givenName?: null | string; - middleName?: null | string; - surname?: null | string; - phoneNumber?: null | string; - emailAddress?: null | string; + branchManager?: null | string; + branchPhoneNumber?: null | string; + branchEmailAddr?: null | string; } @Component({ @@ -33,25 +31,11 @@ export interface MetalDealersAndRecyclersBranchResponse {
-
- - Given Name - - -
- -
- - Middle Name (optional) - - -
- -
+
- Surname - - This is required + Full Name + + This is required
@@ -60,14 +44,14 @@ export interface MetalDealersAndRecyclersBranchResponse { Phone Number - This is required - This must be 10 digits + This is required + This must be 10 digits
@@ -76,12 +60,14 @@ export interface MetalDealersAndRecyclersBranchResponse { Email (if any) - Must be a valid email address + + Must be a valid email address +
diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-manager.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-manager.component.ts index a33e8e7f69..2c871eb01a 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-manager.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-manager.component.ts @@ -12,42 +12,42 @@ import { FormErrorStateMatcher } from '@app/shared/directives/form-error-state-m subtitle="The business manager is the person responsible for the day to day management of the business." >
-
+
-
+
Full Name - - This is required + + This is required
-
+
Phone Number - This must be 10 digits + This must be 10 digits
-
+
Email Address (if any) - + Must be a valid email address diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-owner.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-owner.component.ts index 15c90a071e..05f374fe4b 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-owner.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-owner.component.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; import { FormControl } from '@angular/forms'; +import { SPD_CONSTANTS } from '@app/core/constants/constants'; import { MetalDealersApplicationService } from '@app/core/services/metal-dealers-application.service'; import { LicenceChildStepperStepComponent } from '@app/core/services/util.service'; import { FormErrorStateMatcher } from '@app/shared/directives/form-error-state-matcher.directive'; @@ -9,42 +10,57 @@ import { FormErrorStateMatcher } from '@app/shared/directives/form-error-state-m template: `
-
+
-
+
Given Name(s) - +
-
+
Surname - - This is required + + This is required
-
+
Email Address - This is required - + This is required + Must be a valid email address
-
+
+ Phone Number + +
+ +
Legal Business Name @@ -52,7 +68,7 @@ import { FormErrorStateMatcher } from '@app/shared/directives/form-error-state-m
-
+
Trade or 'Doing Business As' Name @@ -93,6 +109,8 @@ import { FormErrorStateMatcher } from '@app/shared/directives/form-error-state-m export class StepMdraBusinessOwnerComponent implements LicenceChildStepperStepComponent { matcher = new FormErrorStateMatcher(); + phoneMask = SPD_CONSTANTS.phone.displayMask; + form = this.metalDealersApplicationService.businessOwnerFormGroup; constructor(private metalDealersApplicationService: MetalDealersApplicationService) {} diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts index 96df70914f..cdb45d0ccc 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts @@ -1,9 +1,9 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; -import { MatTableDataSource } from '@angular/material/table'; +import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; import { ApplicationTypeCode } from '@app/api/models'; +import { BooleanTypeCode } from '@app/core/code-types/model-desc.models'; import { MetalDealersApplicationService } from '@app/core/services/metal-dealers-application.service'; import { LicenceChildStepperStepComponent } from '@app/core/services/util.service'; -import { MetalDealersAndRecyclersBranchResponse } from './modal-mdra-branch.component'; +import { FormMdraBranchesComponent } from './form-mdra-branches.component'; @Component({ selector: 'app-step-mdra-summary', @@ -36,40 +36,63 @@ import { MetalDealersAndRecyclersBranchResponse } from './modal-mdra-branch.comp
-
Business Owner
+ +
Expired Licence
+
Expired Licence
+
{{ hasExpiredLicence | default }}
+
+ +
+
Expired Licence Number
+
{{ expiredLicenceNumber | default }}
+
+
+
Expiry Date
+
+ {{ expiredLicenceExpiryDate | formatDate | default }} +
+
+
+
+ + +
Business Owner
+
+
Business Owner Name
{{ businessOwnerDataname | default }}
-
+
Legal Business Name
{{ businessOwnerDatabizLegalName | default }}
-
+
Trade or 'Doing Business As' Name
{{ businessOwnerDatabizTradeName | default }}
+
+
Email Address
+
+ {{ businessOwnerDatabizEmailAddress | default }} +
+
Business Licence Documents
- -
-
    - -
  • {{ doc.name }}
  • -
    -
-
-
- -
There are no business licence documents
-
+
+
    + +
  • {{ doc.name }}
  • +
    +
+
@@ -85,13 +108,13 @@ import { MetalDealersAndRecyclersBranchResponse } from './modal-mdra-branch.comp
Phone Number
- {{ businessManagerDataname | default }} + {{ businessManagerDatabizPhoneNumber | formatPhoneNumber | default }}
Email Address
- {{ businessManagerDataname | default }} + {{ businessManagerDatabizManagerEmailAddress | default }}
@@ -133,12 +156,7 @@ import { MetalDealersAndRecyclersBranchResponse } from './modal-mdra-branch.comp
- - - - -
No branches have been entered.
-
+
@@ -188,12 +206,13 @@ import { MetalDealersAndRecyclersBranchResponse } from './modal-mdra-branch.comp export class StepMdraSummaryComponent implements OnInit, LicenceChildStepperStepComponent { metalDealersModelData: any = {}; - attachmentsExist!: boolean; - branchesExist!: boolean; + booleanTypeCodeYes = BooleanTypeCode.Yes; + branchesFormGroup = this.metalDealersApplicationService.branchesFormGroup; - dataSource!: MatTableDataSource; columns: string[] = ['addressLine1', 'city', 'branchManager']; + @ViewChild(FormMdraBranchesComponent) formBranches!: FormMdraBranchesComponent; + @Input() applicationTypeCode!: ApplicationTypeCode; @Output() editStep: EventEmitter = new EventEmitter(); @@ -215,15 +234,23 @@ export class StepMdraSummaryComponent implements OnInit, LicenceChildStepperStep ...this.metalDealersApplicationService.metalDealersModelFormGroup.getRawValue(), }; - this.dataSource = new MatTableDataSource(this.branchesArray); - this.branchesExist = this.dataSource.data.length > 0; - this.attachmentsExist = this.businessLicenceAttachments.length > 0; + this.formBranches.refreshTable(); } isFormValid(): boolean { return true; } + get hasExpiredLicence(): string { + return this.metalDealersApplicationService.getSummaryhasExpiredLicence(this.metalDealersModelData); + } + get expiredLicenceNumber(): string { + return this.metalDealersApplicationService.getSummaryexpiredLicenceNumber(this.metalDealersModelData); + } + get expiredLicenceExpiryDate(): string { + return this.metalDealersApplicationService.getSummaryexpiredLicenceExpiryDate(this.metalDealersModelData); + } + get businessOwnerDataname(): string { return this.metalDealersApplicationService.getSummarybusinessOwnerDataname(this.metalDealersModelData); } @@ -233,15 +260,20 @@ export class StepMdraSummaryComponent implements OnInit, LicenceChildStepperStep get businessOwnerDatabizTradeName(): string { return this.metalDealersApplicationService.getSummarybusinessOwnerDatabizTradeName(this.metalDealersModelData); } + get businessOwnerDatabizEmailAddress(): string { + return this.metalDealersApplicationService.getSummarybusinessOwnerDatabizEmailAddress(this.metalDealersModelData); + } get businessManagerDataname(): string { return this.metalDealersApplicationService.getSummarybusinessManagerDataname(this.metalDealersModelData); } - get businessManagerDataphoneNumber(): string { - return this.metalDealersApplicationService.getSummarybusinessManagerDataphoneNumber(this.metalDealersModelData); + get businessManagerDatabizPhoneNumber(): string { + return this.metalDealersApplicationService.getSummarybusinessManagerDatabizPhoneNumber(this.metalDealersModelData); } - get businessManagerDataemailAddress(): string { - return this.metalDealersApplicationService.getSummarybusinessManagerDataemailAddress(this.metalDealersModelData); + get businessManagerDatabizManagerEmailAddress(): string { + return this.metalDealersApplicationService.getSummarybusinessManagerDatabizManagerEmailAddress( + this.metalDealersModelData + ); } get isAddressTheSame(): boolean { From 6e3edadc7ff2ad48490a5804866e6f7511e6e95d Mon Sep 17 00:00:00 2001 From: Carol Carpenter Date: Wed, 11 Jun 2025 10:13:17 -0700 Subject: [PATCH 3/7] wip --- .../api/models/mdra-registration-request.ts | 1 + .../metal-dealers-application.helper.ts | 31 +++++++++--------- .../components/modal-mdra-branch.component.ts | 6 ++-- .../step-mdra-business-manager.component.ts | 6 ++-- .../step-mdra-business-owner.component.ts | 5 ++- .../components/step-mdra-summary.component.ts | 32 ++++++++++++------- 6 files changed, 46 insertions(+), 35 deletions(-) diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-request.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-request.ts index 15537dedc7..d20455a438 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-request.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/api/models/mdra-registration-request.ts @@ -15,6 +15,7 @@ export interface MdraRegistrationRequest { bizMailingAddress?: Address; bizManagerEmailAddress?: string | null; bizManagerFullName?: string | null; + bizManagerPhoneNumber?: string | null; bizOwnerGivenNames?: string | null; bizOwnerSurname?: string | null; bizPhoneNumber?: string | null; diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts index ee57272a58..525c8b321a 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts @@ -16,12 +16,13 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel bizOwnerGivenNames: new FormControl(''), bizOwnerSurname: new FormControl('', [FormControlValidators.required]), bizEmailAddress: new FormControl('', [FormControlValidators.required, FormControlValidators.email]), + bizPhoneNumber: new FormControl(''), attachments: new FormControl([], [Validators.required]), }); businessManagerFormGroup: FormGroup = this.formBuilder.group({ bizManagerFullName: new FormControl('', [FormControlValidators.required]), - bizPhoneNumber: new FormControl(''), + bizManagerPhoneNumber: new FormControl(''), bizManagerEmailAddress: new FormControl('', [FormControlValidators.email]), }); @@ -96,11 +97,9 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel FormControlValidators.required, FormControlValidators.requiredValue(SPD_CONSTANTS.address.countryCA, SPD_CONSTANTS.address.countryCanada), ]), - givenName: new FormControl(''), - middleName: new FormControl(''), - surname: new FormControl('', [FormControlValidators.required]), - phoneNumber: new FormControl('', [FormControlValidators.required]), - emailAddress: new FormControl('', [FormControlValidators.email]), + branchManager: new FormControl('', [FormControlValidators.required]), + branchPhoneNumber: new FormControl('', [FormControlValidators.required]), + branchEmailAddr: new FormControl('', [FormControlValidators.email]), }); consentAndDeclarationFormGroup: FormGroup = this.formBuilder.group({ @@ -214,25 +213,21 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel const body = { applicationOriginTypeCode: ApplicationOriginTypeCode.Portal, - // applicationTypeCode: applicationTypeData.applicationTypeCode, + applicationTypeCode: applicationTypeData.applicationTypeCode, bizOwnerGivenNames: businessOwnerData.bizOwnerGivenNames, bizOwnerSurname: businessOwnerData.bizOwnerSurname, bizEmailAddress: businessOwnerData.bizEmailAddress, + bizPhoneNumber: businessOwnerData.bizPhoneNumber, bizLegalName: businessOwnerData.bizLegalName, bizTradeName: businessOwnerData.bizTradeName, bizManagerFullName: businessManagerData.bizManagerFullName, - bizPhoneNumber: businessManagerData.bizPhoneNumber, + bizManagerPhoneNumber: businessManagerData.bizManagerPhoneNumber, bizManagerEmailAddress: businessManagerData.bizManagerEmailAddress, bizAddress, bizMailingAddress, branches, - // documentKeyCodes: Array | null; - // licenceAppId, - // originalApplicationId: originalLicenceData.originalApplicationId, // originalLicenceId: originalLicenceData.originalLicenceId, - // applicationTypeCode: applicationTypeData.applicationTypeCode, - // serviceTypeCode: serviceTypeData.serviceTypeCode, //----------------------------------- hasExpiredLicence, expiredLicenceId, @@ -278,6 +273,9 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel getSummarybusinessOwnerDatabizEmailAddress(metalDealersModelData: any): string { return metalDealersModelData.businessOwnerData.bizEmailAddress ?? ''; } + getSummarybusinessOwnerDatabizPhoneNumber(metalDealersModelData: any): string { + return metalDealersModelData.businessOwnerData.bizPhoneNumber ?? ''; + } getSummarybusinessOwnerDataattachments(metalDealersModelData: any): File[] { return metalDealersModelData.businessOwnerData.attachments ?? []; } @@ -285,12 +283,13 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel getSummarybusinessManagerDataname(metalDealersModelData: any): string { return metalDealersModelData.businessManagerData.bizManagerFullName; } - getSummarybusinessManagerDatabizPhoneNumber(metalDealersModelData: any): string { - return metalDealersModelData.businessManagerData.bizPhoneNumber ?? ''; - } getSummarybusinessManagerDatabizManagerEmailAddress(metalDealersModelData: any): string { return metalDealersModelData.businessManagerData.bizManagerEmailAddress ?? ''; } + getSummarybusinessManagerDatabizManagerPhoneNumber(metalDealersModelData: any): string { + return metalDealersModelData.businessManagerData.bizManagerPhoneNumber ?? ''; + } + getSummarybranchesDatabranches(metalDealersModelData: any): Array { return metalDealersModelData.branchesData.branches ?? []; } diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/modal-mdra-branch.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/modal-mdra-branch.component.ts index c5a5490e7c..1159573619 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/modal-mdra-branch.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/modal-mdra-branch.component.ts @@ -31,7 +31,7 @@ export interface MetalDealersAndRecyclersBranchResponse {
-
+
Full Name @@ -39,7 +39,7 @@ export interface MetalDealersAndRecyclersBranchResponse {
-
+
Phone Number
-
+
Email (if any) Phone Number - This must be 10 digits + This must be 10 digits
diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-owner.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-owner.component.ts index 05f374fe4b..a68ef427b0 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-owner.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-owner.component.ts @@ -46,8 +46,7 @@ import { FormErrorStateMatcher } from '@app/shared/directives/form-error-state-m
- Phone Number - +
diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts index cdb45d0ccc..503c600a8e 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts @@ -36,7 +36,6 @@ import { FormMdraBranchesComponent } from './form-mdra-branches.component';
-
Expired Licence
@@ -60,28 +59,34 @@ import { FormMdraBranchesComponent } from './form-mdra-branches.component';
Business Owner
-
+
Business Owner Name
{{ businessOwnerDataname | default }}
-
Legal Business Name
+
Phone Number
- {{ businessOwnerDatabizLegalName | default }} + {{ businessOwnerDatabizPhoneNumber | formatPhoneNumber | default }}
-
Trade or 'Doing Business As' Name
+
Email Address
- {{ businessOwnerDatabizTradeName | default }} + {{ businessOwnerDatabizEmailAddress | default }}
-
Email Address
+
Legal Business Name
- {{ businessOwnerDatabizEmailAddress | default }} + {{ businessOwnerDatabizLegalName | default }} +
+
+
+
Trade or 'Doing Business As' Name
+
+ {{ businessOwnerDatabizTradeName | default }}
@@ -108,7 +113,7 @@ import { FormMdraBranchesComponent } from './form-mdra-branches.component';
Phone Number
- {{ businessManagerDatabizPhoneNumber | formatPhoneNumber | default }} + {{ businessManagerDatabizManagerPhoneNumber | formatPhoneNumber | default }}
@@ -263,12 +268,17 @@ export class StepMdraSummaryComponent implements OnInit, LicenceChildStepperStep get businessOwnerDatabizEmailAddress(): string { return this.metalDealersApplicationService.getSummarybusinessOwnerDatabizEmailAddress(this.metalDealersModelData); } + get businessOwnerDatabizPhoneNumber(): string { + return this.metalDealersApplicationService.getSummarybusinessOwnerDatabizPhoneNumber(this.metalDealersModelData); + } get businessManagerDataname(): string { return this.metalDealersApplicationService.getSummarybusinessManagerDataname(this.metalDealersModelData); } - get businessManagerDatabizPhoneNumber(): string { - return this.metalDealersApplicationService.getSummarybusinessManagerDatabizPhoneNumber(this.metalDealersModelData); + get businessManagerDatabizManagerPhoneNumber(): string { + return this.metalDealersApplicationService.getSummarybusinessManagerDatabizManagerPhoneNumber( + this.metalDealersModelData + ); } get businessManagerDatabizManagerEmailAddress(): string { return this.metalDealersApplicationService.getSummarybusinessManagerDatabizManagerEmailAddress( From 458d23057e5c2d4dc7a83b5fc9a8b1a58768d90b Mon Sep 17 00:00:00 2001 From: Carol Carpenter Date: Wed, 11 Jun 2025 10:51:44 -0700 Subject: [PATCH 4/7] branches are optional --- .../metal-dealers-application.helper.ts | 30 +++++-------------- .../core/validators/form-group.validators.ts | 18 +++++------ .../form-mdra-branches.component.ts | 10 +++---- 3 files changed, 22 insertions(+), 36 deletions(-) diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts index 525c8b321a..0e8e58b658 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/services/metal-dealers-application.helper.ts @@ -77,14 +77,9 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel } ); - branchesFormGroup: FormGroup = this.formBuilder.group( - { - branches: this.formBuilder.array([]), - }, - { - validators: [FormGroupValidators.branchrequiredValidator('branches')], - } - ); + branchesFormGroup: FormGroup = this.formBuilder.group({ + branches: this.formBuilder.array([]), + }); branchFormGroup: FormGroup = this.formBuilder.group({ addressSelected: new FormControl(false, [Validators.requiredTrue]), @@ -238,17 +233,6 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel return body; } - getFullNameWithMiddle(givenName: string | null | undefined, surname: string | null | undefined): string { - const userNameArray: string[] = []; - if (givenName) { - userNameArray.push(givenName); - } - if (surname) { - userNameArray.push(surname); - } - return userNameArray.join(' '); - } - getSummaryhasExpiredLicence(metalDealersModelData: any): string { return metalDealersModelData.expiredLicenceData.hasExpiredLicence ?? ''; } @@ -259,9 +243,11 @@ export abstract class MetalDealersApplicationHelper extends CommonApplicationHel return metalDealersModelData.expiredLicenceData.expiredLicenceExpiryDate ?? ''; } getSummarybusinessOwnerDataname(metalDealersModelData: any): string { - return this.getFullNameWithMiddle( - metalDealersModelData.businessOwnerData.bizOwnerGivenNames, - metalDealersModelData.businessOwnerData.bizOwnerSurname + return ( + this.utilService.getFullName( + metalDealersModelData.businessOwnerData.bizOwnerGivenNames, + metalDealersModelData.businessOwnerData.bizOwnerSurname + ) ?? '' ); } getSummarybusinessOwnerDatabizLegalName(metalDealersModelData: any): string { diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/validators/form-group.validators.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/validators/form-group.validators.ts index ef9d58b3ad..37b7c9971e 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/validators/form-group.validators.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/validators/form-group.validators.ts @@ -122,17 +122,17 @@ export class FormGroupValidators { }; } - public static branchrequiredValidator(controlArrayName: string): ValidatorFn { - return (controls: AbstractControl) => { - const control = controls.get(controlArrayName); - const value = control?.value; - const count = value.length; + // public static branchrequiredValidator(controlArrayName: string): ValidatorFn { + // return (controls: AbstractControl) => { + // const control = controls.get(controlArrayName); + // const value = control?.value; + // const count = value.length; - if (count === 0) return { branchrequired: true }; + // if (count === 0) return { branchrequired: true }; - return null; - }; - } + // return null; + // }; + // } public static matchValidator(controlName: string, checkControlName: string): ValidatorFn { return (controls: AbstractControl) => { diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/form-mdra-branches.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/form-mdra-branches.component.ts index 81fbb7e364..849e3ff366 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/form-mdra-branches.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/form-mdra-branches.component.ts @@ -11,7 +11,7 @@ import { MetalDealersAndRecyclersBranchResponse, ModalMdraBranchComponent } from template: `
- + Branch Manager @@ -72,14 +72,14 @@ import { MetalDealersAndRecyclersBranchResponse, ModalMdraBranchComponent } from + +
No branches have been entered
+
+
- -
- At least one branch is required -
From 455b9deb7c7a13b837c9199700e61a58b993aaea Mon Sep 17 00:00:00 2001 From: peggy-quartech Date: Wed, 11 Jun 2025 11:21:49 -0700 Subject: [PATCH 5/7] make upload registration file working --- src/Spd.Manager.Licence/MDRARegistrationManager.cs | 1 + src/Spd.Manager.Licence/Mappings.cs | 3 ++- .../Document/DocumentRepository.cs | 8 +++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Spd.Manager.Licence/MDRARegistrationManager.cs b/src/Spd.Manager.Licence/MDRARegistrationManager.cs index a3e2bda41d..46ed7415ce 100644 --- a/src/Spd.Manager.Licence/MDRARegistrationManager.cs +++ b/src/Spd.Manager.Licence/MDRARegistrationManager.cs @@ -74,6 +74,7 @@ protected async Task UploadNewDocsAsync( { SpdTempFile? tempFile = _mapper.Map(licAppFile); CreateDocumentCmd? fileCmd = _mapper.Map(licAppFile); + fileCmd.TempFile = tempFile; fileCmd.OrgRegistrationId = orgRegistrationId; await _documentRepository.ManageAsync(fileCmd, ct); } diff --git a/src/Spd.Manager.Licence/Mappings.cs b/src/Spd.Manager.Licence/Mappings.cs index c1011d9210..3a5de4f8f3 100644 --- a/src/Spd.Manager.Licence/Mappings.cs +++ b/src/Spd.Manager.Licence/Mappings.cs @@ -864,7 +864,8 @@ private static List GetBranchAddr(IEnumerable branchInfo {LicenceDocumentTypeCode.VeterinarianConfirmationForSpayedNeuteredDog, DocumentTypeEnum.VeterinarianConfirmationForSpayedNeuteredDog }, {LicenceDocumentTypeCode.DogTrainingCurriculumCertificateSupportingDocument, DocumentTypeEnum.DogTrainingCurriculumCertificateSupportingDocument }, {LicenceDocumentTypeCode.GDSDPracticeHoursLog, DocumentTypeEnum.GDSDPracticeHoursLog }, - {LicenceDocumentTypeCode.GDSDCertificate, DocumentTypeEnum.GDSDCertificate } + {LicenceDocumentTypeCode.GDSDCertificate, DocumentTypeEnum.GDSDCertificate }, + {LicenceDocumentTypeCode.BusinessLicenceDocuments, DocumentTypeEnum.BusinessLicenceDocuments } }.ToImmutableDictionary(); private string GetHolderName(string firstName, string middleName, string lastName) diff --git a/src/Spd.Resource.Repository/Document/DocumentRepository.cs b/src/Spd.Resource.Repository/Document/DocumentRepository.cs index afd82f41fd..8a43a86040 100644 --- a/src/Spd.Resource.Repository/Document/DocumentRepository.cs +++ b/src/Spd.Resource.Repository/Document/DocumentRepository.cs @@ -131,7 +131,13 @@ private IEnumerable GetLatestSet(IEnumerable resp) private async Task DocumentCreateAsync(CreateDocumentCmd cmd, CancellationToken ct) { bcgov_documenturl documenturl = _mapper.Map(cmd.TempFile); - documenturl.bcgov_url = cmd.ApplicationId == null ? $"contact/{cmd.ApplicantId}" : $"spd_application/{cmd.ApplicationId}"; + if (cmd.ApplicationId != null) + documenturl.bcgov_url = $"spd_application/{cmd.ApplicationId}"; + else if (cmd.ApplicantId != null) + documenturl.bcgov_url = $"contact/{cmd.ApplicantId}"; + else if (cmd.OrgRegistrationId != null) + documenturl.bcgov_url = $"spd_orgregistration/{cmd.OrgRegistrationId}"; + if (cmd.ExpiryDate != null && cmd.ExpiryDate < new DateOnly(1800, 1, 1)) throw new ArgumentException("Invalid Document Expiry Date"); if (cmd.ExpiryDate != null) documenturl.spd_expirydate = SharedMappingFuncs.GetDateFromDateOnly(cmd.ExpiryDate); From d0bff3b7b3ff5579a6bc3ff31f19b5454f930df1 Mon Sep 17 00:00:00 2001 From: Carol Carpenter Date: Wed, 11 Jun 2025 13:06:06 -0700 Subject: [PATCH 6/7] wip --- ...dealers-registration-received.component.ts | 57 +++++-------------- .../step-mdra-business-manager.component.ts | 2 +- .../step-mdra-business-owner.component.ts | 6 +- .../components/step-mdra-summary.component.ts | 16 ++---- 4 files changed, 24 insertions(+), 57 deletions(-) diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/metal-dealers-registration-received.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/metal-dealers-registration-received.component.ts index 9cf5b1c420..5f84f45158 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/metal-dealers-registration-received.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/metal-dealers-registration-received.component.ts @@ -1,5 +1,6 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { SPD_CONSTANTS } from '@app/core/constants/constants'; +import { MetalDealersApplicationService } from '@app/core/services/metal-dealers-application.service'; @Component({ selector: 'app-metal-dealers-registration-received', @@ -12,48 +13,12 @@ import { SPD_CONSTANTS } from '@app/core/constants/constants';

Registration Received

- -
-
- -
-
- - - Your registration has been received. - -
We will contact you if we need more information.
- -
-
-
Application Number
-
-
-
---
-
-
-
Business Name
-
-
-
---
-
-
-
Business Owner
-
-
-
---
-
-
+ + Your registration has been received. A confirmation email will be sent to you. We will contact you if + additional information is needed. +
@@ -75,10 +40,14 @@ import { SPD_CONSTANTS } from '@app/core/constants/constants'; styles: [], standalone: false, }) -export class MetalDealersRegistrationReceivedComponent { +export class MetalDealersRegistrationReceivedComponent implements OnInit { contactSpdUrl = SPD_CONSTANTS.urls.contactSpdUrl; - onPrint(): void { - window.print(); + constructor(private metalDealersApplicationService: MetalDealersApplicationService) {} + + ngOnInit(): void { + if (this.metalDealersApplicationService.initialized) { + this.metalDealersApplicationService.reset(); + } } } diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-manager.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-manager.component.ts index f7ef55d5da..dbc821e752 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-manager.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-business-manager.component.ts @@ -25,7 +25,7 @@ import { FormErrorStateMatcher } from '@app/shared/directives/form-error-state-m
- Phone Number + Phone Number (optional) - Phone Number + Phone Number (optional) - Trade or 'Doing Business As' Name + Trade or 'Doing Business As' Name (optional) This is the name commonly used to refer to your business diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts index 503c600a8e..ccc69e380d 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts @@ -36,13 +36,9 @@ import { FormMdraBranchesComponent } from './form-mdra-branches.component';
-
Expired Licence
-
-
-
Expired Licence
-
{{ hasExpiredLicence | default }}
-
- + +
Expired Licence
+
Expired Licence Number
{{ expiredLicenceNumber | default }}
@@ -53,9 +49,9 @@ import { FormMdraBranchesComponent } from './form-mdra-branches.component'; {{ expiredLicenceExpiryDate | formatDate | default }}
-
-
- +
+ +
Business Owner
From fa8690987cbabfb904d9abf43a58e98ae2159648 Mon Sep 17 00:00:00 2001 From: Carol Carpenter Date: Thu, 12 Jun 2025 09:43:51 -0700 Subject: [PATCH 7/7] wip --- .../src/app/core/code-types/model-desc.models.ts | 2 +- .../components/step-mdra-consent.component.ts | 2 -- .../components/step-mdra-summary.component.ts | 12 ++++++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/code-types/model-desc.models.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/code-types/model-desc.models.ts index 48dba73149..b96ef24a73 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/core/code-types/model-desc.models.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/core/code-types/model-desc.models.ts @@ -293,7 +293,7 @@ export const ServiceTypes: SelectOptions[] = [ { desc: 'Dog Trainer Certification', code: ServiceTypeCode.DogTrainerCertification }, { desc: 'GDSD Team Certification', code: ServiceTypeCode.GdsdTeamCertification }, { desc: 'Mcfd', code: ServiceTypeCode.Mcfd }, - { desc: 'Metal Dealers & Recyclers Registration', code: ServiceTypeCode.Mdra }, + { desc: 'Metal Dealers & Recyclers', code: ServiceTypeCode.Mdra }, { desc: 'PeCrc', code: ServiceTypeCode.PeCrc }, { desc: 'PeCrcVs', code: ServiceTypeCode.PeCrcVs }, { desc: 'Psso', code: ServiceTypeCode.Psso }, diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-consent.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-consent.component.ts index 09181d33e8..de090829a5 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-consent.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-consent.component.ts @@ -112,8 +112,6 @@ import { LicenceChildStepperStepComponent, UtilService } from '@app/core/service standalone: false, }) export class StepMdraConsentComponent implements LicenceChildStepperStepComponent { - collectionNoticeActName = 'Metal Dealers and Recyclers Act'; - form: FormGroup = this.metalDealersApplicationService.consentAndDeclarationFormGroup; constructor( diff --git a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts index ccc69e380d..9cac66d9f0 100644 --- a/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts +++ b/src/Spd.Presentation.Licensing/ClientApp/src/app/modules/metal-dealers-and-recyclers/components/step-mdra-summary.component.ts @@ -55,37 +55,37 @@ import { FormMdraBranchesComponent } from './form-mdra-branches.component';
Business Owner
-
+
Business Owner Name
{{ businessOwnerDataname | default }}
-
+
Phone Number
{{ businessOwnerDatabizPhoneNumber | formatPhoneNumber | default }}
-
+
Email Address
{{ businessOwnerDatabizEmailAddress | default }}
-
+
Legal Business Name
{{ businessOwnerDatabizLegalName | default }}
-
+
Trade or 'Doing Business As' Name
{{ businessOwnerDatabizTradeName | default }}
-
+
Business Licence Documents