mario-core 2.0.102-release → 2.0.103-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 (67) hide show
  1. package/dist/Dashboard-B2WY8-IU.js +1 -0
  2. package/dist/Dashboard-BzKx6Ox_.mjs +206 -0
  3. package/dist/Dashboard-DJS7P679.mjs +206 -0
  4. package/dist/Dashboard-NC2RHYE3.js +1 -0
  5. package/dist/EmailTemplateDetail-22mli8ZO.js +1 -0
  6. package/dist/EmailTemplateDetail-CfqeSysW.js +1 -0
  7. package/dist/EmailTemplateDetail-D5H-KPFi.mjs +443 -0
  8. package/dist/EmailTemplateDetail-DnEe1dJY.mjs +443 -0
  9. package/dist/EmailTemplateList-BBgctzKn.mjs +170 -0
  10. package/dist/EmailTemplateList-BSETyjvK.js +1 -0
  11. package/dist/EmailTemplateList-CEfrVodv.mjs +170 -0
  12. package/dist/EmailTemplateList-CpfPUX5H.js +1 -0
  13. package/dist/GalleryList-BKH6TE8o.js +1 -0
  14. package/dist/GalleryList-D1-lprY3.mjs +329 -0
  15. package/dist/GalleryList-D6Npg6OD.mjs +329 -0
  16. package/dist/GalleryList-DZDBNr1J.js +1 -0
  17. package/dist/Login-07zPaPX9.js +1 -0
  18. package/dist/Login-CSb85ENW.mjs +1697 -0
  19. package/dist/Login-C_elLcnh.mjs +1688 -0
  20. package/dist/Login-t8Cp9sZB.js +1 -0
  21. package/dist/NotificationList-D1ay6Hyf.mjs +3982 -0
  22. package/dist/NotificationList-DHjB1hHV.js +2 -0
  23. package/dist/NotificationList-DlWtyPB-.mjs +3982 -0
  24. package/dist/NotificationList-Dr8Yrfl7.js +2 -0
  25. package/dist/SkillList-CjP3DHVV.mjs +386 -0
  26. package/dist/SkillList-DED-BKhK.js +1 -0
  27. package/dist/SkillList-EMox2GtU.js +1 -0
  28. package/dist/SkillList-a-PCBXTS.mjs +386 -0
  29. package/dist/TeacherSelector-CT_LK5ps.js +1 -0
  30. package/dist/TeacherSelector-CYN1RV9H.js +1 -0
  31. package/dist/TeacherSelector-Ckdz4LDA.mjs +30 -0
  32. package/dist/TeacherSelector-TtFRSN6T.mjs +30 -0
  33. package/dist/TheContent-BLL5TnF0.js +1 -0
  34. package/dist/TheContent-C1z93b1T.mjs +38 -0
  35. package/dist/TheContent-CV2yUmwY.js +1 -0
  36. package/dist/TheContent-ClceIaDH.mjs +38 -0
  37. package/dist/UserContainer-BwVN8uDh.mjs +2902 -0
  38. package/dist/UserContainer-DKBxc6bM.js +5 -0
  39. package/dist/UserContainer-Dgajsjc2.js +5 -0
  40. package/dist/UserContainer-W5RhNyuY.mjs +2902 -0
  41. package/dist/UserDetail-B1OEfUkB.mjs +903 -0
  42. package/dist/UserDetail-CcAyPDXB.mjs +903 -0
  43. package/dist/UserDetail-D_54wIZ1.js +1 -0
  44. package/dist/UserDetail-EIVg7R4V.js +1 -0
  45. package/dist/UserList-BHBPOboi.js +7 -0
  46. package/dist/UserList-CuML6EN2.mjs +1261 -0
  47. package/dist/UserList-D7DcyFHI.js +7 -0
  48. package/dist/UserList-DPS62SYL.mjs +1254 -0
  49. package/dist/constants-CAl8i9EQ.mjs +286 -0
  50. package/dist/constants-CQviSc2u.js +1 -0
  51. package/dist/constants-DIXj0L_y.js +1 -0
  52. package/dist/constants-Jqu1Wphx.mjs +286 -0
  53. package/dist/index-7hA60HfM.mjs +19133 -0
  54. package/dist/index-9XtI-PeV.js +15 -0
  55. package/dist/index-C6cqi7Br.js +15 -0
  56. package/dist/index-DplP6JK1.mjs +19133 -0
  57. package/dist/index.js +1 -1
  58. package/dist/index.modern.js +1 -1
  59. package/dist/mailCategoryService-Bhcruih6.js +1 -0
  60. package/dist/mailCategoryService-CJQb-5oo.mjs +11 -0
  61. package/dist/mailCategoryService-CQdNPG8e.js +1 -0
  62. package/dist/mailCategoryService-D_DFc1LB.mjs +11 -0
  63. package/dist/userService-1_ugW9AK.js +1 -0
  64. package/dist/userService-C4VF2Wck.mjs +56 -0
  65. package/dist/userService-De8Jm8I4.js +1 -0
  66. package/dist/userService-OWU32PxA.mjs +56 -0
  67. package/package.json +1 -1
