mario-core 2.0.127-release → 2.0.128-release

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.
Files changed (34) hide show
  1. package/dist/Dashboard-Dn1Xl7SC.js +1 -0
  2. package/dist/Dashboard-DxrE_UdE.mjs +206 -0
  3. package/dist/EmailTemplateDetail-BxDmv_IB.mjs +443 -0
  4. package/dist/EmailTemplateDetail-c2h1KwyT.js +1 -0
  5. package/dist/EmailTemplateList-C6KbuCHO.mjs +170 -0
  6. package/dist/EmailTemplateList-Dk7gCfdy.js +1 -0
  7. package/dist/GalleryList-CG-GA7Go.mjs +329 -0
  8. package/dist/GalleryList-p6WP3Krc.js +1 -0
  9. package/dist/Login-BMRuV2H4.js +1 -0
  10. package/dist/Login-Ch1dKH9m.mjs +1700 -0
  11. package/dist/NotificationList-51yt2V-v.js +1 -0
  12. package/dist/NotificationList-bZsuTSkC.mjs +419 -0
  13. package/dist/SkillList-BQM2FIla.mjs +386 -0
  14. package/dist/SkillList-BxqOHumi.js +1 -0
  15. package/dist/TeacherSelector-CrH5Ji_R.mjs +30 -0
  16. package/dist/TeacherSelector-DYwwL8rL.js +1 -0
  17. package/dist/TheContent-B_P8fq4J.mjs +38 -0
  18. package/dist/TheContent-C5I2GeSi.js +1 -0
  19. package/dist/UserContainer-JB0zF0Be.js +5 -0
  20. package/dist/UserContainer-QmPiHlko.mjs +2698 -0
  21. package/dist/UserDetail-BuhWeZrj.mjs +913 -0
  22. package/dist/UserDetail-ClL8qEKG.js +1 -0
  23. package/dist/UserList-Crz4aLRP.mjs +1514 -0
  24. package/dist/UserList-DoZZeZzW.js +7 -0
  25. package/dist/constants-DF79sw6a.mjs +241 -0
  26. package/dist/constants-DSNqVx4Y.js +1 -0
  27. package/dist/index-CD8bO3wO.js +15 -0
  28. package/dist/index-CfBp3NrB.mjs +22670 -0
  29. package/dist/mailCategoryService-C9FSK6lv.js +1 -0
  30. package/dist/mailCategoryService-CRdM3FRx.mjs +11 -0
  31. package/dist/shared/gradeYear/ukYearCsv.d.ts +4 -0
  32. package/dist/userService-CDfW2VnH.js +1 -0
  33. package/dist/userService-CjQDQKT0.mjs +47 -0
  34. package/package.json +113 -113
