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