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