@eeplatform/nuxt-layer-common 1.4.0 → 1.4.2

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.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 75c5e38: Revise EnrollmentForm.vue implementation
8
+
9
+ ## 1.4.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 27be86a: Revise enrollment form
14
+
3
15
  ## 1.4.0
4
16
 
5
17
  ### Minor Changes
@@ -7,11 +7,12 @@
7
7
  <InputLabel class="text-capitalize" title="Region" />
8
8
  <v-col cols="12">
9
9
  <v-autocomplete
10
- v-model="region"
10
+ v-model="enrollment.region"
11
11
  :items="regions"
12
12
  item-title="name"
13
13
  item-value="code"
14
14
  :loading="regionStatus"
15
+ :disabled="regionStatus"
15
16
  ></v-autocomplete>
16
17
  </v-col>
17
18
  </v-row>
@@ -22,11 +23,12 @@
22
23
  <InputLabel class="text-capitalize" title="Province" />
23
24
  <v-col cols="12">
24
25
  <v-autocomplete
25
- v-model="province"
26
+ v-model="enrollment.province"
26
27
  :items="provinces"
27
28
  item-title="name"
28
29
  item-value="code"
29
30
  :loading="provincesStatus"
31
+ :disabled="provincesStatus"
30
32
  ></v-autocomplete>
31
33
  </v-col>
32
34
  </v-row>
@@ -37,12 +39,14 @@
37
39
  <InputLabel class="text-capitalize" title="City/Municipality" />
38
40
  <v-col cols="12">
39
41
  <v-autocomplete
40
- v-model="cityMunicipality"
42
+ v-model="enrollment.cityMunicipality"
41
43
  :items="citiesMunicipalities"
42
44
  item-title="name"
43
- item-value="name"
45
+ item-value="code"
44
46
  :loading="citiesMunicipalitiesStatus"
45
- ></v-autocomplete>
47
+ :disabled="citiesMunicipalitiesStatus"
48
+ >
49
+ </v-autocomplete>
46
50
  </v-col>
47
51
  </v-row>
48
52
  </v-col>
@@ -55,11 +59,40 @@
55
59
  <v-row no-gutters>
56
60
  <InputLabel class="text-capitalize" title="School" required />
57
61
  <v-col cols="12">
58
- <v-autocomplete
59
- v-model="enrollment.school"
62
+ <v-combobox
63
+ v-model="selectedSchool"
64
+ v-model:search="searchSchool"
60
65
  :rules="[requiredRule]"
61
- :items="gradeLevels"
62
- ></v-autocomplete>
66
+ :items="schools"
67
+ item-title="name"
68
+ item-value="id"
69
+ :loading="schoolsStatus"
70
+ :disabled="schoolsStatus"
71
+ :hide-no-data="false"
72
+ >
73
+ <template v-slot:no-data>
74
+ <v-list-item>
75
+ <v-list-item-title>
76
+ No results matching "<strong>{{ searchSchool }}</strong
77
+ >". Click the search button and try again.
78
+ </v-list-item-title>
79
+ </v-list-item>
80
+ </template>
81
+
82
+ <template #append>
83
+ <v-btn
84
+ variant="tonal"
85
+ :disabled="schoolsStatus"
86
+ class="text-none"
87
+ size="48"
88
+ width="100"
89
+ icon
90
+ @click="refreshSchools()"
91
+ >
92
+ <v-icon>ph:magnifying-glass-bold</v-icon>
93
+ </v-btn>
94
+ </template>
95
+ </v-combobox>
63
96
  </v-col>
64
97
  </v-row>
65
98
  </v-col>
@@ -98,14 +131,14 @@
98
131
 
99
132
  <v-col cols="12">
100
133
  <v-checkbox
101
- v-model="returningLearner"
134
+ v-model="enrollment.returningLearner"
102
135
  label="Returning Learner(Balik-Aral)"
103
136
  hide-details
104
137
  density="compact"
105
138
  ></v-checkbox>
106
139
  </v-col>
