@eeplatform/nuxt-layer-common 1.6.0 → 1.7.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @eeplatform/nuxt-layer-common
2
2
 
3
+ ## 1.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e16c339: Program management initial release
8
+
3
9
  ## 1.6.0
4
10
 
5
11
  ### Minor Changes
@@ -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>
@@ -60,12 +60,13 @@
60
60
  <InputLabel class="text-capitalize" title="School" required />
61
61
  <v-col cols="12">
62
62
  <v-combobox
63
- v-model="selectedSchool"
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="gradeLevels"
125
+ :items="gradeLevelOffering"
125
126
  ></v-autocomplete>
126
127
  </v-col>
127
128
  </v-row>
@@ -1381,7 +1382,7 @@ watchEffect(() => {
1381
1382
  }
1382
1383
  });
1383
1384
 
1384
- const schools = ref<Array<Record<string, any>>>([]);
1385
+ const schools = ref<TSchool[]>([]);
1385
1386
  const searchSchool = ref("");
1386
1387
 
1387
1388
  const { getAll: getAllSchools } = useSchool();
@@ -1432,48 +1433,84 @@ watchEffect(() => {
1432
1433
  }
1433
1434
  });
1434
1435
 
1435
- const selectedSchool = ref<TSchool>({
1436
- id: "",
1437
- name: "",
1438
- });
1436
+ const selectedSchool = computed(() => enrollment.value.schoolId);
1439
1437
 
1440
1438
  watch(selectedSchool, (val) => {
1441
- if (val.id) {
1442
- enrollment.value.school = val.id;
1439
+ enrollment.value.gradeLevel = "";
1440
+ const school = schools.value.find((s) => s.id === val);
1441
+
1442
+ if (school?.name) {
1443
+ enrollment.value.school = school?._id ?? "";
1444
+ enrollment.value.schoolName = school?.name;
1443
1445
  }
1444
1446
 
1445
- enrollment.value.cityMunicipality = val.cityMunicipalityPSGC ?? "";
1447
+ enrollment.value.cityMunicipality = school?.cityMunicipalityPSGC ?? "";
1446
1448
 
1447
- if (val.province) {
1448
- enrollment.value.province = val.province;
1449
+ if (school?.province) {
1450
+ enrollment.value.province = school?.province;
1449
1451
  }
1450
1452
 
1451
- const regionPSGC = val.cityMunicipalityPSGC
1452
- ? val.cityMunicipalityPSGC.slice(0, 2) + "00000000"
1453
+ const regionPSGC = school?.cityMunicipalityPSGC
1454
+ ? school?.cityMunicipalityPSGC.slice(0, 2) + "00000000"
1453
1455
  : "";
1454
1456
 
1455
- if (val.region && regionPSGC) {
1457
+ if (school?.region && regionPSGC) {
1456
1458
  enrollment.value.region = regionPSGC;
1457
1459
  }
1458
1460
 
1459
- if (val.regionName) {
1460
- enrollment.value.regionName = val.regionName;
1461
+ if (school?.regionName) {
1462
+ enrollment.value.regionName = school?.regionName;
1461
1463
  }
1462
1464
 
1463
- if (val.division) {
1464
- enrollment.value.division = val.cityMunicipalityPSGC
1465
- ? val.cityMunicipalityPSGC.slice(0, 5) + "00000"
1465
+ if (school?.division) {
1466
+ enrollment.value.division = school?.cityMunicipalityPSGC
1467
+ ? school?.cityMunicipalityPSGC.slice(0, 5) + "00000"
1466
1468
  : "";
1467
1469
  }
1468
1470
 
1469
- if (val.divisionName) {
1470
- enrollment.value.divisionName = val.divisionName;
1471
+ if (school?.divisionName) {
1472
+ enrollment.value.divisionName = school?.divisionName;
1471
1473
  }
1472
1474
  });
1473
1475
 
1474
1476
  const { gradeLevels, generateSchoolYears, motherTongueOptions, tracks } =
1475
1477
  useBasicEdu();
1476
1478
 
1479
+ const gradeLevelOffering = ref<Record<string, any>[]>([]);
1480
+
1481
+ const { getAll: getGradeLevels } = useGradeLevel();
1482
+
1483
+ const { data: getGradeLevelReq, refresh: refreshGradeLevels } =
1484
+ await useLazyAsyncData(
1485
+ "get-grade-levels-for-curriculum-subject-form",
1486
+ () =>
1487
+ getGradeLevels({
1488
+ limit: 100,
1489
+ status: "active",
1490
+ school: enrollment.value.school,
1491
+ }),
1492
+ {
1493
+ watch: [() => enrollment.value.school],
1494
+ immediate: false,
1495
+ }
1496
+ );
1497
+
1498
+ watchEffect(() => {
1499
+ if (getGradeLevelReq.value && getGradeLevelReq.value.items) {
1500
+ gradeLevelOffering.value = getGradeLevelReq.value.items.map(
1501
+ (l: TCurriculumSubject) => {
1502
+ if (typeof l.gradeLevel === "string") {
1503
+ return {
1504
+ title: l.gradeLevel.replace("-", " "),
1505
+ value: l.gradeLevel,
1506
+ educationLevel: l.educationLevel,
1507
+ };
1508
+ }
1509
+ }
1510
+ );
1511
+ }
1512
+ });
1513
+
1477
1514
  const selectedTrackStrands = computed(
1478
1515
  () =>
1479
1516
  tracks.find(
@@ -28,6 +28,9 @@
28
28
  <template #append>
29
29
  <slot name="append"></slot>
30
30
  </template>
31
+ <template #prepend>
32
+ <slot name="prepend"></slot>
33
+ </template>
31
34
  </v-navigation-drawer>
32
35
  </template>
33
36
 
@@ -1,7 +1,7 @@
1
- export default function useCurriculum() {
2
- const resource = "basic-education/curriculums";
1
+ export default function useGradeLevel() {
2
+ const resource = "basic-education/grade-levels";
3
3
 
4
- function add(value: TCurriculum) {
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.6.0",
5
+ "version": "1.7.0",
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.10.11"
26
+ "vuetify": "^3.11.2"
27
27
  },
28
28
  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
29
29
  "dependencies": {
@@ -8,6 +8,8 @@ declare type TCurriculumSubject = {
8
8
  subjectCode: string;
9
9
  subjectName: string;
10
10
  subjectType: string;
11
+ program?: string;
12
+ programName?: string;
11
13
  sessionFrequency: number;
12
14
  sessionDuration: number;
13
15
  totalMinutesPerWeek: number;
@@ -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>