mario-core 2.0.32-release → 2.0.33-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 (187) hide show
  1. package/dist/Dashboard-BIhv8car.js +1 -0
  2. package/dist/Dashboard-BY5BVLIW.mjs +206 -0
  3. package/dist/Dashboard-BYXh-LYm.mjs +206 -0
  4. package/dist/Dashboard-Bp0ko4Nx.js +1 -0
  5. package/dist/Dashboard-BxX4EZkL.mjs +206 -0
  6. package/dist/Dashboard-CLvLdCvD.mjs +206 -0
  7. package/dist/Dashboard-CjDPZlwI.js +1 -0
  8. package/dist/Dashboard-D4yeROnn.mjs +206 -0
  9. package/dist/Dashboard-D6igZd4M.js +1 -0
  10. package/dist/Dashboard-D7X8bg8t.mjs +206 -0
  11. package/dist/Dashboard-DRaSlZLc.js +1 -0
  12. package/dist/Dashboard-DbI4E9od.js +1 -0
  13. package/dist/EmailTemplateDetail-B-Kab5TK.mjs +443 -0
  14. package/dist/EmailTemplateDetail-BJGaN7uh.js +1 -0
  15. package/dist/EmailTemplateDetail-BOqn4rkr.mjs +417 -0
  16. package/dist/EmailTemplateDetail-BlhCa_EF.mjs +443 -0
  17. package/dist/EmailTemplateDetail-CW0ymDWF.mjs +443 -0
  18. package/dist/EmailTemplateDetail-CZKvX-_q.js +1 -0
  19. package/dist/EmailTemplateDetail-D4EupjNO.js +1 -0
  20. package/dist/EmailTemplateDetail-DDbJbMWn.js +1 -0
  21. package/dist/EmailTemplateDetail-DP04M6QH.js +1 -0
  22. package/dist/EmailTemplateDetail-DSeAyn-F.mjs +443 -0
  23. package/dist/EmailTemplateDetail-J5R0X631.mjs +443 -0
  24. package/dist/EmailTemplateDetail-c2RcFzG5.js +1 -0
  25. package/dist/EmailTemplateList-BAVOo58z.js +1 -0
  26. package/dist/EmailTemplateList-BMCpm7sf.js +1 -0
  27. package/dist/EmailTemplateList-BQCcXdif.mjs +170 -0
  28. package/dist/EmailTemplateList-BVB1lsW7.mjs +170 -0
  29. package/dist/EmailTemplateList-BVfQCPzA.js +1 -0
  30. package/dist/EmailTemplateList-C-aj1Pl0.mjs +170 -0
  31. package/dist/EmailTemplateList-C5c2T4_M.mjs +170 -0
  32. package/dist/EmailTemplateList-D3G-A7Jo.js +1 -0
  33. package/dist/EmailTemplateList-DPQTaV4-.js +1 -0
  34. package/dist/EmailTemplateList-JRLV6pZW.mjs +170 -0
  35. package/dist/EmailTemplateList-ZTs0DmjS.js +1 -0
  36. package/dist/EmailTemplateList-gwkheOgx.mjs +168 -0
  37. package/dist/GalleryList-BU1m_MP_.js +1 -0
  38. package/dist/GalleryList-BftIdfu8.js +1 -0
  39. package/dist/GalleryList-Bl4FojYJ.mjs +329 -0
  40. package/dist/GalleryList-ByJ1_7Qx.mjs +329 -0
  41. package/dist/GalleryList-CVzc1xGW.js +1 -0
  42. package/dist/GalleryList-D5E7p3kE.mjs +329 -0
  43. package/dist/GalleryList-D5ZydfSV.js +1 -0
  44. package/dist/GalleryList-DHblERzG.js +1 -0
  45. package/dist/GalleryList-DXnU-Aou.mjs +329 -0
  46. package/dist/GalleryList-DpM906eg.mjs +329 -0
  47. package/dist/GalleryList-ZJ_mdpVZ.js +1 -0
  48. package/dist/GalleryList-oJNXivHy.mjs +329 -0
  49. package/dist/Login-A2cXwovI.mjs +1380 -0
  50. package/dist/Login-B69XhtIm.mjs +1380 -0
  51. package/dist/Login-BLyikyni.mjs +1380 -0
  52. package/dist/Login-Bwr0h4GC.js +1 -0
  53. package/dist/Login-C12Whvdx.js +1 -0
  54. package/dist/Login-CIcbHD7-.mjs +1380 -0
  55. package/dist/Login-D7gUoYyV.js +1 -0
  56. package/dist/Login-DEMe7ra6.js +1 -0
  57. package/dist/Login-Dcwb-HaZ.js +1 -0
  58. package/dist/Login-Rwbmk--s.js +1 -0
  59. package/dist/Login-h3o1lUKK.mjs +1380 -0
  60. package/dist/Login-xn2j4Jqq.mjs +1380 -0
  61. package/dist/NotificationList--DZcYUS5.js +2 -0
  62. package/dist/NotificationList-D26jJ6Wc.mjs +3969 -0
  63. package/dist/NotificationList-DZ1epO3L.mjs +3969 -0
  64. package/dist/NotificationList-D_lGCmIS.js +2 -0
  65. package/dist/NotificationList-Da-pWu35.js +2 -0
  66. package/dist/NotificationList-Dogczlgr.mjs +3969 -0
  67. package/dist/NotificationList-Dv0JIP69.js +2 -0
  68. package/dist/NotificationList-DygQSzwE.mjs +3969 -0
  69. package/dist/NotificationList-Ku1m25fI.mjs +3969 -0
  70. package/dist/NotificationList-Ml4QiyAE.mjs +3969 -0
  71. package/dist/NotificationList-_AHdv4bs.js +2 -0
  72. package/dist/NotificationList-rKx7xooX.js +2 -0
  73. package/dist/SkillList-BUDiP8Ba.mjs +386 -0
  74. package/dist/SkillList-Btum0zIE.js +1 -0
  75. package/dist/SkillList-C-dw1122.js +1 -0
  76. package/dist/SkillList-C0ZfIxCl.js +1 -0
  77. package/dist/SkillList-CZTd0oz_.mjs +386 -0
  78. package/dist/SkillList-DPU-l8aA.js +1 -0
  79. package/dist/SkillList-DTxT0Hbn.js +1 -0
  80. package/dist/SkillList-DVXAACsz.mjs +386 -0
  81. package/dist/SkillList-DX530KHp.mjs +386 -0
  82. package/dist/SkillList-DahOq8Os.mjs +386 -0
  83. package/dist/SkillList-DivkFIrP.mjs +386 -0
  84. package/dist/SkillList-yosFFVsc.js +1 -0
  85. package/dist/TeacherSelector-5UVov2Wf.mjs +30 -0
  86. package/dist/TeacherSelector-Bi582rEx.mjs +30 -0
  87. package/dist/TeacherSelector-BmmfQxU8.js +1 -0
  88. package/dist/TeacherSelector-BngXAzRe.mjs +30 -0
  89. package/dist/TeacherSelector-C7-XuXfb.mjs +30 -0
  90. package/dist/TeacherSelector-C9Z5JX-P.js +1 -0
  91. package/dist/TeacherSelector-CZ1DrLUk.js +1 -0
  92. package/dist/TeacherSelector-CbJ1kPyV.js +1 -0
  93. package/dist/TeacherSelector-CkGdl96R.js +1 -0
  94. package/dist/TeacherSelector-CxDiVyno.mjs +30 -0
  95. package/dist/TeacherSelector-DomtJIQi.js +1 -0
  96. package/dist/TeacherSelector-mjBcHGJF.mjs +30 -0
  97. package/dist/TheContent-B42qwDUV.mjs +38 -0
  98. package/dist/TheContent-BW03X6oT.mjs +38 -0
  99. package/dist/TheContent-CayaQR9C.js +1 -0
  100. package/dist/TheContent-CiU0FBTA.mjs +38 -0
  101. package/dist/TheContent-D5Qx4QXe.js +1 -0
  102. package/dist/TheContent-DHWnB8WX.js +1 -0
  103. package/dist/TheContent-DPy5BFuN.js +1 -0
  104. package/dist/TheContent-Dl7_h11H.mjs +38 -0
  105. package/dist/TheContent-DxN9-GIu.mjs +38 -0
  106. package/dist/TheContent-H-Hg7kIq.js +1 -0
  107. package/dist/TheContent-aEfXKW_H.mjs +38 -0
  108. package/dist/TheContent-xUKaH5bl.js +1 -0
  109. package/dist/UserContainer-3dOz3yZF.js +5 -0
  110. package/dist/UserContainer-B-abn6--.js +5 -0
  111. package/dist/UserContainer-BIl8c0yJ.js +5 -0
  112. package/dist/UserContainer-BjYrV0kt.mjs +2783 -0
  113. package/dist/UserContainer-BoJ73Ko9.js +5 -0
  114. package/dist/UserContainer-CFnSfW2A.js +5 -0
  115. package/dist/UserContainer-CGlDCED1.mjs +2771 -0
  116. package/dist/UserContainer-CqTUtCe6.mjs +2770 -0
  117. package/dist/UserContainer-CtYpysOo.mjs +2771 -0
  118. package/dist/UserContainer-Cu6koTiw.mjs +2771 -0
  119. package/dist/UserContainer-Dz991Fto.mjs +2770 -0
  120. package/dist/UserContainer-d3ywqdWh.js +5 -0
  121. package/dist/UserDetail-BCLssfN6.mjs +902 -0
  122. package/dist/UserDetail-BRCOabYu.mjs +902 -0
  123. package/dist/UserDetail-BsWWKLof.js +1 -0
  124. package/dist/UserDetail-CkMU6eej.js +1 -0
  125. package/dist/UserDetail-Cl6y6AtA.js +1 -0
  126. package/dist/UserDetail-CqBaMe5l.mjs +902 -0
  127. package/dist/UserDetail-D36q7Em-.mjs +902 -0
  128. package/dist/UserDetail-DFjYZZOc.js +1 -0
  129. package/dist/UserDetail-DIGlXdot.mjs +914 -0
  130. package/dist/UserDetail-DizNdqsR.mjs +902 -0
  131. package/dist/UserDetail-DwNEJ0kC.js +1 -0
  132. package/dist/UserDetail-Wn1wTs2Z.js +1 -0
  133. package/dist/UserList-4XLAsuI5.mjs +1205 -0
  134. package/dist/UserList-B9_Ok-O-.js +5 -0
  135. package/dist/UserList-BAirPxDM.js +7 -0
  136. package/dist/UserList-BFRsUwHp.js +5 -0
  137. package/dist/UserList-BgtFj_YA.mjs +1171 -0
  138. package/dist/UserList-BjEBqEMi.mjs +1205 -0
  139. package/dist/UserList-C6MCzl4Q.js +7 -0
  140. package/dist/UserList-CLDgmfZl.mjs +1171 -0
  141. package/dist/UserList-CRqA2Kvb.js +7 -0
  142. package/dist/UserList-D-5W9tzb.mjs +1205 -0
  143. package/dist/UserList-D63-z7TV.mjs +1205 -0
  144. package/dist/UserList-DX_DRp8l.js +7 -0
  145. package/dist/constants-1VW88-cg.mjs +320 -0
  146. package/dist/constants-B09dcc2W.js +1 -0
  147. package/dist/constants-BSg1aI4R.js +1 -0
  148. package/dist/constants-BXFDJA-1.js +1 -0
  149. package/dist/constants-BdoFiMvT.mjs +320 -0
  150. package/dist/constants-BrOUFw2c.js +1 -0
  151. package/dist/constants-ClfPwBI0.mjs +320 -0
  152. package/dist/constants-D3RqPPqz.mjs +320 -0
  153. package/dist/constants-D5ZWXomx.js +1 -0
  154. package/dist/constants-DiRwIQ5M.mjs +320 -0
  155. package/dist/constants-bWeajrBe.js +1 -0
  156. package/dist/constants-dgRR32rI.mjs +320 -0
  157. package/dist/containers/EmailTemplate/hooks/useEmailTemplateDetail.d.ts +1 -0
  158. package/dist/containers/User/constants/types.d.ts +1 -0
  159. package/dist/containers/User/hooks/useExportUsersCsv.d.ts +1 -0
  160. package/dist/index-B3Kqv7dj.mjs +17787 -0
  161. package/dist/index-BTWI5jDz.js +15 -0
  162. package/dist/index-C1gw45bw.mjs +17792 -0
  163. package/dist/index-CFAFmJ4F.mjs +17782 -0
  164. package/dist/index-D6pNkzlV.mjs +17787 -0
  165. package/dist/index-DDw_4X4u.js +15 -0
  166. package/dist/index-DVZt7HdB.js +15 -0
  167. package/dist/index-Di2zNE1O.mjs +17792 -0
  168. package/dist/index-DzHydV61.js +15 -0
  169. package/dist/index-Ihdym4EQ.js +15 -0
  170. package/dist/index-UpEZLqQV.js +15 -0
  171. package/dist/index-cuQPyXoT.mjs +17772 -0
  172. package/dist/index.js +1 -1
  173. package/dist/index.modern.js +1 -1
  174. package/dist/mailCategoryService-BbqIjbpT.mjs +11 -0
  175. package/dist/mailCategoryService-C1sorb9h.js +1 -0
  176. package/dist/mailCategoryService-CZ9m51K4.js +1 -0
  177. package/dist/mailCategoryService-C_Lq0Uks.mjs +11 -0
  178. package/dist/mailCategoryService-DcwLjTWD.mjs +11 -0
  179. package/dist/mailCategoryService-DexSxwen.js +1 -0
  180. package/dist/mailCategoryService-DrZXrEp2.js +1 -0
  181. package/dist/mailCategoryService-DyLMoDxP.mjs +11 -0
  182. package/dist/mailCategoryService-LumZqQLL.mjs +11 -0
  183. package/dist/mailCategoryService-MyMGdKSl.mjs +11 -0
  184. package/dist/mailCategoryService-Pl31B1JT.js +1 -0
  185. package/dist/mailCategoryService-lvLdr9b4.js +1 -0
  186. package/dist/mario-core.css +1 -1
  187. package/package.json +1 -1
