@eeplatform/nuxt-layer-common 1.4.0 → 1.4.1

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,11 @@
1
1
  # @eeplatform/nuxt-layer-common
2
2
 
3
+ ## 1.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 27be86a: Revise enrollment form
8
+
3
9
  ## 1.4.0
4
10
 
5
11
  ### Minor Changes
@@ -12,6 +12,7 @@
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>
@@ -27,6 +28,7 @@
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>
@@ -40,9 +42,11 @@
40
42
  v-model="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
62
+ <v-combobox
59
63
  v-model="enrollment.school"
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>
@@ -1203,10 +1236,6 @@ watchEffect(() => {
1203
1236
  const provinces = ref<Array<Record<string, any>>>([]);
1204
1237
  const province = ref("");
1205
1238
 
1206
- watch(region, () => {
1207
- province.value = "";
1208
- });
1209
-
1210
1239
  const { data: getAllPSGCProvData, status: getAllProvStatus } =
1211
1240
  await useLazyAsyncData(
1212
1241
  "get-all-psgc-provinces",
@@ -1231,6 +1260,11 @@ watch(province, () => {
1231
1260
  cityMunicipality.value = "";
1232
1261
  });
1233
1262
 
1263
+ watch(region, () => {
1264
+ province.value = "";
1265
+ cityMunicipality.value = "";
1266
+ });
1267
+
1234
1268
  const cityMunicipalityPrefix = computed(() => {
1235
1269
  let prefix = "";
1236
1270
  if (region.value) {
@@ -1268,9 +1302,54 @@ watchEffect(() => {
1268
1302
  }
1269
1303
  });
1270
1304
 
1271
- const regionOptions: string[] = [];
1272
- const provinceOptions: string[] = [];
1273
- const cityMunicipalityOptions: string[] = [];
1305
+ const schools = ref<Array<Record<string, any>>>([]);
1306
+ const searchSchool = ref("");
1307
+
1308
+ const { getAll: getAllSchools } = useSchool();
1309
+
1310
+ const psgcSchool = computed(() => {
1311
+ let prefix = "";
1312
+ if (region.value) {
1313
+ prefix = region.value.slice(0, 2);
1314
+ }
1315
+
1316
+ if (province.value) {
1317
+ prefix = province.value.slice(0, 5);
1318
+ }
1319
+
1320
+ if (cityMunicipality.value) {
1321
+ prefix = cityMunicipality.value.slice(0, 7);
1322
+ }
1323
+
1324
+ return prefix;
1325
+ });
1326
+
1327
+ const {
1328
+ data: getAllSchoolsData,
1329
+ status: getAllSchoolReqStatus,
1330
+ refresh: refreshSchools,
1331
+ } = await useLazyAsyncData(
1332
+ `get-all-schools-by-${psgcSchool.value ?? "psgc"}-${
1333
+ searchSchool.value ?? "search"
1334
+ }`,
1335
+ () =>
1336
+ getAllSchools({
1337
+ limit: 100,
1338
+ psgc: psgcSchool.value,
1339
+ search: searchSchool.value,
1340
+ }),
1341
+ {
1342
+ watch: [psgcSchool],
1343
+ }
1344
+ );
1345
+
1346
+ const schoolsStatus = computed(() => getAllSchoolReqStatus.value === "pending");
1347
+
1348
+ watchEffect(() => {
1349
+ if (getAllSchoolsData.value) {
1350
+ schools.value = getAllSchoolsData.value.items;
1351
+ }
1352
+ });
1274
1353
 
1275
1354
  const {
1276
1355
  gradeLevels,
@@ -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.1",
6
6
  "main": "./nuxt.config.ts",
7
7
  "publishConfig": {
8
8
  "access": "public"