Skip to content

Commit e514cf9

Browse files
committed
Merge remote-tracking branch 'origin/master' into stories/ecer-4786
2 parents bfc3d72 + 5e8f3fa commit e514cf9

File tree

9 files changed

+76
-49
lines changed

9 files changed

+76
-49
lines changed

src/ECER.Clients.RegistryPortal/ECER.Clients.RegistryPortal.Server/Applications/ApplicationsEndpoints.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,8 @@ public enum WorkExperienceRefStage
620620
Submitted,
621621
UnderReview,
622622
WaitingforResponse,
623-
ICRAEligibilitySubmitted
623+
ICRAEligibilitySubmitted,
624+
EligibilityResponseSubmitted
624625
}
625626

626627
public enum WorkExperienceTypes

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ import * as Rules from "@/utils/formRules";
153153
import { removeElementByIndex, replaceElementByIndex } from "@/utils/functions";
154154
155155
import ECEHeader from "../ECEHeader.vue";
156-
import FileUploader from "../FileUploader.vue";
157156
import EceIcraWorkExperienceEligibilityCard from "../EceIcraWorkExperienceEligibilityCard.vue";
158157
import ProgressBar from "../ProgressBar.vue";
159158
import { useIcraStore } from "@/store/icra";
@@ -167,7 +166,7 @@ interface IcraWorkExperienceEligibilityData extends Components.Schemas.WorkExper
167166
168167
export default defineComponent({
169168
name: "EceIcraWorkExperienceEligibility",
170-
components: { ProgressBar, FileUploader, EceIcraWorkExperienceEligibilityCard, EceDateInput, EceTextField, Callout, ECEHeader },
169+
components: { ProgressBar, EceIcraWorkExperienceEligibilityCard, EceDateInput, EceTextField, Callout, ECEHeader },
171170
props: {
172171
modelValue: {
173172
type: Object as () => Components.Schemas.WorkExperienceReference[],

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

Lines changed: 51 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
<v-col md="8" lg="6" xl="4">
1010
Country
1111
<v-select
12+
id="certificateCountrySelect"
1213
class="pt-2"
13-
:items="configStore.countryList"
14+
:items="configStore.countryList.filter((country) => country.isICRA === true)"
1415
variant="outlined"
1516
label=""
1617
v-model="countryId"
@@ -142,17 +143,25 @@
142143
<div v-if="previousNameRadio === 'other'">
143144
<v-row>
144145
<v-col md="8" lg="6" xl="4">
145-
<EceTextField v-model="otherFirstName" label="First name on transcript" variant="outlined" color="primary" maxlength="100"></EceTextField>
146+
<EceTextField
147+
id="txtOtherFirstName"
148+
v-model="otherFirstName"
149+
label="First name on transcript"
150+
variant="outlined"
151+
color="primary"
152+
maxlength="100"
153+
></EceTextField>
146154
</v-col>
147155
</v-row>
148156
<v-row>
149157
<v-col md="8" lg="6" xl="4">
150-
<EceTextField v-model="otherMiddleName" label="Middle name(s) on transcript (optional)" maxlength="100"></EceTextField>
158+
<EceTextField id="txtOtherMiddleName" v-model="otherMiddleName" label="Middle name(s) on transcript (optional)" maxlength="100"></EceTextField>
151159
</v-col>
152160
</v-row>
153161
<v-row>
154162
<v-col md="8" lg="6" xl="4">
155163
<EceTextField
164+
id="txtOtherLastName"
156165
v-model="otherLastName"
157166
:rules="[Rules.required('Enter your last name')]"
158167
label="Last name on transcript"
@@ -176,9 +185,9 @@
176185
:delete-file-from-temp-when-removed="false"
177186
@update:files="handleFileUpdate"
178187
@delete:file="handleFileDelete"
188+
:rules="[Rules.atLeastOneOptionRequired('Upload a certificate or document that shows you completed the course or workshop')]"
179189
/>
180190
</v-col>
181-
<!-- :rules="[Rules.atLeastOneOptionRequired('Upload a certificate or document that shows you completed the course or workshop')]" -->
182191
</v-row>
183192
</v-form>
184193

@@ -229,22 +238,6 @@
229238
/>
230239
</v-col>
231240
</v-row>
232-
<!-- this prevents form from proceeding if rules are not met -->
233-
<v-input
234-
class="mt-6"
235-
:model-value="modelValue"
236-
:rules="[
237-
(v) =>
238-
//if user has 4 certificates and they are all expired they cannot proceed
239-
hasValidCertificate ||
240-
v.length < MAX_NUM_CERTIFICATIONS ||
241-
`You have entered the maximum number of certifications. You must replace one of your entries with a valid certificate to proceed.`,
242-
(v) =>
243-
(v && v.some((certificate: any) => certificate.certificateStatus === 'Valid')) ||
244-
`You provided an expired certificate. To continue, you must also provide a valid certificate.`,
245-
]"
246-
auto-hide="auto"
247-
></v-input>
248241
<v-row v-if="showAddInternationalCertificationButton">
249242
<v-col sm="12" md="10" lg="8" xl="6">
250243
<v-btn
@@ -259,6 +252,20 @@
259252
</v-btn>
260253
</v-col>
261254
</v-row>
255+
<!-- this prevents form from proceeding if rules are not met -->
256+
<v-input
257+
class="mt-6"
258+
:model-value="modelValue"
259+
:rules="[
260+
(v) =>
261+
//if user has 4 certificates and they are all expired they cannot proceed
262+
hasValidCertificate ||
263+
v.length < MAX_NUM_CERTIFICATIONS ||
264+
`You have entered the maximum number of certifications. You must replace one of your entries with a valid certificate to proceed.`,
265+
(v) => hasValidCertificate || `You provided an expired certificate. To continue, you must also provide a valid certificate.`,
266+
]"
267+
auto-hide="auto"
268+
></v-input>
262269
<!-- callouts and optional messages -->
263270
<v-row>
264271
<v-col>
@@ -300,6 +307,7 @@ import { isNumber } from "@/utils/formInput";
300307
import * as Rules from "@/utils/formRules";
301308
import { parseHumanFileSize, removeElementByIndex, replaceElementByIndex } from "@/utils/functions";
302309
310+
import applicationWizardIcraEligibility from "@/config/application-wizard-icra-eligibility";
303311
import ECEHeader from "../ECEHeader.vue";
304312
import FileUploader from "../FileUploader.vue";
305313
import InternationalCertificationCard from "../InternationalCertificationCard.vue";
@@ -314,10 +322,10 @@ interface RadioOptions {
314322
315323
interface InternationalCertificationData {
316324
//name fields
317-
previousNameRadio?: any; //TODO not supposed to be optional
325+
previousNameRadio: any;
318326
newFilesWithData?: FileItem[];
319327
//other fields
320-
internationalCertificationFormMode?: "add" | "edit" | undefined; //TODO not supposed to be optional
328+
internationalCertificationFormMode: "add" | "edit" | undefined;
321329
}
322330
323331
export interface InternationalCertificationExtended extends Components.Schemas.InternationalCertification {
@@ -334,7 +342,7 @@ export default defineComponent({
334342
},
335343
},
336344
emits: {
337-
"update:model-value": (_internationalCertificationData: Components.Schemas.InternationalCertification[]) => true, //TODO change type to InternationalCertificationExtended[]
345+
"update:model-value": (_internationalCertificationData: InternationalCertificationExtended[]) => true,
338346
},
339347
setup: () => {
340348
const alertStore = useAlertStore();
@@ -489,6 +497,10 @@ export default defineComponent({
489497
this.otherMiddleName = internationalCertification.otherMiddleName;
490498
this.otherLastName = internationalCertification.otherLastName;
491499
this.hasOtherName = internationalCertification.hasOtherName;
500+
this.files = internationalCertification.files;
501+
this.newFiles = internationalCertification.newFiles;
502+
this.deletedFiles = internationalCertification.deletedFiles;
503+
this.newFilesWithData = internationalCertification.newFilesWithData || [];
492504
493505
//set the radio button for previous names and field buttons correctly
494506
if (internationalCertification.hasOtherName) {
@@ -510,9 +522,9 @@ export default defineComponent({
510522
async handleDelete(_internationalCertification: InternationalCertificationExtended, index: number) {
511523
this.$emit("update:model-value", removeElementByIndex(this.modelValue, index));
512524
513-
// await this.icraStore.saveDraft();
525+
await this.icraStore.saveDraft();
514526
//we need to update wizardData with the latest information to avoid creating duplicate new entries
515-
// await this.wizardStore.initializeWizard(this.icraStore.applicationConfiguration, this.icraStore.draftApplication);
527+
await this.wizardStore.initializeWizardForIcraEligibility(applicationWizardIcraEligibility, this.icraStore.draftIcraEligibility);
516528
517529
this.alertStore.setSuccessAlert("You have deleted your international certification.");
518530
},
@@ -536,6 +548,10 @@ export default defineComponent({
536548
otherMiddleName: this.otherMiddleName,
537549
otherLastName: this.otherLastName,
538550
hasOtherName: this.hasOtherName,
551+
files: this.files,
552+
newFiles: this.newFiles,
553+
deletedFiles: this.deletedFiles,
554+
newFilesWithData: this.newFilesWithData,
539555
};
540556
let updatedModelValue = this.modelValue?.slice() || []; //create a copy of the array
541557
@@ -550,7 +566,7 @@ export default defineComponent({
550566
551567
await this.icraStore.saveDraft();
552568
//we need to update wizardData with the latest information to avoid creating duplicate new entries
553-
// await this.wizardStore.initializeWizard(this.icraStore.applicationConfiguration, this.icraStore.draftApplication);
569+
await this.wizardStore.initializeWizardForIcraEligibility(applicationWizardIcraEligibility, this.icraStore.draftIcraEligibility);
554570
555571
this.resetFormData();
556572
@@ -605,22 +621,25 @@ export default defineComponent({
605621
//international certification
606622
this.id = "";
607623
this.countryId = undefined;
608-
this.nameOfRegulatoryAuthority = "test";
609-
this.emailOfRegulatoryAuthority = "[email protected]";
610-
this.phoneOfRegulatoryAuthority = "60464646846468";
624+
this.nameOfRegulatoryAuthority = "";
625+
this.emailOfRegulatoryAuthority = "";
626+
this.phoneOfRegulatoryAuthority = "";
611627
this.websiteOfRegulatoryAuthority = "";
612628
this.onlineCertificateValidationToolOfRegulatoryAuthority = "";
613-
this.certificateStatus = "Expired";
614-
this.certificateTitle = "aweoigwaogi";
629+
this.certificateStatus = undefined;
630+
this.certificateTitle = "";
615631
this.issueDate = "";
616632
this.expiryDate = "";
633+
this.files = [];
634+
this.newFiles = [];
635+
this.deletedFiles = [];
636+
this.newFilesWithData = [];
617637
//name fields
618638
this.previousNameRadio = undefined;
619639
this.otherFirstName = "";
620640
this.otherMiddleName = "";
621641
this.otherLastName = "";
622642
this.hasOtherName = false;
623-
//selection
624643
625644
this.internationalCertificationFormMode = undefined;
626645
},

src/ECER.Clients.RegistryPortal/ecer.clients.registryportal.client/src/config/application-wizard-icra-eligibility.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const applicationWizard: Wizard = {
3030
stage: "Review",
3131
title: "Review and submit",
3232
form: previewFormIcraEligibility,
33-
key: "item.5",
33+
key: "item.4",
3434
},
3535
},
3636
};

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { defineStore } from "pinia";
33
import { createOrUpdateDraftIcraEligibility, getIcraEligibilities } from "@/api/icra";
44
import type { Components } from "@/types/openapi";
55
import type { FileItem } from "@/components/UploadFileItem.vue";
6-
import { humanFileSize } from "@/utils/functions";
76

87
import { useWizardStore } from "./wizard";
98
import type { IcraEligibilityStage } from "@/types/wizard";
@@ -79,15 +78,9 @@ export const useIcraStore = defineStore("icra", {
7978
//remove all newFilesWithData elements and add them to newFiles as ID's
8079
const internationalCertificationCleaned = wizardStore.wizardData[internationalCertificationId].map((item: InternationalCertificationExtended) => {
8180
if (item?.newFilesWithData) {
81+
//we meed to convert newFilesWithData to an array of ID's for newFiles
8282
for (const each of item?.newFilesWithData as FileItem[]) {
8383
item.newFiles?.push(each.fileId);
84-
//we need to change wizardData to match what's been done on the server (added files)
85-
const addedFile: Components.Schemas.FileInfo = {
86-
id: each.fileId,
87-
size: humanFileSize(each.fileSize),
88-
name: each.fileName,
89-
};
90-
item.files?.push(addedFile);
9184
}
9285
delete item["newFilesWithData"];
9386
}
@@ -99,7 +92,7 @@ export const useIcraStore = defineStore("icra", {
9992
}
10093

10194
if (employmentExperienceId) {
102-
console.log("TODO not implemented"); //TODO
95+
console.log("employment experience TODO not implemented"); //TODO
10396
}
10497
},
10598
async upsertDraftIcraEligibility(): Promise<Components.Schemas.DraftICRAEligibilityResponse | null | undefined> {
@@ -118,7 +111,6 @@ export const useIcraStore = defineStore("icra", {
118111
},
119112
async saveDraft(): Promise<Components.Schemas.DraftICRAEligibilityResponse | null | undefined> {
120113
this.prepareDraftIcraEligibilityFromWizard();
121-
console.log("Draft ICRA Eligibility to be saved:", this.draftIcraEligibility);
122114
return await this.upsertDraftIcraEligibility();
123115
},
124116
async patchDraft(draftIcraEligibility: Components.Schemas.ICRAEligibility): Promise<Components.Schemas.DraftICRAEligibilityResponse | null | undefined> {

src/ECER.Resources.Documents/Applications/IApplicationRepository.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,8 @@ public enum WorkExperienceRefStage
308308
Submitted,
309309
UnderReview,
310310
WaitingforResponse,
311-
ICRAEligibilitySubmitted
311+
ICRAEligibilitySubmitted,
312+
EligibilityResponseSubmitted
312313
}
313314

314315
public enum WorkExperienceTypes

src/ECER.Resources.Documents/ICRA/ICRAChildren/InternationalCertifications.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,17 @@ private async Task UpdateInternationalCertifications(ecer_ICRAEligibilityAssessm
3333
context.Detach(oldInternationalCertification);
3434
ecerInternationalCertification.StatusCode = oldInternationalCertification.StatusCode;
3535
}
36-
36+
3737
context.Attach(ecerInternationalCertification);
3838
context.UpdateObject(ecerInternationalCertification);
39+
if (InternationalCertification.CountryId != null)
40+
{
41+
var ecer_country = context.ecer_CountrySet.SingleOrDefault(c => c.ecer_CountryId == Guid.Parse(InternationalCertification.CountryId));
42+
if (ecer_country != null)
43+
{
44+
context.AddLink(ecer_country, ecer_InternationalCertification.Fields.ecer_internationalcertification_CountryId, ecerInternationalCertification);
45+
}
46+
}
3947
await HandleInternationalCertificationFiles(ecerInternationalCertification, Guid.Parse(ApplicantId), InternationalCertification.NewFiles, InternationalCertification.DeletedFiles, ct);
4048
}
4149

@@ -54,7 +62,7 @@ private async Task UpdateInternationalCertifications(ecer_ICRAEligibilityAssessm
5462
var ecer_country = context.ecer_CountrySet.SingleOrDefault(c => c.ecer_CountryId == Guid.Parse(InternationalCertification.CountryId));
5563
if (ecer_country != null)
5664
{
57-
context.AddLink(ecer_country, ecer_ICRAEligibilityAssessment.Fields.ecer_icraeligibilityassessment_CountryId, ecerInternationalCertification);
65+
context.AddLink(ecer_country, ecer_InternationalCertification.Fields.ecer_internationalcertification_CountryId, ecerInternationalCertification);
5866
}
5967
}
6068
await HandleInternationalCertificationFiles(ecerInternationalCertification, Guid.Parse(ApplicantId), InternationalCertification.NewFiles, InternationalCertification.DeletedFiles, ct);

src/ECER.Tests/Integration/RegistryApi/IcraTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ public async Task SaveDraftIcraEligibility_WithInternationalCertificationAndFile
130130

131131
var uploadedFileResponse = (await fileResponse.ReadAsJsonAsync<ECER.Clients.RegistryPortal.Server.Files.FileResponse>()).ShouldNotBeNull();
132132

133+
var countryId = this.Fixture.Country.ecer_CountryId!.Value.ToString();
134+
133135
var eligibility = new ICRAEligibility
134136
{
135137
Status = ICRAStatus.Draft,
@@ -141,6 +143,7 @@ public async Task SaveDraftIcraEligibility_WithInternationalCertificationAndFile
141143
CertificateTitle = faker.Company.CatchPhrase(),
142144
IssueDate = faker.Date.Past(),
143145
ExpiryDate = faker.Date.Soon(),
146+
CountryId = countryId,
144147
NewFiles = new [] { uploadedFileResponse.fileId }
145148
}
146149
}
@@ -168,5 +171,6 @@ public async Task SaveDraftIcraEligibility_WithInternationalCertificationAndFile
168171
fetched.InternationalCertifications.ShouldHaveSingleItem();
169172
fetched.InternationalCertifications.First().Files.ShouldHaveSingleItem();
170173
fetched.InternationalCertifications.First().Files.First().Id!.ShouldContain(uploadedFileResponse.fileId);
174+
fetched.InternationalCertifications.First().CountryId.ShouldBe(countryId);
171175
}
172176
}

src/ECER.Utilities.DataverseSdk/Model/Entities/ECER_WorkExperienceRef.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public enum ecer_WorkExperienceRef_StatusCode
4444
[System.Runtime.Serialization.EnumMemberAttribute()]
4545
Draft = 1,
4646

47+
[System.Runtime.Serialization.EnumMemberAttribute()]
48+
EligibilityResponseSubmitted = 621870008,
49+
4750
[System.Runtime.Serialization.EnumMemberAttribute()]
4851
ICRAEligibilitySubmitted = 621870007,
4952

0 commit comments

Comments
 (0)