107
140
 
108
- <v-col v-if="!returningLearner" cols="12">
141
+ <v-col v-if="!enrollment.returningLearner" cols="12">
109
142
  <v-row no-gutters>
110
143
  <v-col cols="12" class="mt-4">
111
144
  <v-row>
@@ -129,14 +162,14 @@
129
162
  <InputLabel
130
163
  class="text-capitalize"
131
164
  title="Leaner Reference Number"
132
- required
165
+ :required="enrollment.returningLearner"
133
166
  />
134
167
  <v-col cols="12">
135
- <v-text-field
136
- v-model="enrollment.learnerInfo.learnerReferenceNumber"
137
- :rules="[requiredRule]"
138
- type="number"
139
- ></v-text-field>
168
+ <v-mask-input
169
+ v-model="enrollment.learnerInfo.lrn"
170
+ :rules="enrollment.returningLearner ? [requiredRule] : []"
171
+ mask="####-####-####"
172
+ ></v-mask-input>
140
173
  </v-col>
141
174
  </v-row>
142
175
  </v-col>
@@ -276,6 +309,8 @@
276
309
  v-model="enrollment.learnerInfo.placeOfBirth"
277
310
  :rules="[requiredRule]"
278
311
  :items="citiesMunicipalities"
312
+ item-title="name"
313
+ items-value="name"
279
314
  :hide-no-data="false"
280
315
  >
281
316
  <template v-slot:no-data>
@@ -365,14 +400,14 @@
365
400
 
366
401
  <v-col cols="12">
367
402
  <v-checkbox
368
- v-model="withDisability"
403
+ v-model="enrollment.learnerInfo.withDisability"
369
404
  label="Learner with Disability"
370
405
  hide-details
371
406
  density="compact"
372
407
  ></v-checkbox>
373
408
  </v-col>
374
409
 
375
- <v-col v-if="withDisability" cols="12">
410
+ <v-col v-if="enrollment.learnerInfo.withDisability" cols="12">
376
411
  <v-row no-gutters>
377
412
  <v-col cols="12">
378
413
  <v-checkbox
@@ -1056,6 +1091,75 @@
1056
1091
  </v-col>
1057
1092
  </v-row>
1058
1093
  </v-col>
1094
+
1095
+ <v-col v-if="isSeniorHighSchool" cols="12" class="mt-2">
1096
+ <v-row no-gutters>
1097
+ <v-col cols="12">
1098
+ <span class="font-weight-bold text-subtitle-1">
1099
+ For Learners in Senior High School
1100
+ </span>
1101
+ </v-col>
1102
+
1103
+ <v-col v-if="enrollment.seniorHighInfo" cols="12">
1104
+ <v-row no-gutters>
1105
+ <v-col cols="12" class="mt-4">
1106
+ <v-row no-gutters>
1107
+ <InputLabel
1108
+ class="text-capitalize"
1109
+ title="Semester"
1110
+ required
1111
+ />
1112
+ <v-col cols="12">
1113
+ <v-radio-group
1114
+ v-model="enrollment.seniorHighInfo.semester"
1115
+ density="compact"
1116
+ >
1117
+ <v-radio label="1st" value="1st"></v-radio>
1118
+ <v-radio label="2nd" value="2nd"></v-radio>
1119
+ </v-radio-group>
1120
+ </v-col>
1121
+ </v-row>
1122
+ </v-col>
1123
+
1124
+ <v-col cols="12">
1125
+ <v-row>
1126
+ <v-col cols="4">
1127
+ <v-row no-gutters>
1128
+ <InputLabel
1129
+ class="text-capitalize"
1130
+ title="Track"
1131
+ required
1132
+ />
1133
+ <v-col cols="12">
1134
+ <v-autocomplete
1135
+ v-model="enrollment.seniorHighInfo.track"
1136
+ :items="tracks"
1137
+ ></v-autocomplete>
1138
+ </v-col>
1139
+ </v-row>
1140
+ </v-col>
1141
+
1142
+ <v-col cols="6">
1143
+ <v-row no-gutters>
1144
+ <InputLabel
1145
+ class="text-capitalize"
1146
+ title="Strand"
1147
+ required
1148
+ />
1149
+ <v-col cols="12">
1150
+ <v-autocomplete
1151
+ v-model="enrollment.seniorHighInfo.strand"
1152
+ :items="selectedTrackStrands"
1153
+ ></v-autocomplete>
1154
+ </v-col>
1155
+ </v-row>
1156
+ </v-col>
1157
+ </v-row>
1158
+ </v-col>
1159
+ </v-row>
1160
+ </v-col>
1161
+ </v-row>
1162
+ </v-col>
1059
1163
  </v-row>
