diff --git a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/authenticated/gdsd-licence-main-licences-list.component.ts b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/authenticated/gdsd-licence-main-licences-list.component.ts index ba79e9b950..702767e542 100644 --- a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/authenticated/gdsd-licence-main-licences-list.component.ts +++ b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/authenticated/gdsd-licence-main-licences-list.component.ts @@ -110,12 +110,6 @@ import { MainLicenceResponse } from '@app/core/services/common-application.servi (keydown)="onKeydownRequestReplacement($event, licence)" >Request a replacement - -
- - A replacement for this record is not available at this time. - -
diff --git a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/authenticated/gdsd-licence-main.component.ts b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/authenticated/gdsd-licence-main.component.ts index 41e0272261..1ac12d2c94 100644 --- a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/authenticated/gdsd-licence-main.component.ts +++ b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/authenticated/gdsd-licence-main.component.ts @@ -231,18 +231,6 @@ export class GdsdLicenceMainComponent implements OnInit { .getLicenceWithSelectionAuthenticated(ApplicationTypeCode.Replacement, licence) .pipe( tap((_resp: any) => { - const originalPhotoOfYourselfExpired = !!this.gdsdTeamApplicationService.gdsdTeamModelFormGroup.get( - 'originalLicenceData.originalPhotoOfYourselfExpired' - )?.value; - - licence.originalPhotoOfYourselfExpired = originalPhotoOfYourselfExpired; - - // User cannot continue with this flow if the photograph of yourself is missing - if (originalPhotoOfYourselfExpired) { - this.gdsdTeamApplicationService.reset(); - return; - } - this.router.navigateByUrl(AppRoutes.pathGdsdAuthenticated(AppRoutes.GDSD_TEAM_REPLACEMENT_AUTHENTICATED)); }), take(1) @@ -255,18 +243,6 @@ export class GdsdLicenceMainComponent implements OnInit { .getLicenceWithSelectionAuthenticated(ApplicationTypeCode.Replacement, licence) .pipe( tap((_resp: any) => { - const originalPhotoOfYourselfExpired = !!this.retiredDogApplicationService.retiredDogModelFormGroup.get( - 'originalLicenceData.originalPhotoOfYourselfExpired' - )?.value; - - licence.originalPhotoOfYourselfExpired = originalPhotoOfYourselfExpired; - - // User cannot continue with this flow if the photograph of yourself is missing - if (originalPhotoOfYourselfExpired) { - this.retiredDogApplicationService.reset(); - return; - } - this.router.navigateByUrl( AppRoutes.pathGdsdAuthenticated(AppRoutes.RETIRED_DOG_REPLACEMENT_AUTHENTICATED) ); diff --git a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/dog-trainer/dog-trainer-wizard-new-renewal.component.ts b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/dog-trainer/dog-trainer-wizard-new-renewal.component.ts index 65a0483aff..b9b074eca7 100644 --- a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/dog-trainer/dog-trainer-wizard-new-renewal.component.ts +++ b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/dog-trainer/dog-trainer-wizard-new-renewal.component.ts @@ -144,7 +144,7 @@ export class DogTrainerWizardNewRenewalComponent extends BaseWizardComponent imp } onSubmit(): void { - this.dogTrainerApplicationService.submitLicenceNewOrRenewalAnonymous().subscribe({ + this.dogTrainerApplicationService.submitLicenceAnonymous().subscribe({ next: (_resp: StrictHttpResponse) => { this.router.navigateByUrl(AppRoutes.path(AppRoutes.GDSD_APPLICATION_RECEIVED)); }, diff --git a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/dog-trainer/dog-trainer-wizard-replacement.component.ts b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/dog-trainer/dog-trainer-wizard-replacement.component.ts index 8f5d18d915..5f0045706c 100644 --- a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/dog-trainer/dog-trainer-wizard-replacement.component.ts +++ b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/dog-trainer/dog-trainer-wizard-replacement.component.ts @@ -4,12 +4,14 @@ import { Router } from '@angular/router'; import { ApplicationTypeCode, DogTrainerAppCommandResponse } from '@app/api/models'; import { StrictHttpResponse } from '@app/api/strict-http-response'; import { AppRoutes } from '@app/app.routes'; +import { BooleanTypeCode } from '@app/core/code-types/model-desc.models'; import { BaseWizardComponent } from '@app/core/components/base-wizard.component'; import { DogTrainerApplicationService } from '@app/core/services/dog-trainer-application.service'; import { UtilService } from '@app/core/services/util.service'; import { distinctUntilChanged, Subscription } from 'rxjs'; import { StepDtConsentReplacementComponent } from './step-dt-consent-replacement.component'; import { StepDtMailingAddressComponent } from './step-dt-mailing-address.component'; +import { StepDtPhotographOfYourselfRenewComponent } from './step-dt-photograph-of-yourself-renew.component'; @Component({ selector: 'app-dog-trainer-wizard-replacement', @@ -33,7 +35,17 @@ import { StepDtMailingAddressComponent } from './step-dt-mailing-address.compone > - + + Photograph of Yourself + + + + + + Acknowledgement @@ -56,11 +68,15 @@ import { StepDtMailingAddressComponent } from './step-dt-mailing-address.compone export class DogTrainerWizardReplacementComponent extends BaseWizardComponent implements OnInit, OnDestroy { readonly STEP_SUMMARY = 0; readonly STEP_MAILING_ADDRESS = 1; + readonly STEP_PHOTO_OF_YOURSELF = 2; step2Complete = false; step3Complete = false; + updatePhoto = false; + @ViewChild(StepDtMailingAddressComponent) stepAddress!: StepDtMailingAddressComponent; + @ViewChild(StepDtPhotographOfYourselfRenewComponent) stepPhoto!: StepDtPhotographOfYourselfRenewComponent; @ViewChild(StepDtConsentReplacementComponent) stepConsent!: StepDtConsentReplacementComponent; applicationTypeReplacement = ApplicationTypeCode.Replacement; @@ -89,6 +105,10 @@ export class DogTrainerWizardReplacementComponent extends BaseWizardComponent im this.dogTrainerChangedSubscription = this.dogTrainerApplicationService.dogTrainerModelValueChanges$.subscribe( (_resp: boolean) => { + this.updatePhoto = + this.dogTrainerApplicationService.dogTrainerFormGroup.get('photographOfYourselfData.updatePhoto')?.value === + BooleanTypeCode.Yes; + this.updateCompleteStatus(); } ); @@ -114,6 +134,8 @@ export class DogTrainerWizardReplacementComponent extends BaseWizardComponent im return true; case this.STEP_MAILING_ADDRESS: return this.stepAddress.isFormValid(); + case this.STEP_PHOTO_OF_YOURSELF: + return this.stepPhoto.isFormValid(); default: console.error('Unknown Form', step); } @@ -127,7 +149,7 @@ export class DogTrainerWizardReplacementComponent extends BaseWizardComponent im onSubmit(): void { if (!this.stepConsent.isFormValid()) return; - this.dogTrainerApplicationService.submitLicenceReplacementAnonymous().subscribe({ + this.dogTrainerApplicationService.submitLicenceAnonymous().subscribe({ next: (_resp: StrictHttpResponse) => { this.router.navigateByUrl(AppRoutes.path(AppRoutes.GDSD_APPLICATION_RECEIVED)); }, @@ -139,7 +161,9 @@ export class DogTrainerWizardReplacementComponent extends BaseWizardComponent im private updateCompleteStatus(): void { this.step2Complete = this.dogTrainerApplicationService.trainerMailingAddressFormGroup.valid; - this.step3Complete = this.dogTrainerApplicationService.consentAndDeclarationDtFormGroup.valid; + this.step3Complete = this.updatePhoto + ? this.dogTrainerApplicationService.photographOfYourselfFormGroup.valid + : true; console.debug('Complete Status', this.step2Complete, this.step3Complete); } diff --git a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/gdsd-team/gdsd-team-wizard-replacement.component.ts b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/gdsd-team/gdsd-team-wizard-replacement.component.ts index 022aaa0f24..b10e09fd34 100644 --- a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/gdsd-team/gdsd-team-wizard-replacement.component.ts +++ b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/gdsd-team/gdsd-team-wizard-replacement.component.ts @@ -4,6 +4,7 @@ import { Router } from '@angular/router'; import { ApplicationTypeCode, GdsdTeamAppCommandResponse } from '@app/api/models'; import { StrictHttpResponse } from '@app/api/strict-http-response'; import { AppRoutes } from '@app/app.routes'; +import { BooleanTypeCode } from '@app/core/code-types/model-desc.models'; import { BaseWizardComponent } from '@app/core/components/base-wizard.component'; import { AuthenticationService } from '@app/core/services/authentication.service'; import { GdsdTeamApplicationService } from '@app/core/services/gdsd-team-application.service'; @@ -11,6 +12,7 @@ import { UtilService } from '@app/core/services/util.service'; import { distinctUntilChanged, Subscription } from 'rxjs'; import { StepTeamConsentReplacementComponent } from './step-team-consent-replacement.component'; import { StepTeamMailingAddressComponent } from './step-team-mailing-address.component'; +import { StepTeamPhotographOfYourselfRenewComponent } from './step-team-photograph-of-yourself-renew.component'; @Component({ selector: 'app-gdsd-team-wizard-replacement', @@ -37,7 +39,17 @@ import { StepTeamMailingAddressComponent } from './step-team-mailing-address.com > - + + Photograph of Yourself + + + + + + Acknowledgement @@ -60,14 +72,17 @@ import { StepTeamMailingAddressComponent } from './step-team-mailing-address.com export class GdsdTeamWizardReplacementComponent extends BaseWizardComponent implements OnInit, OnDestroy { readonly STEP_SUMMARY = 0; readonly STEP_MAILING_ADDRESS = 1; + readonly STEP_PHOTO_OF_YOURSELF = 2; step2Complete = false; step3Complete = false; isLoggedIn = false; + updatePhoto = false; applicationTypeReplacement = ApplicationTypeCode.Replacement; @ViewChild(StepTeamMailingAddressComponent) stepAddress!: StepTeamMailingAddressComponent; + @ViewChild(StepTeamPhotographOfYourselfRenewComponent) stepPhoto!: StepTeamPhotographOfYourselfRenewComponent; @ViewChild(StepTeamConsentReplacementComponent) stepConsent!: StepTeamConsentReplacementComponent; private gdsdTeamChangedSubscription!: Subscription; @@ -97,6 +112,10 @@ export class GdsdTeamWizardReplacementComponent extends BaseWizardComponent impl this.gdsdTeamChangedSubscription = this.gdsdTeamApplicationService.gdsdTeamModelValueChanges$.subscribe( (_resp: boolean) => { + this.updatePhoto = + this.gdsdTeamApplicationService.gdsdTeamModelFormGroup.get('photographOfYourselfData.updatePhoto')?.value === + BooleanTypeCode.Yes; + this.updateCompleteStatus(); } ); @@ -122,6 +141,8 @@ export class GdsdTeamWizardReplacementComponent extends BaseWizardComponent impl return true; case this.STEP_MAILING_ADDRESS: return this.stepAddress.isFormValid(); + case this.STEP_PHOTO_OF_YOURSELF: + return this.stepPhoto.isFormValid(); default: console.error('Unknown Form', step); } @@ -147,7 +168,7 @@ export class GdsdTeamWizardReplacementComponent extends BaseWizardComponent impl return; } - this.gdsdTeamApplicationService.submitLicenceReplacementAnonymous().subscribe({ + this.gdsdTeamApplicationService.submitLicenceAnonymous().subscribe({ next: (_resp: StrictHttpResponse) => { this.router.navigateByUrl(AppRoutes.path(AppRoutes.GDSD_APPLICATION_RECEIVED)); }, @@ -159,7 +180,7 @@ export class GdsdTeamWizardReplacementComponent extends BaseWizardComponent impl private updateCompleteStatus(): void { this.step2Complete = this.gdsdTeamApplicationService.mailingAddressFormGroup.valid; - this.step3Complete = this.gdsdTeamApplicationService.consentAndDeclarationFormGroup.valid; + this.step3Complete = this.updatePhoto ? this.gdsdTeamApplicationService.photographOfYourselfFormGroup.valid : true; console.debug('Complete Status', this.step2Complete, this.step3Complete); } diff --git a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/retired-dog/retired-dog-wizard-replacement.component.ts b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/retired-dog/retired-dog-wizard-replacement.component.ts index aa384100e0..241baed74e 100644 --- a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/retired-dog/retired-dog-wizard-replacement.component.ts +++ b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/components/retired-dog/retired-dog-wizard-replacement.component.ts @@ -4,6 +4,7 @@ import { Router } from '@angular/router'; import { ApplicationTypeCode, RetiredDogAppCommandResponse } from '@app/api/models'; import { StrictHttpResponse } from '@app/api/strict-http-response'; import { AppRoutes } from '@app/app.routes'; +import { BooleanTypeCode } from '@app/core/code-types/model-desc.models'; import { BaseWizardComponent } from '@app/core/components/base-wizard.component'; import { AuthenticationService } from '@app/core/services/authentication.service'; import { RetiredDogApplicationService } from '@app/core/services/retired-dog-application.service'; @@ -11,6 +12,7 @@ import { UtilService } from '@app/core/services/util.service'; import { distinctUntilChanged, Subscription } from 'rxjs'; import { StepRdConsentReplacementComponent } from './step-rd-consent-replacement.component'; import { StepRdMailingAddressComponent } from './step-rd-mailing-address.component'; +import { StepRdPhotographOfYourselfRenewComponent } from './step-rd-photograph-of-yourself-renew.component'; @Component({ selector: 'app-retired-dog-wizard-replacement', @@ -37,7 +39,17 @@ import { StepRdMailingAddressComponent } from './step-rd-mailing-address.compone > - + + Photograph of Yourself + + + + + + Acknowledgement @@ -60,14 +72,17 @@ import { StepRdMailingAddressComponent } from './step-rd-mailing-address.compone export class RetiredDogWizardReplacementComponent extends BaseWizardComponent implements OnInit, OnDestroy { readonly STEP_SUMMARY = 0; readonly STEP_MAILING_ADDRESS = 1; + readonly STEP_PHOTO_OF_YOURSELF = 2; step2Complete = false; step3Complete = false; isLoggedIn = false; + updatePhoto = false; applicationTypeReplacement = ApplicationTypeCode.Replacement; @ViewChild(StepRdMailingAddressComponent) stepAddress!: StepRdMailingAddressComponent; + @ViewChild(StepRdPhotographOfYourselfRenewComponent) stepPhoto!: StepRdPhotographOfYourselfRenewComponent; @ViewChild(StepRdConsentReplacementComponent) stepConsent!: StepRdConsentReplacementComponent; private retiredDogChangedSubscription!: Subscription; @@ -97,6 +112,10 @@ export class RetiredDogWizardReplacementComponent extends BaseWizardComponent im this.retiredDogChangedSubscription = this.retiredDogApplicationService.retiredDogModelValueChanges$.subscribe( (_resp: boolean) => { + this.updatePhoto = + this.retiredDogApplicationService.retiredDogModelFormGroup.get('photographOfYourselfData.updatePhoto') + ?.value === BooleanTypeCode.Yes; + this.updateCompleteStatus(); } ); @@ -122,6 +141,8 @@ export class RetiredDogWizardReplacementComponent extends BaseWizardComponent im return true; case this.STEP_MAILING_ADDRESS: return this.stepAddress.isFormValid(); + case this.STEP_PHOTO_OF_YOURSELF: + return this.stepPhoto.isFormValid(); default: console.error('Unknown Form', step); } @@ -147,7 +168,7 @@ export class RetiredDogWizardReplacementComponent extends BaseWizardComponent im return; } - this.retiredDogApplicationService.submitLicenceReplacementAnonymous().subscribe({ + this.retiredDogApplicationService.submitLicenceAnonymous().subscribe({ next: (_resp: StrictHttpResponse) => { this.router.navigateByUrl(AppRoutes.path(AppRoutes.GDSD_APPLICATION_RECEIVED)); }, @@ -159,7 +180,9 @@ export class RetiredDogWizardReplacementComponent extends BaseWizardComponent im private updateCompleteStatus(): void { this.step2Complete = this.retiredDogApplicationService.mailingAddressFormGroup.valid; - this.step3Complete = this.retiredDogApplicationService.consentAndDeclarationFormGroup.valid; + this.step3Complete = this.updatePhoto + ? this.retiredDogApplicationService.photographOfYourselfFormGroup.valid + : true; console.debug('Complete Status', this.step2Complete, this.step3Complete); } diff --git a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/common-application.helper.ts b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/common-application.helper.ts index f5a5c3b7ce..083b8e1a21 100644 --- a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/common-application.helper.ts +++ b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/common-application.helper.ts @@ -51,10 +51,10 @@ export abstract class CommonApplicationHelper { photographOfYourselfFormGroup: FormGroup = this.formBuilder.group( { - updatePhoto: new FormControl(''), // used by update/renewal + updatePhoto: new FormControl(''), // used by replacement/renewal uploadedDateTime: new FormControl(''), // used in Renewal to determine if a new photo is mandatory attachments: new FormControl([]), - updateAttachments: new FormControl([]), // used by update/renewal + updateAttachments: new FormControl([]), // used by replacement/renewal }, { validators: [ diff --git a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/common-application.service.ts b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/common-application.service.ts index 773f4fa24b..2935739493 100644 --- a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/common-application.service.ts +++ b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/common-application.service.ts @@ -41,7 +41,6 @@ export interface MainApplicationResponse extends LicenceAppListResponse { export interface MainLicenceResponse extends LicenceResponse { hasLoginNameChanged: boolean; - originalPhotoOfYourselfExpired: boolean; licenceExpiryNumberOfDays?: null | number; isRenewalPeriod: boolean; isReplacementPeriod: boolean; @@ -397,8 +396,6 @@ export class CommonApplicationService { const licenceRenewPeriodDays = SPD_CONSTANTS.periods.licenceRenewPeriodDays; const licenceRenewPeriodDaysNinetyDayTerm = SPD_CONSTANTS.periods.licenceRenewPeriodDaysNinetyDayTerm; - licence.originalPhotoOfYourselfExpired = false; // default - licence.isRenewalPeriod = false; licence.isReplacementPeriod = false; licence.isExpiredLicenceRenewable = this.utilService.isExpiredLicenceRenewable(licence); diff --git a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/dog-trainer-application.service.ts b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/dog-trainer-application.service.ts index 0626541f7f..ff5682a9f5 100644 --- a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/dog-trainer-application.service.ts +++ b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/dog-trainer-application.service.ts @@ -293,11 +293,15 @@ export class DogTrainerApplicationService extends DogTrainerApplicationHelper { const applicationTypeData = { applicationTypeCode: ApplicationTypeCode.Replacement }; const trainerMailingAddressData = dogTrainerModelData.trainerMailingAddressData; + const photographOfYourselfData = dogTrainerModelData.photographOfYourselfData; const originalLicenceData = dogTrainerModelData.originalLicenceData; // if the photo is missing, set the flag as expired so that it is required if (!this.isPhotographOfYourselfEmpty(photoOfYourself)) { originalLicenceData.originalPhotoOfYourselfExpired = true; + + // set flag - user will be forced to update their photo + photographOfYourselfData.updatePhoto = BooleanTypeCode.Yes; } this.mailingAddressFormGroup.patchValue({ @@ -315,6 +319,8 @@ export class DogTrainerApplicationService extends DogTrainerApplicationHelper { { licenceAppId: null, applicationTypeData, + originalLicenceData, + photographOfYourselfData, }, { emitEvent: false, @@ -519,7 +525,7 @@ export class DogTrainerApplicationService extends DogTrainerApplicationHelper { /** * Submit the application data for anonymous new */ - submitLicenceNewOrRenewalAnonymous(): Observable> { + submitLicenceAnonymous(): Observable> { const dogTrainerModelFormValue = this.dogTrainerModelFormGroup.getRawValue(); const body = this.getSaveBodyBaseNewOrRenewal(dogTrainerModelFormValue); const documentsToSave = this.getDocsToSaveBlobs(dogTrainerModelFormValue); @@ -542,30 +548,6 @@ export class DogTrainerApplicationService extends DogTrainerApplicationHelper { body ); } - /** - * Submit the application data for anonymous new - */ - submitLicenceReplacementAnonymous(): Observable> { - const dogTrainerModelFormValue = this.dogTrainerModelFormGroup.getRawValue(); - const body = this.getSaveBodyBaseReplacement(dogTrainerModelFormValue); - const documentsToSave = this.getDocsToSaveBlobs(dogTrainerModelFormValue); - - const { existingDocumentIds, documentsToSaveApis } = this.getDocumentData(documentsToSave); - delete body.documentInfos; - - const consentData = this.consentAndDeclarationDtFormGroup.getRawValue(); - const googleRecaptcha = { recaptchaCode: consentData.captchaFormGroup.token }; - - const originalLicenceData = dogTrainerModelFormValue.originalLicenceData; - body.contactId = originalLicenceData.originalLicenceHolderId; - - return this.submitLicenceAnonymousDocuments( - googleRecaptcha, - existingDocumentIds, - documentsToSaveApis.length > 0 ? documentsToSaveApis : null, - body - ); - } private getDocumentData(documentsToSave: Array): { existingDocumentIds: Array; diff --git a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/gdsd-team-application.service.ts b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/gdsd-team-application.service.ts index 7942a4fa68..a31cad3ff2 100644 --- a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/gdsd-team-application.service.ts +++ b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/gdsd-team-application.service.ts @@ -761,10 +761,14 @@ export class GdsdTeamApplicationService extends GdsdTeamApplicationHelper { const dogRenewData = { isAssistanceStillRequired: true }; const originalLicenceData = gdsdModelData.originalLicenceData; + const photographOfYourselfData = gdsdModelData.photographOfYourselfData; // if the photo is missing, set the flag as expired so that it is required if (!this.isPhotographOfYourselfEmpty(photoOfYourself)) { originalLicenceData.originalPhotoOfYourselfExpired = true; + + // set flag - user will be forced to update their photo + photographOfYourselfData.updatePhoto = BooleanTypeCode.Yes; } this.gdsdTeamModelFormGroup.patchValue( @@ -773,6 +777,7 @@ export class GdsdTeamApplicationService extends GdsdTeamApplicationHelper { applicationTypeData, dogRenewData, originalLicenceData, + photographOfYourselfData, }, { emitEvent: false, @@ -1360,32 +1365,6 @@ export class GdsdTeamApplicationService extends GdsdTeamApplicationHelper { ); } - /** - * Submit the application data for anonymous replacement - */ - submitLicenceReplacementAnonymous(): Observable> { - const gdsdModelFormValue = this.gdsdTeamModelFormGroup.getRawValue(); - const body = this.getSaveBodyBaseChange(gdsdModelFormValue); - - // Get the keyCode for the existing documents to save. - const existingDocumentIds: Array = []; - body.documentInfos?.forEach((doc: Document) => { - if (doc.documentUrlId) { - existingDocumentIds.push(doc.documentUrlId); - } - }); - - delete body.documentInfos; - - const originalLicenceData = gdsdModelFormValue.originalLicenceData; - body.applicantId = originalLicenceData.originalLicenceHolderId; - - const consentData = this.consentAndDeclarationFormGroup.getRawValue(); - const googleRecaptcha = { recaptchaCode: consentData.captchaFormGroup.token }; - - return this.submitLicenceAnonymousDocuments(googleRecaptcha, existingDocumentIds, null, body); - } - /** * Submit the application data for anonymous renewal or replacement including documents * @returns diff --git a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/retired-dog-application.service.ts b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/retired-dog-application.service.ts index 404de1b40e..661caf77ef 100644 --- a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/retired-dog-application.service.ts +++ b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/core/services/retired-dog-application.service.ts @@ -523,10 +523,14 @@ export class RetiredDogApplicationService extends RetiredDogApplicationHelper { const applicationTypeData = { applicationTypeCode: ApplicationTypeCode.Replacement }; const originalLicenceData = retiredDogModelData.originalLicenceData; + const photographOfYourselfData = retiredDogModelData.photographOfYourselfData; // if the photo is missing, set the flag as expired so that it is required if (!this.isPhotographOfYourselfEmpty(photoOfYourself)) { originalLicenceData.originalPhotoOfYourselfExpired = true; + + // set flag - user will be forced to update their photo + photographOfYourselfData.updatePhoto = BooleanTypeCode.Yes; } this.retiredDogModelFormGroup.patchValue( @@ -534,6 +538,7 @@ export class RetiredDogApplicationService extends RetiredDogApplicationHelper { licenceAppId: null, applicationTypeData, originalLicenceData, + photographOfYourselfData, }, { emitEvent: false, @@ -1046,32 +1051,6 @@ export class RetiredDogApplicationService extends RetiredDogApplicationHelper { ); } - /** - * Submit the application data for anonymous replacement - */ - submitLicenceReplacementAnonymous(): Observable> { - const rdModelFormValue = this.retiredDogModelFormGroup.getRawValue(); - const body = this.getSaveBodyBaseChange(rdModelFormValue); - - // Get the keyCode for the existing documents to save. - const existingDocumentIds: Array = []; - body.documentInfos?.forEach((doc: Document) => { - if (doc.documentUrlId) { - existingDocumentIds.push(doc.documentUrlId); - } - }); - - delete body.documentInfos; - - const originalLicenceData = rdModelFormValue.originalLicenceData; - body.applicantId = originalLicenceData.originalLicenceHolderId; - - const consentData = this.consentAndDeclarationFormGroup.getRawValue(); - const googleRecaptcha = { recaptchaCode: consentData.captchaFormGroup.token }; - - return this.submitLicenceAnonymousDocuments(googleRecaptcha, existingDocumentIds, null, body); - } - /** * Submit the application data for anonymous renewal or replacement including documents * @returns diff --git a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/shared/components/form-access-code-anonymous.component.ts b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/shared/components/form-access-code-anonymous.component.ts index 332c500b0d..4dc13a439a 100644 --- a/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/shared/components/form-access-code-anonymous.component.ts +++ b/src/Spd.Presentation.GuideDogServiceDog/ClientApp/src/app/shared/components/form-access-code-anonymous.component.ts @@ -188,9 +188,6 @@ export class FormAccessCodeAnonymousComponent implements OnInit { ) { // Replacement-specific error: access code matches licence, but the licence is not within the replacement period this.errorMessage = `This ${this.label} is too close to its expiry date to allow replacement. Please renew it instead.`; - } else if (this.applicationTypeCode === ApplicationTypeCode.Replacement && !resp.photoDocumentInfo) { - // Replacement-specific error: the photo is missing on the licence - this.errorMessage = 'A replacement for this record is not available at this time.'; } else if (this.applicationTypeCode === ApplicationTypeCode.Renewal && daysBetween > renewPeriodDays) { // Renewal-specific error: access code matches licence, but the licence is not within the expiry period this.errorMessage = `This ${this.label} is still valid. Please renew it when it is within ${renewPeriodDays} days of the expiry date.`;