@eeplatform/nuxt-layer-common 1.6.0 → 1.7.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/ConfirmPrompt.vue +73 -0
- package/components/EnrollmentForm.vue +59 -24
- package/components/Layout/NavigationDrawer.vue +3 -0
- package/composables/{useCurriculum.ts → useGradeLevel.ts} +4 -11
- package/package.json +2 -2
- package/types/curriculum.d.ts +2 -0
- package/types/enrollment.d.ts +1 -0
- package/types/grade-level.d.ts +20 -0
- package/components/Curriculum.vue +0 -269
- package/components/CurriculumForm.vue +0 -347
- package/components/CurriculumSubject.vue +0 -273
- package/components/CurriculumSubjectForm.vue +0 -597
- package/composables/useCurriculumSubject.ts +0 -58
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-card width="100%">
|
|
3
|
+
<v-toolbar density="compact" class="pl-4">
|
|
4
|
+
<span class="font-weight-medium text-h5 text-capitalize">
|
|
5
|
+
Delete {{ localProps.title }}
|
|
6
|
+
</span>
|
|
7
|
+
</v-toolbar>
|
|
8
|
+
|
|
9
|
+
<v-card-text>
|
|
10
|
+
<p class="text-subtitle-2 text-center">
|
|
11
|
+
Are you sure you want to delete this
|
|
12
|
+
{{ localProps.title.toLowerCase() }}? This action cannot be undone.
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<v-row v-if="message" no-gutters justify="center" class="mt-4">
|
|
16
|
+
<span class="text-caption text-error text-center">
|
|
17
|
+
{{ message }}
|
|
18
|
+
</span>
|
|
19
|
+
</v-row>
|
|
20
|
+
</v-card-text>
|
|
21
|
+
|
|
22
|
+
<v-toolbar density="compact">
|
|
23
|
+
<v-row no-gutters>
|
|
24
|
+
<v-col cols="6">
|
|
25
|
+
<v-btn
|
|
26
|
+
tile
|
|
27
|
+
block
|
|
28
|
+
size="48"
|
|
29
|
+
variant="text"
|
|
30
|
+
class="text-none"
|
|
31
|
+
@click="emits('cancel')"
|
|
32
|
+
:disabled="localProps.disabled"
|
|
33
|
+
>
|
|
34
|
+
Cancel
|
|
35
|
+
</v-btn>
|
|
36
|
+
</v-col>
|
|
37
|
+
<v-col cols="6">
|
|
38
|
+
<v-btn
|
|
39
|
+
tile
|
|
40
|
+
block
|
|
41
|
+
size="48"
|
|
42
|
+
color="black"
|
|
43
|
+
variant="flat"
|
|
44
|
+
class="text-none"
|
|
45
|
+
@click="emits('confirm')"
|
|
46
|
+
:disabled="localProps.disabled"
|
|
47
|
+
>
|
|
48
|
+
Delete {{ localProps.title }}
|
|
49
|
+
</v-btn>
|
|
50
|
+
</v-col>
|
|
51
|
+
</v-row>
|
|
52
|
+
</v-toolbar>
|
|
53
|
+
</v-card>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script setup lang="ts">
|
|
57
|
+
const localProps = defineProps({
|
|
58
|
+
title: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: "Title",
|
|
61
|
+
},
|
|
62
|
+
message: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: "",
|
|
65
|
+
},
|
|
66
|
+
disabled: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const emits = defineEmits(["cancel", "confirm"]);
|
|
73
|
+
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-row no-gutters>
|
|
3
|
-
<v-col cols="12" class="mb-4">
|
|
3
|
+
<v-col v-if="prop.selfService" cols="12" class="mb-4">
|
|
4
4
|
<v-row>
|
|
5
5
|
<v-col cols="3" class="pb-0">
|
|
6
6
|
<v-row no-gutters>
|
|
@@ -53,19 +53,20 @@
|
|
|
53
53
|
</v-row>
|
|
54
54
|
</v-col>
|
|
55
55
|
|
|
56
|
-
<v-col cols="12" class="mb-4">
|
|
56
|
+
<v-col v-if="prop.selfService" cols="12" class="mb-4">
|
|
57
57
|
<v-row>
|
|
58
58
|
<v-col cols="6" class="pb-0">
|
|
59
59
|
<v-row no-gutters>
|
|
60
60
|
<InputLabel class="text-capitalize" title="School" required />
|
|
61
61
|
<v-col cols="12">
|
|
62
62
|
<v-combobox
|
|
63
|
-
v-model="
|
|
63
|
+
v-model="enrollment.schoolId"
|
|
64
64
|
v-model:search="searchSchool"
|
|
65
65
|
:rules="[requiredRule]"
|
|
66
66
|
:items="schools"
|
|
67
67
|
item-title="name"
|
|
68
68
|
item-value="id"
|
|
69
|
+
:return-object="false"
|
|
69
70
|
:loading="schoolsStatus"
|
|
70
71
|
:disabled="schoolsStatus"
|
|
71
72
|
:hide-no-data="false"
|
|
@@ -121,7 +122,7 @@
|
|
|
121
122
|
<v-autocomplete
|
|
122
123
|
v-model="enrollment.gradeLevel"
|
|
123
124
|
:rules="[requiredRule]"
|
|
124
|
-
:items="
|
|
125
|
+
:items="gradeLevelOffering"
|
|
125
126
|
></v-autocomplete>
|
|
126
127
|
</v-col>
|
|
127
128
|
</v-row>
|
|
@@ -1281,6 +1282,10 @@ const prop = defineProps({
|
|
|
1281
1282
|
type: Boolean,
|
|
1282
1283
|
default: false,
|
|
1283
1284
|
},
|
|
1285
|
+
school: {
|
|
1286
|
+
type: String,
|
|
1287
|
+
default: "",
|
|
1288
|
+
},
|
|
1284
1289
|
});
|
|
1285
1290
|
|
|
1286
1291
|
import { VMaskInput } from "vuetify/labs/VMaskInput";
|
|
@@ -1292,6 +1297,10 @@ const enrollment = defineModel<TTLearner>({
|
|
|
1292
1297
|
|
|
1293
1298
|
const { cookieConfig } = useRuntimeConfig().public;
|
|
1294
1299
|
|
|
1300
|
+
if (prop.school) {
|
|
1301
|
+
enrollment.value.school = prop.school ?? "school";
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1295
1304
|
enrollment.value.createdBy = useCookie("user", cookieConfig).value ?? "";
|
|
1296
1305
|
|
|
1297
1306
|
const { getAll: getAllPSGC } = usePSGC();
|
|
@@ -1381,7 +1390,7 @@ watchEffect(() => {
|
|
|
1381
1390
|
}
|
|
1382
1391
|
});
|
|
1383
1392
|
|
|
1384
|
-
const schools = ref<
|
|
1393
|
+
const schools = ref<TSchool[]>([]);
|
|
1385
1394
|
const searchSchool = ref("");
|
|
1386
1395
|
|
|
1387
1396
|
const { getAll: getAllSchools } = useSchool();
|
|
@@ -1432,48 +1441,74 @@ watchEffect(() => {
|
|
|
1432
1441
|
}
|
|
1433
1442
|
});
|
|
1434
1443
|
|
|
1435
|
-
const selectedSchool =
|
|
1436
|
-
id: "",
|
|
1437
|
-
name: "",
|
|
1438
|
-
});
|
|
1444
|
+
const selectedSchool = computed(() => enrollment.value.schoolId);
|
|
1439
1445
|
|
|
1440
1446
|
watch(selectedSchool, (val) => {
|
|
1441
|
-
|
|
1442
|
-
|
|
1447
|
+
enrollment.value.gradeLevel = "";
|
|
1448
|
+
const school = schools.value.find((s) => s.id === val);
|
|
1449
|
+
|
|
1450
|
+
if (school?.name) {
|
|
1451
|
+
enrollment.value.school = school?._id ?? "";
|
|
1452
|
+
enrollment.value.schoolName = school?.name;
|
|
1443
1453
|
}
|
|
1444
1454
|
|
|
1445
|
-
enrollment.value.cityMunicipality =
|
|
1455
|
+
enrollment.value.cityMunicipality = school?.cityMunicipalityPSGC ?? "";
|
|
1446
1456
|
|
|
1447
|
-
if (
|
|
1448
|
-
enrollment.value.province =
|
|
1457
|
+
if (school?.province) {
|
|
1458
|
+
enrollment.value.province = school?.province;
|
|
1449
1459
|
}
|
|
1450
1460
|
|
|
1451
|
-
const regionPSGC =
|
|
1452
|
-
?
|
|
1461
|
+
const regionPSGC = school?.cityMunicipalityPSGC
|
|
1462
|
+
? school?.cityMunicipalityPSGC.slice(0, 2) + "00000000"
|
|
1453
1463
|
: "";
|
|
1454
1464
|
|
|
1455
|
-
if (
|
|
1465
|
+
if (school?.region && regionPSGC) {
|
|
1456
1466
|
enrollment.value.region = regionPSGC;
|
|
1457
1467
|
}
|
|
1458
1468
|
|
|
1459
|
-
if (
|
|
1460
|
-
enrollment.value.regionName =
|
|
1469
|
+
if (school?.regionName) {
|
|
1470
|
+
enrollment.value.regionName = school?.regionName;
|
|
1461
1471
|
}
|
|
1462
1472
|
|
|
1463
|
-
if (
|
|
1464
|
-
enrollment.value.division =
|
|
1465
|
-
?
|
|
1473
|
+
if (school?.division) {
|
|
1474
|
+
enrollment.value.division = school?.cityMunicipalityPSGC
|
|
1475
|
+
? school?.cityMunicipalityPSGC.slice(0, 5) + "00000"
|
|
1466
1476
|
: "";
|
|
1467
1477
|
}
|
|
1468
1478
|
|
|
1469
|
-
if (
|
|
1470
|
-
enrollment.value.divisionName =
|
|
1479
|
+
if (school?.divisionName) {
|
|
1480
|
+
enrollment.value.divisionName = school?.divisionName;
|
|
1471
1481
|
}
|
|
1472
1482
|
});
|
|
1473
1483
|
|
|
1474
1484
|
const { gradeLevels, generateSchoolYears, motherTongueOptions, tracks } =
|
|
1475
1485
|
useBasicEdu();
|
|
1476
1486
|
|
|
1487
|
+
const gradeLevelOffering = ref<Record<string, any>[]>([]);
|
|
1488
|
+
|
|
1489
|
+
const { getAll: getGradeLevels } = useGradeLevel();
|
|
1490
|
+
|
|
1491
|
+
const { data: getGradeLevelReq } = await useLazyAsyncData(
|
|
1492
|
+
"get-grade-level-offerings" + enrollment.value.school,
|
|
1493
|
+
() => getGradeLevels({ school: enrollment.value.school, limit: 100 })
|
|
1494
|
+
);
|
|
1495
|
+
|
|
1496
|
+
watchEffect(() => {
|
|
1497
|
+
if (getGradeLevelReq.value && getGradeLevelReq.value.items) {
|
|
1498
|
+
gradeLevelOffering.value = getGradeLevelReq.value.items.map(
|
|
1499
|
+
(l: TCurriculumSubject) => {
|
|
1500
|
+
if (typeof l.gradeLevel === "string") {
|
|
1501
|
+
return {
|
|
1502
|
+
title: l.gradeLevel.replace("-", " "),
|
|
1503
|
+
value: l.gradeLevel,
|
|
1504
|
+
educationLevel: l.educationLevel,
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
);
|
|
1509
|
+
}
|
|
1510
|
+
});
|
|
1511
|
+
|
|
1477
1512
|
const selectedTrackStrands = computed(
|
|
1478
1513
|
() =>
|
|
1479
1514
|
tracks.find(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export default function
|
|
2
|
-
const resource = "basic-education/
|
|
1
|
+
export default function useGradeLevel() {
|
|
2
|
+
const resource = "basic-education/grade-levels";
|
|
3
3
|
|
|
4
|
-
function add(value:
|
|
4
|
+
function add(value: TGradeLevel) {
|
|
5
5
|
return $fetch<Record<string, any>>(`/api/${resource}`, {
|
|
6
6
|
method: "POST",
|
|
7
7
|
body: value,
|
|
@@ -21,16 +21,9 @@ export default function useCurriculum() {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
function updateById(
|
|
25
|
-
id: string,
|
|
26
|
-
value: Pick<
|
|
27
|
-
TCurriculum,
|
|
28
|
-
"name" | "effectiveSchoolYear" | "maxTeachingHoursPerDay"
|
|
29
|
-
>
|
|
30
|
-
) {
|
|
24
|
+
function updateById(id: string) {
|
|
31
25
|
return $fetch<Record<string, any>>(`/api/${resource}/${id}`, {
|
|
32
26
|
method: "PUT",
|
|
33
|
-
body: value,
|
|
34
27
|
});
|
|
35
28
|
}
|
|
36
29
|
|
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.
|
|
5
|
+
"version": "1.7.1",
|
|
6
6
|
"main": "./nuxt.config.ts",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"typescript": "^5.6.3",
|
|
24
24
|
"vite-plugin-vuetify": "^2.0.4",
|
|
25
25
|
"vue": "latest",
|
|
26
|
-
"vuetify": "^3.
|
|
26
|
+
"vuetify": "^3.11.2"
|
|
27
27
|
},
|
|
28
28
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
|
|
29
29
|
"dependencies": {
|
package/types/curriculum.d.ts
CHANGED
package/types/enrollment.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ declare type TTLearner = {
|
|
|
8
8
|
cityMunicipalityPSGC?: string; // e.g., "Manila"
|
|
9
9
|
division: string; // e.g., "Manila"
|
|
10
10
|
divisionName?: string; // e.g., "Manila"
|
|
11
|
+
schoolId: string;
|
|
11
12
|
school: string;
|
|
12
13
|
schoolName?: string;
|
|
13
14
|
schoolYear: string; // e.g., "2025-2026"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare type TGradeLevel = {
|
|
2
|
+
_id?: string;
|
|
3
|
+
school: string;
|
|
4
|
+
educationLevel: string;
|
|
5
|
+
gradeLevel: string;
|
|
6
|
+
teachingStyle: string;
|
|
7
|
+
minNumberOfLearners: number;
|
|
8
|
+
maxNumberOfLearners: number;
|
|
9
|
+
tracks?: string[];
|
|
10
|
+
trackStrands?: string[];
|
|
11
|
+
defaultStartTime?: string;
|
|
12
|
+
defaultEndTime?: string;
|
|
13
|
+
status?: string;
|
|
14
|
+
createdAt?: string;
|
|
15
|
+
updatedAt?: string;
|
|
16
|
+
deletedAt?: string;
|
|
17
|
+
createdBy?: string;
|
|
18
|
+
updatedBy?: string;
|
|
19
|
+
deletedBy?: string;
|
|
20
|
+
};
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<v-row no-gutters class="pa-4">
|
|
3
|
-
<v-col v-if="localProps.canAdd" cols="12" class="mb-2">
|
|
4
|
-
<v-row no-gutters>
|
|
5
|
-
<v-btn
|
|
6
|
-
class="text-none"
|
|
7
|
-
rounded="pill"
|
|
8
|
-
variant="tonal"
|
|
9
|
-
@click="dialogCreate = true"
|
|
10
|
-
size="large"
|
|
11
|
-
>
|
|
12
|
-
Add Curriculum
|
|
13
|
-
</v-btn>
|
|
14
|
-
</v-row>
|
|
15
|
-
</v-col>
|
|
16
|
-
|
|
17
|
-
<v-col cols="12">
|
|
18
|
-
<v-card width="100%" variant="outlined" border="thin" rounded="lg">
|
|
19
|
-
<v-toolbar density="compact" color="grey-lighten-4">
|
|
20
|
-
<template #prepend>
|
|
21
|
-
<v-btn fab icon density="comfortable" @click="">
|
|
22
|
-
<v-icon>mdi-refresh</v-icon>
|
|
23
|
-
</v-btn>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<template #append>
|
|
27
|
-
<v-row no-gutters justify="end" align="center">
|
|
28
|
-
<span class="mr-2 text-caption text-fontgray">
|
|
29
|
-
{{ pageRange }}
|
|
30
|
-
</span>
|
|
31
|
-
<local-pagination
|
|
32
|
-
v-model="page"
|
|
33
|
-
:length="pages"
|
|
34
|
-
@update:value=""
|
|
35
|
-
/>
|
|
36
|
-
</v-row>
|
|
37
|
-
</template>
|
|
38
|
-
</v-toolbar>
|
|
39
|
-
|
|
40
|
-
<v-data-table
|
|
41
|
-
:headers="headers"
|
|
42
|
-
:items="items"
|
|
43
|
-
item-value="_id"
|
|
44
|
-
items-per-page="20"
|
|
45
|
-
fixed-header
|
|
46
|
-
hide-default-footer
|
|
47
|
-
hide-default-header
|
|
48
|
-
@click:row="tableRowClickHandler"
|
|
49
|
-
style="max-height: calc(100vh - (200px))"
|
|
50
|
-
>
|
|
51
|
-
</v-data-table>
|
|
52
|
-
</v-card>
|
|
53
|
-
</v-col>
|
|
54
|
-
|
|
55
|
-
<!-- dialog -->
|
|
56
|
-
<v-dialog v-model="dialogCreate" persistent width="450">
|
|
57
|
-
<CurriculumForm
|
|
58
|
-
title="Add curriculum"
|
|
59
|
-
:school="school"
|
|
60
|
-
@cancel="dialogCreate = false"
|
|
61
|
-
@success="successHandler()"
|
|
62
|
-
/>
|
|
63
|
-
</v-dialog>
|
|
64
|
-
|
|
65
|
-
<v-dialog v-model="dialogView" persistent width="450">
|
|
66
|
-
<CurriculumForm
|
|
67
|
-
title="View curriculum details"
|
|
68
|
-
:school="school"
|
|
69
|
-
@cancel="dialogView = false"
|
|
70
|
-
@edit="handleEdit()"
|
|
71
|
-
@delete="dialogDelete = true"
|
|
72
|
-
:data="curriculum"
|
|
73
|
-
mode="view"
|
|
74
|
-
:can-edit="localProps.canEdit"
|
|
75
|
-
:can-delete="localProps.canDelete"
|
|
76
|
-
/>
|
|
77
|
-
</v-dialog>
|
|
78
|
-
|
|
79
|
-
<v-dialog v-model="dialogUpdate" persistent width="450">
|
|
80
|
-
<CurriculumForm
|
|
81
|
-
title="Update curriculum details"
|
|
82
|
-
:school="school"
|
|
83
|
-
@cancel="dialogUpdate = false"
|
|
84
|
-
:data="curriculum"
|
|
85
|
-
mode="edit"
|
|
86
|
-
:can-edit="localProps.canEdit"
|
|
87
|
-
:can-delete="localProps.canDelete"
|
|
88
|
-
/>
|
|
89
|
-
</v-dialog>
|
|
90
|
-
|
|
91
|
-
<v-dialog
|
|
92
|
-
v-model="dialogDelete"
|
|
93
|
-
:loading="loadingDelete"
|
|
94
|
-
width="450"
|
|
95
|
-
persistent
|
|
96
|
-
>
|
|
97
|
-
<v-card width="100%">
|
|
98
|
-
<v-toolbar density="compact" class="pl-4">
|
|
99
|
-
<span class="font-weight-medium text-h5">Delete Curriculum</span>
|
|
100
|
-
</v-toolbar>
|
|
101
|
-
|
|
102
|
-
<v-card-text>
|
|
103
|
-
<p class="text-subtitle-2 text-center">
|
|
104
|
-
Are you sure you want to delete this curriculum? This action cannot
|
|
105
|
-
be undone.
|
|
106
|
-
</p>
|
|
107
|
-
|
|
108
|
-
<v-row v-if="message" no-gutters justify="center" class="mt-4">
|
|
109
|
-
<span class="text-caption text-error text-center">
|
|
110
|
-
{{ message }}
|
|
111
|
-
</span>
|
|
112
|
-
</v-row>
|
|
113
|
-
</v-card-text>
|
|
114
|
-
|
|
115
|
-
<v-toolbar density="compact">
|
|
116
|
-
<v-row no-gutters>
|
|
117
|
-
<v-col cols="6">
|
|
118
|
-
<v-btn
|
|
119
|
-
tile
|
|
120
|
-
block
|
|
121
|
-
size="48"
|
|
122
|
-
variant="text"
|
|
123
|
-
class="text-none"
|
|
124
|
-
@click="dialogDelete = false"
|
|
125
|
-
:disabled="loadingDelete"
|
|
126
|
-
>
|
|
127
|
-
Cancel
|
|
128
|
-
</v-btn>
|
|
129
|
-
</v-col>
|
|
130
|
-
<v-col cols="6">
|
|
131
|
-
<v-btn
|
|
132
|
-
tile
|
|
133
|
-
block
|
|
134
|
-
size="48"
|
|
135
|
-
color="black"
|
|
136
|
-
variant="flat"
|
|
137
|
-
class="text-none"
|
|
138
|
-
@click="submitDelete()"
|
|
139
|
-
:loading="loadingDelete"
|
|
140
|
-
>
|
|
141
|
-
Delete Curriculum
|
|
142
|
-
</v-btn>
|
|
143
|
-
</v-col>
|
|
144
|
-
</v-row>
|
|
145
|
-
</v-toolbar>
|
|
146
|
-
</v-card>
|
|
147
|
-
</v-dialog>
|
|
148
|
-
</v-row>
|
|
149
|
-
</template>
|
|
150
|
-
|
|
151
|
-
<script setup lang="ts">
|
|
152
|
-
const localProps = defineProps({
|
|
153
|
-
school: {
|
|
154
|
-
type: String,
|
|
155
|
-
default: "",
|
|
156
|
-
required: true,
|
|
157
|
-
},
|
|
158
|
-
status: {
|
|
159
|
-
type: String,
|
|
160
|
-
default: "active",
|
|
161
|
-
required: true,
|
|
162
|
-
},
|
|
163
|
-
canAdd: {
|
|
164
|
-
type: Boolean,
|
|
165
|
-
default: false,
|
|
166
|
-
},
|
|
167
|
-
canEdit: {
|
|
168
|
-
type: Boolean,
|
|
169
|
-
default: false,
|
|
170
|
-
},
|
|
171
|
-
canDelete: {
|
|
172
|
-
type: Boolean,
|
|
173
|
-
default: false,
|
|
174
|
-
},
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
const school = localProps.school;
|
|
178
|
-
|
|
179
|
-
const headers = [
|
|
180
|
-
{
|
|
181
|
-
title: "Curriculum",
|
|
182
|
-
value: "name",
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
title: "Effective School Year",
|
|
186
|
-
value: "effectiveSchoolYear",
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
title: "Maximum Teaching Hours Per Day",
|
|
190
|
-
value: "maxTeachingHoursPerDay",
|
|
191
|
-
},
|
|
192
|
-
];
|
|
193
|
-
|
|
194
|
-
const page = ref(1);
|
|
195
|
-
const pages = ref(0);
|
|
196
|
-
const pageRange = ref("-- - -- of --");
|
|
197
|
-
|
|
198
|
-
const items = ref<Array<Record<string, any>>>([]);
|
|
199
|
-
|
|
200
|
-
const { getAll, deleteById } = useCurriculum();
|
|
201
|
-
|
|
202
|
-
const { data: getCurriculumReq, refresh: refreshCurriculumItems } =
|
|
203
|
-
await useLazyAsyncData(
|
|
204
|
-
`curriculums-page-${page.value}-${localProps.status}-${
|
|
205
|
-
localProps.school ?? "all"
|
|
206
|
-
}`,
|
|
207
|
-
() =>
|
|
208
|
-
getAll({
|
|
209
|
-
page: page.value,
|
|
210
|
-
limit: 20,
|
|
211
|
-
status: localProps.status,
|
|
212
|
-
school: localProps.school,
|
|
213
|
-
}),
|
|
214
|
-
{
|
|
215
|
-
watch: [page, () => localProps.status],
|
|
216
|
-
}
|
|
217
|
-
);
|
|
218
|
-
|
|
219
|
-
watchEffect(() => {
|
|
220
|
-
if (getCurriculumReq.value) {
|
|
221
|
-
items.value = getCurriculumReq.value.items;
|
|
222
|
-
pages.value = getCurriculumReq.value.pages;
|
|
223
|
-
pageRange.value = getCurriculumReq.value.pageRange;
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
const curriculum = ref<TCurriculum>();
|
|
228
|
-
|
|
229
|
-
function tableRowClickHandler(_: any, data: any) {
|
|
230
|
-
dialogView.value = true;
|
|
231
|
-
curriculum.value = data.item;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
const dialogCreate = ref(false);
|
|
235
|
-
const dialogView = ref(false);
|
|
236
|
-
|
|
237
|
-
function successHandler() {
|
|
238
|
-
dialogCreate.value = false;
|
|
239
|
-
refreshCurriculumItems();
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
const dialogUpdate = ref(false);
|
|
243
|
-
|
|
244
|
-
function handleEdit() {
|
|
245
|
-
dialogView.value = false;
|
|
246
|
-
dialogUpdate.value = true;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const dialogDelete = ref(false);
|
|
250
|
-
const loadingDelete = ref(false);
|
|
251
|
-
const message = ref("");
|
|
252
|
-
|
|
253
|
-
async function submitDelete() {
|
|
254
|
-
loadingDelete.value = true;
|
|
255
|
-
message.value = "";
|
|
256
|
-
try {
|
|
257
|
-
if (curriculum.value && curriculum.value._id) {
|
|
258
|
-
await deleteById(curriculum.value._id);
|
|
259
|
-
}
|
|
260
|
-
dialogDelete.value = false;
|
|
261
|
-
dialogView.value = false;
|
|
262
|
-
refreshCurriculumItems();
|
|
263
|
-
} catch (error: any) {
|
|
264
|
-
message.value = error.response._data.message;
|
|
265
|
-
} finally {
|
|
266
|
-
loadingDelete.value = false;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
</script>
|