@eeplatform/nuxt-layer-common 1.3.3 → 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 +12 -0
- package/components/EnrollmentForm.vue +192 -34
- package/composables/useDivision.ts +10 -57
- package/composables/useEnrollment.ts +8 -2
- package/composables/usePSGC.ts +17 -0
- package/composables/useRegion.ts +8 -54
- package/composables/useSchool.ts +6 -69
- package/package.json +1 -1
- package/types/basic-edu.d.ts +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
<v-row>
|
|
5
5
|
<v-col cols="3" class="pb-0">
|
|
6
6
|
<v-row no-gutters>
|
|
7
|
-
<InputLabel class="text-capitalize" title="Region"
|
|
7
|
+
<InputLabel class="text-capitalize" title="Region" />
|
|
8
8
|
<v-col cols="12">
|
|
9
9
|
<v-autocomplete
|
|
10
|
-
v-model="
|
|
11
|
-
:
|
|
12
|
-
|
|
10
|
+
v-model="region"
|
|
11
|
+
:items="regions"
|
|
12
|
+
item-title="name"
|
|
13
|
+
item-value="code"
|
|
14
|
+
:loading="regionStatus"
|
|
15
|
+
:disabled="regionStatus"
|
|
13
16
|
></v-autocomplete>
|
|
14
17
|
</v-col>
|
|
15
18
|
</v-row>
|
|
@@ -17,12 +20,15 @@
|
|
|
17
20
|
|
|
18
21
|
<v-col cols="3" class="pb-0">
|
|
19
22
|
<v-row no-gutters>
|
|
20
|
-
<InputLabel class="text-capitalize" title="Province"
|
|
23
|
+
<InputLabel class="text-capitalize" title="Province" />
|
|
21
24
|
<v-col cols="12">
|
|
22
25
|
<v-autocomplete
|
|
23
|
-
v-model="
|
|
24
|
-
:
|
|
25
|
-
|
|
26
|
+
v-model="province"
|
|
27
|
+
:items="provinces"
|
|
28
|
+
item-title="name"
|
|
29
|
+
item-value="code"
|
|
30
|
+
:loading="provincesStatus"
|
|
31
|
+
:disabled="provincesStatus"
|
|
26
32
|
></v-autocomplete>
|
|
27
33
|
</v-col>
|
|
28
34
|
</v-row>
|
|
@@ -30,17 +36,17 @@
|
|
|
30
36
|
|
|
31
37
|
<v-col cols="4" class="pb-0">
|
|
32
38
|
<v-row no-gutters>
|
|
33
|
-
<InputLabel
|
|
34
|
-
class="text-capitalize"
|
|
35
|
-
title="City/Municipality"
|
|
36
|
-
required
|
|
37
|
-
/>
|
|
39
|
+
<InputLabel class="text-capitalize" title="City/Municipality" />
|
|
38
40
|
<v-col cols="12">
|
|
39
41
|
<v-autocomplete
|
|
40
|
-
v-model="
|
|
41
|
-
:
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
v-model="cityMunicipality"
|
|
43
|
+
:items="citiesMunicipalities"
|
|
44
|
+
item-title="name"
|
|
45
|
+
item-value="code"
|
|
46
|
+
:loading="citiesMunicipalitiesStatus"
|
|
47
|
+
:disabled="citiesMunicipalitiesStatus"
|
|
48
|
+
>
|
|
49
|
+
</v-autocomplete>
|
|
44
50
|
</v-col>
|
|
45
51
|
</v-row>
|
|
46
52
|
</v-col>
|
|
@@ -53,11 +59,40 @@
|
|
|
53
59
|
<v-row no-gutters>
|
|
54
60
|
<InputLabel class="text-capitalize" title="School" required />
|
|
55
61
|
<v-col cols="12">
|
|
56
|
-
<v-
|
|
62
|
+
<v-combobox
|
|
57
63
|
v-model="enrollment.school"
|
|
64
|
+
v-model:search="searchSchool"
|
|
58
65
|
:rules="[requiredRule]"
|
|
59
|
-
:items="
|
|
60
|
-
|
|
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>
|
|
61
96
|
</v-col>
|
|
62
97
|
</v-row>
|
|
63
98
|
</v-col>
|
|
@@ -388,7 +423,7 @@
|
|
|
388
423
|
label="A. Blind"
|
|
389
424
|
hide-details
|
|
390
425
|
density="compact"
|
|
391
|
-
value="Blind"
|
|
426
|
+
value="Visual Impairment(Blind)"
|
|
392
427
|
></v-checkbox>
|
|
393
428
|
</v-col>
|
|
394
429
|
|
|
@@ -398,7 +433,7 @@
|
|
|
398
433
|
label="B. Low vision"
|
|
399
434
|
hide-details
|
|
400
435
|
density="compact"
|
|
401
|
-
value="Low vision"
|
|
436
|
+
value="Visual Impairment(Low vision)"
|
|
402
437
|
></v-checkbox>
|
|
403
438
|
</v-col>
|
|
404
439
|
|
|
@@ -1180,9 +1215,141 @@ const prop = defineProps({
|
|
|
1180
1215
|
import { VMaskInput } from "vuetify/labs/VMaskInput";
|
|
1181
1216
|
const { requiredRule } = useUtils();
|
|
1182
1217
|
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1185
|
-
const
|
|
1218
|
+
const { getAll: getAllPSGC } = usePSGC();
|
|
1219
|
+
|
|
1220
|
+
const region = ref("");
|
|
1221
|
+
const regions = ref<Array<Record<string, any>>>([]);
|
|
1222
|
+
|
|
1223
|
+
const { data: getAllRegPSGCData, status: getAllRegionStatus } =
|
|
1224
|
+
await useLazyAsyncData("get-all-psgc-region", () =>
|
|
1225
|
+
getAllPSGC({ type: "Reg" })
|
|
1226
|
+
);
|
|
1227
|
+
|
|
1228
|
+
const regionStatus = computed(() => getAllRegionStatus.value === "pending");
|
|
1229
|
+
|
|
1230
|
+
watchEffect(() => {
|
|
1231
|
+
if (getAllRegPSGCData.value) {
|
|
1232
|
+
regions.value = getAllRegPSGCData.value.items;
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
|
|
1236
|
+
const provinces = ref<Array<Record<string, any>>>([]);
|
|
1237
|
+
const province = ref("");
|
|
1238
|
+
|
|
1239
|
+
const { data: getAllPSGCProvData, status: getAllProvStatus } =
|
|
1240
|
+
await useLazyAsyncData(
|
|
1241
|
+
"get-all-psgc-provinces",
|
|
1242
|
+
() => getAllPSGC({ type: "Prov", prefix: region.value.slice(0, 2) }),
|
|
1243
|
+
{
|
|
1244
|
+
watch: [region],
|
|
1245
|
+
}
|
|
1246
|
+
);
|
|
1247
|
+
|
|
1248
|
+
const provincesStatus = computed(() => getAllProvStatus.value === "pending");
|
|
1249
|
+
|
|
1250
|
+
watchEffect(() => {
|
|
1251
|
+
if (getAllPSGCProvData.value) {
|
|
1252
|
+
provinces.value = getAllPSGCProvData.value.items;
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
|
|
1256
|
+
const citiesMunicipalities = ref<Array<Record<string, any>>>([]);
|
|
1257
|
+
const cityMunicipality = ref("");
|
|
1258
|
+
|
|
1259
|
+
watch(province, () => {
|
|
1260
|
+
cityMunicipality.value = "";
|
|
1261
|
+
});
|
|
1262
|
+
|
|
1263
|
+
watch(region, () => {
|
|
1264
|
+
province.value = "";
|
|
1265
|
+
cityMunicipality.value = "";
|
|
1266
|
+
});
|
|
1267
|
+
|
|
1268
|
+
const cityMunicipalityPrefix = computed(() => {
|
|
1269
|
+
let prefix = "";
|
|
1270
|
+
if (region.value) {
|
|
1271
|
+
prefix = region.value.slice(0, 2);
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
if (province.value) {
|
|
1275
|
+
prefix = province.value.slice(0, 5);
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
return prefix;
|
|
1279
|
+
});
|
|
1280
|
+
|
|
1281
|
+
const { data: getAllPSGCCityMunData, status: getAllCityMunStatus } =
|
|
1282
|
+
await useLazyAsyncData(
|
|
1283
|
+
`get-all-psgc-citiesMunicipalities-by-prefix-${cityMunicipalityPrefix.value}`,
|
|
1284
|
+
() =>
|
|
1285
|
+
getAllPSGC({
|
|
1286
|
+
type: "City",
|
|
1287
|
+
prefix: cityMunicipalityPrefix.value,
|
|
1288
|
+
limit: 2000,
|
|
1289
|
+
}),
|
|
1290
|
+
{
|
|
1291
|
+
watch: [cityMunicipalityPrefix],
|
|
1292
|
+
}
|
|
1293
|
+
);
|
|
1294
|
+
|
|
1295
|
+
const citiesMunicipalitiesStatus = computed(
|
|
1296
|
+
() => getAllCityMunStatus.value === "pending"
|
|
1297
|
+
);
|
|
1298
|
+
|
|
1299
|
+
watchEffect(() => {
|
|
1300
|
+
if (getAllPSGCCityMunData.value) {
|
|
1301
|
+
citiesMunicipalities.value = getAllPSGCCityMunData.value.items;
|
|
1302
|
+
}
|
|
1303
|
+
});
|
|
1304
|
+
|
|
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
|
+
});
|
|
1186
1353
|
|
|
1187
1354
|
const {
|
|
1188
1355
|
gradeLevels,
|
|
@@ -1204,15 +1371,6 @@ const { data: municipalitiesData } = await useLazyAsyncData(
|
|
|
1204
1371
|
() => getPhilippineMunicipalities()
|
|
1205
1372
|
);
|
|
1206
1373
|
|
|
1207
|
-
const citiesMunicipalities = computed(() => {
|
|
1208
|
-
return [
|
|
1209
|
-
...(citiesData.value || []).map((i: any) => i.name),
|
|
1210
|
-
...(municipalitiesData.value || []).map(
|
|
1211
|
-
(i: any) => `Municipality of ${i.name}`
|
|
1212
|
-
),
|
|
1213
|
-
];
|
|
1214
|
-
});
|
|
1215
|
-
|
|
1216
1374
|
const indigenousCommunitiesPhilippines = [
|
|
1217
1375
|
// Luzon (Northern Philippines) - Cordillera Groups (Igorot Subgroups)
|
|
1218
1376
|
"Ifugao",
|
|
@@ -1,64 +1,17 @@
|
|
|
1
|
-
export default function
|
|
2
|
-
function getAll({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
1
|
+
export default function useRegion() {
|
|
2
|
+
async function getAll({
|
|
3
|
+
page = 1,
|
|
4
|
+
search = "",
|
|
5
|
+
status = "active",
|
|
6
|
+
limit = 20,
|
|
7
|
+
region = "",
|
|
8
|
+
} = {}) {
|
|
9
|
+
return $fetch<Record<string, any>>("/api/basic-education/divisions", {
|
|
10
|
+
query: { page, search, status, limit, region },
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
function getById(id = "") {
|
|
15
|
-
return useNuxtApp().$api<Record<string, any>>(`/api/divisions/id/${id}`, {
|
|
16
|
-
method: "GET",
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function getByName(name = "") {
|
|
21
|
-
return useNuxtApp().$api(`/api/divisions/name/${name}`, {
|
|
22
|
-
method: "GET",
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function createDivision(data: Record<string, any>) {
|
|
27
|
-
return useNuxtApp().$api("/api/divisions", {
|
|
28
|
-
method: "POST",
|
|
29
|
-
body: data,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function updateDivisionField(id: string, field: string, value: string) {
|
|
34
|
-
return useNuxtApp().$api(`/api/divisions/${id}`, {
|
|
35
|
-
method: "PATCH",
|
|
36
|
-
body: { field, value },
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function deleteDivision(id: string) {
|
|
41
|
-
return useNuxtApp().$api(`/api/divisions/${id}`, {
|
|
42
|
-
method: "DELETE",
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const division = ref({
|
|
47
|
-
_id: "",
|
|
48
|
-
name: "",
|
|
49
|
-
region: "",
|
|
50
|
-
regionName: "",
|
|
51
|
-
superintendent: "",
|
|
52
|
-
superintendentName: "",
|
|
53
|
-
});
|
|
54
|
-
|
|
55
14
|
return {
|
|
56
|
-
division,
|
|
57
15
|
getAll,
|
|
58
|
-
getById,
|
|
59
|
-
getByName,
|
|
60
|
-
createDivision,
|
|
61
|
-
updateDivisionField,
|
|
62
|
-
deleteDivision,
|
|
63
16
|
};
|
|
64
17
|
}
|
|
@@ -7,9 +7,7 @@ export default function useEnrollment() {
|
|
|
7
7
|
division: "",
|
|
8
8
|
divisionName: "",
|
|
9
9
|
province: "",
|
|
10
|
-
provincePSGC: "",
|
|
11
10
|
cityMunicipality: "",
|
|
12
|
-
cityMunicipalityPSGC: "",
|
|
13
11
|
schoolYear: "",
|
|
14
12
|
gradeLevel: "",
|
|
15
13
|
learnerInfo: {
|
|
@@ -91,7 +89,15 @@ export default function useEnrollment() {
|
|
|
91
89
|
isCertifiedAndConsented: false,
|
|
92
90
|
});
|
|
93
91
|
|
|
92
|
+
function add(value: TBasicEducEnrForm) {
|
|
93
|
+
return $fetch("/api/basic-education/enrollments", {
|
|
94
|
+
method: "POST",
|
|
95
|
+
body: value,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
94
99
|
return {
|
|
95
100
|
enrollment,
|
|
101
|
+
add,
|
|
96
102
|
};
|
|
97
103
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default function usePSGC() {
|
|
2
|
+
function getAll({
|
|
3
|
+
page = 1,
|
|
4
|
+
limit = 10,
|
|
5
|
+
search = "",
|
|
6
|
+
type = "",
|
|
7
|
+
prefix = "",
|
|
8
|
+
} = {}) {
|
|
9
|
+
return $fetch<Record<string, any>>("/api/psgc", {
|
|
10
|
+
query: { page, limit, search, type, prefix },
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
getAll,
|
|
16
|
+
};
|
|
17
|
+
}
|
package/composables/useRegion.ts
CHANGED
|
@@ -1,62 +1,16 @@
|
|
|
1
1
|
export default function useRegion() {
|
|
2
|
-
function getAll({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
},
|
|
2
|
+
async function getAll({
|
|
3
|
+
page = 1,
|
|
4
|
+
search = "",
|
|
5
|
+
status = "active",
|
|
6
|
+
limit = 20,
|
|
7
|
+
} = {}) {
|
|
8
|
+
return $fetch<Record<string, any>>("/api/basic-education/regions", {
|
|
9
|
+
query: { page, search, status, limit },
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
function getById(id = "") {
|
|
14
|
-
return useNuxtApp().$api<Record<string, any>>(`/api/regions/id/${id}`, {
|
|
15
|
-
method: "GET",
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function getByName(name = "") {
|
|
20
|
-
return useNuxtApp().$api(`/api/regions/name/${name}`, {
|
|
21
|
-
method: "GET",
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function createRegion(data: Record<string, any>) {
|
|
26
|
-
return useNuxtApp().$api("/api/regions", {
|
|
27
|
-
method: "POST",
|
|
28
|
-
body: data,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function updateRegionField(id: string, field: string, value: string) {
|
|
33
|
-
return useNuxtApp().$api(`/api/regions/${id}`, {
|
|
34
|
-
method: "PATCH",
|
|
35
|
-
body: { field, value },
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function deleteRegion(id: string) {
|
|
40
|
-
return useNuxtApp().$api(`/api/regions/${id}`, {
|
|
41
|
-
method: "DELETE",
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const region = ref({
|
|
46
|
-
_id: "",
|
|
47
|
-
name: "",
|
|
48
|
-
director: "",
|
|
49
|
-
directorName: "",
|
|
50
|
-
});
|
|
51
|
-
|
|
52
13
|
return {
|
|
53
|
-
region,
|
|
54
14
|
getAll,
|
|
55
|
-
getById,
|
|
56
|
-
getByName,
|
|
57
|
-
createRegion,
|
|
58
|
-
updateRegionField,
|
|
59
|
-
deleteRegion,
|
|
60
15
|
};
|
|
61
16
|
}
|
|
62
|
-
|
package/composables/useSchool.ts
CHANGED
|
@@ -1,80 +1,17 @@
|
|
|
1
1
|
export default function useSchool() {
|
|
2
|
-
function
|
|
3
|
-
return useNuxtApp().$api<{ message: string }>("/api/schools", {
|
|
4
|
-
method: "POST",
|
|
5
|
-
body: school,
|
|
6
|
-
});
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function registerSchool(school: TSchool) {
|
|
10
|
-
return useNuxtApp().$api("/api/schools/register", {
|
|
11
|
-
method: "POST",
|
|
12
|
-
body: school,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function getPendingByCreatedBy(createdBy: string) {
|
|
17
|
-
return useNuxtApp().$api<Record<string, any>>(
|
|
18
|
-
`/api/schools/createdBy/${createdBy}`,
|
|
19
|
-
{
|
|
20
|
-
method: "GET",
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function approvedById(id: string) {
|
|
26
|
-
return useNuxtApp().$api<Record<string, any>>(
|
|
27
|
-
`/api/schools/approve/${id}`,
|
|
28
|
-
{
|
|
29
|
-
method: "PATCH",
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function getAll({
|
|
2
|
+
async function getAll({
|
|
35
3
|
page = 1,
|
|
36
|
-
status = "active",
|
|
37
4
|
search = "",
|
|
38
|
-
|
|
39
|
-
|
|
5
|
+
status = "active",
|
|
6
|
+
limit = 20,
|
|
7
|
+
psgc = "",
|
|
40
8
|
} = {}) {
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
query: { page, status, search, org, app },
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function bulkAdd(file: File | null, region: string, division: string) {
|
|
48
|
-
if (!file) {
|
|
49
|
-
throw new Error("File not found.");
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const formData = new FormData();
|
|
53
|
-
formData.append("file", file);
|
|
54
|
-
formData.append("region", region);
|
|
55
|
-
formData.append("division", division);
|
|
56
|
-
|
|
57
|
-
return useNuxtApp().$api<{
|
|
58
|
-
message: string;
|
|
59
|
-
details: {
|
|
60
|
-
successful: number;
|
|
61
|
-
failed: number;
|
|
62
|
-
total: number;
|
|
63
|
-
totalSizeMB: number;
|
|
64
|
-
errors: string[];
|
|
65
|
-
};
|
|
66
|
-
}>("/api/schools/bulk", {
|
|
67
|
-
method: "POST",
|
|
68
|
-
body: formData,
|
|
9
|
+
return $fetch<Record<string, any>>("/api/basic-education/schools", {
|
|
10
|
+
query: { page, search, status, limit, psgc },
|
|
69
11
|
});
|
|
70
12
|
}
|
|
71
13
|
|
|
72
14
|
return {
|
|
73
|
-
addSchool,
|
|
74
|
-
registerSchool,
|
|
75
|
-
getPendingByCreatedBy,
|
|
76
15
|
getAll,
|
|
77
|
-
approvedById,
|
|
78
|
-
bulkAdd,
|
|
79
16
|
};
|
|
80
17
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare type TRegion = {
|
|
2
|
+
_id?: string;
|
|
3
|
+
name: string;
|
|
4
|
+
director?: string;
|
|
5
|
+
directorName?: string;
|
|
6
|
+
status: string;
|
|
7
|
+
createdAt?: string;
|
|
8
|
+
updatedAt?: string;
|
|
9
|
+
deletedAt?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
declare type TDivision = {
|
|
13
|
+
_id?: string;
|
|
14
|
+
name: string;
|
|
15
|
+
region?: string;
|
|
16
|
+
regionName?: string;
|
|
17
|
+
superintendent?: string;
|
|
18
|
+
superintendentName?: string;
|
|
19
|
+
status: string;
|
|
20
|
+
createdAt?: string;
|
|
21
|
+
updatedAt?: string;
|
|
22
|
+
deletedAt?: string;
|
|
23
|
+
};
|