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"
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"
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
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
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";
300307import * as Rules from " @/utils/formRules" ;
301308import { parseHumanFileSize , removeElementByIndex , replaceElementByIndex } from " @/utils/functions" ;
302309
310+ import applicationWizardIcraEligibility from " @/config/application-wizard-icra-eligibility" ;
303311import ECEHeader from " ../ECEHeader.vue" ;
304312import FileUploader from " ../FileUploader.vue" ;
305313import InternationalCertificationCard from " ../InternationalCertificationCard.vue" ;
@@ -314,10 +322,10 @@ interface RadioOptions {
314322
315323interface 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
323331export 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 },
0 commit comments