@eeplatform/nuxt-layer-common 1.7.0 → 1.7.2
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 +7 -3
- package/components/ConfirmationPrompt.vue +80 -0
- package/components/EnrollmentForm.vue +175 -16
- package/composables/useEnrollment.ts +6 -0
- package/composables/useProgram.ts +53 -0
- package/composables/useUtils.ts +0 -9
- package/package.json +1 -1
- package/types/enrollment.d.ts +6 -0
- package/types/program.d.ts +33 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
<v-card width="100%">
|
|
3
3
|
<v-toolbar density="compact" class="pl-4">
|
|
4
4
|
<span class="font-weight-medium text-h5 text-capitalize">
|
|
5
|
-
|
|
5
|
+
{{ localProps.action }} {{ localProps.title }}
|
|
6
6
|
</span>
|
|
7
7
|
</v-toolbar>
|
|
8
8
|
|
|
9
9
|
<v-card-text>
|
|
10
10
|
<p class="text-subtitle-2 text-center">
|
|
11
|
-
Are you sure you want to
|
|
11
|
+
Are you sure you want to {{ localProps.action }} this
|
|
12
12
|
{{ localProps.title.toLowerCase() }}? This action cannot be undone.
|
|
13
13
|
</p>
|
|
14
14
|
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
@click="emits('confirm')"
|
|
46
46
|
:disabled="localProps.disabled"
|
|
47
47
|
>
|
|
48
|
-
|
|
48
|
+
{{ localProps.action }} {{ localProps.title }}
|
|
49
49
|
</v-btn>
|
|
50
50
|
</v-col>
|
|
51
51
|
</v-row>
|
|
@@ -67,6 +67,10 @@ const localProps = defineProps({
|
|
|
67
67
|
type: Boolean,
|
|
68
68
|
default: false,
|
|
69
69
|
},
|
|
70
|
+
action: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: "delete",
|
|
73
|
+
},
|
|
70
74
|
});
|
|
71
75
|
|
|
72
76
|
const emits = defineEmits(["cancel", "confirm"]);
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
{{ localProps.title }}
|
|
6
|
+
</span>
|
|
7
|
+
</v-toolbar>
|
|
8
|
+
|
|
9
|
+
<v-card-text>
|
|
10
|
+
<p class="text-subtitle-2 text-center">
|
|
11
|
+
{{ localProps.content }}
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<v-row v-if="localProps.message" no-gutters justify="center" class="mt-4">
|
|
15
|
+
<span class="text-caption text-error text-center">
|
|
16
|
+
{{ localProps.message }}
|
|
17
|
+
</span>
|
|
18
|
+
</v-row>
|
|
19
|
+
</v-card-text>
|
|
20
|
+
|
|
21
|
+
<v-toolbar density="compact">
|
|
22
|
+
<v-row no-gutters>
|
|
23
|
+
<v-col cols="6">
|
|
24
|
+
<v-btn
|
|
25
|
+
tile
|
|
26
|
+
block
|
|
27
|
+
size="48"
|
|
28
|
+
variant="text"
|
|
29
|
+
class="text-none"
|
|
30
|
+
@click="emits('cancel')"
|
|
31
|
+
:disabled="localProps.disabled"
|
|
32
|
+
>
|
|
33
|
+
Cancel
|
|
34
|
+
</v-btn>
|
|
35
|
+
</v-col>
|
|
36
|
+
<v-col cols="6">
|
|
37
|
+
<v-btn
|
|
38
|
+
tile
|
|
39
|
+
block
|
|
40
|
+
size="48"
|
|
41
|
+
color="black"
|
|
42
|
+
variant="flat"
|
|
43
|
+
class="text-none"
|
|
44
|
+
@click="emits('confirm')"
|
|
45
|
+
:disabled="localProps.disabled"
|
|
46
|
+
>
|
|
47
|
+
{{ localProps.action }}
|
|
48
|
+
</v-btn>
|
|
49
|
+
</v-col>
|
|
50
|
+
</v-row>
|
|
51
|
+
</v-toolbar>
|
|
52
|
+
</v-card>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script setup lang="ts">
|
|
56
|
+
const localProps = defineProps({
|
|
57
|
+
title: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: "Title",
|
|
60
|
+
},
|
|
61
|
+
message: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "",
|
|
64
|
+
},
|
|
65
|
+
disabled: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: false,
|
|
68
|
+
},
|
|
69
|
+
action: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: "Submit",
|
|
72
|
+
},
|
|
73
|
+
content: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: "Are you sure you want to proceed?",
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const emits = defineEmits(["cancel", "confirm"]);
|
|
80
|
+
</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,7 +53,7 @@
|
|
|
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>
|
|
@@ -130,6 +130,106 @@
|
|
|
130
130
|
</v-row>
|
|
131
131
|
</v-col>
|
|
132
132
|
|
|
133
|
+
<v-col v-if="hasSpecialProgram" cols="12">
|
|
134
|
+
<v-row no-gutters>
|
|
135
|
+
<v-col cols="12">
|
|
136
|
+
<v-checkbox
|
|
137
|
+
v-model="enrollment.applyToSpecialProgram"
|
|
138
|
+
label="Apply to Special Program"
|
|
139
|
+
hide-details
|
|
140
|
+
density="compact"
|
|
141
|
+
></v-checkbox>
|
|
142
|
+
</v-col>
|
|
143
|
+
|
|
144
|
+
<v-col v-if="enrollment.applyToSpecialProgram" cols="12">
|
|
145
|
+
<v-row>
|
|
146
|
+
<v-col cols="4">
|
|
147
|
+
<v-row no-gutters>
|
|
148
|
+
<v-col cols="12">
|
|
149
|
+
<v-row no-gutters>
|
|
150
|
+
<InputLabel
|
|
151
|
+
class="text-capitalize"
|
|
152
|
+
title="Special Program"
|
|
153
|
+
required
|
|
154
|
+
/>
|
|
155
|
+
<v-col cols="12">
|
|
156
|
+
<v-autocomplete
|
|
157
|
+
v-model="enrollment.specialProgram"
|
|
158
|
+
:rules="[requiredRule]"
|
|
159
|
+
:items="programs"
|
|
160
|
+
item-title="name"
|
|
161
|
+
item-value="_id"
|
|
162
|
+
></v-autocomplete>
|
|
163
|
+
</v-col>
|
|
164
|
+
</v-row>
|
|
165
|
+
</v-col>
|
|
166
|
+
|
|
167
|
+
<v-col v-if="enrollment.specialProgram" cols="12">
|
|
168
|
+
<v-row no-gutters>
|
|
169
|
+
<v-col cols="12">
|
|
170
|
+
<v-row no-gutters>
|
|
171
|
+
<v-col cols="12">
|
|
172
|
+
<InputLabel
|
|
173
|
+
class="text-capitalize"
|
|
174
|
+
title="GWA"
|
|
175
|
+
required
|
|
176
|
+
/>
|
|
177
|
+
</v-col>
|
|
178
|
+
<v-col cols="12">
|
|
179
|
+
<v-text-field
|
|
180
|
+
v-model.number="enrollment.gwa"
|
|
181
|
+
:rules="[requiredRule, (v:any) => v >= selectedProgram.gwa || `Required GWA is equal or greater than ${selectedProgram.gwa}`]"
|
|
182
|
+
type="number"
|
|
183
|
+
></v-text-field>
|
|
184
|
+
</v-col>
|
|
185
|
+
</v-row>
|
|
186
|
+
</v-col>
|
|
187
|
+
|
|
188
|
+
<v-col v-if="enrollment.subjects" cols="12">
|
|
189
|
+
<v-row no-gutters>
|
|
190
|
+
<template
|
|
191
|
+
v-for="(
|
|
192
|
+
programSubject, programSubjectIndex
|
|
193
|
+
) in selectedProgram.subjects"
|
|
194
|
+
:key="programSubjectIndex"
|
|
195
|
+
>
|
|
196
|
+
<v-col cols="12" class="mb-2">
|
|
197
|
+
<v-row no-gutters>
|
|
198
|
+
<InputLabel
|
|
199
|
+
class="text-capitalize"
|
|
200
|
+
:title="programSubject.title"
|
|
201
|
+
required
|
|
202
|
+
/>
|
|
203
|
+
<v-col cols="12">
|
|
204
|
+
<v-text-field
|
|
205
|
+
v-model.number="
|
|
206
|
+
enrollment.subjects[programSubjectIndex]
|
|
207
|
+
.grade
|
|
208
|
+
"
|
|
209
|
+
type="number"
|
|
210
|
+
:rules="[
|
|
211
|
+
requiredRule,
|
|
212
|
+
(v:any) =>
|
|
213
|
+
v >= programSubject.grade ||
|
|
214
|
+
`Required grade is equal or greater than ${programSubject.grade}`,
|
|
215
|
+
]"
|
|
216
|
+
>
|
|
217
|
+
</v-text-field>
|
|
218
|
+
</v-col>
|
|
219
|
+
</v-row>
|
|
220
|
+
</v-col>
|
|
221
|
+
</template>
|
|
222
|
+
</v-row>
|
|
223
|
+
</v-col>
|
|
224
|
+
</v-row>
|
|
225
|
+
</v-col>
|
|
226
|
+
</v-row>
|
|
227
|
+
</v-col>
|
|
228
|
+
</v-row>
|
|
229
|
+
</v-col>
|
|
230
|
+
</v-row>
|
|
231
|
+
</v-col>
|
|
232
|
+
|
|
133
233
|
<v-col cols="12">
|
|
134
234
|
<v-checkbox
|
|
135
235
|
v-model="enrollment.returningLearner"
|
|
@@ -1282,6 +1382,10 @@ const prop = defineProps({
|
|
|
1282
1382
|
type: Boolean,
|
|
1283
1383
|
default: false,
|
|
1284
1384
|
},
|
|
1385
|
+
school: {
|
|
1386
|
+
type: String,
|
|
1387
|
+
default: "",
|
|
1388
|
+
},
|
|
1285
1389
|
});
|
|
1286
1390
|
|
|
1287
1391
|
import { VMaskInput } from "vuetify/labs/VMaskInput";
|
|
@@ -1293,6 +1397,10 @@ const enrollment = defineModel<TTLearner>({
|
|
|
1293
1397
|
|
|
1294
1398
|
const { cookieConfig } = useRuntimeConfig().public;
|
|
1295
1399
|
|
|
1400
|
+
if (prop.school) {
|
|
1401
|
+
enrollment.value.school = prop.school ?? "school";
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1296
1404
|
enrollment.value.createdBy = useCookie("user", cookieConfig).value ?? "";
|
|
1297
1405
|
|
|
1298
1406
|
const { getAll: getAllPSGC } = usePSGC();
|
|
@@ -1382,6 +1490,63 @@ watchEffect(() => {
|
|
|
1382
1490
|
}
|
|
1383
1491
|
});
|
|
1384
1492
|
|
|
1493
|
+
const { getAll } = useProgram();
|
|
1494
|
+
|
|
1495
|
+
const programs = ref<Array<Record<string, any>>>([]);
|
|
1496
|
+
|
|
1497
|
+
const { data: getPrograms } = await useLazyAsyncData(
|
|
1498
|
+
`get-programs-as-options-enrollment-form`,
|
|
1499
|
+
() =>
|
|
1500
|
+
getAll({
|
|
1501
|
+
limit: 20,
|
|
1502
|
+
school: enrollment.value.school,
|
|
1503
|
+
}),
|
|
1504
|
+
{
|
|
1505
|
+
watch: [() => enrollment.value.school],
|
|
1506
|
+
immediate: false,
|
|
1507
|
+
}
|
|
1508
|
+
);
|
|
1509
|
+
|
|
1510
|
+
watchEffect(() => {
|
|
1511
|
+
if (getPrograms.value) {
|
|
1512
|
+
programs.value = getPrograms.value.items;
|
|
1513
|
+
}
|
|
1514
|
+
});
|
|
1515
|
+
|
|
1516
|
+
const selectedProgram = computed(() => {
|
|
1517
|
+
const program = programs.value.find(
|
|
1518
|
+
(p) => p._id === enrollment.value.specialProgram
|
|
1519
|
+
);
|
|
1520
|
+
|
|
1521
|
+
if (!program) {
|
|
1522
|
+
return useProgram().program.value;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
return program;
|
|
1526
|
+
});
|
|
1527
|
+
|
|
1528
|
+
watchEffect(() => {
|
|
1529
|
+
if (selectedProgram.value) {
|
|
1530
|
+
enrollment.value.subjects = selectedProgram.value.subjects.map(
|
|
1531
|
+
(i: any) => ({ title: i.title, grade: 0 })
|
|
1532
|
+
);
|
|
1533
|
+
} else {
|
|
1534
|
+
enrollment.value.subjects = [];
|
|
1535
|
+
}
|
|
1536
|
+
});
|
|
1537
|
+
|
|
1538
|
+
const hasSpecialProgram = computed(() => {
|
|
1539
|
+
const juniorHigh = ["grade-7", "grade-8", "grade-9", "grade-10"];
|
|
1540
|
+
|
|
1541
|
+
const isJuniorHigh = juniorHigh.includes(enrollment.value.gradeLevel);
|
|
1542
|
+
|
|
1543
|
+
if (isJuniorHigh && programs.value.length > 0) {
|
|
1544
|
+
return true;
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
return false;
|
|
1548
|
+
});
|
|
1549
|
+
|
|
1385
1550
|
const schools = ref<TSchool[]>([]);
|
|
1386
1551
|
const searchSchool = ref("");
|
|
1387
1552
|
|
|
@@ -1480,20 +1645,14 @@ const gradeLevelOffering = ref<Record<string, any>[]>([]);
|
|
|
1480
1645
|
|
|
1481
1646
|
const { getAll: getGradeLevels } = useGradeLevel();
|
|
1482
1647
|
|
|
1483
|
-
const { data: getGradeLevelReq
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
}),
|
|
1492
|
-
{
|
|
1493
|
-
watch: [() => enrollment.value.school],
|
|
1494
|
-
immediate: false,
|
|
1495
|
-
}
|
|
1496
|
-
);
|
|
1648
|
+
const { data: getGradeLevelReq } = await useLazyAsyncData(
|
|
1649
|
+
"get-grade-level-offerings" + enrollment.value.school,
|
|
1650
|
+
() => getGradeLevels({ school: enrollment.value.school, limit: 100 }),
|
|
1651
|
+
{
|
|
1652
|
+
watch: [() => enrollment.value.school],
|
|
1653
|
+
immediate: false,
|
|
1654
|
+
}
|
|
1655
|
+
);
|
|
1497
1656
|
|
|
1498
1657
|
watchEffect(() => {
|
|
1499
1658
|
if (getGradeLevelReq.value && getGradeLevelReq.value.items) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export default function useEnrollment() {
|
|
2
2
|
const enrollment = ref<TTLearner>({
|
|
3
|
+
schoolId: "",
|
|
3
4
|
school: "",
|
|
4
5
|
schoolName: "",
|
|
5
6
|
region: "",
|
|
@@ -10,6 +11,11 @@ export default function useEnrollment() {
|
|
|
10
11
|
cityMunicipality: "",
|
|
11
12
|
schoolYear: "",
|
|
12
13
|
gradeLevel: "",
|
|
14
|
+
specialProgram: "",
|
|
15
|
+
specialProgramName: "",
|
|
16
|
+
applyToSpecialProgram: false,
|
|
17
|
+
gwa: 0,
|
|
18
|
+
subjects: [],
|
|
13
19
|
returningLearner: false,
|
|
14
20
|
learnerInfo: {
|
|
15
21
|
psaBirthCertificateNo: "",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export function useProgram() {
|
|
2
|
+
const resource = "basic-education/programs";
|
|
3
|
+
|
|
4
|
+
const program = ref<TProgram>({
|
|
5
|
+
school: "",
|
|
6
|
+
name: "",
|
|
7
|
+
code: "",
|
|
8
|
+
gwa: 0,
|
|
9
|
+
subjects: [],
|
|
10
|
+
description: "",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
function add(value: TProgram) {
|
|
14
|
+
return $fetch<Record<string, any>>(`/api/${resource}`, {
|
|
15
|
+
method: "POST",
|
|
16
|
+
body: value,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function getAll({
|
|
21
|
+
page = 1,
|
|
22
|
+
search = "",
|
|
23
|
+
limit = 10,
|
|
24
|
+
status = "active",
|
|
25
|
+
school = "",
|
|
26
|
+
} = {}) {
|
|
27
|
+
return $fetch<Record<string, any>>(`/api/${resource}`, {
|
|
28
|
+
method: "GET",
|
|
29
|
+
query: { page, limit, search, status, school },
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function updateById(id: string, value: TProgram) {
|
|
34
|
+
return $fetch<Record<string, any>>(`/api/${resource}/id/${id}`, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
body: value,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function deleteById(id: string) {
|
|
41
|
+
return $fetch<Record<string, any>>(`/api/${resource}/id/${id}`, {
|
|
42
|
+
method: "DELETE",
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
add,
|
|
48
|
+
getAll,
|
|
49
|
+
program,
|
|
50
|
+
updateById,
|
|
51
|
+
deleteById,
|
|
52
|
+
};
|
|
53
|
+
}
|
package/composables/useUtils.ts
CHANGED
|
@@ -190,15 +190,6 @@ export default function useUtils() {
|
|
|
190
190
|
}).format(amount);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
// 🔹 Examples:
|
|
194
|
-
// console.log(formatNumber(1234.56)); // "1,234.56" (comma separator, 2 decimals)
|
|
195
|
-
// console.log(formatNumber(1234.56, { decimalPlaces: 0 })); // "1,234" (no decimals)
|
|
196
|
-
// console.log(formatNumber(1234.56, { useSymbol: true, currency: "USD" })); // "$1,234.56"
|
|
197
|
-
// console.log(formatNumber(1234.56, { useSymbol: true, currency: "PHP", decimalPlaces: 0 })); // "₱1,234"
|
|
198
|
-
// console.log(formatNumber(1234.56, { useSymbol: false, decimalPlaces: 0 })); // "1,234"
|
|
199
|
-
// console.log(formatNumber(1234.56, { useSymbol: true, currency: "EUR", locale: "de-DE" })); // "1.234,56 €"
|
|
200
|
-
// console.log(formatNumber(1234.56, { useSymbol: true, currency: "EUR", locale: "de-DE", decimalPlaces: 0 })); // "1.234 €"
|
|
201
|
-
|
|
202
193
|
function computeTieredCost(
|
|
203
194
|
seats: number,
|
|
204
195
|
tiers: { min: number; max: number; price: number }[],
|
package/package.json
CHANGED
package/types/enrollment.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ declare type TTLearner = {
|
|
|
13
13
|
schoolName?: string;
|
|
14
14
|
schoolYear: string; // e.g., "2025-2026"
|
|
15
15
|
gradeLevel: string; // e.g., "Grade 7"
|
|
16
|
+
applyToSpecialProgram: boolean;
|
|
17
|
+
specialProgram?: string;
|
|
18
|
+
specialProgramName?: string;
|
|
19
|
+
specialProgramCode?: string;
|
|
20
|
+
gwa?: number;
|
|
21
|
+
subjects?: { title: string; grade: number }[];
|
|
16
22
|
returningLearner: boolean;
|
|
17
23
|
learnerInfo: EnrLearnerInfo;
|
|
18
24
|
parentGuardianInfo: EnrParentGuardianInfo;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare type TProgram = {
|
|
2
|
+
_id?: string;
|
|
3
|
+
school?: string;
|
|
4
|
+
schoolName?: string;
|
|
5
|
+
name: string;
|
|
6
|
+
code: string;
|
|
7
|
+
gradeLevels?: string[];
|
|
8
|
+
gwa?: number;
|
|
9
|
+
subjects?: { title: string; grade: number }[];
|
|
10
|
+
description?: string;
|
|
11
|
+
status?: string;
|
|
12
|
+
createdAt?: string;
|
|
13
|
+
updatedAt?: string;
|
|
14
|
+
deletedAt?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
declare type TProgramScreening = {
|
|
18
|
+
_id?: string;
|
|
19
|
+
school: string;
|
|
20
|
+
schoolName?: string;
|
|
21
|
+
schoolYear: string;
|
|
22
|
+
gradeLevel: string;
|
|
23
|
+
specialProgram: string;
|
|
24
|
+
specialProgramName?: string;
|
|
25
|
+
applicant: string;
|
|
26
|
+
applicantName?: string;
|
|
27
|
+
gwa?: number;
|
|
28
|
+
subjects?: { title: string; grade: number }[];
|
|
29
|
+
status?: string;
|
|
30
|
+
createdAt?: string;
|
|
31
|
+
updatedAt?: string;
|
|
32
|
+
deletedAt?: string;
|
|
33
|
+
};
|