Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing auto selection of certificate type. In exchange, error message pops up right away on new application + other bug fixes #169

Merged
merged 11 commits into from
Apr 2, 2024
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"
pcatkins marked this conversation as resolved.
Show resolved Hide resolved
: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 (
pcatkins marked this conversation as resolved.
Show resolved Hide resolved
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
Loading