Skip to content

Commit

Permalink
Merge pull request #169 from bcgov/stories/ecer-1013
Browse files Browse the repository at this point in the history
removing auto selection of certificate type. In exchange, error message pops up right away on new application + other bug fixes
  • Loading branch information
SoLetsDev authored Apr 2, 2024
2 parents 8e05cab + dac425c commit 5bb8f21
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<script lang="ts">
import { defineComponent, type PropType } from "vue";
import type { VForm } from "vuetify/components";
import FormContainer from "@/components/FormContainer.vue";
import PageContainer from "@/components/PageContainer.vue";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<v-row>
<v-col cols="12">
<EceForm
v-if="step.form.id === wizardStore.currentStep.form.id"
:form="step.form"
:form-data="wizardStore.wizardData"
@updated-form-data="wizardStore.setWizardData"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,6 @@ export default defineComponent({
this.$emit("updatedValidation", this.errorState);
},
},
mounted() {
//if user does not have a selection, default to EceAssistant.
if (!this.certificationTypeStore.selection) {
this.certificationTypeStore.selection = "EceAssistant";
}
},
});
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@
<v-col cols="12" md="8" lg="6" xl="4">
<v-text-field
v-model="emailAddress"
:rules="[Rules.required('Enter your reference\'s email in the format \'[email protected]\''), Rules.email('Enter your reference\'s email in the format \'[email protected]\'')]"
:rules="[
Rules.required('Enter your reference\'s email in the format \'[email protected]\''),
Rules.email('Enter your reference\'s email in the format \'[email protected]\''),
]"
label="Reference Email"
variant="outlined"
color="primary"
Expand Down Expand Up @@ -108,7 +111,6 @@ export default defineComponent({
Rules,
};
},
created() {},
methods: {
async updateCharacterReference() {
this.$emit("update:model-value", [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<v-checkbox
v-model="officialTranscriptReceived"
color="primary"
label="The ECE Registry has already my official transcript for the course/program relevant to this application and certificate type"
label="The ECE Registry already has my official transcript for the course/program relevant to this application and certificate type"
></v-checkbox>
</form>
</v-col>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@
<p class="small">You must enter 500 hours of work experience to submit your application.</p>
</Alert>
</v-col>
<v-col v-if="duplicateCharacterReference" sm="12" md="10" lg="8" xl="6">
<Alert type="error">
<p class="small">Your work experience reference(s) cannot be the same as your character reference</p>
</Alert>
</v-col>
<v-col sm="12" md="10" lg="8" xl="6" class="my-6">
<WorkExperienceReferenceProgressBar :references="modelValue" />
</v-col>
Expand All @@ -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";
Expand All @@ -161,9 +167,11 @@ export default defineComponent({
},
setup: () => {
const alertStore = useAlertStore();
const wizardStore = useWizardStore();
return {
alertStore,
wizardStore,
};
},
data: function () {
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Components.Schemas.DraftApplicationResponse | null | undefined> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
};
},
Expand Down

0 comments on commit 5bb8f21

Please sign in to comment.