@@ -0,0 +1,1254 @@
1
+ import { jsxs as b, jsx as t, Fragment as ke } from "react/jsx-runtime";
2
+ import { Button as ye, Popover as De, PopoverBody as Le, Label as Y, Input as X, FormGroup as de, Row as Se, Col as Q, Table as Fe } from "reactstrap";
3
+ import { l as Me, t as ve, m as Pe, n as ze, s as He, o as je, p as Ve, q as Je, v as Ge, w as Ke, x as qe } from "./userService-C4VF2Wck.mjs";
4
+ import { useTranslation as ce } from "react-i18next";
5
+ import { useState as H, useMemo as re, useCallback as j, useEffect as V, useRef as Ce, Fragment as We } from "react";
6
+ import { useSelector as oe, useDispatch as ee } from "react-redux";
7
+ import { useNavigate as Ye, useLocation as Qe } from "react-router-dom";
8
+ import { a9 as be, b as I, aa as me, c as B, O as Z, u as Xe, I as Ze, d as Ee, N as et, ab as tt, G as q, s as D, ac as we, ad as Oe, a6 as te, B as Ae, i as st, ae as nt, Q as at, af as rt, S as ot, T as ct, U as it, ag as lt } from "./index-7hA60HfM.mjs";
9
+ import { d as dt, u as mt, e as ht, S as J, f as pt, C as Ne, g as ut } from "./constants-CAl8i9EQ.mjs";
10
+ import { L as gt } from "./types-BvnbDeJF.mjs";
11
+ import { differenceInCalendarYears as ft, parseISO as yt } from "date-fns";
12
+ import _e from "papaparse";
13
+ function St(e, s) {
14
+ Me(2, arguments);
15
+ var m = ve(e), c = ve(s);
16
+ return m.getFullYear() - c.getFullYear();
17
+ }
18
+ const vt = () => {
19
+ const [e, s] = H(dt);
20
+ return { filters: e, setFilters: s, changeFilters: (c) => {
21
+ const S = {
22
+ ...e,
23
+ ...c
24
+ };
25
+ S.searchString && c.searchString && c.searchString != e.searchString && (S.currentPage = 1), s(S);
26
+ } };
27
+ }, Ct = "/admin/user", bt = "/admin/create-user", Et = "User list", ae = "/home", Nt = "/home", _t = "/admin/home", Rt = "/parent", xt = "/admin/schools", Tt = "/list-student", wt = () => {
28
+ const e = Ye(), m = new URLSearchParams(location.search).get("query"), c = oe((n) => n.users.userList), S = oe((n) => n.users.totalItems), { filters: f, changeFilters: r } = vt(), y = m || "", [u, E] = H([]), i = window.location.host.includes("-district"), o = ee(), { t: h } = ce(), $ = (n) => {
29
+ const g = u.find((p) => p == n);
30
+ E(g ? u.filter((p) => p != n) : u.concat([n]));
31
+ }, R = re(() => (c || []).length > 0 && (c || []).every((n) => u.includes(n.id)), [c, u]), w = j(() => {
32
+ if (R) {
33
+ const g = new Set((c || []).map((p) => p.id));
34
+ E((p) => p.filter((a) => !g.has(a)));
35
+ return;
36
+ }
37
+ const n = (c || []).map((g) => g.id).filter((g) => !u.includes(g));
38
+ E((g) => [...g, ...n]);
39
+ }, [c, R, u]), N = j(
40
+ async () => {
41
+ if (f.searchBy !== void 0 && f.searchByStrings !== void 0 && f.searchByStrings.length === 0) {
42
+ o(be({ userList: [], totalItems: 0 }));
43
+ return;
44
+ }
45
+ o(I(!0));
46
+ try {
47
+ const n = await Pe(f), { items: g, totalItems: p } = n.data;
48
+ for (const a of g)
49
+ a.roles = a.roles.map((d) => d != me.EDUTEACHER ? d : "EduTeacher"), a.msRoles && (a.msRoles = a.msRoles.map((d) => d != me.EDUTEACHER ? d : "EduTeacher")), a.esRoles && (a.esRoles = a.esRoles.map((d) => d != me.EDUTEACHER ? d : "EduTeacher"));
50
+ o(be({ userList: g, totalItems: p }));
51
+ } catch (n) {
52
+ o(
53
+ B({
54
+ type: "danger",
55
+ message: n.response?.data?.title || n.message
56
+ })
57
+ );
58
+ }
59
+ o(I(!1));
60
+ },
61
+ [o, f]
62
+ ), v = async () => {
63
+ o(I(!0));
64
+ try {
65
+ const g = (await je()).data?.message || h("sync_roster_running_in_background", "Roster synchronization is currently running in the background. Please wait a few moments before refreshing the page.");
66
+ o(
67
+ Z({
68
+ isOpen: !0,
69
+ type: "success",
70
+ message: g
71
+ })
72
+ );
73
+ } catch (n) {
74
+ o(
75
+ Z({
76
+ isOpen: !0,
77
+ type: "danger",
78
+ message: n.response?.data?.message || n.response?.data?.title || n.message
79
+ })
80
+ );
81
+ }
82
+ o(I(!1));
83
+ }, C = (n) => {
84
+ if (!n) return "";
85
+ const g = [], { sourcedId: p, rosterUser: a } = n;
86
+ if (p && a && g.push(p), a) {
87
+ const { givenName: d, middleName: U, familyName: T, email: M } = a, P = [];
88
+ T && P.push(T), U && P.push(U), d && P.push(d), g.push(P.join(" ") || ""), g.push(M || "");
89
+ }
90
+ return g.join(" / ");
91
+ };
92
+ V(() => {
93
+ document.title = Et;
94
+ }, []), V(() => {
95
+ r({
96
+ ...f,
97
+ searchString: y
98
+ });
99
+ }, [y]), V(() => {
100
+ N();
101
+ }, [JSON.stringify(f)]);
102
+ const x = j(
103
+ (n) => {
104
+ o(
105
+ Z({
106
+ isOpen: !0,
107
+ type: "warning",
108
+ message: h("do_you_want_to_remove_this_user"),
109
+ onConfirm: async () => {
110
+ o(I(!0));
111
+ try {
112
+ await ze(n), o(
113
+ B({
114
+ type: "success",
115
+ message: "Remove user successfully"
116
+ })
117
+ ), f.currentPage !== 1 ? r({ currentPage: 1 }) : N();
118
+ } catch (g) {
119
+ o(
120
+ B({
121
+ type: "danger",
122
+ message: g.response?.data?.title || g.message
123
+ })
124
+ );
125
+ }
126
+ o(I(!1));
127
+ }
128
+ })
129
+ );
130
+ },
131
+ [JSON.stringify(f)]
132
+ ), F = [
133
+ { role: "Admin", path: _t },
134
+ { role: "Teacher", path: ae },
135
+ { role: "Assistant", path: ae },
136
+ { role: "Counselor", path: ae },
137
+ { role: "SecondaryTeacher", path: ae },
138
+ { role: "EduTeacher", path: Tt },
139
+ { role: "Student", path: Nt },
140
+ { role: "Parent", path: Rt }
141
+ ], k = (n) => {
142
+ const g = sessionStorage.getItem(Ze), p = n.data?.token;
143
+ let a = n.data.msRoles || [], d = n.data.esRoles || [];
144
+ const U = n.data.roles || n.data.userRoles || [], T = (n.data.appType || "").toUpperCase();
145
+ a.length === 0 && d.length === 0 && U.length > 0 && (T.includes("ES") && !T.includes("MS") ? d = U : T.includes("MS") && !T.includes("ES") ? a = U : (a = U, d = U));
146
+ let M = "MS", P = "/home", L = !1;
147
+ for (const { role: W, path: se } of F) {
148
+ const K = a.includes(W), z = d.includes(W);
149
+ if (!(!K && !z)) {
150
+ M = K ? "MS" : "ES", P = se, L = !0;
151
+ break;
152
+ }
153
+ }
154
+ L || (M = a.length > 0 ? "MS" : d.length > 0 ? "ES" : "MS");
155
+ const _ = M === "ES" ? d : a;
156
+ g ? sessionStorage.setItem(Ee, p) : localStorage.setItem(Ee, p);
157
+ let A = "";
158
+ _.includes("Admin") ? A = "Admin" : _.includes("Teacher") ? A = _.includes("Assistant") ? "Teacher,Assistant" : "Teacher" : _.includes("Assistant") ? A = "Assistant" : _.includes("Counselor") ? A = "Counselor" : _.includes("SecondaryTeacher") ? A = "SecondaryTeacher" : _.includes("EduTeacher") ? A = "EduTeacher" : _.includes("Student") ? A = "Student" : _.includes("Parent") ? A = "Parent" : _.length > 0 && (A = _[0]), A && localStorage.setItem("ROLES", A), localStorage.removeItem(et), i && (P = xt);
159
+ const G = M === "ES" && !_.includes("Admin") ? `/es${P}` : P;
160
+ window.location.href = G;
161
+ }, O = j(
162
+ async (n) => {
163
+ try {
164
+ const p = (await He(n)).data;
165
+ o(
166
+ Z({
167
+ isOpen: !0,
168
+ type: "warning",
169
+ message: h("do_you_want_to_impersonate_this_user"),
170
+ onConfirm: async () => {
171
+ o(I(!0));
172
+ try {
173
+ const a = {
174
+ email: p.email,
175
+ password: "default",
176
+ accessToken: p.token,
177
+ loginType: gt.Impersonate
178
+ }, d = await Xe(a), U = {};
179
+ for (let T = 0; T < localStorage.length; T++) {
180
+ const M = localStorage.key(T);
181
+ M && (M === "SELECTED_TIER" || M.startsWith("SELECTED_TIER_")) && (U[M] = localStorage.getItem(M) || "");
182
+ }
183
+ localStorage.clear(), Object.keys(U).forEach((T) => {
184
+ localStorage.setItem(T, U[T]);
185
+ }), k(d);
186
+ } catch (a) {
187
+ B({
188
+ type: "danger",
189
+ message: a.response?.data?.title || a.message
190
+ });
191
+ }
192
+ o(I(!1));
193
+ }
194
+ })
195
+ );
196
+ } catch (g) {
197
+ o(
198
+ B({
199
+ type: "danger",
200
+ message: g.response?.data?.title || g.message
201
+ })
202
+ );
203
+ }
204
+ },
205
+ [f]
206
+ );
207
+ return {
208
+ userList: c,
209
+ totalItems: S,
210
+ filters: f,
211
+ queryName: m,
212
+ fullName: y,
213
+ getData: N,
214
+ removeData: x,
215
+ changeFilters: r,
216
+ reDirectDetailPage: (n) => {
217
+ const g = n ? `${Ct}/${n}` : bt;
218
+ e(g);
219
+ },
220
+ switchUser: O,
221
+ handleSyncRosterUsers: v,
222
+ rosterUserInfo: C,
223
+ userIds: u,
224
+ onSelectAllUser: w,
225
+ onSelectUser: $,
226
+ isCheckAll: R
227
+ };
228
+ }, Ot = {
229
+ fontWeight: 500
230
+ }, At = {
231
+ height: 38,
232
+ background: "#316cd9"
233
+ }, It = ({
234
+ text: e,
235
+ onClick: s,
236
+ className: m = ""
237
+ }) => /* @__PURE__ */ b(
238
+ ye,
239
+ {
240
+ onClick: s,
241
+ color: "primary",
242
+ style: At,
243
+ className: `d-flex align-items-center ${m} gap-2`,
244
+ children: [
245
+ /* @__PURE__ */ t(tt, {}),
246
+ /* @__PURE__ */ t("span", { style: Ot, children: e })
247
+ ]
248
+ }
249
+ );
250
+ function Ut(e) {
251
+ return q({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M21 3H5a1 1 0 0 0-1 1v2.59c0 .523.213 1.037.583 1.407L10 13.414V21a1.001 1.001 0 0 0 1.447.895l4-2c.339-.17.553-.516.553-.895v-5.586l5.417-5.417c.37-.37.583-.884.583-1.407V4a1 1 0 0 0-1-1zm-6.707 9.293A.996.996 0 0 0 14 13v5.382l-2 1V13a.996.996 0 0 0-.293-.707L6 6.59V5h14.001l.002 1.583-5.71 5.71z" } }] })(e);
252
+ }
253
+ function Bt(e) {
254
+ return q({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M19.023 16.977a35.13 35.13 0 0 1-1.367-1.384c-.372-.378-.596-.653-.596-.653l-2.8-1.337A6.962 6.962 0 0 0 16 9c0-3.859-3.14-7-7-7S2 5.141 2 9s3.14 7 7 7c1.763 0 3.37-.66 4.603-1.739l1.337 2.8s.275.224.653.596c.387.363.896.854 1.384 1.367l1.358 1.392.604.646 2.121-2.121-.646-.604c-.379-.372-.885-.866-1.391-1.36zM9 14c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5z" } }] })(e);
255
+ }
256
+ function $t(e) {
257
+ return q({ attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M3 3a1 1 0 011-1h12a1 1 0 011 1v3a1 1 0 01-.293.707L12 11.414V15a1 1 0 01-.293.707l-2 2A1 1 0 018 17v-5.586L3.293 6.707A1 1 0 013 6V3z", clipRule: "evenodd" } }] })(e);
258
+ }
259
+ function ds(e) {
260
+ return q({ attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] })(e);
261
+ }
262
+ function Ie(e) {
263
+ return q({ attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M839.6 433.8L749 150.5a9.24 9.24 0 0 0-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 0 0-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 0 0-9.2-9.3zM416 702h-76V172c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v530h-76c-6.7 0-10.5 7.8-6.3 13l112 141.9a8 8 0 0 0 12.6 0l112-141.9c4.1-5.2.4-13-6.3-13z" } }] })(e);
264
+ }
265
+ function Ue(e) {
266
+ return q({ attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M839.6 433.8L749 150.5a9.24 9.24 0 0 0-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 0 0-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 0 0-9.2-9.3zM310.3 167.1a8 8 0 0 0-12.6 0L185.7 309c-4.2 5.3-.4 13 6.3 13h76v530c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V322h76c6.7 0 10.5-7.8 6.3-13l-112-141.9z" } }] })(e);
267
+ }
268
+ const kt = (e, s) => {
269
+ V(() => {
270
+ function m(c) {
271
+ e.current && !e.current.contains(c.target) && s?.();
272
+ }
273
+ return document.addEventListener("mousedown", m), () => {
274
+ document.removeEventListener("mousedown", m);
275
+ };
276
+ }, [e.current]);
277
+ }, Dt = (e) => {
278
+ const {
279
+ isOpen: s,
280
+ sortBy: m,
281
+ filters: c,
282
+ users: S,
283
+ searchBy: f,
284
+ defaultOptions: r,
285
+ selectedOptions: y,
286
+ searchKey: u,
287
+ onChangeSearchKey: E,
288
+ onOptionsChange: i,
289
+ onSearch: o,
290
+ onClose: h,
291
+ onChangeFilters: $,
292
+ getOption: R
293
+ } = e, [w, N] = H(), [v, C] = H([]), x = Ce(null), F = Ce(null);
294
+ kt(x, h);
295
+ const { t: k } = ce(), O = j(
296
+ () => {
297
+ if (!s) return;
298
+ const L = u?.trim?.() ?? "";
299
+ f != null && !r && o?.(L, f), f != null && r && C(r.filter((_) => _.label.toLowerCase().includes(L.toLowerCase())));
300
+ },
301
+ [f, u, JSON.stringify(r), s]
302
+ ), l = () => {
303
+ F.current && clearTimeout(F.current), F.current = setTimeout(O, 500);
304
+ }, n = (L) => {
305
+ const _ = L.target.value;
306
+ E(_);
307
+ }, g = j(() => {
308
+ i?.(w, f), h?.();
309
+ }, [JSON.stringify(w)]), p = j((L) => {
310
+ const _ = L.target.value ?? "";
311
+ let A = w ?? [], G = A.indexOf(_);
312
+ G > -1 ? A.splice(G, 1) : A = [...A, _], N(A == null ? A : [...A]);
313
+ }, [JSON.stringify(w)]), a = j((L) => {
314
+ const _ = L.target.checked;
315
+ N(_ ? void 0 : []);
316
+ }, []), d = j(() => {
317
+ $?.({
318
+ ...c,
319
+ sortBy: m,
320
+ isDescending: !0
321
+ }), h?.();
322
+ }, [JSON.stringify(c), f]), U = j(() => {
323
+ $?.({
324
+ ...c,
325
+ sortBy: m,
326
+ isDescending: !1
327
+ }), h?.();
328
+ }, [JSON.stringify(c), f]), T = re(() => R ? S.map((L) => R(L, k)) : [], [JSON.stringify(S), JSON.stringify(R)]), M = c?.isDescending == !1 && c.sortBy === m, P = !!c?.isDescending && c.sortBy === m;
329
+ return V(() => {
330
+ c?.searchBy !== f ? N(void 0) : N(y);
331
+ }, [JSON.stringify(y), c?.searchBy]), V(() => {
332
+ C(r || []);
333
+ }, [JSON.stringify(r)]), V(() => {
334
+ l();
335
+ }, [u, s]), {
336
+ ref: x,
337
+ options: T,
338
+ inputRef: F,
339
+ sOptions: w,
340
+ isAscending: M,
341
+ isDescending: P,
342
+ filteredOptions: v,
343
+ searchKey: u,
344
+ handleSearch: O,
345
+ handleApplyFilter: g,
346
+ handleOptionSelected: p,
347
+ handleOptionSelectedAll: a,
348
+ handleSortDesc: d,
349
+ handleSortAsc: U,
350
+ handleChangeSearchKey: n
351
+ };
352
+ }, Lt = (e) => {
353
+ const {
354
+ defaultOptions: s,
355
+ onClose: m,
356
+ getOption: c
357
+ } = e, {
358
+ ref: S,
359
+ inputRef: f,
360
+ options: r,
361
+ sOptions: y,
362
+ isAscending: u,
363
+ isDescending: E,
364
+ filteredOptions: i,
365
+ searchKey: o,
366
+ handleChangeSearchKey: h,
367
+ handleApplyFilter: $,
368
+ handleOptionSelected: R,
369
+ handleOptionSelectedAll: w,
370
+ handleSortDesc: N,
371
+ handleSortAsc: v
372
+ } = Dt(e);
373
+ return /* @__PURE__ */ t(De, { ...e, hideArrow: !0, className: D["popover-zindex"], children: /* @__PURE__ */ t(Le, { className: "pb-3", children: /* @__PURE__ */ b("div", { ref: S, className: D.popover, children: [
374
+ /* @__PURE__ */ b(
375
+ "div",
376
+ {
377
+ className: `d-flex flex-column ${D.popover__sort}`,
378
+ children: [
379
+ /* @__PURE__ */ t(Y, { className: "font-weight-bold", children: "Sort" }),
380
+ /* @__PURE__ */ b(
381
+ "div",
382
+ {
383
+ className: `px-1 ${D.popover__sort__item} ${u && D["popover__sort__item--active"]}`,
384
+ onClick: v,
385
+ children: [
386
+ /* @__PURE__ */ t(Ie, { className: "mr-1" }),
387
+ "Ascending"
388
+ ]
389
+ }
390
+ ),
391
+ /* @__PURE__ */ b(
392
+ "div",
393
+ {
394
+ className: `px-1 mt-1 ${D.popover__sort__item} ${E && D["popover__sort__item--active"]}`,
395
+ onClick: N,
396
+ children: [
397
+ /* @__PURE__ */ t(Ue, { className: "mr-1" }),
398
+ "Descending"
399
+ ]
400
+ }
401
+ )
402
+ ]
403
+ }
404
+ ),
405
+ (typeof c < "u" || !!s) && /* @__PURE__ */ b(We, { children: [
406
+ /* @__PURE__ */ t("div", { className: "border border-top-1 border-bottom-0 mx-1 my-2" }),
407
+ /* @__PURE__ */ b("div", { className: "d-flex flex-column", children: [
408
+ /* @__PURE__ */ t(Y, { className: "font-weight-bold", children: "Filter" }),
409
+ /* @__PURE__ */ b("div", { className: `position-relative px-1 ${D.popover__search}`, children: [
410
+ /* @__PURE__ */ t(
411
+ Bt,
412
+ {
413
+ className: `position-absolute ${D.popover__search__icon}`
414
+ }
415
+ ),
416
+ /* @__PURE__ */ t(
417
+ X,
418
+ {
419
+ ref: f,
420
+ className: D.popover__search__input,
421
+ value: o,
422
+ onChange: h
423
+ }
424
+ )
425
+ ] }),
426
+ /* @__PURE__ */ b(
427
+ "div",
428
+ {
429
+ className: `mx-1 mt-2 p-2 bg-light ${D.popover__options}`,
430
+ children: [
431
+ /* @__PURE__ */ b(
432
+ de,
433
+ {
434
+ className: "d-flex align-items-center",
435
+ check: !0,
436
+ style: { gap: "8px" },
437
+ children: [
438
+ /* @__PURE__ */ t(
439
+ X,
440
+ {
441
+ type: "checkbox",
442
+ onChange: w,
443
+ checked: y == null
444
+ }
445
+ ),
446
+ " ",
447
+ /* @__PURE__ */ t(Y, { check: !0, children: "(Select all)" })
448
+ ]
449
+ }
450
+ ),
451
+ !!c && !s && r.map((C) => /* @__PURE__ */ b(
452
+ de,
453
+ {
454
+ className: "d-flex align-items-center",
455
+ check: !0,
456
+ style: { gap: "8px" },
457
+ children: [
458
+ /* @__PURE__ */ t(
459
+ X,
460
+ {
461
+ type: "checkbox",
462
+ value: C.value,
463
+ onChange: R,
464
+ checked: y?.includes(C.value) || y == null
465
+ }
466
+ ),
467
+ " ",
468
+ /* @__PURE__ */ t(Y, { check: !0, children: C.label })
469
+ ]
470
+ },
471
+ C.value
472
+ )),
473
+ !!s && i.map((C) => /* @__PURE__ */ b(
474
+ de,
475
+ {
476
+ className: "d-flex align-items-center",
477
+ check: !0,
478
+ style: { gap: "8px" },
479
+ children: [
480
+ /* @__PURE__ */ t(
481
+ X,
482
+ {
483
+ type: "checkbox",
484
+ value: C.value,
485
+ onChange: R,
486
+ checked: y?.includes(C.value) || y == null
487
+ }
488
+ ),
489
+ " ",
490
+ /* @__PURE__ */ t(Y, { check: !0, children: C.label })
491
+ ]
492
+ },
493
+ C.value
494
+ ))
495
+ ]
496
+ }
497
+ )
498
+ ] }),
499
+ /* @__PURE__ */ b("div", { className: "d-flex justify-content-end mt-3", style: { gap: "8px" }, children: [
500
+ /* @__PURE__ */ t(
501
+ ye,
502
+ {
503
+ color: "primary",
504
+ className: "mr-2",
505
+ size: "sm",
506
+ onClick: $,
507
+ children: "Apply Filter"
508
+ }
509
+ ),
510
+ /* @__PURE__ */ t(
511
+ ye,
512
+ {
513
+ color: "secondary",
514
+ size: "sm",
515
+ onClick: m,
516
+ children: "Cancel"
517
+ }
518
+ )
519
+ ] })
520
+ ] })
521
+ ] }) }) });
522
+ }, Ft = ({
523
+ data: e,
524
+ popoverId: s,
525
+ filters: m,
526
+ searchString: c,
527
+ users: S,
528
+ selectedOptions: f,
529
+ onOptionsChange: r,
530
+ onSearch: y,
531
+ onChangeFilters: u,
532
+ onOpenFilter: E,
533
+ onClose: i,
534
+ isCenter: o,
535
+ isActive: h = !1
536
+ }) => {
537
+ const { t: $ } = ce(), [R, w] = H(""), N = re(
538
+ () => e.sortBy != null ? mt[e.sortBy] : "",
539
+ [e.sortBy]
540
+ ), v = re(() => s === N, [N, s]), C = () => {
541
+ E?.(N, e.searchBy, R, e.sortBy);
542
+ }, x = (F) => {
543
+ w(F);
544
+ };
545
+ return /* @__PURE__ */ t("th", { className: e.className, children: N && e.sortBy !== void 0 ? /* @__PURE__ */ b("div", { className: `w-100 d-flex ${o ? "justify-content-center" : "justify-content-between"} align-items-center ${D["table-filter-icon"]}`, children: [
546
+ $(e.name),
547
+ /* @__PURE__ */ b(
548
+ "div",
549
+ {
550
+ className: "ml-2 p-1",
551
+ id: N,
552
+ onClick: C,
553
+ style: {
554
+ cursor: "pointer"
555
+ },
556
+ children: [
557
+ e.sortBy !== void 0 && e.sortBy === m?.sortBy && /* @__PURE__ */ t("span", { children: m.isDescending ? /* @__PURE__ */ t(Ue, {}) : /* @__PURE__ */ t(Ie, {}) }),
558
+ m?.searchByStrings?.length && e.searchBy === m?.searchBy ? /* @__PURE__ */ t($t, { color: h ? "#007bff" : "#242424" }) : /* @__PURE__ */ t(Ut, { color: h ? "#007bff" : "#242424" })
559
+ ]
560
+ }
561
+ ),
562
+ /* @__PURE__ */ t(
563
+ Lt,
564
+ {
565
+ placement: "bottom-end",
566
+ target: N,
567
+ users: S,
568
+ isOpen: v,
569
+ filters: m,
570
+ sortBy: e.sortBy,
571
+ searchKey: R,
572
+ searchBy: e.searchBy,
573
+ searchString: c,
574
+ defaultOptions: e.options,
575
+ selectedOptions: f,
576
+ onClose: i,
577
+ onSearch: y,
578
+ getOption: e.getOption,
579
+ onChangeFilters: u,
580
+ onOptionsChange: r,
581
+ onChangeSearchKey: x
582
+ }
583
+ )
584
+ ] }) : $(e.name) });
585
+ }, Mt = (e) => {
586
+ const {
587
+ filters: s,
588
+ onChangeFilters: m,
589
+ isStudentFilter: c,
590
+ teacherOptions: S,
591
+ assistantOptions: f,
592
+ counselorOptions: r,
593
+ secondaryTeacherOptions: y
594
+ } = e, [u, E] = H(), [i, o] = H([]), [h, $] = H({
595
+ ...ht,
596
+ isDescending: s.isDescending,
597
+ searchString: s.searchString
598
+ }), R = ee(), w = Qe(), N = j(
599
+ async (k) => {
600
+ try {
601
+ const l = (c ? await Je(h) : await Ve({ ...h, byStudent: k })).data?.items || [];
602
+ o(l);
603
+ } catch (O) {
604
+ R(
605
+ B({
606
+ type: "danger",
607
+ message: O.response?.data?.title || O.message
608
+ })
609
+ );
610
+ }
611
+ },
612
+ [JSON.stringify(h), c]
613
+ ), v = j((k, O, l, n) => {
614
+ E(k), $({
615
+ ...h,
616
+ searchBy: O,
617
+ searchStringBy: l,
618
+ isDescending: s.sortBy === n ? s.isDescending : void 0,
619
+ searchString: s.searchString
620
+ });
621
+ }, [JSON.stringify(h), s.isDescending, s.searchString]), C = () => {
622
+ E("");
623
+ }, x = j((k, O) => {
624
+ $({
625
+ ...h,
626
+ searchBy: O,
627
+ searchStringBy: k
628
+ });
629
+ }, [JSON.stringify(h)]), F = j((k, O) => {
630
+ O && m?.({
631
+ ...s,
632
+ [J[O]]: k
633
+ });
634
+ }, [JSON.stringify(s)]);
635
+ return V(() => {
636
+ if (!w.pathname.includes("users/assign-student")) return;
637
+ const k = (l) => l.sort((n, g) => n.localeCompare(g)), O = h.searchStringBy?.toLowerCase() || "";
638
+ if (h.searchBy === J.Grade)
639
+ o(pt);
640
+ else {
641
+ let l = [];
642
+ switch (h.searchBy) {
643
+ case J.Name:
644
+ N(!0);
645
+ break;
646
+ case J.Teacher:
647
+ l = S?.map((a) => a.label).filter(Boolean) || [];
648
+ break;
649
+ case J.Assistant:
650
+ l = f?.map((a) => a.label).filter(Boolean) || [];
651
+ break;
652
+ case J.Counselor:
653
+ l = r?.map((a) => a.label).filter(Boolean) || [];
654
+ break;
655
+ case J.SecondaryTeacher:
656
+ l = y?.map((a) => a.label).filter(Boolean) || [];
657
+ break;
658
+ }
659
+ const n = Array.from(new Set(l)), g = O ? n.filter(
660
+ (a) => a.toLowerCase().includes(O)
661
+ ) : n, p = k(g);
662
+ o(p);
663
+ }
664
+ }, [
665
+ JSON.stringify(h),
666
+ S,
667
+ f,
668
+ r,
669
+ y,
670
+ w.pathname
671
+ ]), V(() => {
672
+ !(w.pathname.includes("users/assign-student") && h.searchBy !== void 0) && h.searchBy !== void 0 && N();
673
+ }, [
674
+ JSON.stringify(h),
675
+ w.pathname
676
+ ]), {
677
+ popoverFilters: h,
678
+ popoverId: u,
679
+ users: i,
680
+ handleFilterIcon: v,
681
+ handleCloseFilter: C,
682
+ handleSearch: x,
683
+ handleChangeFilters: F
684
+ };
685
+ }, Pt = ({
686
+ headers: e,
687
+ filters: s,
688
+ onChangeFilters: m,
689
+ isStudentFilter: c,
690
+ teacherOptions: S = [],
691
+ assistantOptions: f = [],
692
+ counselorOptions: r = [],
693
+ secondaryTeacherOptions: y = []
694
+ }) => {
695
+ const {
696
+ popoverId: u,
697
+ users: E,
698
+ handleFilterIcon: i,
699
+ handleCloseFilter: o,
700
+ handleSearch: h,
701
+ handleChangeFilters: $
702
+ } = Mt({
703
+ filters: s,
704
+ onChangeFilters: m,
705
+ isStudentFilter: c,
706
+ teacherOptions: S,
707
+ assistantOptions: f,
708
+ counselorOptions: r,
709
+ secondaryTeacherOptions: y
710
+ }), R = Object.entries(s).filter(
711
+ ([v, C]) => C !== "" && !(Array.isArray(C) && C.length === 0) && C !== null && C !== void 0
712
+ ).map(([v]) => v), w = Object.entries(J).filter(([v, C]) => isNaN(Number(v))), N = R.map((v) => w.find(([C]) => C === v)).filter((v) => !!v);
713
+ return /* @__PURE__ */ t("tr", { children: e.map((v) => v.onSelectAll ? /* @__PURE__ */ t("th", { className: `align-middle text-center ${v.className}`, children: /* @__PURE__ */ t(
714
+ "input",
715
+ {
716
+ type: "checkbox",
717
+ onChange: () => v.onSelectAll?.(),
718
+ checked: v.isCheckAll ?? !1
719
+ }
720
+ ) }, v.name) : /* @__PURE__ */ t(
721
+ Ft,
722
+ {
723
+ users: E,
724
+ data: v,
725
+ isCenter: v.isCenter,
726
+ filters: s,
727
+ popoverId: u,
728
+ selectedOptions: s.searchByStrings,
729
+ onSearch: h,
730
+ onClose: o,
731
+ onOpenFilter: i,
732
+ onChangeFilters: m,
733
+ onOptionsChange: $,
734
+ isActive: typeof v.searchBy == "number" && N.some(([C, x]) => x === v.searchBy)
735
+ },
736
+ v.name
737
+ )) });
738
+ }, zt = () => {
739
+ const e = ee(), s = oe((y) => y?.common?.user?.schoolName) || "", m = async (y) => {
740
+ e(I(!0));
741
+ try {
742
+ const u = await Ke(y), E = u.data.items || u.data, i = c(E), o = document.createElement("a");
743
+ o.href = i, o.download = `${s}_Users_Report.csv`, o.click();
744
+ } catch (u) {
745
+ e(
746
+ B({
747
+ type: "danger",
748
+ message: u.response?.data?.title || u.message
749
+ })
750
+ );
751
+ }
752
+ e(I(!1));
753
+ }, c = (y) => {
754
+ let u = `First Name,Last Name,Email,Phone,Age,Grade,Tiers,Role,Active Status,Create Time,Roster Sourced Id,Roster Status,Roster Family Name,Roster Middle Name,Roster Given Name,Roster Email,Roster Role,Roster Grades,Teachers,Assistants,Counselors,SupportTeachers,EduTeachers
755
+ `;
756
+ const E = y.map((i) => {
757
+ const o = i.dateOfBirth !== we ? ft(
758
+ /* @__PURE__ */ new Date(),
759
+ yt(i.dateOfBirth)
760
+ ) : "";
761
+ return `${r(i.firstName)},${r(i.lastName)},${r(i.email)},${r(i.phoneNumber)},${o},${r(i.grade)},${r(i.appType || "")},${r(i.roles.join(", ").replace("SecondaryTeacher", "SupportTeacher"))},${i.isActive ? "Active" : "Inactive"},${Oe(i?.createTime, "yyyy-MM-dd HH:mm")},${r(i.sourcedId)},${r(i.rosterUser?.status)},${r(i.rosterUser?.familyName)},${r(i.rosterUser?.middleName)},${r(i.rosterUser?.givenName)},${r(i.rosterUser?.email)},${r(i.rosterUser?.role)},${r(i.rosterUser?.grades)},${r(i.teachers)},${r(i.assistants)},${r(i.counselors)},${r(i.supportTeachers)},${r(i.eduTeachers)}`;
762
+ }).join(`
763
+ `);
764
+ return `${Ne}${u}${encodeURIComponent(E)}`;
765
+ }, S = async (y) => {
766
+ e(I(!0));
767
+ try {
768
+ const u = await Ge(y), E = u?.data?.items || u?.data || [], i = f(E), o = document.createElement("a");
769
+ o.href = i, o.download = "Classcode.csv", o.click();
770
+ } catch (u) {
771
+ e(
772
+ B({
773
+ type: "danger",
774
+ message: u.response?.data?.title || u.message
775
+ })
776
+ );
777
+ }
778
+ e(I(!1));
779
+ }, f = (y) => {
780
+ let u = `Teacher name,Teacher Email,Teacher code
781
+ `;
782
+ const o = (Array.isArray(y) ? y : []).filter((h) => h.roles && h.roles.includes("Teacher")).map((h) => `${r(h.fullName)},${r(h.email)},${r(h?.assignCode || "")}`).join(`
783
+ `);
784
+ return `${Ne}${u}${encodeURIComponent(o)}`;
785
+ }, r = (y) => y ? `"${y.replace(/"/g, '""').replaceAll(/\n/g, " ")}"` : "";
786
+ return {
787
+ exportUsers: m,
788
+ exportClassCodes: S
789
+ };
790
+ }, Be = `${Ae}/api/ImportCsv/csv`, ie = `${Ae}/api/Teacher`, Ht = (e, s) => te.post(`${Be}/${s}`, e), Re = (e) => te.post(`${Be}/importClassReflection`, e), jt = (e, s) => te.post(`${ie}/adminImportStudentByTeacherId/${e}`, s), Vt = (e) => te.post(`${ie}/adminImport`, e), Jt = (e = !0) => st.get(`${ie}/download-template-file-user?hasEsSchool=${e}`), ms = (e, s, m = !0) => te.post(`${ie}/validate-csv-template-student/${s}?hasEsSchool=${m}`, e);
791
+ var $e = /* @__PURE__ */ ((e) => (e.Students = "students", e.Subjects = "subjects", e.Grades = "grades", e.Attendances = "attendances", e.ClassReflection = "classReflection", e.Others = "others", e.AllUser = "allUser", e))($e || {});
792
+ const he = "csvupload", xe = {
793
+ teacherName: "",
794
+ teacherEmail: "",
795
+ studentIds: [],
796
+ file: ""
797
+ }, Gt = () => {
798
+ const e = ee(), s = oe((p) => p.common.isLoading), [m, c] = H(null), [S, f] = H(), [r, y] = H([]), [u, E] = H(
799
+ xe
800
+ ), [i, o] = H(), h = window.location.hostname, $ = h.includes("isb") || h.includes("stage"), [R, w] = H(0), [N, v] = H(""), C = async () => {
801
+ e(I(!0));
802
+ try {
803
+ const d = await Jt();
804
+ var p = new Blob([d.data.content], { type: "text/csv" });
805
+ const U = window.URL.createObjectURL(p);
806
+ var a = document.createElement("a");
807
+ a.href = U, a.setAttribute("download", d.data.nameFile), a.click(), e(
808
+ B({
809
+ type: "success",
810
+ message: "Download successfully"
811
+ })
812
+ );
813
+ } catch (d) {
814
+ e(
815
+ B({
816
+ type: "danger",
817
+ message: d.message
818
+ })
819
+ );
820
+ }
821
+ e(I(!1));
822
+ }, x = j(
823
+ async (p) => {
824
+ if (!m || !p) return;
825
+ e(I(!0));
826
+ try {
827
+ const T = new FormData();
828
+ if (T.append("file", p, p.name), m == "allUser") {
829
+ let P = (await p.text()).trim();
830
+ const L = P.split(`
831
+ `).map((z) => z.trim()), _ = L.findIndex(
832
+ (z) => z.split(",").includes("FirstName")
833
+ );
834
+ if (_ === 0)
835
+ throw new Error("Invalid CSV: Missing header row.");
836
+ P = L.slice(_).join(`
837
+ `);
838
+ const A = _e.parse(P, {
839
+ header: !0,
840
+ skipEmptyLines: !0
841
+ }), G = A.meta.fields, W = A.data;
842
+ if (!G)
843
+ throw new Error("Unable to determine header from CSV file");
844
+ const se = 20, K = [];
845
+ for (let z = 0; z < W.length; z += se) {
846
+ const le = W.slice(z, z + se), ne = _e.unparse({
847
+ fields: G,
848
+ data: le
849
+ });
850
+ K.push(ne);
851
+ }
852
+ for (let z = 0; z < K.length; z++) {
853
+ const le = new Blob([K[z]], { type: "text/csv" }), ne = new FormData();
854
+ ne.append(
855
+ "file",
856
+ le,
857
+ `students_chunk${z + 1}.csv`
858
+ ), await Vt(ne);
859
+ }
860
+ } else
861
+ $ ? m == "classReflection" && await Re(T) : await Ht(T, m.toString());
862
+ e(
863
+ B({
864
+ type: "success",
865
+ message: "Import CSV successfully"
866
+ })
867
+ );
868
+ } catch (T) {
869
+ e(
870
+ B({
871
+ type: "danger",
872
+ message: T.response?.data?.title || T.message
873
+ })
874
+ );
875
+ }
876
+ e(I(!1));
877
+ const a = document.getElementById(he), d = document.getElementById("import-student"), U = document.getElementById(
878
+ "import-classReflection"
879
+ );
880
+ a && (a.value = ""), d && (d.value = ""), U && (U.value = "");
881
+ },
882
+ [m]
883
+ ), F = async (p) => {
884
+ if (!R) {
885
+ e(
886
+ B({
887
+ type: "danger",
888
+ message: "Select teacher before import csv"
889
+ })
890
+ );
891
+ return;
892
+ }
893
+ if (!m || !p) return;
894
+ e(I(!0));
895
+ try {
896
+ const d = new FormData();
897
+ d.append("file", p, p.name), await jt(R, d), e(
898
+ B({
899
+ type: "success",
900
+ message: "Import CSV successfully"
901
+ })
902
+ );
903
+ } catch (d) {
904
+ e(
905
+ B({
906
+ type: "danger",
907
+ message: d.response?.data?.title || d.message
908
+ })
909
+ );
910
+ }
911
+ e(I(!1));
912
+ const a = document.getElementById("teacherSelector");
913
+ a && (a.value = "");
914
+ }, k = async (p) => {
915
+ if (!S || !S) return;
916
+ e(I(!0));
917
+ try {
918
+ const d = new FormData();
919
+ d.append("file", S, S.name), d.append("teacherName", p.teacherName), d.append("teacherEmail", p.teacherEmail), p.studentIds.forEach((U) => {
920
+ d.append("studentIds", U);
921
+ }), await Re(d), e(
922
+ B({
923
+ type: "success",
924
+ message: "Import CSV successfully"
925
+ })
926
+ ), E(xe);
927
+ } catch (d) {
928
+ e(
929
+ B({
930
+ type: "danger",
931
+ message: d.response?.data?.title || d.message
932
+ })
933
+ );
934
+ }
935
+ e(I(!1));
936
+ const a = document.getElementById(he);
937
+ a && (a.value = "");
938
+ }, O = (p) => {
939
+ w(p.value);
940
+ }, l = (p) => {
941
+ o(p), v(p?.name || "");
942
+ }, n = () => {
943
+ if (!i) {
944
+ e(
945
+ B({
946
+ type: "danger",
947
+ message: "Select CSV to import"
948
+ })
949
+ );
950
+ return;
951
+ }
952
+ F(i);
953
+ };
954
+ return {
955
+ isLoading: s,
956
+ id: he,
957
+ setType: c,
958
+ upload: x,
959
+ initImportReflection: u,
960
+ setInitImportReflection: E,
961
+ onConfirm: k,
962
+ CSVType: $e,
963
+ dataFile: S,
964
+ setDataFile: f,
965
+ setArrStudent: y,
966
+ arrStudent: r,
967
+ isCheckDomainIBS: $,
968
+ onChangeTeacher: O,
969
+ uploadByTeacherId: F,
970
+ setDataFileImportStudent: l,
971
+ onUpLoadStudentFile: n,
972
+ defaultTeacher: R,
973
+ fileName: N,
974
+ onStudentSubmit: () => {
975
+ e(
976
+ Z({
977
+ isOpen: !0,
978
+ type: "warning",
979
+ message: "Are you sure upload this file?",
980
+ onConfirm: () => {
981
+ n();
982
+ }
983
+ })
984
+ );
985
+ },
986
+ downloadTemplateUser: C
987
+ };
988
+ }, Kt = () => {
989
+ const e = ee(), s = async (S) => {
990
+ e(I(!0));
991
+ try {
992
+ await qe(S), e(
993
+ B({
994
+ type: "success",
995
+ message: "Send Successfully"
996
+ })
997
+ );
998
+ } catch (f) {
999
+ e(
1000
+ B({
1001
+ type: "danger",
1002
+ message: f.response?.data?.title || f.message
1003
+ })
1004
+ );
1005
+ }
1006
+ e(I(!1));
1007
+ };
1008
+ return {
1009
+ handleSendMultiUsers: (S) => {
1010
+ s({ userIds: [...S] });
1011
+ },
1012
+ handleSendSingleUser: (S) => {
1013
+ s({ userIds: [S] });
1014
+ }
1015
+ };
1016
+ }, pe = {
1017
+ fontWeight: 500
1018
+ }, ue = {
1019
+ height: 38,
1020
+ backgroundColor: "#2eb85c",
1021
+ borderColor: "#2eb85c"
1022
+ }, qt = {
1023
+ display: "inline-block",
1024
+ fontSize: 11,
1025
+ fontWeight: 700,
1026
+ color: "#3b4ba8",
1027
+ backgroundColor: "#e9ecfb",
1028
+ borderRadius: 4,
1029
+ padding: "1px 6px",
1030
+ marginRight: 6,
1031
+ textTransform: "uppercase"
1032
+ }, Te = ({ label: e }) => /* @__PURE__ */ t("span", { style: qt, children: e }), ge = ({ label: e }) => /* @__PURE__ */ t("span", { style: {
1033
+ display: "inline-flex",
1034
+ alignItems: "center",
1035
+ justifyContent: "center",
1036
+ fontSize: 11,
1037
+ fontWeight: 700,
1038
+ color: "#3b4ba8",
1039
+ backgroundColor: "#e9ecfb",
1040
+ borderRadius: 4,
1041
+ padding: "3px 8px",
1042
+ textTransform: "uppercase"
1043
+ }, children: e }), Wt = ({ isActive: e, t: s }) => /* @__PURE__ */ b("span", { style: {
1044
+ display: "inline-flex",
1045
+ alignItems: "center",
1046
+ fontSize: 12,
1047
+ fontWeight: 600,
1048
+ color: e ? "#047857" : "#6b7280",
1049
+ backgroundColor: e ? "#d1fae5" : "#f3f4f6",
1050
+ borderRadius: "20px",
1051
+ padding: "4px 12px"
1052
+ }, children: [
1053
+ /* @__PURE__ */ t("span", { style: {
1054
+ width: "6px",
1055
+ height: "6px",
1056
+ borderRadius: "50%",
1057
+ backgroundColor: e ? "#10b981" : "#9ca3af",
1058
+ marginRight: "8px"
1059
+ } }),
1060
+ s(e ? "active" : "inactive")
1061
+ ] }), fe = (e) => (e || []).map((s) => s === "SecondaryTeacher" ? "SupportTeacher" : s).join(", "), Yt = "user", Qt = () => {
1062
+ const {
1063
+ queryName: e,
1064
+ userList: s,
1065
+ totalItems: m,
1066
+ filters: c,
1067
+ fullName: S,
1068
+ removeData: f,
1069
+ changeFilters: r,
1070
+ reDirectDetailPage: y,
1071
+ switchUser: u,
1072
+ handleSyncRosterUsers: E,
1073
+ rosterUserInfo: i,
1074
+ onSelectUser: o,
1075
+ userIds: h,
1076
+ onSelectAllUser: $,
1077
+ isCheckAll: R
1078
+ } = wt(), { handleSendMultiUsers: w } = Kt(), { upload: N } = Gt(), {
1079
+ exportUsers: v,
1080
+ exportClassCodes: C
1081
+ } = zt(), { t: x } = ce(), F = () => v(c), k = () => C(c), O = [
1082
+ {
1083
+ name: "",
1084
+ isCenter: !0,
1085
+ onSelectAll: $,
1086
+ isCheckAll: R
1087
+ }
1088
+ ].concat(ut);
1089
+ return /* @__PURE__ */ b("div", { className: `fadeIn animated h-100 ${lt <= 767 ? D["p-0-12"] : ""}`, children: [
1090
+ /* @__PURE__ */ t("h5", { className: "mt-4 mb-2", children: x(`${Yt}`) }),
1091
+ /* @__PURE__ */ b(Se, { className: "my-2", children: [
1092
+ /* @__PURE__ */ t(Q, { md: 8, children: /* @__PURE__ */ t(
1093
+ nt,
1094
+ {
1095
+ text: x("create_user"),
1096
+ onClick: () => y(),
1097
+ initValue: e || "",
1098
+ onSearch: (l) => r({
1099
+ searchString: l
1100
+ }),
1101
+ placeholder: x("type_something_to_search_by_user_name")
1102
+ }
1103
+ ) }),
1104
+ /* @__PURE__ */ b(
1105
+ Q,
1106
+ {
1107
+ md: 4,
1108
+ className: "d-flex justify-content-end align-items-center",
1109
+ children: [
1110
+ x("total_of_users"),
1111
+ " : ",
1112
+ m
1113
+ ]
1114
+ }
1115
+ ),
1116
+ /* @__PURE__ */ b(Q, { md: 12, className: "d-flex justify-content-end my-2 flex-wrap", style: { gap: "8px" }, children: [
1117
+ /* @__PURE__ */ t(
1118
+ "button",
1119
+ {
1120
+ className: "btn btn-success d-flex align-items-center border-0",
1121
+ style: ue,
1122
+ onClick: () => w(h),
1123
+ children: /* @__PURE__ */ t("p", { className: `${D["button-content"]} mb-0`, style: pe, children: x("welcome_email_resend") })
1124
+ }
1125
+ ),
1126
+ /* @__PURE__ */ t(
1127
+ X,
1128
+ {
1129
+ id: "import-user",
1130
+ className: "d-none",
1131
+ type: "file",
1132
+ onChange: (l) => N(l.target.files[0]),
1133
+ accept: "text/csv"
1134
+ }
1135
+ ),
1136
+ /* @__PURE__ */ t(It, { text: x("sync_roster_users"), onClick: E }),
1137
+ /* @__PURE__ */ b(
1138
+ "button",
1139
+ {
1140
+ className: "btn btn-success d-flex align-items-center border-0 p-0",
1141
+ style: ue,
1142
+ onClick: k,
1143
+ children: [
1144
+ /* @__PURE__ */ t("div", { className: `${D["button-icon"]}`, children: /* @__PURE__ */ t("img", { src: "images/export-icon.svg", alt: "" }) }),
1145
+ /* @__PURE__ */ t("p", { className: `${D["button-content"]} mb-0`, style: pe, children: x("export_class_code_to_csv") })
1146
+ ]
1147
+ }
1148
+ ),
1149
+ /* @__PURE__ */ b(
1150
+ "button",
1151
+ {
1152
+ className: "btn btn-success d-flex align-items-center border-0 p-0",
1153
+ style: ue,
1154
+ onClick: F,
1155
+ children: [
1156
+ /* @__PURE__ */ t("div", { className: `${D["button-icon"]}`, children: /* @__PURE__ */ t("img", { src: "images/export-icon.svg", alt: "" }) }),
1157
+ /* @__PURE__ */ t("p", { className: `${D["button-content"]} mb-0`, style: pe, children: x("export_to_csv") })
1158
+ ]
1159
+ }
1160
+ )
1161
+ ] })
1162
+ ] }),
1163
+ /* @__PURE__ */ b(Se, { className: "mb-2", children: [
1164
+ /* @__PURE__ */ t(Q, { md: 12, children: /* @__PURE__ */ t("div", { style: { overflow: "auto" }, children: /* @__PURE__ */ b(Fe, { bordered: !0, hover: !0, striped: !0, size: "sm", children: [
1165
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t(
1166
+ Pt,
1167
+ {
1168
+ headers: O,
1169
+ filters: c,
1170
+ fullName: S,
1171
+ onChangeFilters: r
1172
+ }
1173
+ ) }),
1174
+ /* @__PURE__ */ b("tbody", { children: [
1175
+ s && s.length > 0 && s.map((l) => {
1176
+ const n = (l.appType || "").toUpperCase(), g = n.includes("ES") && n.includes("MS");
1177
+ return /* @__PURE__ */ b("tr", { children: [
1178
+ /* @__PURE__ */ t("td", { className: "align-middle", children: /* @__PURE__ */ t(
1179
+ "input",
1180
+ {
1181
+ type: "checkbox",
1182
+ onChange: () => o(l.id),
1183
+ checked: h.includes(l.id) ?? !1
1184
+ }
1185
+ ) }),
1186
+ /* @__PURE__ */ t("td", { className: "align-middle", children: /* @__PURE__ */ t(
1187
+ at,
1188
+ {
1189
+ label: `${l.fullName}`,
1190
+ onClick: () => y(l.id)
1191
+ }
1192
+ ) }),
1193
+ /* @__PURE__ */ t("td", { className: "align-middle", children: l.email }),
1194
+ /* @__PURE__ */ t("td", { className: "align-middle", children: l.dateOfBirth !== we && St(
1195
+ /* @__PURE__ */ new Date(),
1196
+ new Date(l.dateOfBirth)
1197
+ ) }),
1198
+ /* @__PURE__ */ t("td", { className: "align-middle", children: g ? /* @__PURE__ */ b(ke, { children: [
1199
+ /* @__PURE__ */ b("div", { children: [
1200
+ /* @__PURE__ */ t(Te, { label: "ES" }),
1201
+ fe(l.esRoles)
1202
+ ] }),
1203
+ /* @__PURE__ */ b("div", { className: "mt-1", children: [
1204
+ /* @__PURE__ */ t(Te, { label: "MS" }),
1205
+ fe(l.msRoles)
1206
+ ] })
1207
+ ] }) : !!l.roles && fe(l.roles) }),
1208
+ /* @__PURE__ */ t("td", { className: "align-middle text-uppercase", children: g ? /* @__PURE__ */ b("div", { style: { display: "flex", flexDirection: "column", gap: "4px", alignItems: "center", width: "fit-content" }, children: [
1209
+ /* @__PURE__ */ t(ge, { label: "ES" }),
1210
+ /* @__PURE__ */ t(ge, { label: "MS" })
1211
+ ] }) : l.appType ? /* @__PURE__ */ t(ge, { label: l.appType }) : null }),
1212
+ /* @__PURE__ */ t("td", { className: "align-middle", children: /* @__PURE__ */ t(Wt, { isActive: l.isActive, t: x }) }),
1213
+ /* @__PURE__ */ t("td", { className: "align-middle", children: Oe(l?.createTime, "yyyy-MM-dd HH:mm") }),
1214
+ /* @__PURE__ */ t("td", { children: i(l) }),
1215
+ /* @__PURE__ */ t("td", { className: "align-middle", children: /* @__PURE__ */ t(
1216
+ rt,
1217
+ {
1218
+ style: { fontSize: "18px", margin: "0 10px", cursor: "pointer" },
1219
+ onClick: () => u(l.id)
1220
+ }
1221
+ ) }),
1222
+ /* @__PURE__ */ t("td", { className: "align-middle", style: { padding: "0 15px" }, children: /* @__PURE__ */ t(
1223
+ ot,
1224
+ {
1225
+ onClick: () => f(l.id)
1226
+ }
1227
+ ) })
1228
+ ] }, `${l.id}_${l.appType || ""}`);
1229
+ }),
1230
+ (!s || !s.length) && /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { colSpan: 12, className: "p-0", children: /* @__PURE__ */ t(ct, { className: "mb-0", label: x("user") }) }) })
1231
+ ] })
1232
+ ] }) }) }),
1233
+ /* @__PURE__ */ t(Q, { md: 12, children: /* @__PURE__ */ t(
1234
+ it,
1235
+ {
1236
+ filters: c,
1237
+ totalRecordCount: m,
1238
+ changePageSize: (l) => r({ pageSize: l }),
1239
+ changePage: (l) => r({ currentPage: l })
1240
+ }
1241
+ ) })
1242
+ ] })
1243
+ ] });
1244
+ }, hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1245
+ __proto__: null,
1246
+ default: Qt
1247
+ }, Symbol.toStringTag, { value: "Module" }));
1248
+ export {
1249
+ ds as A,
1250
+ Pt as T,
1251
+ Qt as U,
1252
+ hs as a,
1253
+ ms as v
1254
+ };