@eeplatform/nuxt-layer-common 1.7.53 → 1.7.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @eeplatform/nuxt-layer-common
2
2
 
3
+ ## 1.7.55
4
+
5
+ ### Patch Changes
6
+
7
+ - ce622a8: Fix enrollment form
8
+
9
+ ## 1.7.54
10
+
11
+ ### Patch Changes
12
+
13
+ - 9395bfb: Add key config
14
+
3
15
  ## 1.7.53
4
16
 
5
17
  ### Patch Changes
@@ -1530,12 +1530,31 @@ const enrollment = defineModel<TLearner>({
1530
1530
 
1531
1531
  const { cookieConfig } = useRuntimeConfig().public;
1532
1532
 
1533
- if (prop.school) {
1534
- setTimeout(() => {
1533
+ const { getById: getSchoolById } = useSchool();
1534
+
1535
+ if (prop.schoolId) {
1536
+ setTimeout(async () => {
1535
1537
  enrollment.value.schoolId = prop.schoolId ?? "school";
1536
1538
  }, 1000);
1537
1539
  }
1538
1540
 
1541
+ if (prop.school && prop.selfService) {
1542
+ setTimeout(async () => {
1543
+ try {
1544
+ const school = await getSchoolById(prop.school ?? "school");
1545
+ if (school) {
1546
+ enrollment.value.schoolId = school._id;
1547
+ enrollment.value.region = school.region;
1548
+ enrollment.value.province = school.province;
1549
+ enrollment.value.cityMunicipality = school.cityMunicipality;
1550
+ enrollment.value.schoolName = school.name;
1551
+ }
1552
+ } catch (error) {
1553
+ console.error("Error setting school ID:", error);
1554
+ }
1555
+ }, 1000);
1556
+ }
1557
+
1539
1558
  enrollment.value.createdBy = useCookie("user", cookieConfig).value ?? "";
1540
1559
 
1541
1560
  function validZipCode(value: string) {
@@ -2230,6 +2249,8 @@ watchEffect(() => {
2230
2249
  const selectedSchool = computed(() => enrollment.value.schoolId);
2231
2250
 
2232
2251
  watch(selectedSchool, (val) => {
2252
+ console.log(val);
2253
+
2233
2254
  enrollment.value.gradeLevel = "";
2234
2255
 
2235
2256
  // Clear region, province, and cityMunicipality when schoolId is removed by user (not programmatically)
@@ -2244,8 +2265,11 @@ watch(selectedSchool, (val) => {
2244
2265
 
2245
2266
  const school = schools.value.find((s) => s.id === val);
2246
2267
 
2247
- if (school?.name) {
2268
+ if (school) {
2248
2269
  enrollment.value.school = school?._id ?? "";
2270
+ }
2271
+
2272
+ if (school?.name) {
2249
2273
  enrollment.value.schoolName = school?.name;
2250
2274
  }
2251
2275
 
@@ -0,0 +1,772 @@
1
+ <template>
2
+ <v-row no-gutters class="fill-height" justify="center" align-content="start">
3
+ <v-col cols="6" class="mt-4">
4
+ <v-row no-gutters>
5
+ <v-col cols="12">
6
+ <v-row no-gutters justify="space-between">
7
+ <v-btn icon variant="text" density="comfortable" @click="goBack">
8
+ <v-icon> ph:arrow-left-bold </v-icon>
9
+ </v-btn>
10
+ </v-row>
11
+ </v-col>
12
+
13
+ <v-col cols="12" class="pl-2 mt-2">
14
+ <v-progress-linear
15
+ :model-value="progress"
16
+ rounded="lg"
17
+ height="10"
18
+ ></v-progress-linear>
19
+ </v-col>
20
+
21
+ <v-col v-if="currentStep === 1" cols="12" class="mt-8 pl-2">
22
+ <v-row no-gutters>
23
+ <v-col cols="12">
24
+ <v-form v-model="step1.valid">
25
+ <v-row no-gutters>
26
+ <v-col cols="12" class="mb-6">
27
+ <span class="text-h5 font-weight-bold">
28
+ {{ step1.question }}
29
+ </span>
30
+ </v-col>
31
+
32
+ <v-col cols="12">
33
+ <InputLabel title="School" required />
34
+ <v-combobox
35
+ v-model="step1.answer.schoolId"
36
+ v-model:search="searchSchool"
37
+ :rules="[requiredRule]"
38
+ :items="schools"
39
+ item-title="name"
40
+ item-value="id"
41
+ :return-object="false"
42
+ :loading="schoolsStatus"
43
+ :disabled="schoolsStatus"
44
+ :hide-no-data="false"
45
+ >
46
+ <template v-slot:no-data>
47
+ <v-list-item>
48
+ <v-list-item-title>
49
+ No results matching "<strong>{{
50
+ searchSchool
51
+ }}</strong
52
+ >". Click the search button and try again.
53
+ </v-list-item-title>
54
+ </v-list-item>
55
+ </template>
56
+
57
+ <template #append>
58
+ <v-btn
59
+ variant="tonal"
60
+ :disabled="schoolsStatus"
61
+ class="text-none"
62
+ size="48"
63
+ width="100"
64
+ icon
65
+ @click="refreshSchools()"
66
+ >
67
+ <v-icon>ph:magnifying-glass-bold</v-icon>
68
+ </v-btn>
69
+ </template>
70
+ </v-combobox>
71
+ </v-col>
72
+
73
+ <v-col v-if="isSelfService" cols="12">
74
+ <InputLabel title="Region" />
75
+ <v-autocomplete
76
+ v-model="step1.answer.region"
77
+ :items="regions"
78
+ item-title="name"
79
+ item-value="code"
80
+ :loading="regionStatus"
81
+ :disabled="regionStatus"
82
+ clearable
83
+ ></v-autocomplete>
84
+ </v-col>
85
+
86
+ <v-col v-if="isSelfService" cols="12">
87
+ <InputLabel title="Province" />
88
+ <v-autocomplete
89
+ v-model="step1.answer.province"
90
+ :items="step1Provinces"
91
+ item-title="name"
92
+ item-value="code"
93
+ :return-object="false"
94
+ :loading="step1ProvincesStatus"
95
+ :disabled="step1ProvincesStatus || !step1.answer.region"
96
+ clearable
97
+ ></v-autocomplete>
98
+ </v-col>
99
+
100
+ <v-col v-if="isSelfService" cols="12">
101
+ <InputLabel title="City/Municipality" />
102
+ <v-autocomplete
103
+ v-model="step1.answer.cityMunicipality"
104
+ :items="step1CitiesMunicipalities"
105
+ item-title="name"
106
+ item-value="code"
107
+ :loading="step1CitiesMunicipalitiesStatus"
108
+ :disabled="
109
+ step1CitiesMunicipalitiesStatus ||
110
+ !step1.answer.province
111
+ "
112
+ clearable
113
+ ></v-autocomplete>
114
+ </v-col>
115
+
116
+ <v-col cols="12" class="mt-4">
117
+ <v-btn
118
+ class="text-none px-4"
119
+ size="large"
120
+ variant="flat"
121
+ color="black"
122
+ rounded="lg"
123
+ @click="step1.save()"
124
+ :disabled="!step1.valid"
125
+ >
126
+ Continue
127
+ </v-btn>
128
+ </v-col>
129
+ </v-row>
130
+ </v-form>
131
+ </v-col>
132
+ </v-row>
133
+ </v-col>
134
+ </v-row>
135
+ </v-col>
136
+ </v-row>
137
+ </template>
138
+
139
+ <script setup lang="ts">
140
+ const localProps = defineProps({
141
+ type: {
142
+ type: String as PropType<"self-service" | "encoder">,
143
+ default: "encoder",
144
+ },
145
+ });
146
+
147
+ const { loggedInUser, currentUser } = useLocalAuth();
148
+
149
+ const isEncoder = computed(() => localProps.type === "encoder");
150
+ const isSelfService = computed(() => localProps.type === "self-service");
151
+
152
+ const { enrollment } = useEnrollment();
153
+
154
+ const emit = defineEmits(["close"]);
155
+
156
+ const { requiredRule } = useUtils();
157
+
158
+ // enrollment questions — matched to useEnrollment().enrollment
159
+
160
+ // enrollment.region, .regionName, .province, .cityMunicipality, .schoolId, .school, .schoolName
161
+ const step1 = ref({
162
+ question: "Which school do you want to enroll in?",
163
+ answer: {
164
+ region: "",
165
+ regionName: "",
166
+ province: "",
167
+ cityMunicipality: "",
168
+ schoolId: "",
169
+ school: "",
170
+ schoolName: "",
171
+ },
172
+ save() {
173
+ const school = schools.value.find(
174
+ (s) => s.id === step1.value.answer.schoolId
175
+ );
176
+
177
+ if (school) {
178
+ step1.value.answer.school = school._id ?? "";
179
+ step1.value.answer.schoolName = school.name;
180
+ step1.value.answer.cityMunicipality = school.cityMunicipalityPSGC ?? "";
181
+ step1.value.answer.province = school.cityMunicipalityPSGC
182
+ ? school.cityMunicipalityPSGC.slice(0, 5) + "00000"
183
+ : "";
184
+ step1.value.answer.region = school.cityMunicipalityPSGC
185
+ ? school.cityMunicipalityPSGC.slice(0, 2) + "00000000"
186
+ : "";
187
+ step1.value.answer.regionName = school.regionName ?? "";
188
+ }
189
+
190
+ enrollment.value.region = step1.value.answer.region;
191
+ enrollment.value.regionName = step1.value.answer.regionName;
192
+ enrollment.value.province = step1.value.answer.province;
193
+ enrollment.value.cityMunicipality = step1.value.answer.cityMunicipality;
194
+ enrollment.value.schoolId = step1.value.answer.schoolId;
195
+ enrollment.value.school = step1.value.answer.school;
196
+ enrollment.value.schoolName = step1.value.answer.schoolName;
197
+ currentStep.value++;
198
+ },
199
+ valid: false,
200
+ });
201
+
202
+ // Step 1 data fetching
203
+ const { getAll: getAllPSGC } = usePSGC();
204
+ const { getAll: getAllSchools } = useSchool();
205
+
206
+ // Regions
207
+ const regions = ref<Array<Record<string, any>>>([]);
208
+
209
+ const { data: step1RegionsData, status: step1RegionsStatus } = useLazyAsyncData(
210
+ "eq-psgc-regions",
211
+ () => getAllPSGC({ type: "Reg" })
212
+ );
213
+
214
+ const regionStatus = computed(() => step1RegionsStatus.value === "pending");
215
+
216
+ watchEffect(() => {
217
+ if (step1RegionsData.value) {
218
+ regions.value = step1RegionsData.value.items;
219
+ }
220
+ });
221
+
222
+ // Provinces (filtered by selected region)
223
+ const step1Provinces = ref<Array<Record<string, any>>>([]);
224
+
225
+ const step1SelectedRegion = computed(() => step1.value.answer.region);
226
+
227
+ const { data: step1ProvData, status: step1ProvReqStatus } = useLazyAsyncData(
228
+ "eq-psgc-provinces",
229
+ () =>
230
+ getAllPSGC({
231
+ type: "Prov",
232
+ prefix: step1SelectedRegion.value.slice(0, 2),
233
+ limit: 100,
234
+ }),
235
+ { watch: [step1SelectedRegion] }
236
+ );
237
+
238
+ const step1ProvincesStatus = computed(
239
+ () => step1ProvReqStatus.value === "pending"
240
+ );
241
+
242
+ watchEffect(() => {
243
+ if (step1ProvData.value) {
244
+ step1Provinces.value = step1ProvData.value.items;
245
+ }
246
+ });
247
+
248
+ // Cities/Municipalities (filtered by selected province)
249
+ const step1CitiesMunicipalities = ref<Array<Record<string, any>>>([]);
250
+
251
+ const step1SelectedProvince = computed(() => step1.value.answer.province);
252
+
253
+ const { data: step1CityMunData, status: step1CityMunReqStatus } =
254
+ useLazyAsyncData(
255
+ "eq-psgc-cities-municipalities",
256
+ () =>
257
+ getAllPSGC({
258
+ type: "City",
259
+ prefix: step1SelectedProvince.value.slice(0, 5),
260
+ limit: 2000,
261
+ }),
262
+ { watch: [step1SelectedProvince] }
263
+ );
264
+
265
+ const step1CitiesMunicipalitiesStatus = computed(
266
+ () => step1CityMunReqStatus.value === "pending"
267
+ );
268
+
269
+ watchEffect(() => {
270
+ if (step1CityMunData.value) {
271
+ step1CitiesMunicipalities.value = step1CityMunData.value.items;
272
+ }
273
+ });
274
+
275
+ // Auto-fill region/province/city when a school is selected
276
+ const isAutoFillingFromSchool = ref(false);
277
+
278
+ watch(
279
+ () => step1.value.answer.schoolId,
280
+ (newSchoolId) => {
281
+ if (!newSchoolId) return;
282
+ const school = schools.value.find((s) => s.id === newSchoolId);
283
+ if (!school) return;
284
+
285
+ isAutoFillingFromSchool.value = true;
286
+ step1.value.answer.school = school._id ?? "";
287
+ step1.value.answer.schoolName = school.name;
288
+ step1.value.answer.cityMunicipality = school.cityMunicipalityPSGC ?? "";
289
+ step1.value.answer.province = school.cityMunicipalityPSGC
290
+ ? school.cityMunicipalityPSGC.slice(0, 5) + "00000"
291
+ : "";
292
+ step1.value.answer.region = school.cityMunicipalityPSGC
293
+ ? school.cityMunicipalityPSGC.slice(0, 2) + "00000000"
294
+ : "";
295
+ step1.value.answer.regionName = school.regionName ?? "";
296
+
297
+ nextTick(() => {
298
+ isAutoFillingFromSchool.value = false;
299
+ });
300
+ }
301
+ );
302
+
303
+ // Clear cascade: region -> province -> city
304
+ watch(
305
+ () => step1.value.answer.region,
306
+ () => {
307
+ if (isAutoFillingFromSchool.value) return;
308
+ step1.value.answer.province = "";
309
+ step1.value.answer.cityMunicipality = "";
310
+ step1.value.answer.schoolId = "";
311
+ }
312
+ );
313
+
314
+ watch(
315
+ () => step1.value.answer.province,
316
+ () => {
317
+ if (isAutoFillingFromSchool.value) return;
318
+ step1.value.answer.cityMunicipality = "";
319
+ step1.value.answer.schoolId = "";
320
+ }
321
+ );
322
+
323
+ watch(
324
+ () => step1.value.answer.cityMunicipality,
325
+ () => {
326
+ if (isAutoFillingFromSchool.value) return;
327
+ step1.value.answer.schoolId = "";
328
+ }
329
+ );
330
+
331
+ // Schools (filtered by PSGC prefix)
332
+ const schools = ref<TSchool[]>([]);
333
+ const searchSchool = ref("");
334
+
335
+ const psgcSchoolPrefix = computed(() => {
336
+ if (step1.value.answer.cityMunicipality) {
337
+ return step1.value.answer.cityMunicipality.slice(0, 7);
338
+ }
339
+ if (step1.value.answer.province) {
340
+ return step1.value.answer.province.slice(0, 5);
341
+ }
342
+ if (step1.value.answer.region) {
343
+ return step1.value.answer.region.slice(0, 2);
344
+ }
345
+ return "";
346
+ });
347
+
348
+ const {
349
+ data: step1SchoolsData,
350
+ status: step1SchoolsReqStatus,
351
+ refresh: refreshSchools,
352
+ } = useLazyAsyncData(
353
+ "eq-schools",
354
+ () =>
355
+ getAllSchools({
356
+ limit: 100,
357
+ psgc: psgcSchoolPrefix.value,
358
+ search: searchSchool.value,
359
+ }),
360
+ { watch: [psgcSchoolPrefix] }
361
+ );
362
+
363
+ const schoolsStatus = computed(() => step1SchoolsReqStatus.value === "pending");
364
+
365
+ watchEffect(() => {
366
+ if (step1SchoolsData.value) {
367
+ schools.value = step1SchoolsData.value.items;
368
+ }
369
+ });
370
+
371
+ // enrollment.schoolYear
372
+ const step2 = ref({
373
+ question: "Which school year do you want to enroll in?",
374
+ answer: {
375
+ schoolYear: "",
376
+ },
377
+ save() {
378
+ enrollment.value.schoolYear = step2.value.answer.schoolYear;
379
+ },
380
+ valid: false,
381
+ });
382
+
383
+ // enrollment.gradeLevel
384
+ const step3 = ref({
385
+ question: "Which grade level do you want to enroll in?",
386
+ answer: {
387
+ gradeLevel: "",
388
+ },
389
+ save() {
390
+ enrollment.value.gradeLevel = step3.value.answer.gradeLevel;
391
+ },
392
+ valid: false,
393
+ });
394
+
395
+ // enrollment.seniorHighInfo.semester (shown when grade 11 or 12)
396
+ const step4 = ref({
397
+ question: "What semester do you want to enroll in?",
398
+ answer: {
399
+ semester: "",
400
+ },
401
+ save() {
402
+ enrollment.value.seniorHighInfo!.semester = step4.value.answer.semester;
403
+ },
404
+ valid: false,
405
+ });
406
+
407
+ // enrollment.seniorHighInfo.track, .trackName (shown when grade 11 or 12)
408
+ const step5 = ref({
409
+ question: "What track do you want to enroll in?",
410
+ answer: {
411
+ track: "",
412
+ trackName: "",
413
+ },
414
+ save() {
415
+ enrollment.value.seniorHighInfo!.track = step5.value.answer.track;
416
+ enrollment.value.seniorHighInfo!.trackName = step5.value.answer.trackName;
417
+ },
418
+ valid: false,
419
+ });
420
+
421
+ // enrollment.seniorHighInfo.strand, .strandName (shown when grade 11 or 12)
422
+ const step6 = ref({
423
+ question: "What strand do you want to enroll in?",
424
+ answer: {
425
+ strand: "",
426
+ strandName: "",
427
+ },
428
+ save() {
429
+ enrollment.value.seniorHighInfo!.strand = step6.value.answer.strand;
430
+ enrollment.value.seniorHighInfo!.strandName = step6.value.answer.strandName;
431
+ },
432
+ valid: false,
433
+ });
434
+
435
+ // enrollment.returningLearner
436
+ const step7 = ref({
437
+ question: "Is the learner a returning learner?",
438
+ answer: {
439
+ returningLearner: false,
440
+ },
441
+ save() {
442
+ enrollment.value.returningLearner = step7.value.answer.returningLearner;
443
+ },
444
+ valid: false,
445
+ });
446
+
447
+ // enrollment.learnerInfo.psaBirthCertificateNo, .lrn
448
+ const step8 = ref({
449
+ question: "What is the learner's PSA Birth Certificate No. and LRN?",
450
+ answer: {
451
+ psaBirthCertificateNo: "",
452
+ lrn: "",
453
+ },
454
+ save() {
455
+ enrollment.value.learnerInfo.psaBirthCertificateNo =
456
+ step8.value.answer.psaBirthCertificateNo;
457
+ enrollment.value.learnerInfo.lrn = step8.value.answer.lrn;
458
+ },
459
+ valid: false,
460
+ });
461
+
462
+ // enrollment.learnerInfo.lastName, .firstName, .middleName, .extensionName
463
+ const step9 = ref({
464
+ question: "What is the learner's full name?",
465
+ answer: {
466
+ lastName: "",
467
+ firstName: "",
468
+ middleName: "",
469
+ extensionName: "",
470
+ },
471
+ save() {
472
+ enrollment.value.learnerInfo.lastName = step9.value.answer.lastName;
473
+ enrollment.value.learnerInfo.firstName = step9.value.answer.firstName;
474
+ enrollment.value.learnerInfo.middleName = step9.value.answer.middleName;
475
+ enrollment.value.learnerInfo.extensionName =
476
+ step9.value.answer.extensionName;
477
+ },
478
+ valid: false,
479
+ });
480
+
481
+ // enrollment.learnerInfo.birthDate, .age
482
+ const step10 = ref({
483
+ question: "What is the learner's birthdate?",
484
+ answer: {
485
+ birthDate: "",
486
+ age: 0,
487
+ },
488
+ save() {
489
+ enrollment.value.learnerInfo.birthDate = step10.value.answer.birthDate;
490
+ enrollment.value.learnerInfo.age = step10.value.answer.age;
491
+ },
492
+ valid: false,
493
+ });
494
+
495
+ // enrollment.learnerInfo.sex
496
+ const step11 = ref({
497
+ question: "What is the learner's sex?",
498
+ answer: {
499
+ sex: "",
500
+ },
501
+ save() {
502
+ enrollment.value.learnerInfo.sex = step11.value.answer.sex;
503
+ },
504
+ valid: false,
505
+ });
506
+
507
+ // enrollment.learnerInfo.placeOfBirth
508
+ const step12 = ref({
509
+ question: "What is the learner's place of birth?",
510
+ answer: {
511
+ placeOfBirth: {
512
+ region: "",
513
+ regionName: "",
514
+ province: "",
515
+ provinceName: "",
516
+ cityMunicipality: "",
517
+ cityMunicipalityName: "",
518
+ },
519
+ },
520
+ save() {
521
+ enrollment.value.learnerInfo.placeOfBirth = {
522
+ ...step12.value.answer.placeOfBirth,
523
+ };
524
+ },
525
+ valid: false,
526
+ });
527
+
528
+ // enrollment.learnerInfo.motherTongue
529
+ const step13 = ref({
530
+ question: "What is the learner's mother tongue?",
531
+ answer: {
532
+ motherTongue: "",
533
+ },
534
+ save() {
535
+ enrollment.value.learnerInfo.motherTongue =
536
+ step13.value.answer.motherTongue;
537
+ },
538
+ valid: false,
539
+ });
540
+
541
+ // enrollment.learnerInfo.indigenousCommunity
542
+ const step14 = ref({
543
+ question: "Is the learner part of an indigenous community?",
544
+ answer: {
545
+ indigenousCommunity: "",
546
+ },
547
+ save() {
548
+ enrollment.value.learnerInfo.indigenousCommunity =
549
+ step14.value.answer.indigenousCommunity;
550
+ },
551
+ valid: false,
552
+ });
553
+
554
+ // enrollment.learnerInfo.fourPsHouseholdId
555
+ const step15 = ref({
556
+ question: "Is the learner part of a 4Ps household?",
557
+ answer: {
558
+ fourPsHouseholdId: "",
559
+ },
560
+ save() {
561
+ enrollment.value.learnerInfo.fourPsHouseholdId =
562
+ step15.value.answer.fourPsHouseholdId;
563
+ },
564
+ valid: false,
565
+ });
566
+
567
+ // enrollment.learnerInfo.withDisability, .disabilities
568
+ const step16 = ref({
569
+ question: "Does the learner have a disability?",
570
+ answer: {
571
+ withDisability: false,
572
+ disabilities: [] as string[],
573
+ },
574
+ save() {
575
+ enrollment.value.learnerInfo.withDisability =
576
+ step16.value.answer.withDisability;
577
+ enrollment.value.learnerInfo.disabilities = [
578
+ ...step16.value.answer.disabilities,
579
+ ];
580
+ },
581
+ valid: false,
582
+ });
583
+
584
+ // enrollment.address.current
585
+ const step17 = ref({
586
+ question: "What is the learner's current address?",
587
+ answer: {
588
+ houseNumber: "",
589
+ streetName: "",
590
+ sitio: "",
591
+ barangay: "",
592
+ barangayName: "",
593
+ municipalityCity: "",
594
+ municipalityCityName: "",
595
+ province: "",
596
+ provinceName: "",
597
+ region: "",
598
+ regionName: "",
599
+ country: "",
600
+ zipCode: "",
601
+ },
602
+ save() {
603
+ enrollment.value.address.current = { ...step17.value.answer };
604
+ },
605
+ valid: false,
606
+ });
607
+
608
+ // enrollment.address.permanent
609
+ const step18 = ref({
610
+ question: "What is the learner's permanent address?",
611
+ answer: {
612
+ houseNumber: "",
613
+ streetName: "",
614
+ sitio: "",
615
+ barangay: "",
616
+ municipalityCity: "",
617
+ municipalityCityName: "",
618
+ province: "",
619
+ region: "",
620
+ regionName: "",
621
+ country: "",
622
+ zipCode: "",
623
+ },
624
+ save() {
625
+ enrollment.value.address.permanent = { ...step18.value.answer };
626
+ },
627
+ valid: false,
628
+ });
629
+
630
+ // enrollment.parentGuardianInfo.father
631
+ const step19 = ref({
632
+ question: "What is the learner's father's name?",
633
+ answer: {
634
+ firstName: "",
635
+ lastName: "",
636
+ middleName: "",
637
+ contactNumber: "",
638
+ },
639
+ save() {
640
+ enrollment.value.parentGuardianInfo.father = { ...step19.value.answer };
641
+ },
642
+ valid: false,
643
+ });
644
+
645
+ // enrollment.parentGuardianInfo.mother
646
+ const step20 = ref({
647
+ question: "What is the learner's mother's name?",
648
+ answer: {
649
+ firstName: "",
650
+ lastName: "",
651
+ middleName: "",
652
+ contactNumber: "",
653
+ },
654
+ save() {
655
+ enrollment.value.parentGuardianInfo.mother = { ...step20.value.answer };
656
+ },
657
+ valid: false,
658
+ });
659
+
660
+ // enrollment.parentGuardianInfo.legalGuardian
661
+ const step21 = ref({
662
+ question: "What is the learner's legal guardian's name?",
663
+ answer: {
664
+ firstName: "",
665
+ lastName: "",
666
+ middleName: "",
667
+ contactNumber: "",
668
+ },
669
+ save() {
670
+ enrollment.value.parentGuardianInfo.legalGuardian = {
671
+ ...step21.value.answer,
672
+ };
673
+ },
674
+ valid: false,
675
+ });
676
+
677
+ // enrollment.returningLearnerInfo.lastGradeLevelCompleted
678
+ const step22 = ref({
679
+ question: "What grade level did the learner last complete?",
680
+ answer: {
681
+ lastGradeLevelCompleted: "",
682
+ },
683
+ save() {
684
+ enrollment.value.returningLearnerInfo.lastGradeLevelCompleted =
685
+ step22.value.answer.lastGradeLevelCompleted;
686
+ },
687
+ valid: false,
688
+ });
689
+
690
+ // enrollment.returningLearnerInfo.lastSchoolYearCompleted
691
+ const step23 = ref({
692
+ question: "What school year did the learner last complete?",
693
+ answer: {
694
+ lastSchoolYearCompleted: "",
695
+ },
696
+ save() {
697
+ enrollment.value.returningLearnerInfo.lastSchoolYearCompleted =
698
+ step23.value.answer.lastSchoolYearCompleted;
699
+ },
700
+ valid: false,
701
+ });
702
+
703
+ // enrollment.returningLearnerInfo.lastSchoolAttended, .lastSchoolId
704
+ const step24 = ref({
705
+ question: "What school did the learner last attend?",
706
+ answer: {
707
+ lastSchoolAttended: "",
708
+ lastSchoolId: "",
709
+ },
710
+ save() {
711
+ enrollment.value.returningLearnerInfo.lastSchoolAttended =
712
+ step24.value.answer.lastSchoolAttended;
713
+ enrollment.value.returningLearnerInfo.lastSchoolId =
714
+ step24.value.answer.lastSchoolId;
715
+ },
716
+ valid: false,
717
+ });
718
+
719
+ // enrollment.alternativeLearningOptions
720
+ const step25 = ref({
721
+ question: "What alternative learning options do you want to enroll in?",
722
+ answer: {
723
+ alternativeLearningOptions: [] as string[],
724
+ },
725
+ save() {
726
+ enrollment.value.alternativeLearningOptions = [
727
+ ...step25.value.answer.alternativeLearningOptions,
728
+ ];
729
+ },
730
+ valid: false,
731
+ });
732
+
733
+ // enrollment.isCertifiedAndConsented
734
+ const step26 = ref({
735
+ question: `I hereby certify that the above information given are true and
736
+ correct to the best of my knowledge and I allow the Department of
737
+ Education to use my child's details to create and/or update his/her
738
+ learner profile in the Learner Information System. The information
739
+ herein shall be treated as confidential in compliance with the Data
740
+ Privacy Act of 2012.`,
741
+ answer: {
742
+ isCertifiedAndConsented: false,
743
+ },
744
+ save() {
745
+ enrollment.value.isCertifiedAndConsented =
746
+ step26.value.answer.isCertifiedAndConsented;
747
+ },
748
+ valid: false,
749
+ });
750
+
751
+ const currentStep = ref(1);
752
+
753
+ function goBack() {
754
+ if (currentStep.value === 1) {
755
+ emit("close");
756
+ } else {
757
+ currentStep.value--;
758
+ }
759
+ }
760
+
761
+ const isSeniorHigh = computed(
762
+ () =>
763
+ step3.value.answer.gradeLevel === "Grade 11" ||
764
+ step3.value.answer.gradeLevel === "Grade 12"
765
+ );
766
+
767
+ const totalSteps = computed(() => (isSeniorHigh.value ? 26 : 23));
768
+
769
+ const progress = computed(() =>
770
+ Math.round((currentStep.value / totalSteps.value) * 100)
771
+ );
772
+ </script>
@@ -143,15 +143,15 @@ const invite = ref({
143
143
  const searchRole = ref("");
144
144
  const roles = ref<Array<Record<string, any>>>([]);
145
145
 
146
- const { getRoles } = useRole();
146
+ const { getAll } = useRole();
147
147
 
148
148
  const { data: getRolesData, status: getRolesStatus } = await useLazyAsyncData(
149
149
  "get-roles",
150
150
  () =>
151
- getRoles({
151
+ getAll({
152
152
  search: searchRole.value,
153
- type: prop.app,
154
- id: prop.org,
153
+ app: prop.app,
154
+ org: prop.org,
155
155
  limit: 20,
156
156
  })
157
157
  );
@@ -6,8 +6,6 @@ export default defineNuxtRouteMiddleware(async (to) => {
6
6
  const APP = useRuntimeConfig().public.APP;
7
7
  const org = (to.params.org as string) ?? "";
8
8
 
9
- console.log(APP);
10
-
11
9
  const { loggedInUser } = useLocalAuth();
12
10
 
13
11
  const { getByApp } = useMember();
package/nuxt.config.ts CHANGED
@@ -36,6 +36,7 @@ export default defineNuxtConfig({
36
36
  APP_LOCAL_GOV_PROV: (process.env.APP_LOCAL_GOV_PROV as string) ?? "",
37
37
  APP_LOCAL_GOV_CITY: (process.env.APP_LOCAL_GOV_CITY as string) ?? "",
38
38
  APP_LOCAL_GOV_BRGY: (process.env.APP_LOCAL_GOV_BRGY as string) ?? "",
39
+ ENROLLMENT: (process.env.ENROLLMENT as string) ?? "",
39
40
  },
40
41
  },
41
42
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@eeplatform/nuxt-layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.7.53",
5
+ "version": "1.7.55",
6
6
  "main": "./nuxt.config.ts",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -15,7 +15,7 @@ export default defineNuxtPlugin(() => {
15
15
  const userId = computed(() => useCookie("user").value ?? "");
16
16
 
17
17
  const { data: userMemberData, error: userMemberError } = useLazyAsyncData(
18
- "get-member-by-id",
18
+ `get-member-by-id-${userId.value}-${APP}-${org}`,
19
19
  () => getByUserType(userId.value, APP, org),
20
20
  { watch: [userId] }
21
21
  );
@@ -37,7 +37,7 @@ export default defineNuxtPlugin(() => {
37
37
  const roleId = computed(() => userMemberData.value?.role ?? "");
38
38
 
39
39
  const { data: getRoleByIdReq } = useLazyAsyncData(
40
- "get-role-by-id",
40
+ `get-role-by-id-${roleId.value}`,
41
41
  () => getById(roleId.value),
42
42
  { watch: [roleId], immediate: false }
43
43
  );
@@ -24,7 +24,7 @@ declare type TLearner = {
24
24
  learnerInfo: EnrLearnerInfo;
25
25
  parentGuardianInfo: EnrParentGuardianInfo;
26
26
  address: AddressInformation;
27
- returningLearnerInfo?: EnrReturningLearnerInfo;
27
+ returningLearnerInfo: EnrReturningLearnerInfo;
28
28
  seniorHighInfo?: EnrSeniorHighInformation;
29
29
  lastGradeLevelCompleted?: string;
30
30
  lastSchoolYearCompleted?: string;