@@ -0,0 +1,2698 @@
1
+ import { jsxs as o, jsx as e, Fragment as it } from "react/jsx-runtime";
2
+ import { b as z, c as b, R as pt, K as Pt, s as A, a2 as ae, u as $t, a5 as Et, X as Ut, a6 as Ft, O as jt, a7 as zt, a8 as vt, a3 as Vt, T as qt, W as Jt, i as kt, B as Lt, a9 as gt, aa as yt, ab as _t, ac as Wt, $ as We, E as dt, ad as Gt } from "./index-CfBp3NrB.mjs";
3
+ import { r as Mt, e as Ht, m as Kt, f as ie, T as Yt, v as Xt, A as Tt, U as Qt } from "./UserList-Crz4aLRP.mjs";
4
+ import { useState as C, useRef as ut, useMemo as Se, useCallback as Te, useEffect as _e, forwardRef as Dt, Fragment as Ke } from "react";
5
+ import { Modal as Le, ModalHeader as Me, ModalBody as De, ModalFooter as xe, Button as H, Collapse as Zt, Card as ea, CardBody as ta, Row as pe, Col as X, Nav as aa, NavItem as sa, NavLink as na, TabContent as ra, TabPane as la, CardText as ca, Table as xt, Tooltip as Ne, Alert as Pe, Label as oa, Input as Fe } from "reactstrap";
6
+ import { useTranslation as oe } from "react-i18next";
7
+ import { D as ia, i as da, U as we, a as Ge, T as W, b as Ct, G as It, S as je, c as Ot } from "./constants-DF79sw6a.mjs";
8
+ import { useDispatch as qe, useSelector as ha } from "react-redux";
9
+ import { g as ua, r as ma, a as ze, b as pa, u as ga, c as fa, d as va, e as ya, f as _a, h as Ta } from "./userService-CjQDQKT0.mjs";
10
+ import { T as mt } from "./TeacherSelector-CrH5Ji_R.mjs";
11
+ import Ca from "react-select";
12
+ import Ia from "papaparse";
13
+ import { Formik as ba } from "formik";
14
+ import * as Ve from "yup";
15
+ const bt = "Cannot update two school levels at the same time.", ke = (t) => Mt(t), St = (t) => {
16
+ const n = Object.entries(t).filter(([r]) => r !== "currentPage" && r !== "cursor").sort(([r], [l]) => r.localeCompare(l));
17
+ return JSON.stringify(n);
18
+ }, Sa = (t) => {
19
+ if (t === void 0) return;
20
+ const n = we[t];
21
+ return n ? n.charAt(0).toLowerCase() + n.slice(1) : void 0;
22
+ }, Na = () => {
23
+ const t = qe(), [n, r] = C([]), [l, v] = C(ia), [s, I] = C(0), [p, h] = C([]), [_, R] = C([]), [i, w] = C(da), E = "", L = ut({}), T = ut(""), S = Se(() => {
24
+ const f = _.find((u) => !!ke(u));
25
+ return ke(f);
26
+ }, [_]), O = (f) => {
27
+ const u = Object.keys(f).every(($) => $ === "currentPage"), c = {
28
+ ...l,
29
+ ...f
30
+ };
31
+ u || (c.currentPage = 1, L.current = {}, T.current = St(c)), v(c);
32
+ }, Q = Se(() => {
33
+ const f = n.filter((c) => p.includes(c.id)).flatMap((c) => c.teachers), u = /* @__PURE__ */ new Map();
34
+ return f.forEach((c) => {
35
+ u.has(c.teacherUserId) || u.set(c.teacherUserId, c);
36
+ }), Array.from(u.values()).map((c) => ({
37
+ value: c.teacherUserId,
38
+ label: c.mainTeacherEmail
39
+ }));
40
+ }, [_, p]), U = Se(() => {
41
+ const f = n.filter((c) => p.includes(c.id)).flatMap((c) => c.counselors), u = /* @__PURE__ */ new Map();
42
+ return f.forEach((c) => {
43
+ u.has(c.counselorUserId) || u.set(c.counselorUserId, c);
44
+ }), Array.from(u.values()).map((c) => ({
45
+ value: c.counselorUserId,
46
+ label: c.counselorEmail
47
+ }));
48
+ }, [_, p]), ee = Se(() => {
49
+ const f = n.filter((c) => p.includes(c.id) && c.assistantUserId).map((c) => ({
50
+ value: c.assistantUserId,
51
+ label: c.assistantEmail
52
+ })), u = /* @__PURE__ */ new Map();
53
+ return f.forEach((c) => {
54
+ u.has(c.value) || u.set(c.value, c);
55
+ }), Array.from(u.values());
56
+ }, [n, p]), de = Se(() => {
57
+ const f = n.filter((c) => p.includes(c.id) && c.secondaryTeacherUserId).map((c) => ({
58
+ value: c.secondaryTeacherUserId,
59
+ label: c.secondaryTeacherEmail
60
+ })), u = /* @__PURE__ */ new Map();
61
+ return f.forEach((c) => {
62
+ u.has(c.value) || u.set(c.value, c);
63
+ }), Array.from(u.values());
64
+ }, [n, p]), he = Te((f) => {
65
+ f !== l.sortBy ? O({
66
+ sortBy: f,
67
+ orderBy: "ASC",
68
+ currentPage: 1
69
+ }) : O({
70
+ sortBy: f,
71
+ orderBy: l.orderBy !== "DESC" ? "DESC" : "ASC",
72
+ currentPage: 1
73
+ });
74
+ }, [JSON.stringify(l)]), se = async () => {
75
+ t(z(!0));
76
+ try {
77
+ const f = l.currentPage || 1, u = St(l);
78
+ T.current !== u && (L.current = {}, T.current = u);
79
+ const c = Object.entries(l).filter(([Y, le]) => le !== void 0).reduce((Y, [le, ce]) => (Y[le] = ce, Y), {}), $ = {};
80
+ for (const Y in c) {
81
+ if (Y === "currentPage") {
82
+ $.page = c[Y];
83
+ continue;
84
+ }
85
+ if (Y === "orderBy" || Y === "cursor") continue;
86
+ if (Y === "sortBy") {
87
+ const ce = Sa(c[Y]);
88
+ ce !== void 0 && ($.sortBy = ce);
89
+ continue;
90
+ }
91
+ const le = Y.charAt(0).toLowerCase() + Y.slice(1);
92
+ $[le] = c[Y];
93
+ }
94
+ $.isDescending = l.isDescending ?? l.orderBy === "DESC";
95
+ const F = Object.prototype.hasOwnProperty.call(L.current, f);
96
+ f === 1 ? $.cursor = "" : F && ($.cursor = L.current[f]);
97
+ const ne = (await ua($))?.data || {}, ge = ne?.nextCursor || ne?.pagination?.nextCursor;
98
+ ge ? L.current[f + 1] = ge : delete L.current[f + 1], r(ne?.items || ne?.pagination?.items || []), I(ne?.totalItems || ne?.pagination?.totalItems || 0);
99
+ } catch (f) {
100
+ t(
101
+ b({
102
+ type: "danger",
103
+ message: f.response?.data?.title || f.message
104
+ })
105
+ );
106
+ }
107
+ t(z(!1));
108
+ }, g = Se(() => (f) => {
109
+ const u = ke(f);
110
+ return !!S && !!u && u !== S;
111
+ }, [S]), P = Se(() => {
112
+ const f = n.filter((u) => !g(u));
113
+ return f.length > 0 && f.every((u) => p.includes(u.id));
114
+ }, [n, p, g]), J = () => {
115
+ if (P) {
116
+ const c = new Set(n.map(($) => $.id));
117
+ h(($) => $.filter((F) => !c.has(F))), R(($) => $.filter((F) => !c.has(F.id)));
118
+ return;
119
+ }
120
+ const f = S ?? ke(n.find((c) => !!ke(c))), u = n.filter((c) => {
121
+ const $ = ke(c);
122
+ return !$ || !f || $ === f;
123
+ });
124
+ if (u.length === 0 && n.length > 0) {
125
+ V();
126
+ return;
127
+ }
128
+ h((c) => {
129
+ const $ = u.map((F) => F.id).filter((F) => !c.includes(F));
130
+ return [...c, ...$];
131
+ }), R((c) => {
132
+ const $ = new Set(c.map((K) => K.id)), F = u.filter((K) => !$.has(K.id));
133
+ return [...c, ...F];
134
+ });
135
+ }, V = () => {
136
+ t(
137
+ b({
138
+ type: "warning",
139
+ message: bt
140
+ })
141
+ );
142
+ }, Ce = (f) => {
143
+ const { id: u, checked: c } = f.target, $ = n.find((F) => F.id === u);
144
+ if (c && $ && g($)) {
145
+ V();
146
+ return;
147
+ }
148
+ c ? (h((F) => [...F, u]), $ && R((F) => [...F, $])) : (h((F) => F.filter((K) => K !== u)), R((F) => F.filter((K) => K.id !== u)));
149
+ }, M = Te(() => {
150
+ l.currentPage == 1 ? se() : O({ currentPage: 1 }), h([]), R([]);
151
+ }, [JSON.stringify(l)]);
152
+ return _e(() => {
153
+ se();
154
+ }, [JSON.stringify(l)]), _e(() => {
155
+ document.title = "User | Assign student";
156
+ }, []), _e(() => {
157
+ O({
158
+ ...l,
159
+ searchString: E
160
+ });
161
+ }, [E]), {
162
+ handelSort: he,
163
+ handleRetrievedData: M,
164
+ totalItem: s,
165
+ userList: n,
166
+ filters: l,
167
+ changeFilters: O,
168
+ handleSelectAll: J,
169
+ handleClickCheck: Ce,
170
+ isCheckAll: P,
171
+ isCheck: p,
172
+ fullName: E,
173
+ selectedUser: i,
174
+ setSelectedUser: w,
175
+ userSelected: _,
176
+ getDataUserList: se,
177
+ studentTeacherSelected: Q,
178
+ studentCounselorSelected: U,
179
+ studentAssistantSelected: ee,
180
+ studentSecondaryTeacherSelected: de,
181
+ isStudentSelectionDisabled: g,
182
+ handleBlockedSchoolLevelSelection: V,
183
+ schoolLevelConflictMessage: bt
184
+ };
185
+ }, wa = (t, n, r, l, v, s, I, p) => {
186
+ const h = qe(), [_, R] = C(!1), [i, w] = C(Ge), [E, L] = C(!1), [T, S] = C(!1), [O, Q] = C(W.Teacher), [U, ee] = C([]), [de, he] = C([]), [se, g] = C([]), [P, J] = C({
187
+ header: "",
188
+ titleSelect: "",
189
+ selectPlaceholder: "",
190
+ changeTitle: "",
191
+ changePlaceholder: ""
192
+ }), [V, Ce] = C(""), [M, f] = C(""), [u, c] = C(!1), [$, F] = C(0), [K, ne] = C([]), [ge, Y] = C(""), [le, ce] = C(!1), [Ie, ve] = C(!1), [G, fe] = C(Ct), te = (d) => {
193
+ fe({
194
+ ...G,
195
+ ...d
196
+ });
197
+ }, ye = (d) => {
198
+ if (d && d.length === 0) {
199
+ h(
200
+ b({
201
+ type: "danger",
202
+ message: "Please select students!"
203
+ })
204
+ );
205
+ return;
206
+ }
207
+ ve(!Ie), w({ ...Ge }), fe({ ...Ct });
208
+ }, $e = () => {
209
+ ce(!le), Y("");
210
+ }, Oe = (d) => {
211
+ K.includes(d) ? ne(K.filter((m) => m !== d)) : ne([...K, d]);
212
+ }, Ee = (d) => {
213
+ F((m) => m === d ? -1 : d);
214
+ }, Ae = (d) => {
215
+ if (d && d.length === 0) {
216
+ h(
217
+ b({
218
+ type: "danger",
219
+ message: "Please select students!"
220
+ })
221
+ );
222
+ return;
223
+ }
224
+ R(!_), w({ ...Ge });
225
+ }, Je = (d, m, y) => {
226
+ if (d && d.length === 0) {
227
+ h(
228
+ b({
229
+ type: "danger",
230
+ message: "Please select students!"
231
+ })
232
+ );
233
+ return;
234
+ }
235
+ switch (g(d), he(Ht(d, m)), Q(m), m) {
236
+ case W.Teacher:
237
+ J({
238
+ header: "switch_teacher",
239
+ titleSelect: "current_teacher_name",
240
+ selectPlaceholder: "select_teacher",
241
+ changeTitle: "select_teacher_change",
242
+ changePlaceholder: "select_teacher_change"
243
+ });
244
+ break;
245
+ case W.Assistant:
246
+ J({
247
+ header: "switch_assistant",
248
+ titleSelect: "current_assistant_name",
249
+ selectPlaceholder: "",
250
+ changeTitle: "",
251
+ changePlaceholder: "select_assistant_change"
252
+ });
253
+ break;
254
+ case W.Counselor:
255
+ J({
256
+ header: "switch_counselor",
257
+ titleSelect: "current_counselor_name",
258
+ selectPlaceholder: "select_counselor",
259
+ changeTitle: "select_counselor_change",
260
+ changePlaceholder: "select_counselor_change"
261
+ });
262
+ break;
263
+ case W.SecondaryTeacher:
264
+ J({
265
+ header: "switch_support_teacher",
266
+ titleSelect: "current_assistant_name",
267
+ selectPlaceholder: "",
268
+ changeTitle: "",
269
+ changePlaceholder: "select_support_teacher_change"
270
+ });
271
+ break;
272
+ }
273
+ S(!T), ee(y);
274
+ }, Ue = () => {
275
+ ee([]), S(!1), c(!1), Q(W.Teacher), he([]), Ce(""), f(""), J({
276
+ header: "",
277
+ titleSelect: "",
278
+ selectPlaceholder: "",
279
+ changeTitle: "",
280
+ changePlaceholder: ""
281
+ }), ne([]);
282
+ }, Ye = () => {
283
+ c(!1), F(0), ne([]);
284
+ }, Xe = async (d, m) => {
285
+ h(
286
+ pt({
287
+ isOpen: !0,
288
+ type: "warning",
289
+ message: `Do you want to change ${m === W.Teacher ? "teacher" : m === W.Assistant ? "assistant" : m === W.SecondaryTeacher ? "support teacher" : "counselor"} for ${d.length} student(s)?`,
290
+ onConfirm: async () => {
291
+ h(z(!0));
292
+ try {
293
+ const y = m === W.Teacher ? await fa(d) : m === W.Assistant ? await va(d) : m === W.Counselor ? await ya(d) : await _a(d);
294
+ y && y?.data && (Ue(), v?.(), await I(), h(
295
+ b({
296
+ type: "success",
297
+ message: `Change ${m === W.Teacher ? "teacher" : m === W.Assistant ? "assistant" : m === W.SecondaryTeacher ? "support teacher" : "counselor"} successfully`
298
+ })
299
+ ));
300
+ } catch (y) {
301
+ h(
302
+ b({
303
+ type: "danger",
304
+ message: y.response?.data?.title || y.message
305
+ })
306
+ );
307
+ }
308
+ h(z(!1));
309
+ }
310
+ })
311
+ );
312
+ }, Qe = () => {
313
+ let d = [];
314
+ switch (O) {
315
+ case W.Teacher:
316
+ d = se.filter((m) => {
317
+ const y = m.teachers.map((D) => D.teacherUserId);
318
+ return y.includes(M) && !y.includes(V);
319
+ }).map((m) => ({
320
+ studentId: m.studentId,
321
+ teacher: M,
322
+ teacherChange: V
323
+ }));
324
+ break;
325
+ case W.Counselor:
326
+ d = se.filter((m) => {
327
+ const y = m.counselors.map((D) => D.counselorUserId);
328
+ return y.includes(M) && !y.includes(V);
329
+ }).map((m) => ({
330
+ studentId: m.studentId,
331
+ counselor: M,
332
+ counselorChange: V
333
+ }));
334
+ break;
335
+ case W.Assistant:
336
+ d = se.filter((m) => m?.assistantUserId && m?.teachers?.length > 0).map((m) => ({
337
+ studentId: m.studentId,
338
+ assistantUserId: V
339
+ }));
340
+ break;
341
+ case W.SecondaryTeacher:
342
+ d = se.filter((m) => m?.secondaryTeacherUserId && m?.teachers?.length > 0).map((m) => ({
343
+ studentId: m.studentId,
344
+ secondaryTeacherId: V
345
+ }));
346
+ break;
347
+ }
348
+ if (d.length === 0) {
349
+ h(
350
+ b({
351
+ type: "danger",
352
+ message: "No change to update!"
353
+ })
354
+ );
355
+ return;
356
+ }
357
+ Xe(d || [], O);
358
+ }, Ze = (d) => {
359
+ if (d && d.length === 0) {
360
+ h(
361
+ b({
362
+ type: "danger",
363
+ message: "Please select student(s)!"
364
+ })
365
+ );
366
+ return;
367
+ }
368
+ L(!E);
369
+ }, et = (d, m) => {
370
+ switch (d) {
371
+ case "assistant":
372
+ w({
373
+ ...i,
374
+ assistantId: m.value,
375
+ assistantEmail: m.label
376
+ });
377
+ break;
378
+ case "secondary":
379
+ w({
380
+ ...i,
381
+ secondaryTeacherId: m.value,
382
+ secondaryTeacherEmail: m.label
383
+ });
384
+ break;
385
+ case "grade":
386
+ w({
387
+ ...i,
388
+ gradeLevel: m.value
389
+ });
390
+ break;
391
+ }
392
+ }, tt = (d) => {
393
+ w({
394
+ ...i,
395
+ teacher: d
396
+ });
397
+ }, at = (d) => {
398
+ w({
399
+ ...i,
400
+ counselors: d
401
+ });
402
+ }, Re = async (d) => {
403
+ h(z(!0));
404
+ try {
405
+ await ze(d), h(
406
+ b({
407
+ type: "success",
408
+ message: "Student assigned successfully"
409
+ })
410
+ ), v?.(), Ue();
411
+ } catch (m) {
412
+ h(
413
+ b({
414
+ type: "danger",
415
+ message: m.response?.data?.title || m.message
416
+ })
417
+ );
418
+ }
419
+ h(z(!1));
420
+ }, st = Te((d) => {
421
+ if (d.length === 0) {
422
+ h(
423
+ b({
424
+ type: "danger",
425
+ message: "Not found selected student."
426
+ })
427
+ );
428
+ return;
429
+ }
430
+ if (d.some((D) => {
431
+ const x = t?.[D], N = n?.[D], q = r?.[D], j = l?.[D];
432
+ return !x && !N && !q && !j;
433
+ })) {
434
+ h(
435
+ b({
436
+ type: "danger",
437
+ message: "Please select/add teacher for all selected student first."
438
+ })
439
+ );
440
+ return;
441
+ }
442
+ const y = d.map((D) => {
443
+ const x = t?.[D], N = n?.[D], q = r?.[D], j = l?.[D], Z = p?.find((me) => me.id === D), ue = {
444
+ id: D,
445
+ schoolLevel: Z?.schoolLevel
446
+ };
447
+ return x && (ue.mainTeacherUserId = x ? x.map((me) => me.value) : void 0, ue.mainTeacherEmail = x ? x.map((me) => me.label) : void 0), N && (ue.assistantUserId = N?.value && typeof N?.value == "string" ? N?.value : void 0, ue.assistantEmail = N?.value && typeof N?.value == "number" ? N?.label : void 0), q && (ue.counselorUserIds = q ? q.map((me) => me.value) : void 0, ue.counselorEmails = q ? q.map((me) => me.label) : void 0), j && (ue.secondaryTeacherUserId = j?.value && typeof j?.value == "string" ? j?.value : void 0, ue.secondaryTeacherEmail = j?.value && typeof j?.value == "number" ? j?.label : void 0), ue;
448
+ });
449
+ Re([...y]);
450
+ }, [JSON.stringify(t), JSON.stringify(n), JSON.stringify(r), JSON.stringify(l)]), nt = Te((d) => {
451
+ const m = t?.[d], y = n?.[d], D = r?.[d], x = l?.[d];
452
+ if (!m && !y && !D && !x) {
453
+ h(
454
+ b({
455
+ type: "danger",
456
+ message: "Please select/add teacher for selected student first."
457
+ })
458
+ );
459
+ return;
460
+ }
461
+ const N = p?.find((j) => j.id === d), q = {
462
+ id: d,
463
+ schoolLevel: N?.schoolLevel
464
+ };
465
+ m && (q.mainTeacherUserId = m ? m.map((j) => j.value) : void 0, q.mainTeacherEmail = m ? m.map((j) => j.label) : void 0), y && (q.assistantUserId = y?.value && typeof y?.value == "string" ? y?.value : void 0, q.assistantEmail = y?.value && typeof y?.value == "number" ? y?.label : void 0), D && (q.counselorUserIds = D ? D.map((j) => j.value) : void 0, q.counselorEmails = D ? D.map((j) => j.label) : void 0), x && (q.secondaryTeacherUserId = x?.value && typeof x?.value == "string" ? x?.value : void 0, q.secondaryTeacherEmail = x?.value && typeof x?.value == "number" ? x?.label : void 0), Re([q]);
466
+ }, [JSON.stringify(t), JSON.stringify(n), JSON.stringify(r), JSON.stringify(l)]), rt = async (d) => {
467
+ if (d.length === 0) {
468
+ h(
469
+ b({
470
+ type: "danger",
471
+ message: "Not found selected student."
472
+ })
473
+ );
474
+ return;
475
+ }
476
+ if (i.teacher.length === 0 && i.counselors.length === 0 && !i.assistantId && !i.secondaryTeacherId) {
477
+ h(
478
+ b({
479
+ type: "danger",
480
+ message: "No change to assign!"
481
+ })
482
+ );
483
+ return;
484
+ }
485
+ const m = p?.filter((y) => d?.includes(y.id))?.every((y) => Array.isArray(y.teachers) && y.teachers.length > 0) ?? !1;
486
+ if (i.teacher.length === 0 && !m) {
487
+ h(
488
+ b({
489
+ type: "danger",
490
+ message: "Please assign a teacher to each student before giving other educators access to them"
491
+ })
492
+ );
493
+ return;
494
+ }
495
+ h(z(!0));
496
+ try {
497
+ if (i.teacher.length > 0 && p && p.length > 0) {
498
+ const x = p.filter((N) => d.includes(N.id)).map((N) => {
499
+ const q = N.teachers?.map((Z) => Z.teacherUserId) || [], j = i.teacher.filter(
500
+ (Z) => !q.includes(Z.id)
501
+ );
502
+ return {
503
+ id: N.id,
504
+ schoolLevel: N.schoolLevel,
505
+ mainTeacherUserId: j.map((Z) => Z.id),
506
+ mainTeacherEmail: j.map((Z) => Z.email)
507
+ };
508
+ }).filter((N) => N.mainTeacherUserId.length > 0 || N.mainTeacherEmail.length > 0);
509
+ x.length > 0 && await ze(x);
510
+ }
511
+ if (i.counselors.length > 0 && p && p.length > 0) {
512
+ const x = p.filter((N) => d.includes(N.id)).map((N) => {
513
+ const q = N.counselors?.map((Z) => Z.counselorUserId) || [], j = i.counselors.filter(
514
+ (Z) => !q.includes(Z.id)
515
+ );
516
+ return {
517
+ id: N.id,
518
+ schoolLevel: N.schoolLevel,
519
+ counselorUserIds: j.map((Z) => Z.id),
520
+ counselorEmails: j.map((Z) => Z.email)
521
+ };
522
+ }).filter((N) => N.counselorUserIds.length > 0 || N.counselorEmails.length > 0);
523
+ x.length > 0 && await ze(x);
524
+ }
525
+ const y = p?.filter((x) => !x.assistantUserId);
526
+ if (y && y?.length > 0 && i.assistantId) {
527
+ const x = y.map((N) => ({
528
+ id: N.id,
529
+ schoolLevel: N.schoolLevel,
530
+ assistantUserId: i.assistantId,
531
+ assistantEmail: i.assistantEmail
532
+ }));
533
+ await ze(x.filter((N) => N !== void 0));
534
+ }
535
+ const D = p?.filter((x) => !x.secondaryTeacherUserId);
536
+ if (D && D?.length > 0 && i.secondaryTeacherId) {
537
+ const x = D.map((N) => ({
538
+ id: N.id,
539
+ schoolLevel: N.schoolLevel,
540
+ secondaryTeacherUserId: i.secondaryTeacherId,
541
+ secondaryTeacherEmail: i.secondaryTeacherEmail
542
+ }));
543
+ await ze(x.filter((N) => N !== void 0));
544
+ }
545
+ h(
546
+ b({
547
+ type: "success",
548
+ message: "Student assigned successfully"
549
+ })
550
+ ), v?.(), Ue(), Ae();
551
+ } catch (y) {
552
+ h(
553
+ b({
554
+ type: "danger",
555
+ message: y.response?.data?.title || y.message
556
+ })
557
+ );
558
+ }
559
+ h(z(!1));
560
+ }, lt = async (d) => {
561
+ if (i.teacher.length === 0) {
562
+ h(
563
+ b({
564
+ type: "danger",
565
+ message: "Please select teacher before assign!"
566
+ })
567
+ );
568
+ return;
569
+ }
570
+ if (K.length > 0 && !d) {
571
+ ce(!0);
572
+ return;
573
+ }
574
+ const m = {
575
+ id: s?.id || "",
576
+ schoolLevel: s?.schoolLevel,
577
+ mainTeacherUserId: i.teacher.filter((y) => !s?.teachers?.some((D) => D.teacherUserId === y.id)).map((y) => y.id) || [],
578
+ mainTeacherEmail: i.teacher.filter((y) => !s?.teachers?.some((D) => D.teacherUserId === y.id)).map((y) => y.email) || [],
579
+ assistantUserId: i?.assistantId ? i?.assistantId : void 0,
580
+ assistantEmail: i?.assistantEmail ? i?.assistantEmail : void 0,
581
+ counselorUserIds: i.counselors.map((y) => y.id) || [],
582
+ counselorEmails: i.counselors.map((y) => y.email) || [],
583
+ secondaryTeacherUserId: i?.secondaryTeacherId ? i?.secondaryTeacherId : void 0,
584
+ secondaryTeacherEmail: i?.secondaryTeacherEmail ? i?.secondaryTeacherEmail : void 0,
585
+ removeTeacherUserIds: K,
586
+ teacherSwitchUserId: d || ""
587
+ };
588
+ i?.gradeLevel && i.gradeLevel !== s?.gradeLevel && await pa(s?.id || "", i?.gradeLevel, s?.schoolLevel), Re([m]);
589
+ }, ct = async (d, m) => {
590
+ h(z(!0));
591
+ try {
592
+ (await ga(d)).status == 200 && (h(
593
+ b({
594
+ type: "success",
595
+ message: `Inactive ${d.length} Students successfully`
596
+ })
597
+ ), m());
598
+ } catch (y) {
599
+ h(
600
+ b({
601
+ type: "danger",
602
+ message: y.response?.data?.title || y.message
603
+ })
604
+ );
605
+ }
606
+ L(!E), h(z(!1));
607
+ }, ot = Te(async (d) => {
608
+ if (G.assistantRemoveUserId.length && !G.assistantSwitchDataUserId) {
609
+ h(
610
+ b({
611
+ type: "danger",
612
+ message: "Please select an assistant to transfer data!"
613
+ })
614
+ );
615
+ return;
616
+ }
617
+ if (G.teacherRemoveUserIds.length && !G.teacherSwitchDataUserId) {
618
+ h(
619
+ b({
620
+ type: "danger",
621
+ message: "Please select a teacher to transfer data!"
622
+ })
623
+ );
624
+ return;
625
+ }
626
+ if (G.counselorRemoveUserIds.length && !G.counselorSwitchDataUserId) {
627
+ h(
628
+ b({
629
+ type: "danger",
630
+ message: "Please select a counselor to transfer data!"
631
+ })
632
+ );
633
+ return;
634
+ }
635
+ if (G.supportTeacherRemoveUserIds.length && !G.supportTeacherSwitchDataUserId) {
636
+ h(
637
+ b({
638
+ type: "danger",
639
+ message: "Please select a support teacher to transfer data!"
640
+ })
641
+ );
642
+ return;
643
+ }
644
+ h(z(!0));
645
+ try {
646
+ const m = d?.[0], D = p?.find((x) => x.id === m)?.schoolLevel;
647
+ await ma({
648
+ ...G,
649
+ studentUserIds: d || [],
650
+ schoolLevel: D
651
+ }), v?.(), await I();
652
+ } catch (m) {
653
+ h(
654
+ b({
655
+ type: "danger",
656
+ message: m.response?.data?.title || m.message
657
+ })
658
+ );
659
+ }
660
+ ye(), h(z(!1));
661
+ }, [G]);
662
+ return _e(() => (s?.id && w({
663
+ teacher: s?.teachers?.map((d) => ({
664
+ id: d.teacherUserId,
665
+ email: d.mainTeacherEmail
666
+ })),
667
+ assistantId: s?.assistantUserId,
668
+ assistantEmail: s?.assistantEmail,
669
+ counselors: s?.counselors?.map((d) => ({
670
+ id: d.counselorUserId,
671
+ email: d.counselorEmail
672
+ })),
673
+ secondaryTeacherEmail: s?.secondaryTeacherEmail,
674
+ secondaryTeacherId: s?.secondaryTeacherUserId,
675
+ gradeLevel: s?.gradeLevel
676
+ }), () => {
677
+ w(Ge);
678
+ }), [s]), {
679
+ handleAssignSingleStudent: nt,
680
+ handleAssignMultiStudent: st,
681
+ openModelBulk: _,
682
+ handleToggleModel: Ae,
683
+ handleChangeStaffBulk: et,
684
+ staffBulkAssign: i,
685
+ onAssignStaffToStudents: rt,
686
+ handleToggleInactiveModal: Ze,
687
+ openInactiveModal: E,
688
+ handleInactiveStudents: ct,
689
+ handleChangeTeacherBulk: tt,
690
+ handleEditAssignForStudents: lt,
691
+ handleToggleSwitchModel: Je,
692
+ openSwitchModal: T,
693
+ optionsSwitch: U,
694
+ modalType: O,
695
+ textModal: P,
696
+ teacherSwitchList: de,
697
+ onCloseSwitchModal: Ue,
698
+ handleUpdateSwitch: Qe,
699
+ setTeacherChangeUserId: Ce,
700
+ setTeacherSelectForChangeUserId: f,
701
+ teacherSelectForChangeUserId: M,
702
+ openDetailModal: u,
703
+ setOpenDetailModal: c,
704
+ toggleCollapse: Ee,
705
+ activeIndex: $,
706
+ handleChangeCounselorBulk: at,
707
+ onClose: Ye,
708
+ removeTeacherUserIds: K,
709
+ onSelectRemoveTeacher: Oe,
710
+ openModelSwitchDataTeacher: le,
711
+ onToggleModelSwitchDataTeacher: $e,
712
+ teacherSwitchUserId: ge,
713
+ setTeacherSwitchUserId: Y,
714
+ onToggleModelDeleteBulk: ye,
715
+ openModelDeleteBulk: Ie,
716
+ handelChangeStaffRemove: te,
717
+ switchStaffUsers: G,
718
+ handleRemoveBulkStaff: ot
719
+ };
720
+ };
721
+ function $a(t) {
722
+ return Pt({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M228.9 79.9L51.8 403.1C40.6 423.3 55.5 448 78.9 448h354.3c23.3 0 38.2-24.7 27.1-44.9L283.1 79.9c-11.7-21.2-42.5-21.2-54.2 0zM273.6 214L270 336h-28l-3.6-122h35.2zM256 402.4c-10.7 0-19.1-8.1-19.1-18.4s8.4-18.4 19.1-18.4 19.1 8.1 19.1 18.4-8.4 18.4-19.1 18.4z" } }] })(t);
723
+ }
724
+ const Ea = (t) => {
725
+ const {
726
+ textModal: n,
727
+ isOpen: r,
728
+ teachers: l,
729
+ options: v,
730
+ onClose: s,
731
+ onSave: I,
732
+ modalType: p,
733
+ setTeacherChangeUserId: h,
734
+ setTeacherSelectForChangeUserId: _,
735
+ teacherSelectForChangeUserId: R
736
+ } = t, { t: i } = oe();
737
+ return /* @__PURE__ */ o(
738
+ Le,
739
+ {
740
+ centered: !0,
741
+ isOpen: r,
742
+ toggle: s,
743
+ zIndex: 1201,
744
+ children: [
745
+ /* @__PURE__ */ e(Me, { className: A["header-assign-for-student"], children: i(n.header) }),
746
+ /* @__PURE__ */ o(De, { children: [
747
+ p !== W.Assistant || p !== W.SecondaryTeacher && /* @__PURE__ */ o(Ke, { children: [
748
+ /* @__PURE__ */ e("div", { children: i(n.titleSelect) }),
749
+ /* @__PURE__ */ e("ul", { style: { maxHeight: 200, overflow: "auto" }, children: l.map((w) => /* @__PURE__ */ o("li", { children: [
750
+ w.name,
751
+ "-",
752
+ w.label
753
+ ] }, w.label)) })
754
+ ] }),
755
+ (p === W.Teacher || p === W.Counselor) && /* @__PURE__ */ o(Ke, { children: [
756
+ /* @__PURE__ */ e("div", { children: i(n.selectPlaceholder) }),
757
+ /* @__PURE__ */ e(
758
+ ae,
759
+ {
760
+ options: l,
761
+ value: l.filter((w) => w.value === R),
762
+ placeholder: i(n.selectPlaceholder),
763
+ className: `flex-grow-1 mb-3 ${A["custom-chip-teacher-select"]}`,
764
+ onChange: (w) => {
765
+ _(w.value);
766
+ },
767
+ isClearable: !0,
768
+ style: { maxWidth: 120 }
769
+ }
770
+ )
771
+ ] }),
772
+ /* @__PURE__ */ e("div", { children: i(n.changeTitle) }),
773
+ /* @__PURE__ */ e(
774
+ mt,
775
+ {
776
+ options: v,
777
+ onChange: (w) => {
778
+ p !== W.SecondaryTeacher ? h(w.value) : h(w.id);
779
+ },
780
+ placeholder: i(n.changePlaceholder),
781
+ className: "flex-grow-1 mb-3"
782
+ }
783
+ )
784
+ ] }),
785
+ /* @__PURE__ */ o(xe, { className: "textModal-right", children: [
786
+ /* @__PURE__ */ e(H, { onClick: () => s(!1), children: i("cancel") }),
787
+ /* @__PURE__ */ e(H, { color: "primary", onClick: () => {
788
+ I();
789
+ }, children: i("save") })
790
+ ] })
791
+ ]
792
+ }
793
+ );
794
+ }, Ua = Dt(Ea), ka = ({
795
+ openDetailModal: t,
796
+ onClose: n,
797
+ selectedUser: r,
798
+ staffBulkAssign: l,
799
+ teacherOptions: v,
800
+ handleChangeTeacherBulk: s,
801
+ handleChangeCounselorBulk: I,
802
+ assistantOptions: p,
803
+ counselorOptions: h,
804
+ secondaryTeacherOptions: _,
805
+ handleChangeStaffBulk: R,
806
+ handleEditAssignForStudents: i,
807
+ toggleCollapse: w,
808
+ activeIndex: E
809
+ }) => {
810
+ const { t: L } = oe(), { getLabel: T, system: S } = $t(), O = [
811
+ r?.teachers || [],
812
+ r?.counselors || []
813
+ ], Q = Mt(r), U = (g) => Kt(g, Q), ee = v.filter((g) => !r.teachers?.some((P) => P.teacherUserId === g.value)).filter(U), de = p.filter(U), he = h.filter((g) => !r.counselors?.some((P) => P.counselorUserId === g.value)).filter(U), se = _.filter(U);
814
+ return /* @__PURE__ */ o(
815
+ Le,
816
+ {
817
+ centered: !0,
818
+ isOpen: t,
819
+ toggle: () => n(),
820
+ zIndex: 1201,
821
+ children: [
822
+ /* @__PURE__ */ o(Me, { className: A["header-assign-for-student"], children: [
823
+ /* @__PURE__ */ o("div", { children: [
824
+ "Assign student ",
825
+ r?.fullName
826
+ ] }),
827
+ /* @__PURE__ */ e("div", { children: T(r?.gradeLevel) })
828
+ ] }),
829
+ /* @__PURE__ */ o(De, { children: [
830
+ O.map((g, P) => /* @__PURE__ */ o("div", { children: [
831
+ /* @__PURE__ */ o(
832
+ "button",
833
+ {
834
+ type: "button",
835
+ className: `btn ${A["btn-collapse"]} ${E === P ? "btn-link " : ""}`,
836
+ onClick: () => w(P),
837
+ children: [
838
+ L(P === 0 ? "current_teacher_name" : "current_counselor_name"),
839
+ " ",
840
+ `(${g.length})`,
841
+ " ",
842
+ /* @__PURE__ */ e("i", { className: `fa fa-angle-${E === P ? "up" : "down"}` })
843
+ ]
844
+ }
845
+ ),
846
+ /* @__PURE__ */ e(Zt, { isOpen: E === P, children: /* @__PURE__ */ e(ea, { children: /* @__PURE__ */ e(ta, { children: g.length > 0 ? g.map((J) => P === 0 ? /* @__PURE__ */ o("li", { children: [
847
+ J.mainTeacherName,
848
+ " - ",
849
+ J.mainTeacherEmail
850
+ ] }, J.mainTeacherEmail) : /* @__PURE__ */ o("li", { children: [
851
+ J.counselorName,
852
+ " - ",
853
+ J.counselorEmail
854
+ ] }, J.counselorUserId)) : /* @__PURE__ */ e("div", { children: L("no_data") }) }) }) })
855
+ ] }, P)),
856
+ /* @__PURE__ */ e("div", { children: L("teacher_email") }),
857
+ /* @__PURE__ */ e(
858
+ ae,
859
+ {
860
+ isMulti: !0,
861
+ value: l.teacher.filter((g) => !r.teachers?.some((P) => P.teacherUserId === g.id)).map((g) => ({ label: g.email, value: g.id })),
862
+ options: ee,
863
+ placeholder: L("select_teacher"),
864
+ className: `flex-grow-1 mb-3 ${A["custom-chip-teacher-select"]}`,
865
+ onChange: (g) => {
866
+ const P = g.map((J) => ({
867
+ id: J.value,
868
+ email: J.label
869
+ }));
870
+ s(P);
871
+ },
872
+ isClearable: !0,
873
+ style: { maxWidth: 120 }
874
+ }
875
+ ),
876
+ /* @__PURE__ */ e("div", { children: L("assistant_email") }),
877
+ /* @__PURE__ */ e(
878
+ mt,
879
+ {
880
+ value: p.find((g) => g.value == l.assistantId || g.label == l.assistantEmail) || null,
881
+ options: de,
882
+ onChange: (g) => {
883
+ R("assistant", g);
884
+ },
885
+ placeholder: L("select_assistant"),
886
+ className: "flex-grow-1 mb-3"
887
+ }
888
+ ),
889
+ /* @__PURE__ */ e("div", { children: L("counselor_email") }),
890
+ /* @__PURE__ */ e(
891
+ ae,
892
+ {
893
+ isMulti: !0,
894
+ value: l.counselors.filter((g) => !r.counselors?.some((P) => P.counselorUserId === g.id)).map((g) => ({ label: g.email, value: g.id })),
895
+ options: he,
896
+ placeholder: L("select_counselor"),
897
+ className: `flex-grow-1 mb-3 ${A["custom-chip-teacher-select"]}`,
898
+ onChange: (g) => {
899
+ const P = g.map((J) => ({
900
+ id: J.value,
901
+ email: J.label
902
+ }));
903
+ I(P);
904
+ },
905
+ isClearable: !0,
906
+ style: { maxWidth: 120 }
907
+ }
908
+ ),
909
+ /* @__PURE__ */ e("div", { children: L("support_teacher_email") }),
910
+ /* @__PURE__ */ e(
911
+ mt,
912
+ {
913
+ value: _.find((g) => g.value == l.secondaryTeacherId || g.label == l.secondaryTeacherEmail) || null,
914
+ options: se,
915
+ onChange: (g) => {
916
+ R("secondary", g);
917
+ },
918
+ placeholder: L("select_support_teacher"),
919
+ className: "flex-grow-1"
920
+ }
921
+ ),
922
+ /* @__PURE__ */ e("div", { children: S === "UK" ? "Year" : L("grade") }),
923
+ /* @__PURE__ */ e(
924
+ Ca,
925
+ {
926
+ value: It.filter((g) => g.schoolLevel === Q).map((g) => ({ ...g, label: T(g.value) })).find((g) => g.value === l.gradeLevel) || null,
927
+ options: It.filter((g) => g.schoolLevel === Q).map((g) => ({ ...g, label: T(g.value) })),
928
+ placeholder: S === "UK" ? "Select year" : L("select_grade"),
929
+ className: "flex-grow-1 mb-3",
930
+ onChange: (g) => {
931
+ R("grade", g);
932
+ },
933
+ styles: {
934
+ container: (g) => ({ ...g, maxWidth: 120 })
935
+ }
936
+ }
937
+ )
938
+ ] }),
939
+ /* @__PURE__ */ o(xe, { className: "text-right", children: [
940
+ /* @__PURE__ */ e(H, { onClick: () => n(), children: L("cancel") }),
941
+ /* @__PURE__ */ e(H, { color: "primary", onClick: () => {
942
+ i();
943
+ }, children: L("save") })
944
+ ] })
945
+ ]
946
+ }
947
+ );
948
+ }, La = ({
949
+ open: t,
950
+ onClose: n,
951
+ teachers: r,
952
+ onConfirm: l,
953
+ teacherSwitchUserId: v,
954
+ setTeacherSwitchUserId: s
955
+ }) => {
956
+ const { t: I } = oe();
957
+ return /* @__PURE__ */ o(Le, { centered: !0, isOpen: t, toggle: () => n(), zIndex: 1201, children: [
958
+ /* @__PURE__ */ e(Me, { className: A["header-assign-for-student"], children: /* @__PURE__ */ e("div", { children: "Select teacher switch data" }) }),
959
+ /* @__PURE__ */ e(De, { className: "p-0", children: /* @__PURE__ */ e("div", { className: A["switch-data-teachers"], children: r.map((p) => /* @__PURE__ */ e(
960
+ "p",
961
+ {
962
+ onClick: () => s(p.teacherUserId),
963
+ className: `${A["switch-data-teacher-item"]} ${p.teacherUserId == v ? A["item-checked"] : ""}`,
964
+ children: p.mainTeacherName
965
+ }
966
+ )) }) }),
967
+ /* @__PURE__ */ o(xe, { className: "text-right", children: [
968
+ /* @__PURE__ */ e(H, { onClick: () => n(), children: I("cancel") }),
969
+ /* @__PURE__ */ e(
970
+ H,
971
+ {
972
+ disabled: !v,
973
+ color: "primary",
974
+ onClick: async () => {
975
+ await l(v), n();
976
+ },
977
+ children: I("save")
978
+ }
979
+ )
980
+ ] })
981
+ ] });
982
+ }, Ma = ({
983
+ teachers: t,
984
+ onChangeStaffRemove: n,
985
+ switchStaffUsers: r,
986
+ teacherOptions: l
987
+ }) => {
988
+ const { t: v } = oe();
989
+ return /* @__PURE__ */ o("div", { children: [
990
+ /* @__PURE__ */ e("h6", { children: "Select teacher to remove" }),
991
+ /* @__PURE__ */ e(
992
+ ae,
993
+ {
994
+ isMulti: !0,
995
+ value: t.filter(
996
+ (s) => r.teacherRemoveUserIds.includes(s.value)
997
+ ) || [],
998
+ options: t.filter(
999
+ (s) => !r.teacherRemoveUserIds.includes(
1000
+ s.value
1001
+ ) && s.value !== r.teacherSwitchDataUserId
1002
+ ) || [],
1003
+ placeholder: v("select_teacher"),
1004
+ className: `flex-grow-1 mb-3 ${A["custom-chip-teacher-select"]}`,
1005
+ onChange: (s) => {
1006
+ n({
1007
+ teacherRemoveUserIds: s.map((I) => I.value)
1008
+ });
1009
+ },
1010
+ isClearable: !0
1011
+ }
1012
+ ),
1013
+ /* @__PURE__ */ e("h6", { className: "mt-3", children: "Select the teacher to transfer data to" }),
1014
+ /* @__PURE__ */ e(
1015
+ ae,
1016
+ {
1017
+ value: l.find(
1018
+ (s) => r.teacherSwitchDataUserId == s.value
1019
+ ) || null,
1020
+ options: l.filter(
1021
+ (s) => !r.teacherRemoveUserIds.includes(
1022
+ s.value
1023
+ ) && s.value !== r.teacherSwitchDataUserId
1024
+ ) || [],
1025
+ placeholder: v("select_teacher"),
1026
+ className: `flex-grow-1 mb-3 ${A["custom-chip-teacher-select"]}`,
1027
+ onChange: (s) => {
1028
+ console.log("value", s), n({
1029
+ teacherSwitchDataUserId: s?.value
1030
+ });
1031
+ },
1032
+ isClearable: !0
1033
+ }
1034
+ )
1035
+ ] });
1036
+ }, Da = ({
1037
+ counselors: t,
1038
+ onChangeStaffRemove: n,
1039
+ switchStaffUsers: r,
1040
+ counselorOptions: l
1041
+ }) => {
1042
+ const { t: v } = oe();
1043
+ return /* @__PURE__ */ o("div", { children: [
1044
+ /* @__PURE__ */ e("h6", { children: "Select counselor to remove" }),
1045
+ /* @__PURE__ */ e(
1046
+ ae,
1047
+ {
1048
+ isMulti: !0,
1049
+ value: t.filter(
1050
+ (s) => r.counselorRemoveUserIds.includes(s.value)
1051
+ ) || [],
1052
+ options: t.filter(
1053
+ (s) => !r.counselorRemoveUserIds.includes(
1054
+ s.value
1055
+ ) && s.value !== r.counselorSwitchDataUserId
1056
+ ) || [],
1057
+ placeholder: v("select_counselor"),
1058
+ className: `flex-grow-1 mb-3 ${A["custom-chip-teacher-select"]}`,
1059
+ onChange: (s) => {
1060
+ n({
1061
+ counselorRemoveUserIds: s.map((I) => I.value)
1062
+ });
1063
+ },
1064
+ isClearable: !0
1065
+ }
1066
+ ),
1067
+ /* @__PURE__ */ e("h6", { className: "mt-3", children: "Select the counselor to transfer data to" }),
1068
+ /* @__PURE__ */ e(
1069
+ ae,
1070
+ {
1071
+ value: l.find(
1072
+ (s) => r.counselorSwitchDataUserId == s.value
1073
+ ) || null,
1074
+ options: l.filter(
1075
+ (s) => !r.counselorRemoveUserIds.includes(
1076
+ s.value
1077
+ ) && s.value !== r.counselorSwitchDataUserId
1078
+ ) || [],
1079
+ placeholder: v("select_counselor"),
1080
+ className: `flex-grow-1 mb-3 ${A["custom-chip-counselor-select"]}`,
1081
+ onChange: (s) => {
1082
+ n({
1083
+ counselorSwitchDataUserId: s?.value
1084
+ });
1085
+ },
1086
+ isClearable: !0
1087
+ }
1088
+ )
1089
+ ] });
1090
+ }, xa = ({ tabs: t }) => {
1091
+ const { t: n } = oe(), [r, l] = C(0), v = (I) => {
1092
+ l(I);
1093
+ };
1094
+ return /* @__PURE__ */ e("div", { className: "animated fadeIn", children: /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ o(X, { xl: 12, children: [
1095
+ /* @__PURE__ */ e(aa, { tabs: !0, children: t.map((I, p) => {
1096
+ const h = p === r;
1097
+ return /* @__PURE__ */ e(sa, { children: /* @__PURE__ */ e(
1098
+ na,
1099
+ {
1100
+ className: `${h ? "active" : ""} cursor-pointer`,
1101
+ onClick: () => v(p),
1102
+ style: {
1103
+ color: h ? "#316CD9" : "#242424"
1104
+ },
1105
+ children: n(I.title)
1106
+ }
1107
+ ) }, p);
1108
+ }) }),
1109
+ /* @__PURE__ */ e(
1110
+ ra,
1111
+ {
1112
+ activeTab: r,
1113
+ className: "border-bottom-0 border-left-0 border-right-0 p-3",
1114
+ children: t.map((I, p) => /* @__PURE__ */ e(la, { tabId: p, children: /* @__PURE__ */ e(I.component, {}) }, p))
1115
+ }
1116
+ )
1117
+ ] }) }) });
1118
+ }, Oa = ({
1119
+ assistants: t,
1120
+ onChangeStaffRemove: n,
1121
+ switchStaffUsers: r,
1122
+ assistantOptions: l
1123
+ }) => {
1124
+ const { t: v } = oe();
1125
+ return /* @__PURE__ */ o("div", { children: [
1126
+ /* @__PURE__ */ e("h6", { children: "Select assistant to remove" }),
1127
+ /* @__PURE__ */ e(
1128
+ ae,
1129
+ {
1130
+ isMulti: !0,
1131
+ value: t.filter(
1132
+ (s) => r.assistantRemoveUserId.includes(s.value)
1133
+ ) || [],
1134
+ options: t.filter(
1135
+ (s) => !r.assistantRemoveUserId.includes(
1136
+ s.value
1137
+ ) && s.value !== r.assistantSwitchDataUserId
1138
+ ) || [],
1139
+ placeholder: v("select_assistant"),
1140
+ className: `flex-grow-1 mb-3 ${A["custom-chip-teacher-select"]}`,
1141
+ onChange: (s) => {
1142
+ n({
1143
+ assistantRemoveUserId: s.map((I) => I.value)
1144
+ });
1145
+ },
1146
+ isClearable: !0
1147
+ }
1148
+ ),
1149
+ /* @__PURE__ */ e("h6", { className: "mt-3", children: "Select the assistant to transfer data to" }),
1150
+ /* @__PURE__ */ e(
1151
+ ae,
1152
+ {
1153
+ value: l.find(
1154
+ (s) => r.assistantSwitchDataUserId == s.value
1155
+ ) || null,
1156
+ options: l.filter(
1157
+ (s) => !r.assistantRemoveUserId.includes(
1158
+ s.value
1159
+ ) && s.value !== r.assistantSwitchDataUserId
1160
+ ) || [],
1161
+ placeholder: v("select_assistant"),
1162
+ className: `flex-grow-1 mb-3 ${A["custom-chip-assistant-select"]}`,
1163
+ onChange: (s) => {
1164
+ console.log("value", s), n({
1165
+ assistantSwitchDataUserId: s?.value
1166
+ });
1167
+ },
1168
+ isClearable: !0
1169
+ }
1170
+ )
1171
+ ] });
1172
+ }, Aa = ({
1173
+ secondaryTeachers: t,
1174
+ onChangeStaffRemove: n,
1175
+ switchStaffUsers: r,
1176
+ secondaryTeacherOptions: l
1177
+ }) => {
1178
+ const { t: v } = oe();
1179
+ return /* @__PURE__ */ o("div", { children: [
1180
+ /* @__PURE__ */ e("h6", { children: "Select support teacher to remove" }),
1181
+ /* @__PURE__ */ e(
1182
+ ae,
1183
+ {
1184
+ isMulti: !0,
1185
+ value: t.filter(
1186
+ (s) => r.supportTeacherRemoveUserIds.includes(s.value)
1187
+ ) || [],
1188
+ options: t.filter(
1189
+ (s) => !r.supportTeacherRemoveUserIds.includes(
1190
+ s.value
1191
+ ) && s.value !== r.supportTeacherSwitchDataUserId
1192
+ ) || [],
1193
+ placeholder: v("select_support_teacher"),
1194
+ className: `flex-grow-1 mb-3 ${A["custom-chip-teacher-select"]}`,
1195
+ onChange: (s) => {
1196
+ n({
1197
+ supportTeacherRemoveUserIds: s.map((I) => I.value)
1198
+ });
1199
+ },
1200
+ isClearable: !0
1201
+ }
1202
+ ),
1203
+ /* @__PURE__ */ e("h6", { className: "mt-3", children: "Select the support teacher to transfer data to" }),
1204
+ /* @__PURE__ */ e(
1205
+ ae,
1206
+ {
1207
+ value: l.find(
1208
+ (s) => r.supportTeacherSwitchDataUserId == s.value
1209
+ ) || null,
1210
+ options: l.filter(
1211
+ (s) => !r.supportTeacherRemoveUserIds.includes(
1212
+ s.value
1213
+ ) && s.value !== r.supportTeacherSwitchDataUserId
1214
+ ) || [],
1215
+ placeholder: v("select_support_teacher"),
1216
+ className: `flex-grow-1 mb-3 ${A["custom-chip-teacher-select"]}`,
1217
+ onChange: (s) => {
1218
+ n({
1219
+ supportTeacherSwitchDataUserId: s?.value
1220
+ });
1221
+ },
1222
+ isClearable: !0
1223
+ }
1224
+ )
1225
+ ] });
1226
+ }, Ra = ({
1227
+ open: t,
1228
+ onClose: n,
1229
+ teachers: r,
1230
+ onChangeStaffRemove: l,
1231
+ switchStaffUsers: v,
1232
+ assistants: s,
1233
+ onRemoveBulkStaff: I,
1234
+ counselors: p,
1235
+ studentUserIds: h,
1236
+ secondaryTeachers: _,
1237
+ teacherOptions: R,
1238
+ assistantOptions: i,
1239
+ counselorOptions: w,
1240
+ secondaryTeacherOptions: E
1241
+ }) => {
1242
+ const { t: L } = oe(), T = [
1243
+ {
1244
+ title: "Remove Teacher",
1245
+ component: () => /* @__PURE__ */ e(
1246
+ Ma,
1247
+ {
1248
+ teachers: r,
1249
+ onChangeStaffRemove: l,
1250
+ switchStaffUsers: v,
1251
+ teacherOptions: R
1252
+ }
1253
+ )
1254
+ },
1255
+ {
1256
+ title: "Remove Assistant",
1257
+ component: () => /* @__PURE__ */ e(
1258
+ Oa,
1259
+ {
1260
+ assistants: s,
1261
+ onChangeStaffRemove: l,
1262
+ switchStaffUsers: v,
1263
+ assistantOptions: i
1264
+ }
1265
+ )
1266
+ },
1267
+ {
1268
+ title: "Remove Counselor",
1269
+ component: () => /* @__PURE__ */ e(
1270
+ Da,
1271
+ {
1272
+ counselors: p,
1273
+ onChangeStaffRemove: l,
1274
+ switchStaffUsers: v,
1275
+ counselorOptions: w
1276
+ }
1277
+ )
1278
+ },
1279
+ {
1280
+ title: "Remove Support Teacher",
1281
+ component: () => /* @__PURE__ */ e(
1282
+ Aa,
1283
+ {
1284
+ secondaryTeachers: _,
1285
+ onChangeStaffRemove: l,
1286
+ switchStaffUsers: v,
1287
+ secondaryTeacherOptions: E
1288
+ }
1289
+ )
1290
+ }
1291
+ ];
1292
+ return /* @__PURE__ */ o(Le, { size: "lg", centered: !0, isOpen: t, toggle: () => n(), zIndex: 1201, children: [
1293
+ /* @__PURE__ */ e(
1294
+ Me,
1295
+ {
1296
+ className: `${A["header-assign-for-student"]} border-0`,
1297
+ children: /* @__PURE__ */ e("div", { children: "Remove Bulk" })
1298
+ }
1299
+ ),
1300
+ /* @__PURE__ */ e(De, { className: "p-0", children: /* @__PURE__ */ e(xa, { tabs: T }) }),
1301
+ /* @__PURE__ */ o(xe, { className: "text-right", children: [
1302
+ /* @__PURE__ */ e(H, { onClick: () => n(), children: L("cancel") }),
1303
+ /* @__PURE__ */ e(
1304
+ H,
1305
+ {
1306
+ disabled: !v.teacherRemoveUserIds.length && !v.assistantRemoveUserId && !v.counselorRemoveUserIds.length,
1307
+ color: "primary",
1308
+ onClick: async () => {
1309
+ await I(h);
1310
+ },
1311
+ children: "Remove"
1312
+ }
1313
+ )
1314
+ ] })
1315
+ ] });
1316
+ }, Ba = () => {
1317
+ const { t } = oe(), { getLabel: n, system: r } = $t(), [l, v] = C(), [s, I] = C(), [p, h] = C(), [_, R] = C(), [i, w] = C([]), [E, L] = C([]), [T, S] = C([]), [O, Q] = C([]);
1318
+ _e(() => {
1319
+ Ta().then((a) => {
1320
+ a.data && (w(a.data.teachers || []), L(a.data.assistants || []), S(a.data.counselors || []), Q(a.data.secondaryTeachers || []));
1321
+ }).catch((a) => {
1322
+ console.error("Failed to load educators options", a);
1323
+ });
1324
+ }, []);
1325
+ const {
1326
+ isCheck: U,
1327
+ userList: ee,
1328
+ filters: de,
1329
+ totalItem: he,
1330
+ handleClickCheck: se,
1331
+ changeFilters: g,
1332
+ fullName: P,
1333
+ handleRetrievedData: J,
1334
+ selectedUser: V,
1335
+ setSelectedUser: Ce,
1336
+ getDataUserList: M,
1337
+ userSelected: f,
1338
+ studentTeacherSelected: u,
1339
+ studentCounselorSelected: c,
1340
+ studentAssistantSelected: $,
1341
+ studentSecondaryTeacherSelected: F,
1342
+ isStudentSelectionDisabled: K,
1343
+ handleBlockedSchoolLevelSelection: ne,
1344
+ schoolLevelConflictMessage: ge,
1345
+ handleSelectAll: Y,
1346
+ isCheckAll: le
1347
+ } = Na(), ce = () => {
1348
+ J(), v(void 0), I(void 0), h(void 0), R(void 0);
1349
+ }, {
1350
+ openModelBulk: Ie,
1351
+ handleToggleModel: ve,
1352
+ staffBulkAssign: G,
1353
+ handleChangeStaffBulk: fe,
1354
+ onAssignStaffToStudents: te,
1355
+ handleToggleInactiveModal: ye,
1356
+ openInactiveModal: $e,
1357
+ handleInactiveStudents: Oe,
1358
+ handleChangeTeacherBulk: Ee,
1359
+ handleChangeCounselorBulk: Ae,
1360
+ handleEditAssignForStudents: Je,
1361
+ // handleToggleSwitchModel,
1362
+ modalType: Ue,
1363
+ openSwitchModal: Ye,
1364
+ optionsSwitch: Xe,
1365
+ textModal: Qe,
1366
+ teacherSwitchList: Ze,
1367
+ onCloseSwitchModal: et,
1368
+ handleUpdateSwitch: tt,
1369
+ setTeacherChangeUserId: at,
1370
+ setTeacherSelectForChangeUserId: Re,
1371
+ teacherSelectForChangeUserId: st,
1372
+ openDetailModal: nt,
1373
+ setOpenDetailModal: rt,
1374
+ toggleCollapse: lt,
1375
+ activeIndex: ct,
1376
+ onClose: ot,
1377
+ removeTeacherUserIds: d,
1378
+ // onSelectRemoveTeacher,
1379
+ openModelSwitchDataTeacher: m,
1380
+ onToggleModelSwitchDataTeacher: y,
1381
+ teacherSwitchUserId: D,
1382
+ setTeacherSwitchUserId: x,
1383
+ onToggleModelDeleteBulk: N,
1384
+ openModelDeleteBulk: q,
1385
+ handelChangeStaffRemove: j,
1386
+ switchStaffUsers: Z,
1387
+ handleRemoveBulkStaff: ue
1388
+ } = wa(
1389
+ l,
1390
+ s,
1391
+ p,
1392
+ _,
1393
+ ce,
1394
+ V,
1395
+ M,
1396
+ f
1397
+ ), me = [
1398
+ {
1399
+ name: "",
1400
+ isCenter: !0,
1401
+ onSelectAll: Y,
1402
+ isCheckAll: le,
1403
+ className: `align-top ${A["fixed-width-40"]}`
1404
+ },
1405
+ {
1406
+ name: "student_name",
1407
+ isCenter: !0,
1408
+ sortBy: we.Name,
1409
+ className: `align-top ${A["fixed-width"]}`
1410
+ },
1411
+ {
1412
+ name: r === "UK" ? "Year" : "grade",
1413
+ isCenter: !0,
1414
+ sortBy: we.Grade,
1415
+ searchBy: je.Grade,
1416
+ className: `align-center justify-center ${A["fixed-width-120"]}`,
1417
+ getOption: (a) => ({
1418
+ label: a ? n(a) : "empty",
1419
+ value: a
1420
+ })
1421
+ },
1422
+ {
1423
+ name: "teacher_emails",
1424
+ isCenter: !0,
1425
+ className: "align-center justify-center",
1426
+ sortBy: we.Teacher,
1427
+ searchBy: je.Teacher,
1428
+ getOption: (a) => ({
1429
+ label: a || "empty",
1430
+ value: a
1431
+ })
1432
+ },
1433
+ {
1434
+ name: "assistant_email",
1435
+ isCenter: !0,
1436
+ className: "align-center justify-center",
1437
+ sortBy: we.Assistant,
1438
+ searchBy: je.Assistant,
1439
+ getOption: (a) => ({
1440
+ label: a || "empty",
1441
+ value: a
1442
+ })
1443
+ },
1444
+ {
1445
+ name: "counselor_emails",
1446
+ isCenter: !0,
1447
+ className: "align-center justify-center",
1448
+ sortBy: we.Counselor,
1449
+ searchBy: je.Counselor,
1450
+ getOption: (a) => ({
1451
+ label: a || "empty",
1452
+ value: a
1453
+ })
1454
+ },
1455
+ {
1456
+ name: "support_teacher_email",
1457
+ isCenter: !0,
1458
+ className: "align-center justify-center",
1459
+ sortBy: we.SecondaryTeacher,
1460
+ searchBy: je.SecondaryTeacher,
1461
+ getOption: (a) => ({
1462
+ label: a || "empty",
1463
+ value: a
1464
+ })
1465
+ }
1466
+ ], [be, Bt] = C(null), re = (a) => {
1467
+ Bt((k) => k === a ? null : a);
1468
+ };
1469
+ return /* @__PURE__ */ o("div", { className: "fadeIn animated", children: [
1470
+ /* @__PURE__ */ e("h5", { className: "mt-4 mb-2", children: t("assign_student") }),
1471
+ /* @__PURE__ */ o(pe, { className: "my-2", children: [
1472
+ /* @__PURE__ */ e(X, { md: 3, children: /* @__PURE__ */ e(
1473
+ Et,
1474
+ {
1475
+ initValue: de?.searchString || "",
1476
+ onSearch: (a) => g({ searchString: a }),
1477
+ placeholder: t("type_something_to_search_students")
1478
+ }
1479
+ ) }),
1480
+ /* @__PURE__ */ e(X, { md: 8, className: "d-flex justify-content-end align-items-center", children: /* @__PURE__ */ e(pe, { className: "mb-2", children: /* @__PURE__ */ o(X, { style: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 4 }, children: [
1481
+ /* @__PURE__ */ e(H, { onClick: () => ve(U), color: "primary", style: { background: "#316cd9" }, children: t("assign_bulk") }),
1482
+ /* @__PURE__ */ e(H, { onClick: () => N(U), color: "primary", style: { background: "#316cd9" }, children: t("delete_bulk") }),
1483
+ /* @__PURE__ */ e(H, { onClick: () => ye(U), color: "primary", style: { background: "#316cd9" }, children: t("inactive_students") })
1484
+ ] }) }) }),
1485
+ /* @__PURE__ */ o(
1486
+ X,
1487
+ {
1488
+ md: 1,
1489
+ className: "d-flex justify-content-end align-items-center",
1490
+ style: { whiteSpace: "nowrap", flexWrap: "nowrap" },
1491
+ children: [
1492
+ t("total_of_users"),
1493
+ ": ",
1494
+ he
1495
+ ]
1496
+ }
1497
+ )
1498
+ ] }),
1499
+ /* @__PURE__ */ o(Le, { centered: !0, isOpen: Ie, toggle: () => ve(), zIndex: 1201, children: [
1500
+ /* @__PURE__ */ e(Me, { children: t("assign_bulk_student") }),
1501
+ /* @__PURE__ */ o(De, { children: [
1502
+ /* @__PURE__ */ e(
1503
+ ae,
1504
+ {
1505
+ isMulti: !0,
1506
+ value: G.teacher.map((a) => ({ label: a.email, value: a.id })),
1507
+ options: ie(i, U, f),
1508
+ placeholder: t("select_teacher"),
1509
+ className: `flex-grow-1 mb-3 ${A["custom-chip-teacher-select"]}`,
1510
+ onChange: (a) => {
1511
+ const k = a.map((B) => ({
1512
+ id: B.value,
1513
+ email: B.label
1514
+ }));
1515
+ Ee(k);
1516
+ },
1517
+ isClearable: !0,
1518
+ style: { maxWidth: 120 }
1519
+ }
1520
+ ),
1521
+ /* @__PURE__ */ e(
1522
+ ae,
1523
+ {
1524
+ value: E.find((a) => a.value == G.assistantId || a.label == G.assistantEmail) || null,
1525
+ options: ie(E, U, f),
1526
+ onChange: (a) => fe("assistant", a),
1527
+ placeholder: t("select_assistant"),
1528
+ className: "flex-grow-1 mb-3"
1529
+ }
1530
+ ),
1531
+ /* @__PURE__ */ e(
1532
+ ae,
1533
+ {
1534
+ isMulti: !0,
1535
+ value: G.counselors.map((a) => ({ label: a.email, value: a.id })),
1536
+ options: ie(T, U, f),
1537
+ placeholder: t("select_counselor"),
1538
+ className: `flex-grow-1 mb-3 ${A["custom-chip-teacher-select"]}`,
1539
+ onChange: (a) => {
1540
+ const k = a.map((B) => ({
1541
+ id: B.value,
1542
+ email: B.label,
1543
+ schoolLevel: B.schoolLevel
1544
+ }));
1545
+ Ae(k);
1546
+ },
1547
+ isClearable: !0,
1548
+ style: { maxWidth: 120 }
1549
+ }
1550
+ ),
1551
+ /* @__PURE__ */ e(
1552
+ ae,
1553
+ {
1554
+ value: O.find((a) => a.value == G.secondaryTeacherId || a.label == G.secondaryTeacherEmail) || null,
1555
+ options: ie(O, U, f),
1556
+ onChange: (a) => fe("secondary", a),
1557
+ placeholder: t("select_support_teacher"),
1558
+ className: "flex-grow-1"
1559
+ }
1560
+ )
1561
+ ] }),
1562
+ /* @__PURE__ */ o(xe, { className: "text-right", children: [
1563
+ /* @__PURE__ */ e(H, { onClick: () => ve(), children: t("cancel") }),
1564
+ /* @__PURE__ */ e(H, { color: "primary", onClick: () => te(U), children: t("assign") })
1565
+ ] })
1566
+ ] }),
1567
+ /* @__PURE__ */ o(Le, { centered: !0, isOpen: $e, toggle: () => ye(), zIndex: 1201, children: [
1568
+ /* @__PURE__ */ e(Me, { children: t("inactive_students") }),
1569
+ /* @__PURE__ */ o(De, { style: { display: "flex", gap: 12 }, children: [
1570
+ /* @__PURE__ */ e($a, { color: "red", size: 30 }),
1571
+ /* @__PURE__ */ e(ca, { style: { fontSize: 20, margin: 0, display: "flex", alignItems: "center" }, children: t("are_you_sure_you_want_to_inactive_students", { number: U.length }) })
1572
+ ] }),
1573
+ /* @__PURE__ */ o(xe, { className: "text-right", children: [
1574
+ /* @__PURE__ */ e(H, { onClick: () => ye(), children: t("cancel") }),
1575
+ /* @__PURE__ */ e(H, { color: "primary", onClick: () => Oe(U, ce), children: t("confirm") })
1576
+ ] })
1577
+ ] }),
1578
+ /* @__PURE__ */ o(pe, { className: "my-2", children: [
1579
+ /* @__PURE__ */ e(X, { md: 12, children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ o(xt, { bordered: !0, hover: !0, striped: !0, size: "sm", className: `${A["table-fixed"]}`, children: [
1580
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e(
1581
+ Yt,
1582
+ {
1583
+ headers: me,
1584
+ filters: de,
1585
+ fullName: P,
1586
+ onChangeFilters: g,
1587
+ teacherOptions: i,
1588
+ assistantOptions: E,
1589
+ counselorOptions: T,
1590
+ secondaryTeacherOptions: O
1591
+ }
1592
+ ) }),
1593
+ ee && ee.length > 0 ? /* @__PURE__ */ e("tbody", { children: ee.map((a, k) => /* @__PURE__ */ o("tr", { children: [
1594
+ /* @__PURE__ */ e("td", { className: `align-middle text-center ${A["fixed-width-40"]}`, children: (() => {
1595
+ const B = K(a), Be = `student_checkbox_${a.id}_${k}`;
1596
+ return /* @__PURE__ */ o(
1597
+ "span",
1598
+ {
1599
+ id: Be,
1600
+ onClick: () => {
1601
+ B && ne();
1602
+ },
1603
+ onMouseEnter: () => {
1604
+ B && re(Be);
1605
+ },
1606
+ onMouseLeave: () => {
1607
+ B && re(Be);
1608
+ },
1609
+ style: { display: "inline-block" },
1610
+ children: [
1611
+ /* @__PURE__ */ e(
1612
+ "input",
1613
+ {
1614
+ id: a.id,
1615
+ type: "checkbox",
1616
+ onChange: se,
1617
+ checked: U.includes(
1618
+ a.id
1619
+ ),
1620
+ disabled: B,
1621
+ style: { pointerEvents: B ? "none" : void 0 }
1622
+ }
1623
+ ),
1624
+ B && /* @__PURE__ */ e(
1625
+ Ne,
1626
+ {
1627
+ placement: "right",
1628
+ isOpen: be === Be,
1629
+ target: Be,
1630
+ children: ge
1631
+ }
1632
+ )
1633
+ ]
1634
+ }
1635
+ );
1636
+ })() }),
1637
+ /* @__PURE__ */ o(
1638
+ "td",
1639
+ {
1640
+ className: `align-middle ${A["fixed-width"]}`,
1641
+ id: `student_name_${a.id}_${k}`,
1642
+ onMouseEnter: () => re(`student_name_${a.id}_${k}`),
1643
+ onMouseLeave: () => re(`student_name_${a.id}_${k}`),
1644
+ children: [
1645
+ /* @__PURE__ */ e(
1646
+ "button",
1647
+ {
1648
+ type: "button",
1649
+ className: `${A["button-user-name"]} btn-link`,
1650
+ onClick: () => {
1651
+ Ce(a), rt(!0);
1652
+ },
1653
+ children: a.fullName
1654
+ }
1655
+ ),
1656
+ /* @__PURE__ */ e(
1657
+ Ne,
1658
+ {
1659
+ placement: "top",
1660
+ isOpen: be === `student_name_${a.id}_${k}`,
1661
+ target: `student_name_${a.id}_${k}`,
1662
+ children: a.fullName
1663
+ }
1664
+ )
1665
+ ]
1666
+ }
1667
+ ),
1668
+ /* @__PURE__ */ o(
1669
+ "td",
1670
+ {
1671
+ className: `align-middle text-center ${A["fixed-width-120"]}`,
1672
+ id: `student_grade_${a.id}_${k}`,
1673
+ onMouseEnter: () => re(`student_grade_${a.id}_${k}`),
1674
+ onMouseLeave: () => re(`student_grade_${a.id}_${k}`),
1675
+ children: [
1676
+ /* @__PURE__ */ e("p", { className: "mb-0", children: n(a.gradeLevel) }),
1677
+ !!n(a.gradeLevel) && /* @__PURE__ */ e(
1678
+ Ne,
1679
+ {
1680
+ placement: "top",
1681
+ isOpen: be === `student_grade_${a.id}_${k}`,
1682
+ target: `student_grade_${a.id}_${k}`,
1683
+ children: n(a.gradeLevel)
1684
+ }
1685
+ )
1686
+ ]
1687
+ }
1688
+ ),
1689
+ /* @__PURE__ */ o(
1690
+ "td",
1691
+ {
1692
+ className: `align-middle ${A["equal-width"]}`,
1693
+ id: `student_teacher_${a.id}_${k}`,
1694
+ onMouseEnter: () => re(`student_teacher_${a.id}_${k}`),
1695
+ onMouseLeave: () => re(`student_teacher_${a.id}_${k}`),
1696
+ children: [
1697
+ !!a.teachers && a.teachers.length > 0 && /* @__PURE__ */ e(Ke, { children: a.teachers.map((B) => /* @__PURE__ */ o("p", { className: "mb-0", children: [
1698
+ B.mainTeacherName,
1699
+ " - ",
1700
+ B.mainTeacherEmail
1701
+ ] }, B.mainTeacherEmail)) }),
1702
+ !!a.teachers && a.teachers.length > 0 && /* @__PURE__ */ e(
1703
+ Ne,
1704
+ {
1705
+ placement: "top",
1706
+ isOpen: be === `student_teacher_${a.id}_${k}`,
1707
+ target: `student_teacher_${a.id}_${k}`,
1708
+ children: a.teachers.map((B) => /* @__PURE__ */ o("p", { className: "mb-0", children: [
1709
+ B.mainTeacherName,
1710
+ " - ",
1711
+ B.mainTeacherEmail
1712
+ ] }, B.mainTeacherEmail))
1713
+ }
1714
+ )
1715
+ ]
1716
+ }
1717
+ ),
1718
+ /* @__PURE__ */ o(
1719
+ "td",
1720
+ {
1721
+ className: `align-middle ${A["equal-width"]}`,
1722
+ id: `student_assistant_${a.id}_${k}`,
1723
+ onMouseEnter: () => re(`student_assistant_${a.id}_${k}`),
1724
+ onMouseLeave: () => re(`student_assistant_${a.id}_${k}`),
1725
+ children: [
1726
+ !!a.assistantEmail && /* @__PURE__ */ o("p", { className: "mb-0", children: [
1727
+ a.assistantName,
1728
+ " - ",
1729
+ a.assistantEmail
1730
+ ] }),
1731
+ !!a.assistantEmail && /* @__PURE__ */ o(
1732
+ Ne,
1733
+ {
1734
+ placement: "top",
1735
+ isOpen: be === `student_assistant_${a.id}_${k}`,
1736
+ target: `student_assistant_${a.id}_${k}`,
1737
+ children: [
1738
+ a.assistantName,
1739
+ "-",
1740
+ a.assistantEmail
1741
+ ]
1742
+ }
1743
+ )
1744
+ ]
1745
+ }
1746
+ ),
1747
+ /* @__PURE__ */ o(
1748
+ "td",
1749
+ {
1750
+ className: `align-middle ${A["equal-width"]}`,
1751
+ id: `student_counselor_${a.id}_${k}`,
1752
+ onMouseEnter: () => re(`student_counselor_${a.id}_${k}`),
1753
+ onMouseLeave: () => re(`student_counselor_${a.id}_${k}`),
1754
+ children: [
1755
+ !!a.counselors && a.counselors.length > 0 && /* @__PURE__ */ e(Ke, { children: a.counselors.map((B) => /* @__PURE__ */ o("p", { className: "mb-0", children: [
1756
+ B.counselorName,
1757
+ " - ",
1758
+ B.counselorEmail
1759
+ ] }, B.counselorUserId)) }),
1760
+ !!a.counselors && a.counselors.length > 0 && /* @__PURE__ */ e(
1761
+ Ne,
1762
+ {
1763
+ placement: "top",
1764
+ isOpen: be === `student_counselor_${a.id}_${k}`,
1765
+ target: `student_counselor_${a.id}_${k}`,
1766
+ children: a.counselors.map((B) => /* @__PURE__ */ o("p", { className: "mb-0", children: [
1767
+ B.counselorName,
1768
+ " - ",
1769
+ B.counselorEmail
1770
+ ] }, B.counselorUserId))
1771
+ }
1772
+ )
1773
+ ]
1774
+ }
1775
+ ),
1776
+ /* @__PURE__ */ o(
1777
+ "td",
1778
+ {
1779
+ className: `align-middle ${A["equal-width"]}`,
1780
+ id: `student_secondary_teacher_${a.id}_${k}`,
1781
+ onMouseEnter: () => re(`student_secondary_teacher_${a.id}_${k}`),
1782
+ onMouseLeave: () => re(`student_secondary_teacher_${a.id}_${k}`),
1783
+ children: [
1784
+ !!a.secondaryTeacherEmail && /* @__PURE__ */ o("p", { className: "mb-0", children: [
1785
+ a.secondaryTeacherName,
1786
+ " - ",
1787
+ a.secondaryTeacherEmail
1788
+ ] }),
1789
+ !!a.secondaryTeacherEmail && /* @__PURE__ */ o(
1790
+ Ne,
1791
+ {
1792
+ placement: "top",
1793
+ isOpen: be === `student_secondary_teacher_${a.id}_${k}`,
1794
+ target: `student_secondary_teacher_${a.id}_${k}`,
1795
+ children: [
1796
+ a.secondaryTeacherName,
1797
+ " - ",
1798
+ a.secondaryTeacherEmail
1799
+ ]
1800
+ }
1801
+ )
1802
+ ]
1803
+ }
1804
+ )
1805
+ ] }, `${a.id}_${k}`)) }) : /* @__PURE__ */ e("div", { style: { width: "max-content", padding: 20 }, children: t("no_data") })
1806
+ ] }) }) }),
1807
+ /* @__PURE__ */ e(X, { md: 12, children: /* @__PURE__ */ e(
1808
+ Ut,
1809
+ {
1810
+ filters: de,
1811
+ totalRecordCount: he,
1812
+ changePageSize: (a) => g({ pageSize: a }),
1813
+ changePage: (a) => g({ currentPage: a })
1814
+ }
1815
+ ) })
1816
+ ] }),
1817
+ /* @__PURE__ */ e(
1818
+ ka,
1819
+ {
1820
+ openDetailModal: nt,
1821
+ onClose: ot,
1822
+ selectedUser: V,
1823
+ staffBulkAssign: G,
1824
+ teacherOptions: ie(i, [V?.id], [V]),
1825
+ handleChangeTeacherBulk: Ee,
1826
+ handleChangeCounselorBulk: Ae,
1827
+ assistantOptions: ie(E, [V?.id], [V]),
1828
+ counselorOptions: ie(T, [V?.id], [V]),
1829
+ secondaryTeacherOptions: ie(O, [V?.id], [V]),
1830
+ handleChangeStaffBulk: fe,
1831
+ handleEditAssignForStudents: Je,
1832
+ toggleCollapse: lt,
1833
+ activeIndex: ct
1834
+ }
1835
+ ),
1836
+ /* @__PURE__ */ e(
1837
+ Ua,
1838
+ {
1839
+ textModal: Qe,
1840
+ isOpen: Ye,
1841
+ teachers: Ze,
1842
+ options: Xe,
1843
+ onClose: et,
1844
+ onSave: tt,
1845
+ modalType: Ue,
1846
+ setTeacherChangeUserId: at,
1847
+ setTeacherSelectForChangeUserId: Re,
1848
+ teacherSelectForChangeUserId: st
1849
+ }
1850
+ ),
1851
+ /* @__PURE__ */ e(
1852
+ La,
1853
+ {
1854
+ open: m,
1855
+ onClose: y,
1856
+ teachers: V?.teachers?.filter((a) => !d.includes(a.teacherUserId)) || [],
1857
+ onConfirm: Je,
1858
+ teacherSwitchUserId: D,
1859
+ setTeacherSwitchUserId: x
1860
+ }
1861
+ ),
1862
+ /* @__PURE__ */ e(
1863
+ Ra,
1864
+ {
1865
+ open: q,
1866
+ onClose: N,
1867
+ teachers: u,
1868
+ onChangeStaffRemove: j,
1869
+ switchStaffUsers: Z,
1870
+ counselors: c,
1871
+ assistants: $,
1872
+ onRemoveBulkStaff: ue,
1873
+ studentUserIds: U,
1874
+ secondaryTeachers: F,
1875
+ teacherOptions: ie(i, U, f),
1876
+ assistantOptions: ie(E, U, f),
1877
+ counselorOptions: ie(T, U, f),
1878
+ secondaryTeacherOptions: ie(O, U, f)
1879
+ }
1880
+ )
1881
+ ] });
1882
+ }, Pa = () => {
1883
+ const t = qe(), [n, r] = C(
1884
+ Ot
1885
+ ), [l, v] = C([]), [s, I] = C(""), p = async () => {
1886
+ try {
1887
+ const _ = await Ft();
1888
+ v(_.data);
1889
+ } catch (_) {
1890
+ t(
1891
+ b({
1892
+ type: "danger",
1893
+ message: _.response?.data?.title || _.message
1894
+ })
1895
+ );
1896
+ }
1897
+ }, h = l.map((_) => ({
1898
+ label: `${_.name} - ${_.email}`,
1899
+ value: _.id
1900
+ }));
1901
+ return _e(() => {
1902
+ n.roles?.includes("Teacher") && p();
1903
+ }, [n]), {
1904
+ userChoiced: n,
1905
+ setUserChoiced: r,
1906
+ teacherList: l,
1907
+ options: h,
1908
+ setTeacherChangeId: I,
1909
+ teacherChangeId: s
1910
+ };
1911
+ }, Fa = "User deleted list", ja = () => {
1912
+ const {
1913
+ userChoiced: t,
1914
+ setUserChoiced: n,
1915
+ options: r,
1916
+ teacherChangeId: l,
1917
+ setTeacherChangeId: v
1918
+ } = Pa(), [s, I] = C([]), [p, h] = C(0), { filters: _, changeFilters: R } = jt(), i = qe(), w = ut(null), E = () => {
1919
+ w && w.current && w.current.toggle();
1920
+ }, L = () => {
1921
+ v(""), n(Ot);
1922
+ }, T = Te(async () => {
1923
+ i(z(!0));
1924
+ try {
1925
+ const O = await zt(_), { items: Q, totalItems: U } = O.data;
1926
+ I(Q), h(U);
1927
+ } catch (O) {
1928
+ i(
1929
+ b({
1930
+ type: "danger",
1931
+ message: O.response?.data?.title || O.message
1932
+ })
1933
+ );
1934
+ }
1935
+ i(z(!1));
1936
+ }, [i, _]);
1937
+ _e(() => {
1938
+ document.title = Fa;
1939
+ }, []), _e(() => {
1940
+ T();
1941
+ }, [_]);
1942
+ const S = Te(
1943
+ (O) => {
1944
+ i(
1945
+ pt({
1946
+ isOpen: !0,
1947
+ type: "warning",
1948
+ message: "Do you want to remove this user?",
1949
+ onConfirm: async () => {
1950
+ i(z(!0));
1951
+ try {
1952
+ t.roles.includes("Teacher") ? await vt(O, l) : await vt(O), i(
1953
+ b({
1954
+ type: "success",
1955
+ message: "Remove user successfully"
1956
+ })
1957
+ ), E(), L(), R({ currentPage: 1 });
1958
+ } catch (Q) {
1959
+ i(
1960
+ b({
1961
+ type: "danger",
1962
+ message: Q.response?.data?.title || Q.message
1963
+ })
1964
+ );
1965
+ }
1966
+ i(z(!1));
1967
+ }
1968
+ })
1969
+ );
1970
+ },
1971
+ [_, l, t]
1972
+ );
1973
+ return {
1974
+ userList: s,
1975
+ totalItems: p,
1976
+ filters: _,
1977
+ getData: T,
1978
+ removeData: S,
1979
+ changeFilters: R,
1980
+ modal: w,
1981
+ openModal: E,
1982
+ userChoiced: t,
1983
+ setUserChoiced: n,
1984
+ options: r,
1985
+ teacherChangeId: l,
1986
+ setTeacherChangeId: v,
1987
+ resetData: L
1988
+ };
1989
+ }, za = (t, n) => {
1990
+ const {
1991
+ header: r,
1992
+ removeData: l,
1993
+ resetData: v,
1994
+ userChoiced: s,
1995
+ options: I,
1996
+ teacherChangeId: p,
1997
+ setTeacherChangeId: h
1998
+ } = t, { t: _ } = oe(), R = () => {
1999
+ var i = window.location.origin + "/api/ExportDataUser/" + s.id;
2000
+ window.open(i);
2001
+ };
2002
+ return /* @__PURE__ */ e(
2003
+ Vt,
2004
+ {
2005
+ header: r,
2006
+ ref: n,
2007
+ onCancel: () => {
2008
+ v();
2009
+ },
2010
+ children: /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ o(X, { md: 12, className: "mb-2", children: [
2011
+ /* @__PURE__ */ e("p", { children: _("export_user_data") }),
2012
+ /* @__PURE__ */ e("div", { className: "pb-3", children: /* @__PURE__ */ e(
2013
+ H,
2014
+ {
2015
+ color: "success",
2016
+ onClick: () => {
2017
+ R();
2018
+ },
2019
+ style: { color: "#fff" },
2020
+ children: _("download_users_data")
2021
+ }
2022
+ ) }),
2023
+ /* @__PURE__ */ e("p", { children: "Delete user" }),
2024
+ !!s && /* @__PURE__ */ o("div", { children: [
2025
+ s.roles.includes("Student") && /* @__PURE__ */ o("div", { children: [
2026
+ /* @__PURE__ */ e(Pe, { color: "danger", children: _("alert_delete_user") }),
2027
+ /* @__PURE__ */ e(
2028
+ H,
2029
+ {
2030
+ color: "danger",
2031
+ onClick: () => l(s.id),
2032
+ style: { color: "#fff" },
2033
+ children: _("delete_user")
2034
+ }
2035
+ )
2036
+ ] }),
2037
+ s.roles.includes("Admin") && /* @__PURE__ */ o("div", { children: [
2038
+ /* @__PURE__ */ e(Pe, { color: "danger", children: _("alert_delete_user") }),
2039
+ /* @__PURE__ */ e(
2040
+ H,
2041
+ {
2042
+ color: "danger",
2043
+ onClick: () => l(s.id),
2044
+ children: _("delete_user")
2045
+ }
2046
+ )
2047
+ ] }),
2048
+ s.roles.includes("Teacher") && /* @__PURE__ */ o("div", { children: [
2049
+ /* @__PURE__ */ e(Pe, { color: "warning", children: _("alert_delete_user") }),
2050
+ /* @__PURE__ */ e(
2051
+ ae,
2052
+ {
2053
+ options: I,
2054
+ defaultValue: p,
2055
+ placeholder: "select_teacher_change",
2056
+ onChange: (i) => h(i.value)
2057
+ }
2058
+ ),
2059
+ !!p && /* @__PURE__ */ o("div", { className: "mt-2", children: [
2060
+ /* @__PURE__ */ e(Pe, { color: "danger", children: _("alert_delete_user") }),
2061
+ /* @__PURE__ */ e(
2062
+ H,
2063
+ {
2064
+ color: "danger",
2065
+ onClick: () => l(s.id),
2066
+ children: _("delete_user")
2067
+ }
2068
+ )
2069
+ ] })
2070
+ ] }),
2071
+ (s.roles.includes("Parent") || s.roles.includes("Counselor") || s.roles.includes("SecondaryTeacher")) && /* @__PURE__ */ o("div", { children: [
2072
+ /* @__PURE__ */ e(Pe, { color: "danger", children: _("alert_delete_user") }),
2073
+ /* @__PURE__ */ e(
2074
+ H,
2075
+ {
2076
+ color: "danger",
2077
+ onClick: () => l(s.id),
2078
+ children: _("delete_user")
2079
+ }
2080
+ )
2081
+ ] })
2082
+ ] })
2083
+ ] }) })
2084
+ }
2085
+ );
2086
+ }, Va = Dt(za), qa = "user_deleted", Ja = () => {
2087
+ const {
2088
+ userList: t,
2089
+ totalItems: n,
2090
+ filters: r,
2091
+ changeFilters: l,
2092
+ removeData: v,
2093
+ openModal: s,
2094
+ modal: I,
2095
+ userChoiced: p,
2096
+ setUserChoiced: h,
2097
+ options: _,
2098
+ teacherChangeId: R,
2099
+ setTeacherChangeId: i,
2100
+ resetData: w
2101
+ } = ja(), { t: E } = oe(), L = (T) => {
2102
+ T && h(T), s();
2103
+ };
2104
+ return /* @__PURE__ */ o("div", { className: "fadeIn animated", children: [
2105
+ /* @__PURE__ */ e("h5", { className: "mt-4 mb-2", children: E(qa) }),
2106
+ /* @__PURE__ */ o(pe, { className: "my-2", children: [
2107
+ /* @__PURE__ */ e(X, { md: 8, children: /* @__PURE__ */ e(
2108
+ Et,
2109
+ {
2110
+ initValue: r.searchString,
2111
+ onSearch: (T) => l({ searchString: T }),
2112
+ placeholder: E("type_something_to_search_reflection_result")
2113
+ }
2114
+ ) }),
2115
+ /* @__PURE__ */ o(
2116
+ X,
2117
+ {
2118
+ md: 4,
2119
+ className: "d-flex justify-content-end align-items-center",
2120
+ children: [
2121
+ E("total_of_users"),
2122
+ ": ",
2123
+ n
2124
+ ]
2125
+ }
2126
+ )
2127
+ ] }),
2128
+ /* @__PURE__ */ o(pe, { className: "mb-2", children: [
2129
+ /* @__PURE__ */ e(X, { md: 12, children: t && t.length > 0 ? /* @__PURE__ */ e("div", { children: /* @__PURE__ */ o(xt, { bordered: !0, hover: !0, striped: !0, responsive: !0, size: "sm", children: [
2130
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ o("tr", { children: [
2131
+ /* @__PURE__ */ e("th", { className: "align-top", children: E("name") }),
2132
+ /* @__PURE__ */ e("th", { className: "align-top", children: E("email") }),
2133
+ /* @__PURE__ */ e("th", { className: "align-top", children: E("role") })
2134
+ ] }) }),
2135
+ /* @__PURE__ */ e("tbody", { children: t.map((T) => /* @__PURE__ */ o("tr", { children: [
2136
+ /* @__PURE__ */ e("td", { className: "align-middle", children: /* @__PURE__ */ e(
2137
+ qt,
2138
+ {
2139
+ label: `${T.fullName}`,
2140
+ onClick: () => L(T)
2141
+ }
2142
+ ) }),
2143
+ /* @__PURE__ */ e("td", { className: "align-middle", children: T.email }),
2144
+ /* @__PURE__ */ e("td", { className: "align-middle", children: !!T.roles && T.roles.map((S) => S === "SecondaryTeacher" ? "SupportTeacher" : S).join(", ") })
2145
+ ] }, T.id)) })
2146
+ ] }) }) : /* @__PURE__ */ e(Jt, { label: E("user") }) }),
2147
+ /* @__PURE__ */ e(X, { md: 12, children: /* @__PURE__ */ e(
2148
+ Ut,
2149
+ {
2150
+ filters: r,
2151
+ totalRecordCount: n,
2152
+ changePageSize: (T) => l({ pageSize: T }),
2153
+ changePage: (T) => l({ currentPage: T })
2154
+ }
2155
+ ) })
2156
+ ] }),
2157
+ /* @__PURE__ */ e(
2158
+ Va,
2159
+ {
2160
+ ref: I,
2161
+ header: p.fullName,
2162
+ onCancel: () => {
2163
+ },
2164
+ userChoiced: p,
2165
+ removeData: v,
2166
+ options: _,
2167
+ teacherChangeId: R,
2168
+ setTeacherChangeId: i,
2169
+ resetData: w
2170
+ }
2171
+ )
2172
+ ] });
2173
+ }, Wa = {
2174
+ padding: "4px 8px",
2175
+ marginBottom: 0,
2176
+ borderRadius: "4px",
2177
+ color: "#fff",
2178
+ fontWeight: 500,
2179
+ fontSize: "14px",
2180
+ height: "56px",
2181
+ justifyContent: "center"
2182
+ }, He = ({
2183
+ htmlFor: t,
2184
+ isDisabled: n,
2185
+ text: r,
2186
+ backgroundColor: l,
2187
+ onClick: v,
2188
+ isClassReflection: s
2189
+ }) => /* @__PURE__ */ o(
2190
+ oa,
2191
+ {
2192
+ htmlFor: t,
2193
+ role: "button",
2194
+ tabIndex: 0,
2195
+ className: `d-flex align-items-center justfy-content-center mr-2
2196
+ ${s ? "w-25" : ""}
2197
+ ${n ? "" : "cursor-pointer hover-opacity"}`,
2198
+ style: {
2199
+ ...Wa,
2200
+ backgroundColor: l,
2201
+ opacity: n ? 0.5 : 1,
2202
+ gap: "8px"
2203
+ },
2204
+ onClick: (I) => v(),
2205
+ children: [
2206
+ /* @__PURE__ */ e("i", { className: "fa fa-paperclip mr-1", "aria-hidden": "true" }),
2207
+ r
2208
+ ]
2209
+ }
2210
+ ), At = `${Lt}/api/ImportCsv/csv`, ft = `${Lt}/api/Teacher`, Ga = (t, n) => gt.post(`${At}/${n}`, t), Nt = (t) => gt.post(`${At}/importClassReflection`, t), Ha = (t, n) => gt.post(`${ft}/adminImportStudentByTeacherId/${t}`, n), Ka = (t) => kt.post(`${ft}/adminImportChunkUser`, t), Ya = (t = !0) => kt.get(`${ft}/download-template-file-user?hasEsSchool=${t}`);
2211
+ var Rt = /* @__PURE__ */ ((t) => (t.Students = "students", t.Subjects = "subjects", t.Grades = "grades", t.Attendances = "attendances", t.ClassReflection = "classReflection", t.Others = "others", t.AllUser = "allUser", t))(Rt || {});
2212
+ const Xa = [
2213
+ {
2214
+ text: "import_users",
2215
+ backgroundColor: "#0abde3",
2216
+ type: "allUser"
2217
+ /* AllUser */
2218
+ }
2219
+ ], Qa = [
2220
+ // {
2221
+ // text: "Import students",
2222
+ // backgroundColor: "#0abde3",
2223
+ // type: CSVType.Students
2224
+ // },
2225
+ // {
2226
+ // text: "Import subjects",
2227
+ // backgroundColor: "#1dd1a1",
2228
+ // type: CSVType.Subjects
2229
+ // },
2230
+ // { text: "Import grades", backgroundColor: "#54a0ff", type: CSVType.Grades },
2231
+ // {
2232
+ // text: "Import attendances",
2233
+ // backgroundColor: "#feca57",
2234
+ // type: CSVType.Attendances
2235
+ // },
2236
+ {
2237
+ text: "import_class_reflection",
2238
+ backgroundColor: "#e74c3c",
2239
+ type: "classReflection"
2240
+ /* ClassReflection */
2241
+ }
2242
+ // { text: "Import others", backgroundColor: "#8395a7", type: CSVType.Others }
2243
+ ], Za = "CSV Import", ht = "csvupload", wt = {
2244
+ teacherName: "",
2245
+ teacherEmail: "",
2246
+ studentIds: [],
2247
+ file: ""
2248
+ }, es = () => {
2249
+ const t = qe(), n = ha((M) => M.common.isLoading), [r, l] = C(null), [v, s] = C(), [I, p] = C([]), [h, _] = C(wt), [R, i] = C(), [w, E] = C([]), T = window.location.hostname.includes("isb"), [S, O] = C(0), [Q, U] = C("");
2250
+ _e(() => {
2251
+ document.title = Za;
2252
+ }, []);
2253
+ const ee = T ? Xa : Qa, de = async () => {
2254
+ t(z(!0));
2255
+ try {
2256
+ const u = await Ya(!0);
2257
+ var M = new Blob([Wt(u.data.content)], { type: "text/csv" });
2258
+ const c = window.URL.createObjectURL(M);
2259
+ var f = document.createElement("a");
2260
+ f.href = c, f.setAttribute("download", u.data.nameFile), f.click(), t(
2261
+ b({
2262
+ type: "success",
2263
+ message: "Download successfully"
2264
+ })
2265
+ );
2266
+ } catch (u) {
2267
+ t(
2268
+ b({
2269
+ type: "danger",
2270
+ message: u.message
2271
+ })
2272
+ );
2273
+ }
2274
+ t(z(!1));
2275
+ }, he = Te(
2276
+ async (M) => {
2277
+ if (!r || !M) return;
2278
+ t(z(!0));
2279
+ try {
2280
+ M = await yt(M);
2281
+ const $ = new FormData();
2282
+ $.append("file", M, M.name);
2283
+ const F = r === "allUser" ? _t.Admin : _t.Teacher, K = await Xt($, F, !0);
2284
+ if (K.data && K.data.length > 0) {
2285
+ E(K.data), t(z(!1)), t(
2286
+ b({
2287
+ type: "danger",
2288
+ message: "Please use the file as per the template."
2289
+ })
2290
+ );
2291
+ return;
2292
+ }
2293
+ if (r == "allUser") {
2294
+ let ge = (await M.text()).trim();
2295
+ const Y = ge.split(`
2296
+ `).map((te) => te.trim()), le = Y.findIndex((te) => te.split(",").includes("First Name"));
2297
+ if (le === 0)
2298
+ throw new Error("Invalid CSV: Missing header row.");
2299
+ ge = Y.slice(le).join(`
2300
+ `);
2301
+ const ce = Ia.parse(ge, { header: !0, skipEmptyLines: !0 }), Ie = ce.meta.fields, ve = ce.data;
2302
+ if (!ve.length) {
2303
+ t(z(!1)), t(
2304
+ b({
2305
+ type: "danger",
2306
+ message: "The file has no data or some column names are misformed."
2307
+ })
2308
+ );
2309
+ return;
2310
+ }
2311
+ const G = 10, fe = [];
2312
+ for (let te = 0; te < ve.length; te += G) {
2313
+ const $e = ve.slice(te, te + G).map(
2314
+ (Oe) => Object.values(Oe).map((Ee) => (Ee ?? "").toString().trim())
2315
+ );
2316
+ Ie && $e.unshift(Ie), fe.push($e);
2317
+ }
2318
+ for (let te = 0; te < fe.length; te++)
2319
+ await Ka({
2320
+ index: te,
2321
+ chunks: fe[te]
2322
+ }), await new Promise((ye) => setTimeout(ye, 500));
2323
+ } else
2324
+ T ? r == "classReflection" && await Nt($) : await Ga($, r.toString());
2325
+ t(
2326
+ b({
2327
+ type: "success",
2328
+ message: "Import CSV successfully"
2329
+ })
2330
+ );
2331
+ } catch ($) {
2332
+ console.error("❌ Upload failed", $), t(
2333
+ b({
2334
+ type: "danger",
2335
+ message: $.response?.data?.title || $.message
2336
+ })
2337
+ );
2338
+ }
2339
+ t(z(!1));
2340
+ const f = document.getElementById(ht), u = document.getElementById("import-student"), c = document.getElementById("import-classReflection");
2341
+ f && (f.value = ""), u && (u.value = ""), c && (c.value = "");
2342
+ },
2343
+ [r]
2344
+ ), se = async (M) => {
2345
+ if (!S) {
2346
+ t(
2347
+ b({
2348
+ type: "danger",
2349
+ message: "Select teacher before import csv"
2350
+ })
2351
+ );
2352
+ return;
2353
+ }
2354
+ if (!r || !M) return;
2355
+ t(z(!0));
2356
+ try {
2357
+ M = await yt(M);
2358
+ const u = new FormData();
2359
+ u.append("file", M, M.name), await Ha(S, u), t(
2360
+ b({
2361
+ type: "success",
2362
+ message: "Import CSV successfully"
2363
+ })
2364
+ );
2365
+ } catch (u) {
2366
+ t(
2367
+ b({
2368
+ type: "danger",
2369
+ message: u.response?.data?.title || u.message
2370
+ })
2371
+ );
2372
+ }
2373
+ t(z(!1));
2374
+ const f = document.getElementById("teacherSelector");
2375
+ f && (f.value = "");
2376
+ }, g = async (M) => {
2377
+ if (!v || !v) return;
2378
+ t(z(!0));
2379
+ try {
2380
+ const u = new FormData();
2381
+ u.append("file", v, v.name), u.append("teacherName", M.teacherName), u.append("teacherEmail", M.teacherEmail), M.studentIds.forEach((c) => {
2382
+ u.append("studentIds", c);
2383
+ }), await Nt(u), t(
2384
+ b({
2385
+ type: "success",
2386
+ message: "Import CSV successfully"
2387
+ })
2388
+ ), _(wt);
2389
+ } catch (u) {
2390
+ t(
2391
+ b({
2392
+ type: "danger",
2393
+ message: u.response?.data?.title || u.message
2394
+ })
2395
+ );
2396
+ }
2397
+ t(z(!1));
2398
+ const f = document.getElementById(ht);
2399
+ f && (f.value = "");
2400
+ }, P = (M) => {
2401
+ O(M.value);
2402
+ }, J = (M) => {
2403
+ i(M), U(M?.name || "");
2404
+ }, V = () => {
2405
+ if (!R) {
2406
+ t(
2407
+ b({
2408
+ type: "danger",
2409
+ message: "Select CSV to import"
2410
+ })
2411
+ );
2412
+ return;
2413
+ }
2414
+ se(R);
2415
+ };
2416
+ return {
2417
+ isLoading: n,
2418
+ buttons: ee,
2419
+ id: ht,
2420
+ setType: l,
2421
+ upload: he,
2422
+ initImportReflection: h,
2423
+ setInitImportReflection: _,
2424
+ onConfirm: g,
2425
+ CSVType: Rt,
2426
+ dataFile: v,
2427
+ setDataFile: s,
2428
+ setArrStudent: p,
2429
+ arrStudent: I,
2430
+ isCheckDomainIBS: T,
2431
+ onChangeTeacher: P,
2432
+ uploadByTeacherId: se,
2433
+ setDataFileImportStudent: J,
2434
+ onUpLoadStudentFile: V,
2435
+ defaultTeacher: S,
2436
+ fileName: Q,
2437
+ onStudentSubmit: () => {
2438
+ t(
2439
+ pt({
2440
+ isOpen: !0,
2441
+ type: "warning",
2442
+ message: "Are you sure upload this file?",
2443
+ onConfirm: () => {
2444
+ V();
2445
+ }
2446
+ })
2447
+ );
2448
+ },
2449
+ downloadTemplateUser: de,
2450
+ errorsValidate: w,
2451
+ setErrorsValidate: E
2452
+ };
2453
+ }, ts = Ve.object({
2454
+ teacherName: Ve.string()?.trim().required(),
2455
+ teacherEmail: Ve.string()?.trim().email("Invalid email").required(),
2456
+ studentIds: Ve.array().required().test(
2457
+ "test students",
2458
+ "Please choose student",
2459
+ function() {
2460
+ return !!this.parent.studentIds && !!this.parent.studentIds.length;
2461
+ }
2462
+ ),
2463
+ file: Ve.string()?.trim().required()
2464
+ }), as = () => {
2465
+ const {
2466
+ initImportReflection: t,
2467
+ onConfirm: n,
2468
+ isLoading: r,
2469
+ setType: l,
2470
+ id: v,
2471
+ CSVType: s,
2472
+ dataFile: I,
2473
+ setDataFile: p,
2474
+ setArrStudent: h,
2475
+ buttons: _,
2476
+ upload: R,
2477
+ isCheckDomainIBS: i,
2478
+ downloadTemplateUser: w,
2479
+ errorsValidate: E,
2480
+ setErrorsValidate: L
2481
+ } = es(), { t: T } = oe();
2482
+ return /* @__PURE__ */ e("div", { className: "animated fadeIn pt-3", children: i ? /* @__PURE__ */ o(it, { children: [
2483
+ /* @__PURE__ */ e(
2484
+ Fe,
2485
+ {
2486
+ className: "d-none",
2487
+ type: "file",
2488
+ id: "import-user",
2489
+ onChange: (S) => R(S.target.files[0]),
2490
+ accept: "text/csv"
2491
+ }
2492
+ ),
2493
+ /* @__PURE__ */ e(
2494
+ Fe,
2495
+ {
2496
+ className: "d-none",
2497
+ type: "file",
2498
+ id: "import-classReflection",
2499
+ onChange: (S) => R(S.target.files[0]),
2500
+ accept: "text/csv"
2501
+ }
2502
+ ),
2503
+ /* @__PURE__ */ e("div", { className: "class-reflection", children: /* @__PURE__ */ e(
2504
+ ba,
2505
+ {
2506
+ initialValues: t,
2507
+ enableReinitialize: !0,
2508
+ validationSchema: ts,
2509
+ onSubmit: (S, O) => {
2510
+ n(S), p(""), h([]), O.resetForm();
2511
+ },
2512
+ children: (S) => {
2513
+ const {
2514
+ // values,
2515
+ touched: O,
2516
+ errors: Q
2517
+ // handleSubmit,
2518
+ // handleChange
2519
+ } = S;
2520
+ return /* @__PURE__ */ o(pe, { className: "mb-2", children: [
2521
+ /* @__PURE__ */ e(
2522
+ Fe,
2523
+ {
2524
+ className: "d-none",
2525
+ type: "file",
2526
+ id: v,
2527
+ onChange: (U) => {
2528
+ p(U.target.files[0]), S.setFieldValue("file", "imported");
2529
+ const ee = document.getElementById(v);
2530
+ ee && (ee.value = "");
2531
+ },
2532
+ accept: "text/csv"
2533
+ }
2534
+ ),
2535
+ /* @__PURE__ */ e(X, { md: 6, className: "mb-2 d-flex mt-5", children: /* @__PURE__ */ o(pe, { className: "w-100 flex-column", children: [
2536
+ /* @__PURE__ */ o(X, { md: 12, className: "", children: [
2537
+ /* @__PURE__ */ e(We, { text: T("import_class_reflection") }),
2538
+ /* @__PURE__ */ e(
2539
+ He,
2540
+ {
2541
+ htmlFor: "import-classReflection",
2542
+ text: T("import_class_reflection"),
2543
+ isDisabled: r,
2544
+ backgroundColor: "#e74c3c",
2545
+ onClick: () => {
2546
+ l(s.ClassReflection);
2547
+ }
2548
+ },
2549
+ "Import class reflections"
2550
+ ),
2551
+ !!I && /* @__PURE__ */ e("p", { style: { color: "#007bff", fontStyle: "italic", marginTop: "5px" }, children: I.name })
2552
+ ] }),
2553
+ !I && /* @__PURE__ */ e(X, { md: 12, className: "mb-2", children: O.file && Q.file && /* @__PURE__ */ e(
2554
+ dt,
2555
+ {
2556
+ text: Q.file
2557
+ }
2558
+ ) })
2559
+ ] }) }),
2560
+ /* @__PURE__ */ e(X, { md: 6, className: "mb-2", children: /* @__PURE__ */ o(pe, { className: "flex-column", children: [
2561
+ /* @__PURE__ */ e(X, { md: 12, className: "mb-2 text-right", style: { textAlign: "right" }, children: /* @__PURE__ */ e(
2562
+ H,
2563
+ {
2564
+ role: "button",
2565
+ color: "primary",
2566
+ onClick: () => w(),
2567
+ children: /* @__PURE__ */ o("p", { className: "d-flex align-items-center mb-0", children: [
2568
+ T("download_template"),
2569
+ " ",
2570
+ /* @__PURE__ */ e(Tt, { size: 20, className: "ml-2" })
2571
+ ] })
2572
+ }
2573
+ ) }),
2574
+ /* @__PURE__ */ o(X, { md: 12, className: "mb-2", children: [
2575
+ /* @__PURE__ */ e(We, { text: T("import_users") }),
2576
+ _.map((U) => /* @__PURE__ */ e(
2577
+ He,
2578
+ {
2579
+ htmlFor: "import-user",
2580
+ text: U.text,
2581
+ isDisabled: r,
2582
+ backgroundColor: U.backgroundColor,
2583
+ onClick: () => l(U.type)
2584
+ },
2585
+ U.text
2586
+ ))
2587
+ ] }),
2588
+ E?.length > 0 && E.map((U, ee) => /* @__PURE__ */ e(
2589
+ dt,
2590
+ {
2591
+ text: U
2592
+ },
2593
+ ee
2594
+ ))
2595
+ ] }) })
2596
+ ] });
2597
+ }
2598
+ }
2599
+ ) })
2600
+ ] }) : /* @__PURE__ */ e(it, { children: /* @__PURE__ */ o(pe, { children: [
2601
+ /* @__PURE__ */ e(X, { md: 12, className: "mt-2 mb-2 text-left", children: /* @__PURE__ */ e(
2602
+ H,
2603
+ {
2604
+ role: "button",
2605
+ color: "primary",
2606
+ onClick: () => w(),
2607
+ children: /* @__PURE__ */ o("p", { className: "d-flex align-items-center mb-0", children: [
2608
+ T("download_template"),
2609
+ " ",
2610
+ /* @__PURE__ */ e(Tt, { size: 20, className: "ml-2" })
2611
+ ] })
2612
+ }
2613
+ ) }),
2614
+ /* @__PURE__ */ o(X, { md: 6, className: "mb-3", children: [
2615
+ /* @__PURE__ */ e(
2616
+ Fe,
2617
+ {
2618
+ id: "import-user",
2619
+ className: "d-none",
2620
+ type: "file",
2621
+ onChange: (S) => R(S.target.files[0]),
2622
+ accept: "text/csv"
2623
+ }
2624
+ ),
2625
+ /* @__PURE__ */ e(We, { text: T("import_users") }),
2626
+ /* @__PURE__ */ e(
2627
+ He,
2628
+ {
2629
+ htmlFor: "import-user",
2630
+ text: T("import_users"),
2631
+ isDisabled: r,
2632
+ backgroundColor: "#0abde3",
2633
+ onClick: () => {
2634
+ l(s.AllUser), E.length > 0 && L([]);
2635
+ }
2636
+ },
2637
+ "import-users"
2638
+ )
2639
+ ] }),
2640
+ E.length > 0 && E.map((S, O) => /* @__PURE__ */ e(
2641
+ dt,
2642
+ {
2643
+ text: S
2644
+ },
2645
+ O
2646
+ )),
2647
+ /* @__PURE__ */ o(X, { md: 6, className: "mb-3", children: [
2648
+ /* @__PURE__ */ e(
2649
+ Fe,
2650
+ {
2651
+ className: "d-none",
2652
+ type: "file",
2653
+ id: v,
2654
+ onChange: (S) => R(S.target.files[0]),
2655
+ accept: "text/csv"
2656
+ }
2657
+ ),
2658
+ _.map((S) => /* @__PURE__ */ o(it, { children: [
2659
+ /* @__PURE__ */ e(We, { text: T(S.text) }),
2660
+ /* @__PURE__ */ e(
2661
+ He,
2662
+ {
2663
+ htmlFor: v,
2664
+ text: T(S.text),
2665
+ isDisabled: r,
2666
+ backgroundColor: S.backgroundColor,
2667
+ onClick: () => l(S.type)
2668
+ },
2669
+ S.text
2670
+ )
2671
+ ] }))
2672
+ ] })
2673
+ ] }) }) });
2674
+ }, ss = [
2675
+ {
2676
+ path: "/admin/users/user-list",
2677
+ title: "user_list",
2678
+ component: Qt
2679
+ },
2680
+ {
2681
+ path: "/admin/users/assign-student",
2682
+ title: "assign_student",
2683
+ component: Ba
2684
+ },
2685
+ {
2686
+ path: "/admin/users/user-deleted",
2687
+ title: "user_deleted",
2688
+ component: Ja
2689
+ },
2690
+ {
2691
+ path: "/admin/users/import-csv",
2692
+ title: "csv_import",
2693
+ component: as
2694
+ }
2695
+ ], vs = () => /* @__PURE__ */ e(Gt, { tabs: ss });
2696
+ export {
2697
+ vs as default
2698
+ };