1060
1164
  </v-col>
1061
1165
 
@@ -1182,6 +1286,10 @@ const prop = defineProps({
1182
1286
  import { VMaskInput } from "vuetify/labs/VMaskInput";
1183
1287
  const { requiredRule } = useUtils();
1184
1288
 
1289
+ const enrollment = defineModel<TBasicEducEnrForm>({
1290
+ default: () => useEnrollment().enrollment,
1291
+ });
1292
+
1185
1293
  const { getAll: getAllPSGC } = usePSGC();
1186
1294
 
1187
1295
  const region = ref("");
@@ -1203,10 +1311,6 @@ watchEffect(() => {
1203
1311
  const provinces = ref<Array<Record<string, any>>>([]);
1204
1312
  const province = ref("");
1205
1313
 
1206
- watch(region, () => {
1207
- province.value = "";
1208
- });
1209
-
1210
1314
  const { data: getAllPSGCProvData, status: getAllProvStatus } =
1211
1315
  await useLazyAsyncData(
1212
1316
  "get-all-psgc-provinces",
@@ -1231,6 +1335,11 @@ watch(province, () => {
1231
1335
  cityMunicipality.value = "";
1232
1336
  });
1233
1337
 
1338
+ watch(region, () => {
1339
+ province.value = "";
1340
+ cityMunicipality.value = "";
1341
+ });
1342
+
1234
1343
  const cityMunicipalityPrefix = computed(() => {
1235
1344
  let prefix = "";
1236
1345
  if (region.value) {
@@ -1268,30 +1377,114 @@ watchEffect(() => {
1268
1377
  }
1269
1378
  });
1270
1379
 
1271
- const regionOptions: string[] = [];
1272
- const provinceOptions: string[] = [];
1273
- const cityMunicipalityOptions: string[] = [];
1380
+ const schools = ref<Array<Record<string, any>>>([]);
1381
+ const searchSchool = ref("");
1274
1382
 
1275
- const {
1276
- gradeLevels,
1277
- generateSchoolYears,
1278
- getPhilippineCities,
1279
- getPhilippineMunicipalities,
1280
- motherTongueOptions,
1281
- } = useBasicEdu();
1383
+ const { getAll: getAllSchools } = useSchool();
1282
1384
 
1283
- const effectiveSchoolYearOptions = generateSchoolYears();
1284
- const lastSchoolYearOptions = generateSchoolYears(50).reverse();
1385
+ const selectedCity = computed(() => enrollment.value.cityMunicipality);
1386
+
1387
+ const psgcSchool = computed(() => {
1388
+ let prefix = "";
1389
+ if (region.value) {
1390
+ prefix = region.value.slice(0, 2);
1391
+ }
1392
+
1393
+ if (province.value) {
1394
+ prefix = province.value.slice(0, 5);
1395
+ }
1285
1396
 
1286
- const { data: citiesData } = await useLazyAsyncData("getCities", () =>
1287
- getPhilippineCities()
1397
+ if (selectedCity.value) {
1398
+ prefix = selectedCity.value.slice(0, 7);
1399
+ }
1400
+
1401
+ return prefix;
1402
+ });
1403
+
1404
+ const {
1405
+ data: getAllSchoolsData,
1406
+ status: getAllSchoolReqStatus,
1407
+ refresh: refreshSchools,
1408
+ } = await useLazyAsyncData(
1409
+ `get-all-schools-by-${psgcSchool.value ?? "psgc"}-${
1410
+ searchSchool.value ?? "search"
1411
+ }`,
1412
+ () =>
1413
+ getAllSchools({
1414
+ limit: 100,
1415
+ psgc: psgcSchool.value,
1416
+ search: searchSchool.value,
1417
+ }),
1418
+ {
1419
+ watch: [psgcSchool],
1420
+ }
1288
1421
  );
1289
1422
 
1290
- const { data: municipalitiesData } = await useLazyAsyncData(
1291
- "getMunicipalities",
1292
- () => getPhilippineMunicipalities()
1423
+ const schoolsStatus = computed(() => getAllSchoolReqStatus.value === "pending");
1424
+
1425
+ watchEffect(() => {
1426
+ if (getAllSchoolsData.value) {
1427
+ schools.value = getAllSchoolsData.value.items;
1428
+ }
1429
+ });
1430
+
1431
+ const selectedSchool = ref<TSchool>({
1432
+ id: "",
1433
+ name: "",
1434
+ });
1435
+
1436
+ watch(selectedSchool, (val) => {
1437
+ if (val.id) {
1438
+ enrollment.value.school = val.id;
1439
+ }
1440
+
1441
+ enrollment.value.cityMunicipality = val.cityMunicipalityPSGC ?? "";
1442
+
1443
+ if (val.province) {
1444
+ enrollment.value.province = val.province;
1445
+ }
1446
+
1447
+ const regionPSGC = val.cityMunicipalityPSGC
1448
+ ? val.cityMunicipalityPSGC.slice(0, 2) + "00000000"
1449
+ : "";
1450
+
1451
+ if (val.region && regionPSGC) {
1452
+ enrollment.value.region = regionPSGC;
1453
+ }
1454
+
1455
+ if (val.regionName) {
1456
+ enrollment.value.regionName = val.regionName;
1457
+ }
1458
+
1459
+ if (val.division) {
1460
+ enrollment.value.division = val.cityMunicipalityPSGC
1461
+ ? val.cityMunicipalityPSGC.slice(0, 5) + "00000"
1462
+ : "";
1463
+ }
1464
+
1465
+ if (val.divisionName) {
1466
+ enrollment.value.divisionName = val.divisionName;
1467
+ }
1468
+ });
1469
+
1470
+ const { gradeLevels, generateSchoolYears, motherTongueOptions, tracks } =
1471
+ useBasicEdu();
1472
+
1473
+ const selectedTrackStrands = computed(
1474
+ () =>
1475
+ tracks.find(
1476
+ (track) => track.value === enrollment.value.seniorHighInfo?.track
1477
+ )?.strands || []
1293
1478
  );
1294
1479
 
1480
+ const isSeniorHighSchool = computed(() => {
1481
+ const gradeLevel = enrollment.value.gradeLevel;
1482
+ return ["grade-11", "grade-12"].includes(gradeLevel);
1483
+ });
1484
+
1485
+ const effectiveSchoolYearOptions = generateSchoolYears();
1486
+ const lastSchoolYearOptions = generateSchoolYears(50).reverse();
1487
+
1295
1488
  const indigenousCommunitiesPhilippines = [
1296
1489
  // Luzon (Northern Philippines) - Cordillera Groups (Igorot Subgroups)
1297
1490
  "Ifugao",
@@ -1335,8 +1528,6 @@ const indigenousCommunitiesPhilippines = [
1335
1528
  "Sama-Bajau",
1336
1529
  ];
1337
1530
 
1338
- const returningLearner = ref(false);
1339
- const withDisability = ref(false);
1340
1531
  const sameAsCurrentAddress = ref(false);
1341
1532
  const fatherLegalGuardianSame = ref(false);
1342
1533
  const motherLegalGuardianSame = ref(false);
@@ -1351,14 +1542,11 @@ const alternativeLearning = [
1351
1542
  "Homeschooling",
1352
1543
  ];
1353
1544
 
1354
- const enrollment = defineModel<TBasicEducEnrForm>({
1355
- default: () => useEnrollment().enrollment,
1356
- });
1357
-
1358
- watch(returningLearner, (val) => {
1545
+ watch(enrollment, (val) => {
1359
1546
  if (val) {
1547
+ enrollment.value.returningLearner = false;
1360
1548
  enrollment.value.learnerInfo.psaBirthCertificateNo = "";
1361
- enrollment.value.learnerInfo.learnerReferenceNumber = "";
1549
+ enrollment.value.learnerInfo.lrn = "";
1362
1550
  enrollment.value.learnerInfo.firstName = "";
1363
1551
  enrollment.value.learnerInfo.middleName = "";
1364
1552
  enrollment.value.learnerInfo.lastName = "";
@@ -1368,6 +1556,7 @@ watch(returningLearner, (val) => {
1368
1556
  enrollment.value.learnerInfo.sex = "";
1369
1557
  enrollment.value.learnerInfo.motherTongue = "";
1370
1558
  enrollment.value.learnerInfo.age = 0;
1559
+ enrollment.value.learnerInfo.withDisability = false;
1371
1560
  enrollment.value.learnerInfo.disabilities = [];
1372
1561
  enrollment.value.learnerInfo.indigenousCommunity = "";
1373
1562
  enrollment.value.learnerInfo.fourPsHouseholdId = "";
@@ -1471,6 +1660,7 @@ watchEffect(() => {
1471
1660
  });
1472
1661
 
1473
1662
  import { useMask } from "vuetify";
1663
+ import { fa } from "zod/v4/locales";
1474
1664
 
1475
1665
  watchEffect(() => {
1476
1666
  const mask = useMask({ mask: "##/##/####" });
@@ -8,40 +8,42 @@ export default function useEnrollment() {
8
8
  divisionName: "",
9
9
  province: "",
10
10
  cityMunicipality: "",
11
- schoolYear: "",
12
- gradeLevel: "",
11
+ schoolYear: "2025-2026",
12
+ gradeLevel: "K1",
13
+ returningLearner: false,
13
14
  learnerInfo: {
14
15
  psaBirthCertificateNo: "",
15
- learnerReferenceNumber: "",
16
- firstName: "",
16
+ lrn: "123123123123",
17
+ firstName: "John",
17
18
  middleName: "",
18
- lastName: "",
19
+ lastName: "Doe",
19
20
  extensionName: "",
20
- birthDate: "",
21
- placeOfBirth: "",
22
- sex: "",
23
- motherTongue: "",
24
- age: 0,
21
+ birthDate: "01012022",
22
+ placeOfBirth: "Altavas",
23
+ sex: "Male",
24
+ motherTongue: "Ilocano",
25
+ age: 3,
26
+ withDisability: false,
25
27
  disabilities: [],
26
28
  indigenousCommunity: "",
27
29
  fourPsHouseholdId: "",
28
30
  },
29
31
  parentGuardianInfo: {
30
32
  father: {
31
- firstName: "",
32
- lastName: "",
33
+ firstName: "Papa",
34
+ lastName: "Papa",
33
35
  middleName: "",
34
36
  contactNumber: "",
35
37
  },
36
38
  mother: {
37
- firstName: "",
38
- lastName: "",
39
+ firstName: "Mama",
40
+ lastName: "Mama",
39
41
  middleName: "",
40
42
  contactNumber: "",
41
43
  },
42
44
  legalGuardian: {
43
- firstName: "",
44
- lastName: "",
45
+ firstName: "Papa",
46
+ lastName: "Papa",
45
47
  middleName: "",
46
48
  contactNumber: "",
47
49
  },
@@ -51,21 +53,21 @@ export default function useEnrollment() {
51
53
  houseNumber: "",
52
54
  streetName: "",
53
55
  sitio: "",
54
- barangay: "",
55
- municipalityCity: "",
56
- province: "",
56
+ barangay: "bgy",
57
+ municipalityCity: "sample",
58
+ province: "sample",
57
59
  country: "Philippines",
58
- zipCode: "",
60
+ zipCode: "1111",
59
61
  },
60
62
  permanent: {
61
63
  houseNumber: "",
62
64
  streetName: "",
63
65
  sitio: "",
64
- barangay: "",
65
- municipalityCity: "",
66
- province: "",
67
- country: "",
68
- zipCode: "",
66
+ barangay: "bgy",
67
+ municipalityCity: "sample",
68
+ province: "sample",
69
+ country: "Philippines",
70
+ zipCode: "1111",
69
71
  },
70
72
  },
71
73
  returningLearnerInfo: {
@@ -74,19 +76,10 @@ export default function useEnrollment() {
74
76
  lastSchoolAttended: "",
75
77
  lastSchoolId: "",
76
78
  },
77
- seniorHighInfo: {
78
- track: "",
79
- strand: "",
80
- semester: "",
81
- },
82
- preferredLearningModalities: [],
83
- lastGradeLevelCompleted: "",
84
- lastSchoolYearCompleted: "",
85
- lastSchoolAttended: "",
86
- lastSchoolId: "",
79
+ seniorHighInfo: { track: "", strand: "", semester: "" },
87
80
  remarks: "",
88
- alternativeLearningOptions: [],
89
- isCertifiedAndConsented: false,
81
+ alternativeLearningOptions: ["Online"],
82
+ isCertifiedAndConsented: true,
90
83
  });
91
84
 
92
85
  function add(value: TBasicEducEnrForm) {
@@ -4,9 +4,10 @@ export default function useSchool() {
4
4
  search = "",
5
5
  status = "active",
6
6
  limit = 20,
7
+ psgc = "",
7
8
  } = {}) {
8
9
  return $fetch<Record<string, any>>("/api/basic-education/schools", {
9
- query: { page, search, status, limit },
10
+ query: { page, search, status, limit, psgc },
10
11
  });
11
12
  }
12
13
 
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.4.0",
5
+ "version": "1.4.2",
6
6
  "main": "./nuxt.config.ts",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -12,12 +12,12 @@ declare type TBasicEducEnrForm = {
12
12
  schoolName?: string;
13
13
  schoolYear: string; // e.g., "2025-2026"
14
14
  gradeLevel: string; // e.g., "Grade 7"
15
+ returningLearner: boolean;
15
16
  learnerInfo: EnrLearnerInfo;
16
17
  parentGuardianInfo: EnrParentGuardianInfo;
17
18
  address: AddressInformation;
18
19
  returningLearnerInfo?: EnrReturningLearnerInfo;
19
20
  seniorHighInfo?: EnrSeniorHighInformation;
20
- preferredLearningModalities?: string[];
21
21
  lastGradeLevelCompleted?: string;
22
22
  lastSchoolYearCompleted?: string;
23
23
  lastSchoolAttended?: string;
@@ -37,7 +37,7 @@ declare type TBasicEducEnrForm = {
37
37
 
38
38
  declare type EnrLearnerInfo = {
39
39
  psaBirthCertificateNo?: string;
40
- learnerReferenceNumber?: string; // Learner Reference Number
40
+ lrn?: string; // Learner Reference Number
41
41
  lastName: string;
42
42
  firstName: string;
43
43
  middleName?: string;
@@ -49,6 +49,7 @@ declare type EnrLearnerInfo = {
49
49
  motherTongue?: string;
50
50
  fourPsHouseholdId?: string;
51
51
  indigenousCommunity?: string;
52
+ withDisability: boolean;
52
53
  disabilities?: string[];
53
54
  };
54
55
 
package/types/school.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  declare type TSchool = {
2
2
  _id?: string;
3
- id?: string;
3
+ id: string;
4
4
  name: string;
5
5
  country?: string;
6
6
  address?: string;