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