@@ -0,0 +1,1205 @@
1
+ import { jsxs as w, jsx as s } from "react/jsx-runtime";
2
+ import { Button as le, Popover as $e, PopoverBody as Re, Label as K, Input as Y, FormGroup as ae, Row as ge, Col as q, Table as Te } from "reactstrap";
3
+ import { p as De, t as fe, q as Le, s as Fe, v as ke, w as Me, x as Pe, y as ze, z as He, A as je, B as Ve, C as Je, S as j, E as Ge, F as ye, H as Se, I as Ke, J as qe } from "./constants-dgRR32rI.mjs";
4
+ import { useTranslation as ee } from "react-i18next";
5
+ import { useState as T, useCallback as D, useEffect as H, useRef as ve, useMemo as de, Fragment as Ye } from "react";
6
+ import { useSelector as Z, useDispatch as W } from "react-redux";
7
+ import { useNavigate as We, useLocation as Qe } from "react-router-dom";
8
+ import { a5 as re, b as O, c as I, a6 as Xe, J as me, n as Ze, I as et, d as Ne, N as tt, o as st, a7 as nt, G as V, s as B, a8 as Oe, a9 as Ie, a2 as Q, B as Ee, i as at, aa as rt, L as ct, ab as ot, O as it, P as lt, Q as dt, ac as mt } from "./index-B3Kqv7dj.mjs";
9
+ import { L as ht } from "./types-BvnbDeJF.mjs";
10
+ import { differenceInCalendarYears as ut, parseISO as pt } from "date-fns";
11
+ import Ce from "papaparse";
12
+ function gt(e, a) {
13
+ De(2, arguments);
14
+ var o = fe(e), d = fe(a);
15
+ return o.getFullYear() - d.getFullYear();
16
+ }
17
+ const ft = () => {
18
+ const [e, a] = T(Le);
19
+ return { filters: e, setFilters: a, changeFilters: (d) => {
20
+ const y = {
21
+ ...e,
22
+ ...d
23
+ };
24
+ y.searchString && d.searchString && d.searchString != e.searchString && (y.currentPage = 1), a(y);
25
+ } };
26
+ }, yt = "/admin/user", St = "/admin/create-user", vt = "User list", be = "/home", Nt = "/home", Ct = "/admin/home", bt = "/parent", _t = "/admin/schools", wt = "/list-student", Ot = () => {
27
+ const e = We(), o = new URLSearchParams(location.search).get("query"), d = Z((t) => t.users.userList), y = Z((t) => t.users.totalItems), { filters: i, changeFilters: r } = ft(), u = o || "", [g, N] = T([]), c = window.location.host.includes("-district"), n = W(), { t: p } = ee(), U = (t) => {
28
+ const m = g.find((C) => C == t);
29
+ N(m ? g.filter((C) => C != t) : g.concat([t]));
30
+ }, E = D(
31
+ async () => {
32
+ if (g.length != 0) {
33
+ N([]);
34
+ return;
35
+ }
36
+ if (i.searchBy !== void 0 && i.searchByStrings !== void 0 && i.searchByStrings.length === 0) {
37
+ n(re({ userList: [], totalItems: 0 }));
38
+ return;
39
+ }
40
+ n(O(!0));
41
+ try {
42
+ const t = await Fe(i);
43
+ N(t.data || []);
44
+ } catch (t) {
45
+ n(
46
+ I({
47
+ type: "danger",
48
+ message: t.response?.data?.title || t.message
49
+ })
50
+ );
51
+ }
52
+ n(O(!1));
53
+ },
54
+ [n, i, g]
55
+ ), b = D(
56
+ async () => {
57
+ if (i.searchBy !== void 0 && i.searchByStrings !== void 0 && i.searchByStrings.length === 0) {
58
+ n(re({ userList: [], totalItems: 0 }));
59
+ return;
60
+ }
61
+ n(O(!0));
62
+ try {
63
+ const t = await ke(i), { items: m, totalItems: C } = t.data;
64
+ for (const A of m)
65
+ A.roles = A.roles.map((f) => f != Xe.EDUTEACHER ? f : "EduTeacher");
66
+ n(re({ userList: m, totalItems: C }));
67
+ } catch (t) {
68
+ n(
69
+ I({
70
+ type: "danger",
71
+ message: t.response?.data?.title || t.message
72
+ })
73
+ );
74
+ }
75
+ n(O(!1));
76
+ },
77
+ [n, i]
78
+ ), _ = async () => {
79
+ n(O(!0));
80
+ try {
81
+ const t = await ze();
82
+ t.data ? (n(
83
+ I({
84
+ type: "success",
85
+ message: `${t.data} user${t.data > 1 ? "s have" : " has"} been synchronized`
86
+ })
87
+ ), b()) : n(
88
+ I({
89
+ type: "success",
90
+ message: "Users synchronized"
91
+ })
92
+ );
93
+ } catch (t) {
94
+ n(
95
+ I({
96
+ type: "danger",
97
+ message: t.response?.data?.title || t.message
98
+ })
99
+ );
100
+ }
101
+ n(O(!1));
102
+ }, S = (t) => {
103
+ if (!t) return "";
104
+ const m = [], { sourcedId: C, rosterUser: A } = t;
105
+ if (C && A && m.push(C), A) {
106
+ const { givenName: f, middleName: v, familyName: h, email: M } = A, R = [];
107
+ h && R.push(h), v && R.push(v), f && R.push(f), m.push(R.join(" ") || ""), m.push(M || "");
108
+ }
109
+ return m.join(" / ");
110
+ };
111
+ H(() => {
112
+ document.title = vt;
113
+ }, []), H(() => {
114
+ r({
115
+ ...i,
116
+ searchString: u
117
+ });
118
+ }, [u]), H(() => {
119
+ b();
120
+ }, [JSON.stringify(i)]);
121
+ const l = D(
122
+ (t) => {
123
+ n(
124
+ me({
125
+ isOpen: !0,
126
+ type: "warning",
127
+ message: p("do_you_want_to_remove_this_user"),
128
+ onConfirm: async () => {
129
+ n(O(!0));
130
+ try {
131
+ await Me(t), n(
132
+ I({
133
+ type: "success",
134
+ message: "Remove user successfully"
135
+ })
136
+ ), i.currentPage !== 1 ? r({ currentPage: 1 }) : b();
137
+ } catch (m) {
138
+ n(
139
+ I({
140
+ type: "danger",
141
+ message: m.response?.data?.title || m.message
142
+ })
143
+ );
144
+ }
145
+ n(O(!1));
146
+ }
147
+ })
148
+ );
149
+ },
150
+ [JSON.stringify(i)]
151
+ ), L = (t) => {
152
+ const m = sessionStorage.getItem(et), {
153
+ token: C,
154
+ id: A,
155
+ firstName: f,
156
+ lastName: v,
157
+ roles: h,
158
+ email: M,
159
+ profileImageFileName: R
160
+ } = t.data;
161
+ m ? sessionStorage.setItem(Ne, C) : localStorage.setItem(Ne, C), h.includes("Admin") && localStorage.setItem("ROLES", "Admin"), localStorage.removeItem(tt), n(
162
+ st({
163
+ id: A,
164
+ firstName: f,
165
+ lastName: v,
166
+ roles: h,
167
+ email: M,
168
+ profileImageFileName: R
169
+ })
170
+ ), c ? e(_t) : h.includes("Admin") ? e(Ct) : h.includes("Teacher") || h.includes("Assistant") ? e(be) : h.includes("Student") ? e(Nt) : h.includes("Parent") ? e(bt) : h.includes("EduTeacher") ? e(wt) : (h.includes("Counselor") || h.includes("SecondaryTeacher")) && e(be);
171
+ }, $ = D(
172
+ async (t) => {
173
+ try {
174
+ const C = (await Pe(t)).data;
175
+ n(
176
+ me({
177
+ isOpen: !0,
178
+ type: "warning",
179
+ message: p("do_you_want_to_impersonate_this_user"),
180
+ onConfirm: async () => {
181
+ n(O(!0));
182
+ try {
183
+ const A = {
184
+ email: C.email,
185
+ password: "default",
186
+ accessToken: C.token,
187
+ loginType: ht.Impersonate
188
+ }, f = await Ze(A);
189
+ localStorage.clear(), L(f);
190
+ } catch (A) {
191
+ I({
192
+ type: "danger",
193
+ message: A.response?.data?.title || A.message
194
+ });
195
+ }
196
+ n(O(!1));
197
+ }
198
+ })
199
+ );
200
+ } catch (m) {
201
+ n(
202
+ I({
203
+ type: "danger",
204
+ message: m.response?.data?.title || m.message
205
+ })
206
+ );
207
+ }
208
+ },
209
+ [i]
210
+ );
211
+ return {
212
+ userList: d,
213
+ totalItems: y,
214
+ filters: i,
215
+ queryName: o,
216
+ fullName: u,
217
+ getData: b,
218
+ removeData: l,
219
+ changeFilters: r,
220
+ reDirectDetailPage: (t) => {
221
+ const m = t ? `${yt}/${t}` : St;
222
+ e(m);
223
+ },
224
+ switchUser: $,
225
+ handleSyncRosterUsers: _,
226
+ rosterUserInfo: S,
227
+ userIds: g,
228
+ onSelectAllUser: E,
229
+ onSelectUser: U
230
+ };
231
+ }, It = {
232
+ fontWeight: 500
233
+ }, Et = {
234
+ height: 38,
235
+ background: "#316cd9"
236
+ }, At = ({
237
+ text: e,
238
+ onClick: a,
239
+ className: o = ""
240
+ }) => /* @__PURE__ */ w(
241
+ le,
242
+ {
243
+ onClick: a,
244
+ color: "primary",
245
+ style: Et,
246
+ className: `d-flex align-items-center ${o} gap-2`,
247
+ children: [
248
+ /* @__PURE__ */ s(nt, {}),
249
+ /* @__PURE__ */ s("span", { style: It, children: e })
250
+ ]
251
+ }
252
+ );
253
+ function Ut(e) {
254
+ return V({ 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);
255
+ }
256
+ function Bt(e) {
257
+ return V({ 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);
258
+ }
259
+ function xt(e) {
260
+ return V({ 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);
261
+ }
262
+ function as(e) {
263
+ return V({ 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);
264
+ }
265
+ function Ae(e) {
266
+ return V({ 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);
267
+ }
268
+ function Ue(e) {
269
+ return V({ 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);
270
+ }
271
+ const $t = (e, a) => {
272
+ H(() => {
273
+ function o(d) {
274
+ e.current && !e.current.contains(d.target) && a?.();
275
+ }
276
+ return document.addEventListener("mousedown", o), () => {
277
+ document.removeEventListener("mousedown", o);
278
+ };
279
+ }, [e.current]);
280
+ }, Rt = (e) => {
281
+ const {
282
+ isOpen: a,
283
+ sortBy: o,
284
+ filters: d,
285
+ users: y,
286
+ searchBy: i,
287
+ defaultOptions: r,
288
+ selectedOptions: u,
289
+ searchKey: g,
290
+ onChangeSearchKey: N,
291
+ onOptionsChange: c,
292
+ onSearch: n,
293
+ onClose: p,
294
+ onChangeFilters: U,
295
+ getOption: E
296
+ } = e, [b, _] = T(), [S, l] = T([]), L = ve(null), $ = ve(null);
297
+ $t(L, p);
298
+ const { t: x } = ee(), t = D(
299
+ () => {
300
+ if (!a) return;
301
+ const F = g?.trim?.() ?? "";
302
+ i != null && !r && n?.(F, i), i != null && r && l(r.filter((P) => P.label.toLowerCase().includes(F.toLowerCase())));
303
+ },
304
+ [i, g, JSON.stringify(r), a]
305
+ ), m = () => {
306
+ $.current && clearTimeout($.current), $.current = setTimeout(t, 500);
307
+ }, C = (F) => {
308
+ const P = F.target.value;
309
+ N(P);
310
+ }, A = D(() => {
311
+ c?.(b, i), p?.();
312
+ }, [JSON.stringify(b)]), f = D((F) => {
313
+ const P = F.target.value ?? "";
314
+ let z = b ?? [], G = z.indexOf(P);
315
+ G > -1 ? z.splice(G, 1) : z = [...z, P], _(z == null ? z : [...z]);
316
+ }, [JSON.stringify(b)]), v = D((F) => {
317
+ const P = F.target.checked;
318
+ _(P ? void 0 : []);
319
+ }, []), h = D(() => {
320
+ U?.({
321
+ ...d,
322
+ sortBy: o,
323
+ isDescending: !0
324
+ }), p?.();
325
+ }, [JSON.stringify(d), i]), M = D(() => {
326
+ U?.({
327
+ ...d,
328
+ sortBy: o,
329
+ isDescending: !1
330
+ }), p?.();
331
+ }, [JSON.stringify(d), i]), R = de(() => E ? y.map((F) => E(F, x)) : [], [JSON.stringify(y), JSON.stringify(E)]), he = d?.isDescending == !1 && d.sortBy === o, J = !!d?.isDescending && d.sortBy === o;
332
+ return H(() => {
333
+ d?.searchBy !== i ? _(void 0) : _(u);
334
+ }, [JSON.stringify(u), d?.searchBy]), H(() => {
335
+ l(r || []);
336
+ }, [JSON.stringify(r)]), H(() => {
337
+ m();
338
+ }, [g, a]), {
339
+ ref: L,
340
+ options: R,
341
+ inputRef: $,
342
+ sOptions: b,
343
+ isAscending: he,
344
+ isDescending: J,
345
+ filteredOptions: S,
346
+ searchKey: g,
347
+ handleSearch: t,
348
+ handleApplyFilter: A,
349
+ handleOptionSelected: f,
350
+ handleOptionSelectedAll: v,
351
+ handleSortDesc: h,
352
+ handleSortAsc: M,
353
+ handleChangeSearchKey: C
354
+ };
355
+ }, Tt = (e) => {
356
+ const {
357
+ defaultOptions: a,
358
+ onClose: o,
359
+ getOption: d
360
+ } = e, {
361
+ ref: y,
362
+ inputRef: i,
363
+ options: r,
364
+ sOptions: u,
365
+ isAscending: g,
366
+ isDescending: N,
367
+ filteredOptions: c,
368
+ searchKey: n,
369
+ handleChangeSearchKey: p,
370
+ handleApplyFilter: U,
371
+ handleOptionSelected: E,
372
+ handleOptionSelectedAll: b,
373
+ handleSortDesc: _,
374
+ handleSortAsc: S
375
+ } = Rt(e);
376
+ return /* @__PURE__ */ s($e, { ...e, hideArrow: !0, className: B["popover-zindex"], children: /* @__PURE__ */ s(Re, { className: "pb-3", children: /* @__PURE__ */ w("div", { ref: y, className: B.popover, children: [
377
+ /* @__PURE__ */ w(
378
+ "div",
379
+ {
380
+ className: `d-flex flex-column ${B.popover__sort}`,
381
+ children: [
382
+ /* @__PURE__ */ s(K, { className: "font-weight-bold", children: "Sort" }),
383
+ /* @__PURE__ */ w(
384
+ "div",
385
+ {
386
+ className: `px-1 ${B.popover__sort__item} ${g && B["popover__sort__item--active"]}`,
387
+ onClick: S,
388
+ children: [
389
+ /* @__PURE__ */ s(Ae, { className: "mr-1" }),
390
+ "Ascending"
391
+ ]
392
+ }
393
+ ),
394
+ /* @__PURE__ */ w(
395
+ "div",
396
+ {
397
+ className: `px-1 mt-1 ${B.popover__sort__item} ${N && B["popover__sort__item--active"]}`,
398
+ onClick: _,
399
+ children: [
400
+ /* @__PURE__ */ s(Ue, { className: "mr-1" }),
401
+ "Descending"
402
+ ]
403
+ }
404
+ )
405
+ ]
406
+ }
407
+ ),
408
+ (typeof d < "u" || !!a) && /* @__PURE__ */ w(Ye, { children: [
409
+ /* @__PURE__ */ s("div", { className: "border border-top-1 border-bottom-0 mx-1 my-2" }),
410
+ /* @__PURE__ */ w("div", { className: "d-flex flex-column", children: [
411
+ /* @__PURE__ */ s(K, { className: "font-weight-bold", children: "Filter" }),
412
+ /* @__PURE__ */ w("div", { className: `position-relative px-1 ${B.popover__search}`, children: [
413
+ /* @__PURE__ */ s(
414
+ Bt,
415
+ {
416
+ className: `position-absolute ${B.popover__search__icon}`
417
+ }
418
+ ),
419
+ /* @__PURE__ */ s(
420
+ Y,
421
+ {
422
+ ref: i,
423
+ className: B.popover__search__input,
424
+ value: n,
425
+ onChange: p
426
+ }
427
+ )
428
+ ] }),
429
+ /* @__PURE__ */ w(
430
+ "div",
431
+ {
432
+ className: `mx-1 mt-2 p-2 bg-light ${B.popover__options}`,
433
+ children: [
434
+ /* @__PURE__ */ w(
435
+ ae,
436
+ {
437
+ className: "d-flex align-items-center",
438
+ check: !0,
439
+ style: { gap: "8px" },
440
+ children: [
441
+ /* @__PURE__ */ s(
442
+ Y,
443
+ {
444
+ type: "checkbox",
445
+ onChange: b,
446
+ checked: u == null
447
+ }
448
+ ),
449
+ " ",
450
+ /* @__PURE__ */ s(K, { check: !0, children: "(Select all)" })
451
+ ]
452
+ }
453
+ ),
454
+ !!d && !a && r.map((l) => /* @__PURE__ */ w(
455
+ ae,
456
+ {
457
+ className: "d-flex align-items-center",
458
+ check: !0,
459
+ style: { gap: "8px" },
460
+ children: [
461
+ /* @__PURE__ */ s(
462
+ Y,
463
+ {
464
+ type: "checkbox",
465
+ value: l.value,
466
+ onChange: E,
467
+ checked: u?.includes(l.value) || u == null
468
+ }
469
+ ),
470
+ " ",
471
+ /* @__PURE__ */ s(K, { check: !0, children: l.label })
472
+ ]
473
+ },
474
+ l.value
475
+ )),
476
+ !!a && c.map((l) => /* @__PURE__ */ w(
477
+ ae,
478
+ {
479
+ className: "d-flex align-items-center",
480
+ check: !0,
481
+ style: { gap: "8px" },
482
+ children: [
483
+ /* @__PURE__ */ s(
484
+ Y,
485
+ {
486
+ type: "checkbox",
487
+ value: l.value,
488
+ onChange: E,
489
+ checked: u?.includes(l.value) || u == null
490
+ }
491
+ ),
492
+ " ",
493
+ /* @__PURE__ */ s(K, { check: !0, children: l.label })
494
+ ]
495
+ },
496
+ l.value
497
+ ))
498
+ ]
499
+ }
500
+ )
501
+ ] }),
502
+ /* @__PURE__ */ w("div", { className: "d-flex justify-content-end mt-3", style: { gap: "8px" }, children: [
503
+ /* @__PURE__ */ s(
504
+ le,
505
+ {
506
+ color: "primary",
507
+ className: "mr-2",
508
+ size: "sm",
509
+ onClick: U,
510
+ children: "Apply Filter"
511
+ }
512
+ ),
513
+ /* @__PURE__ */ s(
514
+ le,
515
+ {
516
+ color: "secondary",
517
+ size: "sm",
518
+ onClick: o,
519
+ children: "Cancel"
520
+ }
521
+ )
522
+ ] })
523
+ ] })
524
+ ] }) }) });
525
+ }, Dt = ({
526
+ data: e,
527
+ popoverId: a,
528
+ filters: o,
529
+ searchString: d,
530
+ users: y,
531
+ selectedOptions: i,
532
+ onOptionsChange: r,
533
+ onSearch: u,
534
+ onChangeFilters: g,
535
+ onOpenFilter: N,
536
+ onClose: c,
537
+ isCenter: n,
538
+ isActive: p = !1
539
+ }) => {
540
+ const { t: U } = ee(), [E, b] = T(""), _ = de(
541
+ () => e.sortBy != null ? He[e.sortBy] : "",
542
+ [e.sortBy]
543
+ ), S = de(() => a === _, [_, a]), l = () => {
544
+ N?.(_, e.searchBy, E, e.sortBy);
545
+ }, L = ($) => {
546
+ b($);
547
+ };
548
+ return /* @__PURE__ */ s("th", { className: e.className, children: _ && e.sortBy !== void 0 ? /* @__PURE__ */ w("div", { className: `w-100 d-flex ${n ? "justify-content-center" : "justify-content-between"} align-items-center ${B["table-filter-icon"]}`, children: [
549
+ U(e.name),
550
+ /* @__PURE__ */ w(
551
+ "div",
552
+ {
553
+ className: "ml-2 p-1",
554
+ id: _,
555
+ onClick: l,
556
+ style: {
557
+ cursor: "pointer"
558
+ },
559
+ children: [
560
+ e.sortBy !== void 0 && e.sortBy === o?.sortBy && /* @__PURE__ */ s("span", { children: o.isDescending ? /* @__PURE__ */ s(Ue, {}) : /* @__PURE__ */ s(Ae, {}) }),
561
+ o?.searchByStrings?.length && e.searchBy === o?.searchBy ? /* @__PURE__ */ s(xt, { color: p ? "#007bff" : "#242424" }) : /* @__PURE__ */ s(Ut, { color: p ? "#007bff" : "#242424" })
562
+ ]
563
+ }
564
+ ),
565
+ /* @__PURE__ */ s(
566
+ Tt,
567
+ {
568
+ placement: "bottom-end",
569
+ target: _,
570
+ users: y,
571
+ isOpen: S,
572
+ filters: o,
573
+ sortBy: e.sortBy,
574
+ searchKey: E,
575
+ searchBy: e.searchBy,
576
+ searchString: d,
577
+ defaultOptions: e.options,
578
+ selectedOptions: i,
579
+ onClose: c,
580
+ onSearch: u,
581
+ getOption: e.getOption,
582
+ onChangeFilters: g,
583
+ onOptionsChange: r,
584
+ onChangeSearchKey: L
585
+ }
586
+ )
587
+ ] }) : U(e.name) });
588
+ }, Lt = (e) => {
589
+ const {
590
+ filters: a,
591
+ onChangeFilters: o,
592
+ isStudentFilter: d,
593
+ teacherOptions: y,
594
+ assistantOptions: i,
595
+ counselorOptions: r,
596
+ secondaryTeacherOptions: u
597
+ } = e, [g, N] = T(), [c, n] = T([]), [p, U] = T({
598
+ ...je,
599
+ isDescending: a.isDescending,
600
+ searchString: a.searchString
601
+ }), E = W(), b = Qe(), _ = D(
602
+ async (x) => {
603
+ try {
604
+ const m = (d ? await Je(p) : await Ve({ ...p, byStudent: x })).data?.items || [];
605
+ n(m);
606
+ } catch (t) {
607
+ E(
608
+ I({
609
+ type: "danger",
610
+ message: t.response?.data?.title || t.message
611
+ })
612
+ );
613
+ }
614
+ },
615
+ [JSON.stringify(p), d]
616
+ ), S = D((x, t, m, C) => {
617
+ N(x), U({
618
+ ...p,
619
+ searchBy: t,
620
+ searchStringBy: m,
621
+ isDescending: a.sortBy === C ? a.isDescending : void 0,
622
+ searchString: a.searchString
623
+ });
624
+ }, [JSON.stringify(p), a.isDescending, a.searchString]), l = () => {
625
+ N("");
626
+ }, L = D((x, t) => {
627
+ U({
628
+ ...p,
629
+ searchBy: t,
630
+ searchStringBy: x
631
+ });
632
+ }, [JSON.stringify(p)]), $ = D((x, t) => {
633
+ t && o?.({
634
+ ...a,
635
+ [j[t]]: x
636
+ });
637
+ }, [JSON.stringify(a)]);
638
+ return H(() => {
639
+ if (!b.pathname.includes("users/assign-student")) return;
640
+ const x = (m) => m.sort((C, A) => C.localeCompare(A)), t = p.searchStringBy?.toLowerCase() || "";
641
+ if (p.searchBy === j.Grade)
642
+ n(Ge);
643
+ else {
644
+ let m = [];
645
+ switch (p.searchBy) {
646
+ case j.Name:
647
+ _(!0);
648
+ break;
649
+ case j.Teacher:
650
+ m = y?.map((v) => v.label).filter(Boolean) || [];
651
+ break;
652
+ case j.Assistant:
653
+ m = i?.map((v) => v.label).filter(Boolean) || [];
654
+ break;
655
+ case j.Counselor:
656
+ m = r?.map((v) => v.label).filter(Boolean) || [];
657
+ break;
658
+ case j.SecondaryTeacher:
659
+ m = u?.map((v) => v.label).filter(Boolean) || [];
660
+ break;
661
+ }
662
+ const C = Array.from(new Set(m)), A = t ? C.filter(
663
+ (v) => v.toLowerCase().includes(t)
664
+ ) : C, f = x(A);
665
+ n(f);
666
+ }
667
+ }, [
668
+ JSON.stringify(p),
669
+ y,
670
+ i,
671
+ r,
672
+ u,
673
+ b.pathname
674
+ ]), H(() => {
675
+ !(b.pathname.includes("users/assign-student") && p.searchBy !== void 0) && p.searchBy !== void 0 && _();
676
+ }, [
677
+ JSON.stringify(p),
678
+ b.pathname
679
+ ]), {
680
+ popoverFilters: p,
681
+ popoverId: g,
682
+ users: c,
683
+ handleFilterIcon: S,
684
+ handleCloseFilter: l,
685
+ handleSearch: L,
686
+ handleChangeFilters: $
687
+ };
688
+ }, Ft = ({
689
+ headers: e,
690
+ filters: a,
691
+ onChangeFilters: o,
692
+ isStudentFilter: d,
693
+ teacherOptions: y = [],
694
+ assistantOptions: i = [],
695
+ counselorOptions: r = [],
696
+ secondaryTeacherOptions: u = []
697
+ }) => {
698
+ const {
699
+ popoverId: g,
700
+ users: N,
701
+ handleFilterIcon: c,
702
+ handleCloseFilter: n,
703
+ handleSearch: p,
704
+ handleChangeFilters: U
705
+ } = Lt({
706
+ filters: a,
707
+ onChangeFilters: o,
708
+ isStudentFilter: d,
709
+ teacherOptions: y,
710
+ assistantOptions: i,
711
+ counselorOptions: r,
712
+ secondaryTeacherOptions: u
713
+ }), E = Object.entries(a).filter(
714
+ ([S, l]) => l !== "" && !(Array.isArray(l) && l.length === 0) && l !== null && l !== void 0
715
+ ).map(([S]) => S), b = Object.entries(j).filter(([S, l]) => isNaN(Number(S))), _ = E.map((S) => b.find(([l]) => l === S)).filter((S) => !!S);
716
+ return /* @__PURE__ */ s("tr", { children: e.map((S) => S.onSelectAll ? /* @__PURE__ */ s("th", { className: `align-middle text-center ${S.className}`, children: /* @__PURE__ */ s(
717
+ "input",
718
+ {
719
+ type: "checkbox",
720
+ onChange: () => S.onSelectAll?.(),
721
+ checked: S.isCheckAll ?? !1
722
+ }
723
+ ) }, S.name) : /* @__PURE__ */ s(
724
+ Dt,
725
+ {
726
+ users: N,
727
+ data: S,
728
+ isCenter: S.isCenter,
729
+ filters: a,
730
+ popoverId: g,
731
+ selectedOptions: a.searchByStrings,
732
+ onSearch: p,
733
+ onClose: n,
734
+ onOpenFilter: c,
735
+ onChangeFilters: o,
736
+ onOptionsChange: U,
737
+ isActive: typeof S.searchBy == "number" && _.some(([l, L]) => L === S.searchBy)
738
+ },
739
+ S.name
740
+ )) });
741
+ }, kt = () => {
742
+ const e = W(), a = Z((u) => u?.common?.user?.schoolName) || "", o = async (u) => {
743
+ e(O(!0));
744
+ try {
745
+ const N = (await ye(u)).data, c = d(N), n = document.createElement("a");
746
+ n.href = c, n.download = `${a}_Users_Report.csv`, n.click();
747
+ } catch (g) {
748
+ e(
749
+ I({
750
+ type: "danger",
751
+ message: g.response?.data?.title || g.message
752
+ })
753
+ );
754
+ }
755
+ e(O(!1));
756
+ }, d = (u) => {
757
+ let g = `First Name,Last Name,Email,Phone,Age,Grade,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
758
+ `;
759
+ const N = u.map((c) => {
760
+ const n = c.dateOfBirth !== Oe ? ut(
761
+ /* @__PURE__ */ new Date(),
762
+ pt(c.dateOfBirth)
763
+ ) : "";
764
+ return `${r(c.firstName)},${r(c.lastName)},${r(c.email)},${r(c.phoneNumber)},${n},${r(c.grade)},${r(c.roles.join(", ").replace("SecondaryTeacher", "SupportTeacher"))},${c.isActive ? "Active" : "Inactive"},${Ie(c?.createTime, "yyyy-MM-dd HH:mm")},${r(c.sourcedId)},${r(c.rosterUser?.status)},${r(c.rosterUser?.familyName)},${r(c.rosterUser?.middleName)},${r(c.rosterUser?.givenName)},${r(c.rosterUser?.email)},${r(c.rosterUser?.role)},${r(c.rosterUser?.grades)},${r(c.teachers)},${r(c.assistants)},${r(c.counselors)},${r(c.supportTeachers)},${r(c.eduTeachers)}`;
765
+ }).join(`
766
+ `);
767
+ return `${Se}${g}${encodeURIComponent(N)}`;
768
+ }, y = async (u) => {
769
+ e(O(!0));
770
+ try {
771
+ const N = (await ye(u)).data, c = i(N), n = document.createElement("a");
772
+ n.href = c, n.download = "Classcode.csv", n.click();
773
+ } catch (g) {
774
+ e(
775
+ I({
776
+ type: "danger",
777
+ message: g.response?.data?.title || g.message
778
+ })
779
+ );
780
+ }
781
+ e(O(!1));
782
+ }, i = (u) => {
783
+ let g = `Teacher name,Teacher Email,Teacher code
784
+ `;
785
+ const c = u.filter((n) => n.roles && n.roles.includes("Teacher")).map((n) => `${r(n.fullName)},${r(n.email)},${r(n?.assignCode || "")}`).join(`
786
+ `);
787
+ return `${Se}${g}${encodeURIComponent(c)}`;
788
+ }, r = (u) => u ? `"${u.replace(/"/g, '""').replaceAll(/\n/g, " ")}"` : "";
789
+ return {
790
+ exportUsers: o,
791
+ exportClassCodes: y
792
+ };
793
+ }, Be = `${Ee}/api/ImportCsv/csv`, te = `${Ee}/api/Teacher`, Mt = (e, a) => Q.post(`${Be}/${a}`, e), _e = (e) => Q.post(`${Be}/importClassReflection`, e), Pt = (e, a) => Q.post(`${te}/adminImportStudentByTeacherId/${e}`, a), zt = (e) => Q.post(`${te}/adminImport`, e), Ht = () => at.get(`${te}/download-template-file-user`), rs = (e, a) => Q.post(`${te}/validate-csv-template-student/${a}`, e);
794
+ var xe = /* @__PURE__ */ ((e) => (e.Students = "students", e.Subjects = "subjects", e.Grades = "grades", e.Attendances = "attendances", e.ClassReflection = "classReflection", e.Others = "others", e.AllUser = "allUser", e))(xe || {});
795
+ const ce = "csvupload", we = {
796
+ teacherName: "",
797
+ teacherEmail: "",
798
+ studentIds: [],
799
+ file: ""
800
+ }, jt = () => {
801
+ const e = W(), a = Z((f) => f.common.isLoading), [o, d] = T(null), [y, i] = T(), [r, u] = T([]), [g, N] = T(
802
+ we
803
+ ), [c, n] = T(), p = window.location.hostname, U = p.includes("isb") || p.includes("stage"), [E, b] = T(0), [_, S] = T(""), l = async () => {
804
+ e(O(!0));
805
+ try {
806
+ const h = await Ht();
807
+ var f = new Blob([h.data.content], { type: "text/csv" });
808
+ const M = window.URL.createObjectURL(f);
809
+ var v = document.createElement("a");
810
+ v.href = M, v.setAttribute("download", h.data.nameFile), v.click(), e(
811
+ I({
812
+ type: "success",
813
+ message: "Download successfully"
814
+ })
815
+ );
816
+ } catch (h) {
817
+ e(
818
+ I({
819
+ type: "danger",
820
+ message: h.message
821
+ })
822
+ );
823
+ }
824
+ e(O(!1));
825
+ }, L = D(
826
+ async (f) => {
827
+ if (!o || !f) return;
828
+ e(O(!0));
829
+ try {
830
+ const R = new FormData();
831
+ if (R.append("file", f, f.name), o == "allUser") {
832
+ let J = (await f.text()).trim();
833
+ const F = J.split(`
834
+ `).map((k) => k.trim()), P = F.findIndex(
835
+ (k) => k.split(",").includes("FirstName")
836
+ );
837
+ if (P === 0)
838
+ throw new Error("Invalid CSV: Missing header row.");
839
+ J = F.slice(P).join(`
840
+ `);
841
+ const z = Ce.parse(J, {
842
+ header: !0,
843
+ skipEmptyLines: !0
844
+ }), G = z.meta.fields, ue = z.data;
845
+ if (!G)
846
+ throw new Error("Unable to determine header from CSV file");
847
+ const pe = 20, se = [];
848
+ for (let k = 0; k < ue.length; k += pe) {
849
+ const ne = ue.slice(k, k + pe), X = Ce.unparse({
850
+ fields: G,
851
+ data: ne
852
+ });
853
+ se.push(X);
854
+ }
855
+ for (let k = 0; k < se.length; k++) {
856
+ const ne = new Blob([se[k]], { type: "text/csv" }), X = new FormData();
857
+ X.append(
858
+ "file",
859
+ ne,
860
+ `students_chunk${k + 1}.csv`
861
+ ), await zt(X);
862
+ }
863
+ } else
864
+ U ? o == "classReflection" && await _e(R) : await Mt(R, o.toString());
865
+ e(
866
+ I({
867
+ type: "success",
868
+ message: "Import CSV successfully"
869
+ })
870
+ );
871
+ } catch (R) {
872
+ e(
873
+ I({
874
+ type: "danger",
875
+ message: R.response?.data?.title || R.message
876
+ })
877
+ );
878
+ }
879
+ e(O(!1));
880
+ const v = document.getElementById(ce), h = document.getElementById("import-student"), M = document.getElementById(
881
+ "import-classReflection"
882
+ );
883
+ v && (v.value = ""), h && (h.value = ""), M && (M.value = "");
884
+ },
885
+ [o]
886
+ ), $ = async (f) => {
887
+ if (!E) {
888
+ e(
889
+ I({
890
+ type: "danger",
891
+ message: "Select teacher before import csv"
892
+ })
893
+ );
894
+ return;
895
+ }
896
+ if (!o || !f) return;
897
+ e(O(!0));
898
+ try {
899
+ const h = new FormData();
900
+ h.append("file", f, f.name), await Pt(E, h), e(
901
+ I({
902
+ type: "success",
903
+ message: "Import CSV successfully"
904
+ })
905
+ );
906
+ } catch (h) {
907
+ e(
908
+ I({
909
+ type: "danger",
910
+ message: h.response?.data?.title || h.message
911
+ })
912
+ );
913
+ }
914
+ e(O(!1));
915
+ const v = document.getElementById("teacherSelector");
916
+ v && (v.value = "");
917
+ }, x = async (f) => {
918
+ if (!y || !y) return;
919
+ e(O(!0));
920
+ try {
921
+ const h = new FormData();
922
+ h.append("file", y, y.name), h.append("teacherName", f.teacherName), h.append("teacherEmail", f.teacherEmail), f.studentIds.forEach((M) => {
923
+ h.append("studentIds", M);
924
+ }), await _e(h), e(
925
+ I({
926
+ type: "success",
927
+ message: "Import CSV successfully"
928
+ })
929
+ ), N(we);
930
+ } catch (h) {
931
+ e(
932
+ I({
933
+ type: "danger",
934
+ message: h.response?.data?.title || h.message
935
+ })
936
+ );
937
+ }
938
+ e(O(!1));
939
+ const v = document.getElementById(ce);
940
+ v && (v.value = "");
941
+ }, t = (f) => {
942
+ b(f.value);
943
+ }, m = (f) => {
944
+ n(f), S(f?.name || "");
945
+ }, C = () => {
946
+ if (!c) {
947
+ e(
948
+ I({
949
+ type: "danger",
950
+ message: "Select CSV to import"
951
+ })
952
+ );
953
+ return;
954
+ }
955
+ $(c);
956
+ };
957
+ return {
958
+ isLoading: a,
959
+ id: ce,
960
+ setType: d,
961
+ upload: L,
962
+ initImportReflection: g,
963
+ setInitImportReflection: N,
964
+ onConfirm: x,
965
+ CSVType: xe,
966
+ dataFile: y,
967
+ setDataFile: i,
968
+ setArrStudent: u,
969
+ arrStudent: r,
970
+ isCheckDomainIBS: U,
971
+ onChangeTeacher: t,
972
+ uploadByTeacherId: $,
973
+ setDataFileImportStudent: m,
974
+ onUpLoadStudentFile: C,
975
+ defaultTeacher: E,
976
+ fileName: _,
977
+ onStudentSubmit: () => {
978
+ e(
979
+ me({
980
+ isOpen: !0,
981
+ type: "warning",
982
+ message: "Are you sure upload this file?",
983
+ onConfirm: () => {
984
+ C();
985
+ }
986
+ })
987
+ );
988
+ },
989
+ downloadTemplateUser: l
990
+ };
991
+ }, Vt = () => {
992
+ const e = W(), a = async (y) => {
993
+ e(O(!0));
994
+ try {
995
+ await Ke(y), e(
996
+ I({
997
+ type: "success",
998
+ message: "Send Successfully"
999
+ })
1000
+ );
1001
+ } catch (i) {
1002
+ e(
1003
+ I({
1004
+ type: "danger",
1005
+ message: i.response?.data?.title || i.message
1006
+ })
1007
+ );
1008
+ }
1009
+ e(O(!1));
1010
+ };
1011
+ return {
1012
+ handleSendMultiUsers: (y) => {
1013
+ a({ userIds: [...y] });
1014
+ },
1015
+ handleSendSingleUser: (y) => {
1016
+ a({ userIds: [y] });
1017
+ }
1018
+ };
1019
+ }, oe = {
1020
+ fontWeight: 500
1021
+ }, ie = {
1022
+ height: 38,
1023
+ backgroundColor: "#2eb85c",
1024
+ borderColor: "#2eb85c"
1025
+ }, Jt = "user", Gt = () => {
1026
+ const {
1027
+ queryName: e,
1028
+ userList: a,
1029
+ totalItems: o,
1030
+ filters: d,
1031
+ fullName: y,
1032
+ removeData: i,
1033
+ changeFilters: r,
1034
+ reDirectDetailPage: u,
1035
+ switchUser: g,
1036
+ handleSyncRosterUsers: N,
1037
+ rosterUserInfo: c,
1038
+ onSelectUser: n,
1039
+ userIds: p,
1040
+ onSelectAllUser: U
1041
+ } = Ot(), { handleSendMultiUsers: E } = Vt(), { upload: b } = jt(), {
1042
+ exportUsers: _,
1043
+ exportClassCodes: S
1044
+ } = kt(), { t: l } = ee(), L = () => _(d), $ = () => S(d), x = [
1045
+ {
1046
+ name: "",
1047
+ isCenter: !0,
1048
+ onSelectAll: () => {
1049
+ U();
1050
+ },
1051
+ isCheckAll: p.length == o && o != 0
1052
+ }
1053
+ ].concat(qe);
1054
+ return /* @__PURE__ */ w("div", { className: `fadeIn animated h-100 ${mt <= 767 ? B["p-0-12"] : ""}`, children: [
1055
+ /* @__PURE__ */ s("h5", { className: "mt-4 mb-2", children: l(`${Jt}`) }),
1056
+ /* @__PURE__ */ w(ge, { className: "my-2", children: [
1057
+ /* @__PURE__ */ s(q, { md: 8, children: /* @__PURE__ */ s(
1058
+ rt,
1059
+ {
1060
+ text: l("create_user"),
1061
+ onClick: () => u(),
1062
+ initValue: e || "",
1063
+ onSearch: (t) => r({
1064
+ searchString: t
1065
+ }),
1066
+ placeholder: l("type_something_to_search_by_user_name")
1067
+ }
1068
+ ) }),
1069
+ /* @__PURE__ */ w(
1070
+ q,
1071
+ {
1072
+ md: 4,
1073
+ className: "d-flex justify-content-end align-items-center",
1074
+ children: [
1075
+ l("total_of_users"),
1076
+ " : ",
1077
+ o
1078
+ ]
1079
+ }
1080
+ ),
1081
+ /* @__PURE__ */ w(q, { md: 12, className: "d-flex justify-content-end my-2 flex-wrap", style: { gap: "8px" }, children: [
1082
+ /* @__PURE__ */ s(
1083
+ "button",
1084
+ {
1085
+ className: "btn btn-success d-flex align-items-center border-0",
1086
+ style: ie,
1087
+ onClick: () => E(p),
1088
+ children: /* @__PURE__ */ s("p", { className: `${B["button-content"]} mb-0`, style: oe, children: l("welcome_email_resend") })
1089
+ }
1090
+ ),
1091
+ /* @__PURE__ */ s(
1092
+ Y,
1093
+ {
1094
+ id: "import-user",
1095
+ className: "d-none",
1096
+ type: "file",
1097
+ onChange: (t) => b(t.target.files[0]),
1098
+ accept: "text/csv"
1099
+ }
1100
+ ),
1101
+ /* @__PURE__ */ s(At, { text: l("sync_roster_users"), onClick: N }),
1102
+ /* @__PURE__ */ w(
1103
+ "button",
1104
+ {
1105
+ className: "btn btn-success d-flex align-items-center border-0 p-0",
1106
+ style: ie,
1107
+ onClick: $,
1108
+ children: [
1109
+ /* @__PURE__ */ s("div", { className: `${B["button-icon"]}`, children: /* @__PURE__ */ s("img", { src: "images/export-icon.svg", alt: "" }) }),
1110
+ /* @__PURE__ */ s("p", { className: `${B["button-content"]} mb-0`, style: oe, children: l("export_class_code_to_csv") })
1111
+ ]
1112
+ }
1113
+ ),
1114
+ /* @__PURE__ */ w(
1115
+ "button",
1116
+ {
1117
+ className: "btn btn-success d-flex align-items-center border-0 p-0",
1118
+ style: ie,
1119
+ onClick: L,
1120
+ children: [
1121
+ /* @__PURE__ */ s("div", { className: `${B["button-icon"]}`, children: /* @__PURE__ */ s("img", { src: "images/export-icon.svg", alt: "" }) }),
1122
+ /* @__PURE__ */ s("p", { className: `${B["button-content"]} mb-0`, style: oe, children: l("export_to_csv") })
1123
+ ]
1124
+ }
1125
+ )
1126
+ ] })
1127
+ ] }),
1128
+ /* @__PURE__ */ w(ge, { className: "mb-2", children: [
1129
+ /* @__PURE__ */ s(q, { md: 12, children: /* @__PURE__ */ s("div", { style: { overflow: "auto" }, children: /* @__PURE__ */ w(Te, { bordered: !0, hover: !0, striped: !0, size: "sm", children: [
1130
+ /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s(
1131
+ Ft,
1132
+ {
1133
+ headers: x,
1134
+ filters: d,
1135
+ fullName: y,
1136
+ onChangeFilters: r
1137
+ }
1138
+ ) }),
1139
+ /* @__PURE__ */ w("tbody", { children: [
1140
+ a && a.length > 0 && a.map((t) => /* @__PURE__ */ w("tr", { children: [
1141
+ /* @__PURE__ */ s("td", { className: "align-middle", children: /* @__PURE__ */ s(
1142
+ "input",
1143
+ {
1144
+ type: "checkbox",
1145
+ onChange: () => n(t.id),
1146
+ checked: p.includes(t.id) ?? !1
1147
+ }
1148
+ ) }),
1149
+ /* @__PURE__ */ s("td", { className: "align-middle", children: /* @__PURE__ */ s(
1150
+ ct,
1151
+ {
1152
+ label: `${t.fullName}`,
1153
+ onClick: () => u(
1154
+ t.id
1155
+ )
1156
+ }
1157
+ ) }),
1158
+ /* @__PURE__ */ s("td", { className: "align-middle", children: t.email }),
1159
+ /* @__PURE__ */ s("td", { className: "align-middle", children: t.dateOfBirth !== Oe && gt(
1160
+ /* @__PURE__ */ new Date(),
1161
+ new Date(t.dateOfBirth)
1162
+ ) }),
1163
+ /* @__PURE__ */ s("td", { className: "align-middle", children: !!t.roles && t.roles.map((m) => m === "SecondaryTeacher" ? "SupportTeacher" : m).join(", ") }),
1164
+ /* @__PURE__ */ s("td", { className: "align-middle", children: t.isActive ? l("active") : l("inactive") }),
1165
+ /* @__PURE__ */ s("td", { className: "align-middle", children: Ie(t?.createTime, "yyyy-MM-dd HH:mm") }),
1166
+ /* @__PURE__ */ s("td", { children: c(t) }),
1167
+ /* @__PURE__ */ s("td", { className: "align-middle", children: /* @__PURE__ */ s(
1168
+ ot,
1169
+ {
1170
+ style: { fontSize: "18px", margin: "0 10px", cursor: "pointer" },
1171
+ onClick: () => g(t.id)
1172
+ }
1173
+ ) }),
1174
+ /* @__PURE__ */ s("td", { className: "align-middle", style: { padding: "0 15px" }, children: /* @__PURE__ */ s(
1175
+ it,
1176
+ {
1177
+ onClick: () => i(t.id)
1178
+ }
1179
+ ) })
1180
+ ] }, t.id)),
1181
+ (!a || !a.length) && /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s("td", { colSpan: 12, className: "p-0", children: /* @__PURE__ */ s(lt, { className: "mb-0", label: l("user") }) }) })
1182
+ ] })
1183
+ ] }) }) }),
1184
+ /* @__PURE__ */ s(q, { md: 12, children: /* @__PURE__ */ s(
1185
+ dt,
1186
+ {
1187
+ filters: d,
1188
+ totalRecordCount: o,
1189
+ changePageSize: (t) => r({ pageSize: t }),
1190
+ changePage: (t) => r({ currentPage: t })
1191
+ }
1192
+ ) })
1193
+ ] })
1194
+ ] });
1195
+ }, cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1196
+ __proto__: null,
1197
+ default: Gt
1198
+ }, Symbol.toStringTag, { value: "Module" }));
1199
+ export {
1200
+ as as A,
1201
+ Ft as T,
1202
+ Gt as U,
1203
+ cs as a,
1204
+ rs as v
1205
+ };