@eeplatform/nuxt-layer-common 1.2.11 → 1.3.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/Calendar.vue +199 -0
- package/components/CalendarDay.vue +531 -0
- package/components/CalendarMonth.vue +452 -0
- package/components/CalendarWeek.vue +545 -0
- package/components/CalendarYear.vue +295 -0
- package/components/Layout/Header.vue +18 -16
- package/components/Layout/NavigationDrawer.vue +2 -0
- package/components/OfficeForm.vue +194 -0
- package/components/OfficeMain.vue +126 -0
- package/components/SchoolFormUpload.vue +7 -50
- package/composables/useOffice.ts +40 -0
- package/composables/usePlantilla.ts +52 -0
- package/package.json +1 -1
- package/plugins/API.ts +12 -0
- package/plugins/vuetify.ts +9 -0
- package/types/office.d.ts +12 -0
- package/types/plantilla.d.ts +29 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<v-card width="100%">
|
|
3
3
|
<v-toolbar>
|
|
4
4
|
<v-row no-gutters class="fill-height px-6" align="center">
|
|
5
|
-
<span class="font-weight-bold text-h5"> Bulk Upload
|
|
5
|
+
<span class="font-weight-bold text-h5"> School Bulk Upload </span>
|
|
6
6
|
</v-row>
|
|
7
7
|
</v-toolbar>
|
|
8
8
|
<v-card-text style="max-height: 100vh; overflow-y: auto">
|
|
@@ -46,25 +46,6 @@
|
|
|
46
46
|
</v-row>
|
|
47
47
|
</v-col>
|
|
48
48
|
|
|
49
|
-
<v-col cols="12" class="mt-4">
|
|
50
|
-
<v-row no-gutters>
|
|
51
|
-
<v-col cols="12">
|
|
52
|
-
<v-btn
|
|
53
|
-
variant="outlined"
|
|
54
|
-
color="primary"
|
|
55
|
-
class="text-none"
|
|
56
|
-
size="large"
|
|
57
|
-
block
|
|
58
|
-
prepend-icon="mdi-download"
|
|
59
|
-
@click="downloadTemplate"
|
|
60
|
-
:disabled="disable"
|
|
61
|
-
>
|
|
62
|
-
Download Template
|
|
63
|
-
</v-btn>
|
|
64
|
-
</v-col>
|
|
65
|
-
</v-row>
|
|
66
|
-
</v-col>
|
|
67
|
-
|
|
68
49
|
<v-col cols="12" class="mt-2">
|
|
69
50
|
<v-divider></v-divider>
|
|
70
51
|
</v-col>
|
|
@@ -128,9 +109,7 @@
|
|
|
128
109
|
<v-alert type="info" variant="tonal" class="text-caption">
|
|
129
110
|
<strong>File Requirements:</strong><br />
|
|
130
111
|
• Supported formats: CSV, Excel (.xlsx, .xls)<br />
|
|
131
|
-
• Required columns: schoolName, schoolId, district<br />
|
|
132
112
|
• Maximum file size: 16MB<br />
|
|
133
|
-
• Download the template above for the correct format
|
|
134
113
|
</v-alert>
|
|
135
114
|
</v-col>
|
|
136
115
|
|
|
@@ -149,14 +128,15 @@
|
|
|
149
128
|
</v-form>
|
|
150
129
|
</v-card-text>
|
|
151
130
|
|
|
152
|
-
<v-toolbar>
|
|
153
|
-
<v-row
|
|
131
|
+
<v-toolbar density="compact">
|
|
132
|
+
<v-row no-gutters>
|
|
154
133
|
<v-col cols="6">
|
|
155
134
|
<v-btn
|
|
135
|
+
tile
|
|
156
136
|
block
|
|
157
137
|
variant="text"
|
|
158
138
|
class="text-none"
|
|
159
|
-
size="
|
|
139
|
+
size="48"
|
|
160
140
|
@click="cancel"
|
|
161
141
|
:disabled="disable"
|
|
162
142
|
>
|
|
@@ -166,11 +146,12 @@
|
|
|
166
146
|
|
|
167
147
|
<v-col cols="6">
|
|
168
148
|
<v-btn
|
|
149
|
+
tile
|
|
169
150
|
block
|
|
170
151
|
variant="flat"
|
|
171
152
|
color="black"
|
|
172
153
|
class="text-none"
|
|
173
|
-
size="
|
|
154
|
+
size="48"
|
|
174
155
|
:disabled="!isFormValid || disable"
|
|
175
156
|
@click="submit"
|
|
176
157
|
:loading="disable"
|
|
@@ -306,30 +287,6 @@ function formatFileSize(bytes: number): string {
|
|
|
306
287
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
307
288
|
}
|
|
308
289
|
|
|
309
|
-
function downloadTemplate() {
|
|
310
|
-
// Create CSV template with the expected format
|
|
311
|
-
const headers = ["schoolName", "schoolId", "district"];
|
|
312
|
-
const sampleData = ["Sample Elementary School", "ELEM001", "District 1"];
|
|
313
|
-
|
|
314
|
-
const csvContent = [
|
|
315
|
-
headers.join(","),
|
|
316
|
-
sampleData.map((field) => `"${field}"`).join(","),
|
|
317
|
-
].join("\n");
|
|
318
|
-
|
|
319
|
-
// Create and download file
|
|
320
|
-
const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" });
|
|
321
|
-
const link = document.createElement("a");
|
|
322
|
-
const url = URL.createObjectURL(blob);
|
|
323
|
-
|
|
324
|
-
link.setAttribute("href", url);
|
|
325
|
-
link.setAttribute("download", "school-bulk-upload-template.csv");
|
|
326
|
-
link.style.visibility = "hidden";
|
|
327
|
-
|
|
328
|
-
document.body.appendChild(link);
|
|
329
|
-
link.click();
|
|
330
|
-
document.body.removeChild(link);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
290
|
async function submit() {
|
|
334
291
|
disable.value = true;
|
|
335
292
|
try {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export default function useOffice() {
|
|
2
|
+
function add(value: TOffice) {
|
|
3
|
+
return useNuxtApp().$api<Record<string, any>>("/api/offices", {
|
|
4
|
+
method: "POST",
|
|
5
|
+
body: value,
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async function getAll({
|
|
10
|
+
page = 1,
|
|
11
|
+
search = "",
|
|
12
|
+
limit = 10,
|
|
13
|
+
type = "",
|
|
14
|
+
status = "active",
|
|
15
|
+
} = {}) {
|
|
16
|
+
return useNuxtApp().$api<Record<string, any>>("/api/offices", {
|
|
17
|
+
method: "GET",
|
|
18
|
+
query: { page, limit, search, type, status },
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function updateById(id: string) {
|
|
23
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/offices/${id}`, {
|
|
24
|
+
method: "PUT",
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function deleteById(id: string) {
|
|
29
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/offices/${id}`, {
|
|
30
|
+
method: "DELETE",
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
add,
|
|
36
|
+
getAll,
|
|
37
|
+
updateById,
|
|
38
|
+
deleteById,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export default function usePlantilla() {
|
|
2
|
+
function addPlantilla(plantilla: TPlantilla) {
|
|
3
|
+
return useNuxtApp().$api<{ message: string }>("/api/plantillas", {
|
|
4
|
+
method: "POST",
|
|
5
|
+
body: plantilla,
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function getAll({
|
|
10
|
+
page = 1,
|
|
11
|
+
status = "active",
|
|
12
|
+
search = "",
|
|
13
|
+
org = "",
|
|
14
|
+
app = "admin",
|
|
15
|
+
} = {}) {
|
|
16
|
+
return useNuxtApp().$api<Record<string, any>>("/api/plantillas", {
|
|
17
|
+
method: "GET",
|
|
18
|
+
query: { page, status, search, org, app },
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function bulkAdd(file: File | null, region: string, division: string) {
|
|
23
|
+
if (!file) {
|
|
24
|
+
throw new Error("File not found.");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const formData = new FormData();
|
|
28
|
+
formData.append("file", file);
|
|
29
|
+
formData.append("region", region);
|
|
30
|
+
formData.append("division", division);
|
|
31
|
+
|
|
32
|
+
return useNuxtApp().$api<{
|
|
33
|
+
message: string;
|
|
34
|
+
details: {
|
|
35
|
+
successful: number;
|
|
36
|
+
failed: number;
|
|
37
|
+
total: number;
|
|
38
|
+
totalSizeMB: number;
|
|
39
|
+
errors: string[];
|
|
40
|
+
};
|
|
41
|
+
}>("/api/plantillas/bulk", {
|
|
42
|
+
method: "POST",
|
|
43
|
+
body: formData,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
addPlantilla,
|
|
49
|
+
getAll,
|
|
50
|
+
bulkAdd,
|
|
51
|
+
};
|
|
52
|
+
}
|
package/package.json
CHANGED
package/plugins/API.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export default defineNuxtPlugin(() => {
|
|
2
2
|
const { cookieConfig } = useRuntimeConfig().public;
|
|
3
|
+
const { redirect } = useLocal();
|
|
3
4
|
|
|
4
5
|
const api = $fetch.create({
|
|
5
6
|
baseURL: "/",
|
|
@@ -10,6 +11,17 @@ export default defineNuxtPlugin(() => {
|
|
|
10
11
|
const sid = useCookie("sid", cookieConfig).value ?? "";
|
|
11
12
|
options.headers.set("authorization", sid);
|
|
12
13
|
},
|
|
14
|
+
onResponse({ response }) {
|
|
15
|
+
if (response.status === 401) {
|
|
16
|
+
// Clear cookie
|
|
17
|
+
let sid = useCookie("sid", cookieConfig).value;
|
|
18
|
+
if (sid) {
|
|
19
|
+
sid = null;
|
|
20
|
+
const { APP_MAIN } = useRuntimeConfig().public;
|
|
21
|
+
redirect(APP_MAIN, "logout");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
13
25
|
});
|
|
14
26
|
|
|
15
27
|
// Expose to useNuxtApp().$api
|
package/plugins/vuetify.ts
CHANGED
|
@@ -14,6 +14,8 @@ const darkTheme = {
|
|
|
14
14
|
dark: true,
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
import { VMaskInput } from "vuetify/labs/VMaskInput";
|
|
18
|
+
|
|
17
19
|
export default defineNuxtPlugin((app) => {
|
|
18
20
|
const vuetify = createVuetify({
|
|
19
21
|
defaults: {
|
|
@@ -37,6 +39,10 @@ export default defineNuxtPlugin((app) => {
|
|
|
37
39
|
variant: "outlined",
|
|
38
40
|
density: "comfortable",
|
|
39
41
|
},
|
|
42
|
+
VMaskInput: {
|
|
43
|
+
variant: "outlined",
|
|
44
|
+
density: "comfortable",
|
|
45
|
+
},
|
|
40
46
|
},
|
|
41
47
|
theme: {
|
|
42
48
|
defaultTheme: "defaultTheme",
|
|
@@ -53,6 +59,9 @@ export default defineNuxtPlugin((app) => {
|
|
|
53
59
|
},
|
|
54
60
|
},
|
|
55
61
|
},
|
|
62
|
+
components: {
|
|
63
|
+
VMaskInput,
|
|
64
|
+
},
|
|
56
65
|
});
|
|
57
66
|
|
|
58
67
|
app.vueApp.use(vuetify);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare type TPlantilla = {
|
|
2
|
+
_id?: string;
|
|
3
|
+
itemNumber: string;
|
|
4
|
+
positionTitle: string;
|
|
5
|
+
salaryGrade: number;
|
|
6
|
+
step: number;
|
|
7
|
+
school?: string;
|
|
8
|
+
schoolName?: string;
|
|
9
|
+
office?: string;
|
|
10
|
+
officeName?: string;
|
|
11
|
+
region?: string;
|
|
12
|
+
regionName?: string;
|
|
13
|
+
division?: string;
|
|
14
|
+
divisionName?: string;
|
|
15
|
+
effectivityDate?: string;
|
|
16
|
+
incumbentName?: string;
|
|
17
|
+
basicAnnualSalary?: number;
|
|
18
|
+
basicMonthlySalary?: number;
|
|
19
|
+
positionCategory?: string;
|
|
20
|
+
yearCreated?: string;
|
|
21
|
+
appointmentDate?: string;
|
|
22
|
+
lastPromotionDate?: string;
|
|
23
|
+
eligibility?: string;
|
|
24
|
+
actualDeployment?: string;
|
|
25
|
+
status?: string;
|
|
26
|
+
createdBy?: string;
|
|
27
|
+
createdAt?: string;
|
|
28
|
+
updatedAt?: string;
|
|
29
|
+
};
|