Skip to content

Commit 292454a

Browse files
authored
Merge pull request #1449 from bcgov/stories/ecer-4782
Stories/ecer 4782: Work experience references for ICRA eligibility object
2 parents 241dc81 + 0dd8384 commit 292454a

File tree

16 files changed

+171
-52
lines changed

16 files changed

+171
-52
lines changed

src/ECER.Clients.RegistryPortal/ECER.Clients.RegistryPortal.Server/ICRA/ICRAEligibilitiesEndpoints.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public record ICRAEligibility()
7878

7979
public ICRAStatus Status { get; set; }
8080
public IEnumerable<InternationalCertification> InternationalCertifications { get; set; } = Array.Empty<InternationalCertification>();
81+
public IEnumerable<EmploymentReference> EmploymentReferences { get; set; } = Array.Empty<EmploymentReference>();
8182
}
8283
public record InternationalCertification
8384
{
@@ -107,6 +108,15 @@ public enum CertificateStatus
107108
Expired
108109
}
109110

111+
public record EmploymentReference
112+
{
113+
public string? Id { get; set; }
114+
public string? LastName { get; set; }
115+
public string? FirstName { get; set; }
116+
public string? EmailAddress { get; set; }
117+
public string? PhoneNumber { get; set; }
118+
}
119+
110120
public enum ICRAStatus
111121
{
112122
Active,

src/ECER.Clients.RegistryPortal/ECER.Clients.RegistryPortal.Server/ICRA/ICRAEligibilityMapper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ public ICRAEligibilityMapper()
1212

1313
CreateMap<InternationalCertification, Managers.Registry.Contract.ICRA.InternationalCertification>()
1414
.ReverseMap();
15+
CreateMap<EmploymentReference, Managers.Registry.Contract.ICRA.EmploymentReference>().ReverseMap();
1516
}
1617
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,22 @@ import { cleanPreferredName } from "@/utils/functions";
3838
import type { Components } from "@/types/openapi";
3939
4040
export default defineComponent({
41-
name: "WorkExperienceReferenceCard",
41+
name: "EmploymentExperienceCard",
4242
setup() {
4343
const loadingStore = useLoadingStore();
4444
4545
return { loadingStore };
4646
},
4747
props: {
4848
reference: {
49-
type: Object as () => Components.Schemas.WorkExperienceReference,
49+
type: Object as () => Components.Schemas.EmploymentReference,
5050
required: true,
5151
},
5252
},
5353
5454
emits: {
55-
edit: (_reference: Components.Schemas.WorkExperienceReference) => true,
56-
delete: (_reference: Components.Schemas.WorkExperienceReference) => true,
55+
edit: (_reference: Components.Schemas.EmploymentReference) => true,
56+
delete: (_reference: Components.Schemas.EmploymentReference) => true,
5757
},
5858
computed: {
5959
referenceFullName() {
Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<!-- add view -->
3-
<div v-if="icraWorkExperienceEligibilityFormMode === 'edit' || icraWorkExperienceEligibilityFormMode === 'add'">
3+
<div v-if="employmentExperienceFormMode === 'edit' || employmentExperienceFormMode === 'add'">
44
<ECEHeader title="Employment experience references" />
55
<br />
66
<p>
@@ -84,11 +84,7 @@
8484
</v-row>
8585
<v-row v-if="Array.isArray(modelValue) && modelValue.length > 0" v-for="(reference, index) in modelValue" :key="index">
8686
<v-col sm="12" md="10" lg="8" xl="6">
87-
<EceIcraWorkExperienceEligibilityCard
88-
:reference="reference"
89-
@edit="handleEdit"
90-
@delete="(internationalCertification) => handleDelete(internationalCertification, index)"
91-
/>
87+
<EceEmploymentExperienceCard :reference="reference" @edit="handleEdit" @delete="(reference) => handleDelete(reference, index)" />
9288
</v-col>
9389
</v-row>
9490
<v-row v-else-if="modelValue?.length === 0">
@@ -100,7 +96,7 @@
10096
<v-row v-if="showAddWorkExperienceEligibilityButton">
10197
<v-col sm="12" md="10" lg="8" xl="6">
10298
<v-btn
103-
id="btnAddInternationalCertification"
99+
id="btnAddEmploymentExperience"
104100
prepend-icon="mdi-plus"
105101
rounded="lg"
106102
color="primary"
@@ -134,7 +130,7 @@
134130

135131
<script lang="ts">
136132
import { mapWritableState } from "pinia";
137-
import { defineComponent } from "vue";
133+
import { defineComponent, type PropType } from "vue";
138134
import type { VForm, VInput } from "vuetify/components";
139135
140136
import EceDateInput from "@/components/inputs/EceDateInput.vue";
@@ -153,28 +149,28 @@ import * as Rules from "@/utils/formRules";
153149
import { removeElementByIndex, replaceElementByIndex } from "@/utils/functions";
154150
155151
import ECEHeader from "../ECEHeader.vue";
156-
import EceIcraWorkExperienceEligibilityCard from "../EceIcraWorkExperienceEligibilityCard.vue";
152+
import EceEmploymentExperienceCard from "../EceEmploymentExperienceCard.vue";
157153
import ProgressBar from "../ProgressBar.vue";
158154
import { useIcraStore } from "@/store/icra";
159155
160156
const MAX_NUM_REFERENCES = 6;
161157
162-
interface IcraWorkExperienceEligibilityData extends Components.Schemas.WorkExperienceReference {
158+
interface EmploymentExperienceData extends Components.Schemas.EmploymentReference {
163159
//other fields
164-
icraWorkExperienceEligibilityFormMode: "add" | "edit" | undefined; //TODO not supposed to be optional
160+
employmentExperienceFormMode: "add" | "edit" | undefined;
165161
}
166162
167163
export default defineComponent({
168-
name: "EceIcraWorkExperienceEligibility",
169-
components: { ProgressBar, EceIcraWorkExperienceEligibilityCard, EceDateInput, EceTextField, Callout, ECEHeader },
164+
name: "EceEmploymentExperience",
165+
components: { ProgressBar, EceEmploymentExperienceCard, EceDateInput, EceTextField, Callout, ECEHeader },
170166
props: {
171167
modelValue: {
172-
type: Object as () => Components.Schemas.WorkExperienceReference[],
168+
type: Array as PropType<Components.Schemas.EmploymentReference[]>,
173169
required: true, //to switch to true
174170
},
175171
},
176172
emits: {
177-
"update:model-value": (_icraWorkExperienceEligibility: Components.Schemas.WorkExperienceReference[]) => true,
173+
"update:model-value": (_icraWorkExperienceEligibility: Components.Schemas.EmploymentReference[]) => true,
178174
},
179175
setup: () => {
180176
const alertStore = useAlertStore();
@@ -198,16 +194,16 @@ export default defineComponent({
198194
MAX_NUM_REFERENCES,
199195
};
200196
},
201-
data(): IcraWorkExperienceEligibilityData {
197+
data(): EmploymentExperienceData {
202198
return {
203-
//international certification
204-
id: "",
199+
//employment experience
200+
id: null,
205201
lastName: "",
206202
firstName: "",
207203
emailAddress: "",
208204
phoneNumber: "",
209205
//other data
210-
icraWorkExperienceEligibilityFormMode: undefined,
206+
employmentExperienceFormMode: undefined,
211207
};
212208
},
213209
computed: {
@@ -238,10 +234,10 @@ export default defineComponent({
238234
// Reset the form fields
239235
this.resetFormData();
240236
this.mode = "add";
241-
this.icraWorkExperienceEligibilityFormMode = "add";
237+
this.employmentExperienceFormMode = "add";
242238
window.scroll(0, 0);
243239
},
244-
handleEdit(reference: Components.Schemas.WorkExperienceReference) {
240+
handleEdit(reference: Components.Schemas.EmploymentReference) {
245241
// Set the form fields to component data
246242
this.id = reference.id;
247243
this.lastName = reference.lastName;
@@ -250,9 +246,10 @@ export default defineComponent({
250246
this.phoneNumber = reference.phoneNumber;
251247
252248
this.mode = "add";
253-
this.icraWorkExperienceEligibilityFormMode = "edit";
249+
this.employmentExperienceFormMode = "edit";
250+
window.scroll(0, 0);
254251
},
255-
async handleDelete(_reference: Components.Schemas.WorkExperienceReference, index: number) {
252+
async handleDelete(_reference: Components.Schemas.EmploymentReference, index: number) {
256253
this.$emit("update:model-value", removeElementByIndex(this.modelValue, index));
257254
258255
// await this.icraStore.saveDraft();
@@ -263,7 +260,7 @@ export default defineComponent({
263260
const { valid } = await (this.$refs.icraWorkExperienceEligibilityForm as VForm).validate();
264261
265262
if (valid) {
266-
const newIcraWorkExperienceEligibilityReference: Components.Schemas.WorkExperienceReference = {
263+
const newEmploymentExperienceReference: Components.Schemas.EmploymentReference = {
267264
id: this.id, //empty if we are adding
268265
lastName: this.lastName,
269266
firstName: this.firstName,
@@ -272,21 +269,19 @@ export default defineComponent({
272269
};
273270
let updatedModelValue = this.modelValue?.slice() || []; //create a copy of the array
274271
275-
if (this.icraWorkExperienceEligibilityFormMode === "edit") {
276-
const indexOfEditedReference = updatedModelValue.findIndex((reference) => reference.id === newIcraWorkExperienceEligibilityReference.id);
277-
updatedModelValue = replaceElementByIndex(updatedModelValue, indexOfEditedReference, newIcraWorkExperienceEligibilityReference);
278-
} else if (this.icraWorkExperienceEligibilityFormMode === "add") {
279-
updatedModelValue.push(newIcraWorkExperienceEligibilityReference);
272+
if (this.employmentExperienceFormMode === "edit") {
273+
const indexOfEditedReference = updatedModelValue.findIndex((reference) => reference.id === newEmploymentExperienceReference.id);
274+
updatedModelValue = replaceElementByIndex(updatedModelValue, indexOfEditedReference, newEmploymentExperienceReference);
275+
} else if (this.employmentExperienceFormMode === "add") {
276+
updatedModelValue.push(newEmploymentExperienceReference);
280277
}
281278
282279
this.$emit("update:model-value", updatedModelValue);
283280
284-
// await this.icraStore.saveDraft(); //TODO add in when save draft is ready
281+
await this.icraStore.saveDraft();
285282
286283
this.alertStore.setSuccessAlert(
287-
this.icraWorkExperienceEligibilityFormMode === "edit"
288-
? "You have successfully edited your reference."
289-
: "You have successfully added your reference.",
284+
this.employmentExperienceFormMode === "edit" ? "You have successfully edited your reference." : "You have successfully added your reference.",
290285
);
291286
292287
this.resetFormData();
@@ -299,13 +294,13 @@ export default defineComponent({
299294
}
300295
},
301296
resetFormData() {
302-
this.id = "";
303-
this.lastName = "so"; //TODO remove test data
304-
this.firstName = "derek";
305-
this.emailAddress = "[email protected]";
297+
this.id = null;
298+
this.lastName = "";
299+
this.firstName = "";
300+
this.emailAddress = "";
306301
this.phoneNumber = "";
307302
308-
this.icraWorkExperienceEligibilityFormMode = undefined;
303+
this.employmentExperienceFormMode = undefined;
309304
},
310305
},
311306
});

src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/components/inputs/EceEmploymentExperiencePreview.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default defineComponent({
5959
};
6060
},
6161
computed: {
62-
employmentExperiences(): Components.Schemas.WorkExperienceReference[] {
62+
employmentExperiences(): Components.Schemas.EmploymentReference[] {
6363
return this.wizardStore.wizardData[this.wizardStore.wizardConfig.steps?.employmentExperience?.form?.inputs?.employmentExperience?.id || ""];
6464
},
6565
},

src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/config/employment-experience-form.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import EceIcraWorkExperienceEligibility from "@/components/inputs/EceIcraWorkExperienceEligibility.vue";
1+
import EceEmploymentExperience from "@/components/inputs/EceEmploymentExperience.vue";
22
import type { Form } from "@/types/form";
33

44
const employmentExperienceForm: Form = {
@@ -7,7 +7,7 @@ const employmentExperienceForm: Form = {
77
inputs: {
88
employmentExperience: {
99
id: "employmentExperience",
10-
component: EceIcraWorkExperienceEligibility,
10+
component: EceEmploymentExperience,
1111
cols: {
1212
md: 12,
1313
lg: 12,

src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/store/icra.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const useIcraStore = defineStore("icra", {
9292
}
9393

9494
if (employmentExperienceId) {
95-
console.log("employment experience TODO not implemented"); //TODO
95+
this.draftIcraEligibility.employmentReferences = wizardStore.wizardData[employmentExperienceId];
9696
}
9797
},
9898
async upsertDraftIcraEligibility(): Promise<Components.Schemas.DraftICRAEligibilityResponse | null | undefined> {

src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/store/wizard.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,7 @@ export const useWizardStore = defineStore("wizard", {
207207

208208
//employment experience
209209
...(wizard.steps?.employmentExperience?.form?.inputs?.employmentExperience?.id && {
210-
[wizard.steps?.employmentExperience?.form?.inputs?.employmentExperience?.id]: [
211-
{ id: "", lastName: "test", firstName: "test", emailAddress: "[email protected]", phoneNumber: "" },
212-
{ id: "", lastName: "test2", firstName: "test2", emailAddress: "[email protected]", phoneNumber: "135131313" },
213-
], // TODO we need to add in the draft object here when it's ready
210+
[wizard.steps?.employmentExperience?.form?.inputs?.employmentExperience?.id]: draftIcraEligibility.employmentReferences || [],
214211
}),
215212
});
216213
},

src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/types/openapi.d.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ declare namespace Components {
277277
}
278278
export type EducationOrigin = "InsideBC" | "OutsideBC" | "OutsideofCanada";
279279
export type EducationRecognition = "Recognized" | "NotRecognized";
280+
export interface EmploymentReference {
281+
id?: string | null;
282+
lastName?: string | null;
283+
firstName?: string | null;
284+
emailAddress?: string | null;
285+
phoneNumber?: string | null;
286+
}
280287
export interface FileInfo {
281288
id?: string | null;
282289
url?: string | null;
@@ -318,6 +325,7 @@ declare namespace Components {
318325
createdOn?: string | null; // date-time
319326
status?: ICRAStatus;
320327
internationalCertifications?: InternationalCertification[] | null;
328+
employmentReferences?: EmploymentReference[] | null;
321329
}
322330
export type ICRAStatus = "Active" | "Draft" | "Eligible" | "Inactive" | "Ineligible" | "InReview" | "ReadyforReview" | "Submitted";
323331
export interface IdentificationType {
@@ -621,7 +629,7 @@ declare namespace Components {
621629
timestamp?: string | null;
622630
commit?: string | null;
623631
}
624-
export type WorkExperienceRefStage = "ApplicationSubmitted" | "Approved" | "Draft" | "InProgress" | "Rejected" | "Submitted" | "UnderReview" | "WaitingforResponse" | "ICRAEligibilitySubmitted";
632+
export type WorkExperienceRefStage = "ApplicationSubmitted" | "Approved" | "Draft" | "InProgress" | "Rejected" | "Submitted" | "UnderReview" | "WaitingforResponse" | "ICRAEligibilitySubmitted" | "EligibilityResponseSubmitted";
625633
export interface WorkExperienceReference {
626634
lastName?: string | null;
627635
emailAddress?: string | null;
@@ -1998,6 +2006,7 @@ export type DraftApplicationResponse = Components.Schemas.DraftApplicationRespon
19982006
export type DraftICRAEligibilityResponse = Components.Schemas.DraftICRAEligibilityResponse;
19992007
export type EducationOrigin = Components.Schemas.EducationOrigin;
20002008
export type EducationRecognition = Components.Schemas.EducationRecognition;
2009+
export type EmploymentReference = Components.Schemas.EmploymentReference;
20012010
export type FileInfo = Components.Schemas.FileInfo;
20022011
export type FileResponse = Components.Schemas.FileResponse;
20032012
export type FiveYearRenewalExplanations = Components.Schemas.FiveYearRenewalExplanations;

src/ECER.Managers.Registry.Contract/ICRA/Contract.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public record ICRAEligibility()
2222
public DateTime? CreatedOn { get; set; }
2323
public ICRAStatus Status { get; set; }
2424
public IEnumerable<InternationalCertification> InternationalCertifications { get; set; } = Array.Empty<InternationalCertification>();
25+
public IEnumerable<EmploymentReference> EmploymentReferences { get; set; } = Array.Empty<EmploymentReference>();
2526
}
2627
public record InternationalCertification
2728
{
@@ -45,6 +46,15 @@ public record InternationalCertification
4546
public IEnumerable<string> NewFiles { get; set; } = Array.Empty<string>();
4647
}
4748

49+
public record EmploymentReference
50+
{
51+
public string? Id { get; set; }
52+
public string? LastName { get; set; }
53+
public string? FirstName { get; set; }
54+
public string? EmailAddress { get; set; }
55+
public string? PhoneNumber { get; set; }
56+
}
57+
4858
public enum CertificateStatus
4959
{
5060
Valid,

0 commit comments

Comments
 (0)