@eeplatform/nuxt-layer-common 1.3.3 → 1.4.0
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 +6 -0
- package/components/EnrollmentForm.vue +106 -27
- 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 +5 -69
- package/package.json +1 -1
- package/types/basic-edu.d.ts +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,12 +4,14 @@
|
|
|
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"
|
|
13
15
|
></v-autocomplete>
|
|
14
16
|
</v-col>
|
|
15
17
|
</v-row>
|
|
@@ -17,12 +19,14 @@
|
|
|
17
19
|
|
|
18
20
|
<v-col cols="3" class="pb-0">
|
|
19
21
|
<v-row no-gutters>
|
|
20
|
-
<InputLabel class="text-capitalize" title="Province"
|
|
22
|
+
<InputLabel class="text-capitalize" title="Province" />
|
|
21
23
|
<v-col cols="12">
|
|
22
24
|
<v-autocomplete
|
|
23
|
-
v-model="
|
|
24
|
-
:
|
|
25
|
-
|
|
25
|
+
v-model="province"
|
|
26
|
+
:items="provinces"
|
|
27
|
+
item-title="name"
|
|
28
|
+
item-value="code"
|
|
29
|
+
:loading="provincesStatus"
|
|
26
30
|
></v-autocomplete>
|
|
27
31
|
</v-col>
|
|
28
32
|
</v-row>
|
|
@@ -30,16 +34,14 @@
|
|
|
30
34
|
|
|
31
35
|
<v-col cols="4" class="pb-0">
|
|
32
36
|
<v-row no-gutters>
|
|
33
|
-
<InputLabel
|
|
34
|
-
class="text-capitalize"
|
|
35
|
-
title="City/Municipality"
|
|
36
|
-
required
|
|
37
|
-
/>
|
|
37
|
+
<InputLabel class="text-capitalize" title="City/Municipality" />
|
|
38
38
|
<v-col cols="12">
|
|
39
39
|
<v-autocomplete
|
|
40
|
-
v-model="
|
|
41
|
-
:
|
|
42
|
-
|
|
40
|
+
v-model="cityMunicipality"
|
|
41
|
+
:items="citiesMunicipalities"
|
|
42
|
+
item-title="name"
|
|
43
|
+
item-value="name"
|
|
44
|
+
:loading="citiesMunicipalitiesStatus"
|
|
43
45
|
></v-autocomplete>
|
|
44
46
|
</v-col>
|
|
45
47
|
</v-row>
|
|
@@ -388,7 +390,7 @@
|
|
|
388
390
|
label="A. Blind"
|
|
389
391
|
hide-details
|
|
390
392
|
density="compact"
|
|
391
|
-
value="Blind"
|
|
393
|
+
value="Visual Impairment(Blind)"
|
|
392
394
|
></v-checkbox>
|
|
393
395
|
</v-col>
|
|
394
396
|
|
|
@@ -398,7 +400,7 @@
|
|
|
398
400
|
label="B. Low vision"
|
|
399
401
|
hide-details
|
|
400
402
|
density="compact"
|
|
401
|
-
value="Low vision"
|
|
403
|
+
value="Visual Impairment(Low vision)"
|
|
402
404
|
></v-checkbox>
|
|
403
405
|
</v-col>
|
|
404
406
|
|
|
@@ -1180,6 +1182,92 @@ const prop = defineProps({
|
|
|
1180
1182
|
import { VMaskInput } from "vuetify/labs/VMaskInput";
|
|
1181
1183
|
const { requiredRule } = useUtils();
|
|
1182
1184
|
|
|
1185
|
+
const { getAll: getAllPSGC } = usePSGC();
|
|
1186
|
+
|
|
1187
|
+
const region = ref("");
|
|
1188
|
+
const regions = ref<Array<Record<string, any>>>([]);
|
|
1189
|
+
|
|
1190
|
+
const { data: getAllRegPSGCData, status: getAllRegionStatus } =
|
|
1191
|
+
await useLazyAsyncData("get-all-psgc-region", () =>
|
|
1192
|
+
getAllPSGC({ type: "Reg" })
|
|
1193
|
+
);
|
|
1194
|
+
|
|
1195
|
+
const regionStatus = computed(() => getAllRegionStatus.value === "pending");
|
|
1196
|
+
|
|
1197
|
+
watchEffect(() => {
|
|
1198
|
+
if (getAllRegPSGCData.value) {
|
|
1199
|
+
regions.value = getAllRegPSGCData.value.items;
|
|
1200
|
+
}
|
|
1201
|
+
});
|
|
1202
|
+
|
|
1203
|
+
const provinces = ref<Array<Record<string, any>>>([]);
|
|
1204
|
+
const province = ref("");
|
|
1205
|
+
|
|
1206
|
+
watch(region, () => {
|
|
1207
|
+
province.value = "";
|
|
1208
|
+
});
|
|
1209
|
+
|
|
1210
|
+
const { data: getAllPSGCProvData, status: getAllProvStatus } =
|
|
1211
|
+
await useLazyAsyncData(
|
|
1212
|
+
"get-all-psgc-provinces",
|
|
1213
|
+
() => getAllPSGC({ type: "Prov", prefix: region.value.slice(0, 2) }),
|
|
1214
|
+
{
|
|
1215
|
+
watch: [region],
|
|
1216
|
+
}
|
|
1217
|
+
);
|
|
1218
|
+
|
|
1219
|
+
const provincesStatus = computed(() => getAllProvStatus.value === "pending");
|
|
1220
|
+
|
|
1221
|
+
watchEffect(() => {
|
|
1222
|
+
if (getAllPSGCProvData.value) {
|
|
1223
|
+
provinces.value = getAllPSGCProvData.value.items;
|
|
1224
|
+
}
|
|
1225
|
+
});
|
|
1226
|
+
|
|
1227
|
+
const citiesMunicipalities = ref<Array<Record<string, any>>>([]);
|
|
1228
|
+
const cityMunicipality = ref("");
|
|
1229
|
+
|
|
1230
|
+
watch(province, () => {
|
|
1231
|
+
cityMunicipality.value = "";
|
|
1232
|
+
});
|
|
1233
|
+
|
|
1234
|
+
const cityMunicipalityPrefix = computed(() => {
|
|
1235
|
+
let prefix = "";
|
|
1236
|
+
if (region.value) {
|
|
1237
|
+
prefix = region.value.slice(0, 2);
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
if (province.value) {
|
|
1241
|
+
prefix = province.value.slice(0, 5);
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
return prefix;
|
|
1245
|
+
});
|
|
1246
|
+
|
|
1247
|
+
const { data: getAllPSGCCityMunData, status: getAllCityMunStatus } =
|
|
1248
|
+
await useLazyAsyncData(
|
|
1249
|
+
`get-all-psgc-citiesMunicipalities-by-prefix-${cityMunicipalityPrefix.value}`,
|
|
1250
|
+
() =>
|
|
1251
|
+
getAllPSGC({
|
|
1252
|
+
type: "City",
|
|
1253
|
+
prefix: cityMunicipalityPrefix.value,
|
|
1254
|
+
limit: 2000,
|
|
1255
|
+
}),
|
|
1256
|
+
{
|
|
1257
|
+
watch: [cityMunicipalityPrefix],
|
|
1258
|
+
}
|
|
1259
|
+
);
|
|
1260
|
+
|
|
1261
|
+
const citiesMunicipalitiesStatus = computed(
|
|
1262
|
+
() => getAllCityMunStatus.value === "pending"
|
|
1263
|
+
);
|
|
1264
|
+
|
|
1265
|
+
watchEffect(() => {
|
|
1266
|
+
if (getAllPSGCCityMunData.value) {
|
|
1267
|
+
citiesMunicipalities.value = getAllPSGCCityMunData.value.items;
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
|
|
1183
1271
|
const regionOptions: string[] = [];
|
|
1184
1272
|
const provinceOptions: string[] = [];
|
|
1185
1273
|
const cityMunicipalityOptions: string[] = [];
|
|
@@ -1204,15 +1292,6 @@ const { data: municipalitiesData } = await useLazyAsyncData(
|
|
|
1204
1292
|
() => getPhilippineMunicipalities()
|
|
1205
1293
|
);
|
|
1206
1294
|
|
|
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
1295
|
const indigenousCommunitiesPhilippines = [
|
|
1217
1296
|
// Luzon (Northern Philippines) - Cordillera Groups (Igorot Subgroups)
|
|
1218
1297
|
"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,16 @@
|
|
|
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,
|
|
40
7
|
} = {}) {
|
|
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,
|
|
8
|
+
return $fetch<Record<string, any>>("/api/basic-education/schools", {
|
|
9
|
+
query: { page, search, status, limit },
|
|
69
10
|
});
|
|
70
11
|
}
|
|
71
12
|
|
|
72
13
|
return {
|
|
73
|
-
addSchool,
|
|
74
|
-
registerSchool,
|
|
75
|
-
getPendingByCreatedBy,
|
|
76
14
|
getAll,
|
|
77
|
-
approvedById,
|
|
78
|
-
bulkAdd,
|
|
79
15
|
};
|
|
80
16
|
}
|
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
|
+
};
|