diff --git a/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/Form.vue b/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/Form.vue index ce59a512e..38bfb81bb 100644 --- a/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/Form.vue +++ b/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/Form.vue @@ -17,6 +17,7 @@ diff --git a/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/inputs/EceCharacterReference.vue b/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/inputs/EceCharacterReference.vue index 2248888ed..d1b57b102 100644 --- a/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/inputs/EceCharacterReference.vue +++ b/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/inputs/EceCharacterReference.vue @@ -56,7 +56,10 @@ diff --git a/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/inputs/EceWorkExperienceReferences.vue b/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/inputs/EceWorkExperienceReferences.vue index be924b188..43866eaa5 100644 --- a/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/inputs/EceWorkExperienceReferences.vue +++ b/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/inputs/EceWorkExperienceReferences.vue @@ -116,6 +116,11 @@

You must enter 500 hours of work experience to submit your application.

+ + +

Your work experience reference(s) cannot be the same as your character reference

+
+
@@ -138,6 +143,7 @@ import Alert from "@/components/Alert.vue"; import WorkExperienceReferenceList, { type WorkExperienceReferenceData } from "@/components/WorkExperienceReferenceList.vue"; import WorkExperienceReferenceProgressBar from "@/components/WorkExperienceReferenceProgressBar.vue"; import { useAlertStore } from "@/store/alert"; +import { useWizardStore } from "@/store/wizard"; import type { EceWorkExperienceReferencesProps } from "@/types/input"; import type { Components } from "@/types/openapi"; import { isNumber } from "@/utils/formInput"; @@ -161,9 +167,11 @@ export default defineComponent({ }, setup: () => { const alertStore = useAlertStore(); + const wizardStore = useWizardStore(); return { alertStore, + wizardStore, }; }, data: function () { @@ -195,6 +203,17 @@ export default defineComponent({ newClientId() { return Object.keys(this.modelValue).length + 1; }, + duplicateCharacterReference() { + const check = Object.values(this.modelValue).some((workExperienceReference: Components.Schemas.WorkExperienceReference) => { + const characterReferenceKey = this.wizardStore.wizardConfig.steps.characterReferences.form.inputs.characterReferences.id; + return ( + workExperienceReference.firstName === this.wizardStore.wizardData?.[characterReferenceKey]?.[0]?.firstName && + workExperienceReference.lastName === this.wizardStore.wizardData?.[characterReferenceKey]?.[0]?.lastName && + workExperienceReference.emailAddress === this.wizardStore.wizardData?.[characterReferenceKey]?.[0]?.emailAddress + ); + }); + return check; + }, }, mounted() { if (Object.keys(this.modelValue).length === 0) { diff --git a/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/store/application.ts b/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/store/application.ts index 41fd7ae0b..31ec59a87 100644 --- a/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/store/application.ts +++ b/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/store/application.ts @@ -78,6 +78,12 @@ export const useApplicationStore = defineStore("application", { ) { this.draftApplication.characterReferences = wizardStore.wizardData[wizardStore.wizardConfig.steps.characterReferences.form.inputs.characterReferences.id]; + } else if ( + wizardStore.wizardData[wizardStore.wizardConfig.steps.characterReferences.form.inputs.characterReferences.id]?.[0]?.firstName === "" && + wizardStore.wizardData[wizardStore.wizardConfig.steps.characterReferences.form.inputs.characterReferences.id]?.[0]?.lastName === "" && + wizardStore.wizardData[wizardStore.wizardConfig.steps.characterReferences.form.inputs.characterReferences.id]?.[0]?.emailAddress === "" + ) { + this.draftApplication.characterReferences = []; } }, async upsertDraftApplication(): Promise { diff --git a/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/store/wizard.ts b/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/store/wizard.ts index 37c5ad836..90afc4d5e 100644 --- a/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/store/wizard.ts +++ b/src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/store/wizard.ts @@ -50,6 +50,17 @@ export const useWizardStore = defineStore("wizard", { }, 0); } + const duplicateCharacterReferenceFound = references.some((workExperienceReference: Components.Schemas.WorkExperienceReference) => { + return ( + workExperienceReference.firstName === + state.wizardData?.[this.wizardConfig.steps.characterReferences.form.inputs.characterReferences.id]?.[0]?.firstName && + workExperienceReference.lastName === + state.wizardData?.[this.wizardConfig.steps.characterReferences.form.inputs.characterReferences.id]?.[0]?.lastName && + workExperienceReference.emailAddress === + state.wizardData?.[this.wizardConfig.steps.characterReferences.form.inputs.characterReferences.id]?.[0]?.emailAddress + ); + }); + return { CertificationType: (state.wizardData[this.wizardConfig.steps.certificationType.form.inputs.certificationSelection.id].length || []) > 0, Declaration: @@ -58,7 +69,10 @@ export const useWizardStore = defineStore("wizard", { ContactInformation: true, Education: Object.values(state.wizardData[this.wizardConfig.steps.education.form.inputs.educationList.id]).length > 0, CharacterReferences: (state.wizardData[this.wizardConfig.steps.characterReferences.form.inputs.characterReferences.id].length || []) > 0, - WorkReferences: Object.values(state.wizardData[this.wizardConfig.steps.workReference.form.inputs.referenceList.id]).length > 0 && totalHours >= 500, + WorkReferences: + Object.values(state.wizardData[this.wizardConfig.steps.workReference.form.inputs.referenceList.id]).length > 0 && + totalHours >= 500 && + !duplicateCharacterReferenceFound, Review: true, }; },