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,914 @@
1
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
+ import { useState as v, useEffect as K, useCallback as U } from "react";
3
+ import { useNavigate as pe, useParams as fe } from "react-router-dom";
4
+ import { Row as b, Col as m, FormGroup as T, Input as P, Label as re, Button as G, Modal as ge, ModalHeader as we, ModalBody as ye, ModalFooter as Ne } from "reactstrap";
5
+ import { b as N, c as D, a6 as A, ad as ce, ae as De, X as de, s as W, T as Se, U as I, E as H, af as Te, ag as ve, ah as Ce, W as be, ac as Pe, i as Ue } from "./index-C1gw45bw.mjs";
6
+ import { Formik as ne } from "formik";
7
+ import Ee from "react-datepicker";
8
+ import { format as me } from "date-fns";
9
+ import { K as Re, L as oe, d as xe, M as _e, N as Ie, O as Ae, P as Oe, Q as Be, R as Le, V as ke, W as Fe, t as He, X as le } from "./constants-D3RqPPqz.mjs";
10
+ import { useDispatch as ue, useSelector as Me } from "react-redux";
11
+ import { useTranslation as $e } from "react-i18next";
12
+ import * as E from "yup";
13
+ import { T as qe } from "./TeacherSelector-Bi582rEx.mjs";
14
+ const je = {
15
+ id: "",
16
+ firstName: "",
17
+ lastName: "",
18
+ email: "",
19
+ dateOfBirth: "",
20
+ roles: [],
21
+ isActive: !0,
22
+ profileImageFileName: "",
23
+ teacherUserId: []
24
+ }, ie = "/admin/users/user-list", ze = "User detail", Ve = (l) => {
25
+ const n = ue(), r = pe(), [w, O] = v(je), [S, y] = v(!1), [B, J] = v([]), [C, f] = v(null), [Q, L] = v(!1), [x, M] = v({
26
+ isHasAssistantData: !1,
27
+ isHasCounselorData: !1,
28
+ isHasEduTeacherData: !1,
29
+ isHasSecondaryTeacherData: !1,
30
+ isHasTeacherData: !1
31
+ }), X = async () => {
32
+ localStorage.setItem(window.location.href, "true"), L(!0);
33
+ }, [$, h] = v([]), d = () => {
34
+ y(!S);
35
+ };
36
+ K(() => {
37
+ document.title = ze, L(!1), localStorage.getItem(window.location.href) && localStorage.removeItem(window.location.href);
38
+ }, []), K(() => {
39
+ l && (p(), q()), !l && j();
40
+ }, [l]);
41
+ const p = U(async () => {
42
+ n(N(!0));
43
+ try {
44
+ const a = await Re(l);
45
+ M(a.data);
46
+ } catch (a) {
47
+ n(
48
+ D({
49
+ type: "danger",
50
+ message: a.response?.data?.title || a.message
51
+ })
52
+ );
53
+ }
54
+ n(N(!1));
55
+ }, [l]), q = U(async () => {
56
+ n(N(!0));
57
+ try {
58
+ const a = await oe(l);
59
+ O({
60
+ ...a.data,
61
+ dateOfBirth: me(new Date(a.data.dateOfBirth), ce),
62
+ roles: a.data.roles.map((o) => o != "EduTeacher" ? o : A.EDUTEACHER)
63
+ }), h(a?.data?.roles ?? []), document.title = a.data?.fullName;
64
+ } catch (a) {
65
+ n(
66
+ D({
67
+ type: "danger",
68
+ message: a.response?.data?.title || a.message
69
+ })
70
+ );
71
+ }
72
+ n(N(!1));
73
+ }, [l]), j = async () => {
74
+ try {
75
+ const a = await xe({
76
+ sortBy: "Email"
77
+ });
78
+ a.data && J(a.data.map?.((o) => ({
79
+ label: o.email,
80
+ value: o.id
81
+ })) || []);
82
+ } catch (a) {
83
+ n(
84
+ D({
85
+ type: "danger",
86
+ message: a.response?.data?.title || a.message
87
+ })
88
+ );
89
+ }
90
+ }, k = U((a) => {
91
+ r(a && typeof a == "string" ? ie + `?query=${a}` : ie);
92
+ }, []), z = U(
93
+ async (a) => {
94
+ n(N(!0));
95
+ try {
96
+ if (C) {
97
+ const g = new FormData(), { name: _ } = C;
98
+ g.append("file", C, _);
99
+ const ae = (await De(g))?.data?.key;
100
+ a.profileImageFileName = ae;
101
+ }
102
+ const o = l ? _e : Ie;
103
+ !l && delete a.id, a.dateOfBirth === "" && delete a.dateOfBirth;
104
+ const i = await o(a);
105
+ i && oe(i.data.id).then((g) => {
106
+ k(g.data.fullName);
107
+ }), l || alert("Password of " + i.data.email + ` is "${i.data.password}"`), i.data.id && await Ae(i.data.id, a.gradeLevel), n(
108
+ D({
109
+ type: "success",
110
+ message: `${l ? "Update" : "Create"} user successfully`
111
+ })
112
+ );
113
+ } catch (o) {
114
+ n(
115
+ D({
116
+ type: "danger",
117
+ message: o.response?.data?.title || o.message
118
+ })
119
+ );
120
+ }
121
+ n(N(!1));
122
+ },
123
+ [l, C]
124
+ ), R = (a) => ["Student", "Parent", "EduTeacher"].includes(a), Z = async (a) => {
125
+ n(N(!0));
126
+ try {
127
+ await Le(a), n(
128
+ D({
129
+ type: "success",
130
+ message: "Change password successfully"
131
+ })
132
+ );
133
+ } catch (o) {
134
+ n(
135
+ D({
136
+ type: "danger",
137
+ message: o.response?.data?.title || o.message
138
+ })
139
+ );
140
+ }
141
+ n(N(!1));
142
+ }, u = U(async (a) => {
143
+ n(N(!0));
144
+ try {
145
+ await Oe(a), n(
146
+ D({
147
+ type: "success",
148
+ message: "Send forgot password link successfully"
149
+ })
150
+ );
151
+ } catch (o) {
152
+ n(
153
+ D({
154
+ type: "danger",
155
+ message: o.response?.data?.title || o.message || "Error occured"
156
+ })
157
+ );
158
+ }
159
+ n(N(!1));
160
+ }, []), t = U(
161
+ async (a) => {
162
+ n(N(!0));
163
+ try {
164
+ const i = await Be({
165
+ userId: a
166
+ });
167
+ if (i.data) {
168
+ const g = `${w.firstName} ${w.lastName}`;
169
+ alert(`Password of ${g} is ${i.data}`), n(
170
+ D({
171
+ type: "success",
172
+ message: "Update user password successfully"
173
+ })
174
+ );
175
+ }
176
+ } catch (o) {
177
+ n(
178
+ D({
179
+ type: "danger",
180
+ message: o.response?.data?.title || o.message
181
+ })
182
+ );
183
+ }
184
+ n(N(!1));
185
+ },
186
+ [w]
187
+ );
188
+ return {
189
+ userDetail: w,
190
+ backToList: k,
191
+ confirmData: z,
192
+ file: C,
193
+ setFile: f,
194
+ edited: Q,
195
+ setEdited: L,
196
+ setEditedTrue: X,
197
+ confirmChangePassword: Z,
198
+ forgotPasswordRequest: u,
199
+ currentRoles: $,
200
+ handleDisableRoles: R,
201
+ handleResetPassword: t,
202
+ teacherOptions: B,
203
+ openModel: S,
204
+ handleToggleModel: d,
205
+ userHasData: x
206
+ };
207
+ }, Ge = E.object({
208
+ firstName: E.string().required("First name is required"),
209
+ lastName: E.string().required("Last name is required"),
210
+ email: E.string().email("Email is invalid").required("Email is required"),
211
+ roles: E.array().of(E.string()).min(1, "Role is required")
212
+ }), We = E.object({
213
+ oldPassword: E.string().required("Current password is required"),
214
+ newPassword: E.string().required("New password is required"),
215
+ confirmedNewPassword: E.string().required("Confirm password is required")
216
+ }), Je = {
217
+ currentPage: 1,
218
+ pageSize: 100
219
+ }, Qe = (l, n) => {
220
+ const [r, w] = v([]), [O, S] = v(!1), [y, B] = v(Je), [J, C] = v(), f = ue(), Q = U(async () => {
221
+ S(!0);
222
+ try {
223
+ const d = (await ke(y)).data?.items || [];
224
+ w(x(d));
225
+ } catch {
226
+ f(D({
227
+ type: "error",
228
+ message: "Cannot get roster users"
229
+ }));
230
+ }
231
+ S(!1);
232
+ }, [JSON.stringify(y)]), L = U(async () => {
233
+ if (!n) return;
234
+ const h = r.find((d) => d.value === n);
235
+ if (h) {
236
+ C(h);
237
+ return;
238
+ }
239
+ S(!0);
240
+ try {
241
+ const p = (await Fe(n)).data;
242
+ C({
243
+ label: M(p),
244
+ value: p.sourcedId
245
+ });
246
+ } catch (d) {
247
+ console.log("err:", d);
248
+ }
249
+ S(!1);
250
+ }, [n]), x = (h) => h.map((d) => ({
251
+ label: M(d),
252
+ value: d.sourcedId
253
+ })), M = (h) => {
254
+ const d = [], { givenName: p, middleName: q, familyName: j, email: k, role: z } = h, R = [];
255
+ return p && R.push(p), q && R.push(q), j && R.push(j), R.length && d.push(R.join(" ")), k && d.push(k), `${d.join(" - ")}${z ? ` (${z})` : ""}`;
256
+ }, X = (h) => {
257
+ B((d) => ({ ...d, searchString: h }));
258
+ }, $ = U((h) => {
259
+ B({
260
+ ...y,
261
+ ...h
262
+ });
263
+ }, [JSON.stringify(y)]);
264
+ return K(() => {
265
+ y.roles?.length && Q();
266
+ }, [JSON.stringify(y)]), K(() => {
267
+ $({
268
+ roles: l
269
+ });
270
+ }, [JSON.stringify(l)]), K(() => {
271
+ L();
272
+ }, [n]), {
273
+ users: r,
274
+ isLoading: O,
275
+ user: J,
276
+ handleInputChange: X
277
+ };
278
+ }, Xe = ({ value: l, roles: n, onChange: r }) => {
279
+ const {
280
+ users: w,
281
+ isLoading: O,
282
+ user: S,
283
+ handleInputChange: y
284
+ } = Qe(n, l);
285
+ return /* @__PURE__ */ e(
286
+ de,
287
+ {
288
+ options: w,
289
+ value: S,
290
+ placeholder: "Select user",
291
+ onChange: r,
292
+ isLoading: O,
293
+ onInputChange: y
294
+ }
295
+ );
296
+ }, Ye = "create_user", Ke = "edit_user", Ze = "change_password", ua = () => {
297
+ const { id: l } = fe(), n = Me((u) => u.common.user), { t: r } = $e(), {
298
+ userDetail: w,
299
+ backToList: O,
300
+ confirmData: S,
301
+ file: y,
302
+ setFile: B,
303
+ edited: J,
304
+ setEdited: C,
305
+ setEditedTrue: f,
306
+ confirmChangePassword: Q,
307
+ forgotPasswordRequest: L,
308
+ currentRoles: x,
309
+ handleDisableRoles: M,
310
+ handleResetPassword: X,
311
+ teacherOptions: $,
312
+ openModel: h,
313
+ handleToggleModel: d,
314
+ userHasData: p
315
+ } = Ve(l), q = {
316
+ oldPassword: "",
317
+ newPassword: "",
318
+ confirmedNewPassword: ""
319
+ }, j = r(l ? `${Ke}` : `${Ye}`), k = r(l ? "update" : "create"), z = async () => {
320
+ try {
321
+ const u = await Ue.get("/api/ExportDataUser/" + l, {
322
+ responseType: "blob"
323
+ }), t = u.headers["content-disposition"];
324
+ let a = `${w.firstName || "User"}_${w.lastName || "Data"}.xlsx`;
325
+ if (t) {
326
+ const g = t.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
327
+ g && g[1] && (a = g[1].replace(/['"]/g, ""));
328
+ }
329
+ const o = window.URL.createObjectURL(new Blob([u.data])), i = document.createElement("a");
330
+ i.href = o, i.setAttribute("download", a), document.body.appendChild(i), i.click(), i.remove(), window.URL.revokeObjectURL(o);
331
+ } catch (u) {
332
+ console.error("Failed to download user data", u);
333
+ }
334
+ }, R = async (u) => {
335
+ var t = {
336
+ email: u
337
+ };
338
+ L(t);
339
+ }, Z = () => {
340
+ if (!l) return;
341
+ confirm("You want to reset this user's password") == !0 && X(l);
342
+ };
343
+ return /* @__PURE__ */ e(
344
+ ne,
345
+ {
346
+ initialValues: w,
347
+ enableReinitialize: !0,
348
+ validationSchema: Ge,
349
+ onSubmit: (u) => {
350
+ S({
351
+ ...u,
352
+ roles: u.roles.map(
353
+ (t) => t != A.EDUTEACHER ? t : "EduTeacher"
354
+ )
355
+ }), C(!1), localStorage.getItem(window.location.href) && localStorage.removeItem(window.location.href);
356
+ },
357
+ children: (u) => {
358
+ const {
359
+ values: t,
360
+ touched: a,
361
+ errors: o,
362
+ setFieldValue: i,
363
+ handleChange: g,
364
+ handleBlur: _,
365
+ handleSubmit: ee
366
+ } = u, ae = U(
367
+ (s) => {
368
+ if (t.roles.includes(s)) {
369
+ i(
370
+ "roles",
371
+ t.roles.filter((F) => F !== s)
372
+ );
373
+ return;
374
+ }
375
+ if ([A.STUDENT, A.PARENT].includes(s)) {
376
+ i("roles", [s]);
377
+ return;
378
+ }
379
+ if (t.roles.includes(A.STUDENT) && A.STUDENT != s) {
380
+ i("roles", [s]);
381
+ return;
382
+ }
383
+ i("roles", [...t.roles, s]);
384
+ },
385
+ [t.roles]
386
+ );
387
+ return /* @__PURE__ */ c(
388
+ "div",
389
+ {
390
+ className: `animated fadeIn detail-buttons-padding ${Pe <= 767 ? W["p-0-12"] : ""}`,
391
+ children: [
392
+ /* @__PURE__ */ e(Se, { when: J }),
393
+ /* @__PURE__ */ e("h5", { className: "mb-2", children: j }),
394
+ /* @__PURE__ */ c(b, { className: "pt-2", children: [
395
+ /* @__PURE__ */ c(m, { md: 8, children: [
396
+ /* @__PURE__ */ c(b, { children: [
397
+ /* @__PURE__ */ e(m, { md: 6, children: /* @__PURE__ */ c(T, { children: [
398
+ /* @__PURE__ */ e(
399
+ I,
400
+ {
401
+ text: r("first_name"),
402
+ className: "text-capitalize"
403
+ }
404
+ ),
405
+ /* @__PURE__ */ e(
406
+ P,
407
+ {
408
+ name: "firstName",
409
+ value: t.firstName,
410
+ onChange: (s) => {
411
+ g(s), f();
412
+ },
413
+ onBlur: _("subject"),
414
+ placeholder: r("first_name"),
415
+ className: W["input-name"]
416
+ }
417
+ ),
418
+ a.firstName && o.firstName && /* @__PURE__ */ e(
419
+ H,
420
+ {
421
+ text: o.firstName
422
+ }
423
+ )
424
+ ] }) }),
425
+ /* @__PURE__ */ e(m, { md: 6, children: /* @__PURE__ */ c(T, { children: [
426
+ /* @__PURE__ */ e(re, { children: r("date_of_birth") }),
427
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
428
+ Ee,
429
+ {
430
+ value: t.dateOfBirth,
431
+ todayButton: "Today",
432
+ peekNextMonth: !0,
433
+ showMonthDropdown: !0,
434
+ showYearDropdown: !0,
435
+ dropdownMode: "select",
436
+ selected: t.dateOfBirth ? He(
437
+ new Date(
438
+ t.dateOfBirth
439
+ )
440
+ ) : null,
441
+ onChange: (s) => {
442
+ u.setFieldValue(
443
+ "dateOfBirth",
444
+ me(
445
+ s,
446
+ ce
447
+ )
448
+ ), f();
449
+ },
450
+ placeholderText: r(
451
+ "date_of_birth"
452
+ ),
453
+ customInput: /* @__PURE__ */ e(
454
+ P,
455
+ {
456
+ type: "text",
457
+ style: {
458
+ width: "maxContent"
459
+ },
460
+ placeholder: r(
461
+ "date_of_birth"
462
+ )
463
+ }
464
+ )
465
+ }
466
+ ) })
467
+ ] }) })
468
+ ] }),
469
+ /* @__PURE__ */ c(b, { children: [
470
+ /* @__PURE__ */ e(m, { md: 6, children: /* @__PURE__ */ c(T, { children: [
471
+ /* @__PURE__ */ e(
472
+ I,
473
+ {
474
+ text: r("last_name"),
475
+ className: "text-capitalize"
476
+ }
477
+ ),
478
+ /* @__PURE__ */ e(
479
+ P,
480
+ {
481
+ name: "lastName",
482
+ value: t.lastName,
483
+ onChange: (s) => {
484
+ g(s), f();
485
+ },
486
+ onBlur: _("lastName"),
487
+ placeholder: r("last_name"),
488
+ className: W["input-name"]
489
+ }
490
+ ),
491
+ a.lastName && o.lastName && /* @__PURE__ */ e(
492
+ H,
493
+ {
494
+ text: o.lastName
495
+ }
496
+ )
497
+ ] }) }),
498
+ /* @__PURE__ */ e(m, { md: 6, children: /* @__PURE__ */ c(T, { children: [
499
+ /* @__PURE__ */ e(I, { text: r("roles") }),
500
+ /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(
501
+ m,
502
+ {
503
+ md: 12,
504
+ className: "d-flex flex-wrap align-items-center",
505
+ children: Te.map(
506
+ (s) => /* @__PURE__ */ e(
507
+ "div",
508
+ {
509
+ className: "mr-3",
510
+ children: /* @__PURE__ */ e(
511
+ P,
512
+ {
513
+ type: "checkbox",
514
+ id: `role-checkbox-${s}`,
515
+ label: s === "SecondaryTeacher" ? "SupportTeacher" : `${s}`,
516
+ checked: t.roles.includes(
517
+ s
518
+ ),
519
+ onChange: () => {
520
+ l && (p.isHasTeacherData && s === "Teacher" || p.isHasAssistantData && s === "Assistant" || p.isHasCounselorData && s === "Counselor" || p.isHasSecondaryTeacherData && s === "SecondaryTeacher" || s == "Student" && (p.isHasAssistantData || p.isHasCounselorData || p.isHasSecondaryTeacherData || p.isHasTeacherData)) ? alert(
521
+ "Please switch data before removing the role"
522
+ ) : (ae(
523
+ s
524
+ ), f());
525
+ },
526
+ disabled: x.includes(
527
+ "Parent"
528
+ ) || x.includes(
529
+ "Student"
530
+ ) && l ? x.concat(
531
+ [
532
+ "Student",
533
+ "Parent"
534
+ ]
535
+ ).includes(
536
+ s
537
+ ) || x.every(
538
+ M
539
+ ) : [
540
+ "Parent"
541
+ ].includes(
542
+ s
543
+ )
544
+ }
545
+ )
546
+ },
547
+ s
548
+ )
549
+ )
550
+ }
551
+ ) }),
552
+ a.roles && o.roles && /* @__PURE__ */ e(
553
+ H,
554
+ {
555
+ text: o.roles
556
+ }
557
+ )
558
+ ] }) })
559
+ ] }),
560
+ /* @__PURE__ */ c(b, { children: [
561
+ /* @__PURE__ */ e(m, { md: 6, children: /* @__PURE__ */ c(T, { children: [
562
+ /* @__PURE__ */ e(I, { text: r("email") }),
563
+ /* @__PURE__ */ e(
564
+ P,
565
+ {
566
+ name: "email",
567
+ value: t.email,
568
+ onChange: (s) => {
569
+ g(s), f();
570
+ },
571
+ onBlur: _("email"),
572
+ placeholder: r("email")
573
+ }
574
+ ),
575
+ a.email && o.email && /* @__PURE__ */ e(
576
+ H,
577
+ {
578
+ text: o.email
579
+ }
580
+ )
581
+ ] }) }),
582
+ /* @__PURE__ */ e(m, { md: 6, children: /* @__PURE__ */ c(T, { children: [
583
+ /* @__PURE__ */ e(I, { text: r("status") }),
584
+ /* @__PURE__ */ c(b, { children: [
585
+ /* @__PURE__ */ e(m, { md: 3, children: /* @__PURE__ */ e(
586
+ P,
587
+ {
588
+ id: "role-checkbox-active",
589
+ type: "radio",
590
+ name: "active",
591
+ label: r("active"),
592
+ checked: !!t && !!t.isActive,
593
+ onChange: () => {
594
+ i(
595
+ "isActive",
596
+ !0
597
+ ), f();
598
+ }
599
+ }
600
+ ) }),
601
+ /* @__PURE__ */ e(m, { md: 3, children: /* @__PURE__ */ e(
602
+ P,
603
+ {
604
+ id: "role-checkbox-inActive",
605
+ type: "radio",
606
+ name: "active",
607
+ label: r("inactive"),
608
+ checked: !!t && !t.isActive,
609
+ onChange: () => i(
610
+ "isActive",
611
+ !1
612
+ )
613
+ }
614
+ ) })
615
+ ] })
616
+ ] }) })
617
+ ] }),
618
+ t.roles.includes(A.STUDENT) && /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(m, { md: 6, children: /* @__PURE__ */ c(T, { children: [
619
+ /* @__PURE__ */ e(re, { children: "Grade Level" }),
620
+ /* @__PURE__ */ e(
621
+ de,
622
+ {
623
+ options: le,
624
+ value: le.find(
625
+ (s) => s.value == t.gradeLevel
626
+ ),
627
+ placeholder: "Grade Level",
628
+ onChange: (s) => {
629
+ i(
630
+ "gradeLevel",
631
+ s.value
632
+ );
633
+ }
634
+ }
635
+ )
636
+ ] }) }) }),
637
+ !!l && /* @__PURE__ */ c(b, { children: [
638
+ /* @__PURE__ */ e(m, { md: 6, children: (!t.roles.includes("Admin") || t.roles.length > 1) && !!t.roles.length && /* @__PURE__ */ c(T, { children: [
639
+ /* @__PURE__ */ e(re, { children: "Map from Roster" }),
640
+ /* @__PURE__ */ e(
641
+ Xe,
642
+ {
643
+ roles: t.roles,
644
+ value: t.sourcedId,
645
+ onChange: (s) => i(
646
+ "sourcedId",
647
+ s.value
648
+ )
649
+ }
650
+ )
651
+ ] }) }),
652
+ /* @__PURE__ */ c(m, { md: 6, children: [
653
+ /* @__PURE__ */ e(
654
+ G,
655
+ {
656
+ color: "primary",
657
+ className: "w-100",
658
+ onClick: () => {
659
+ R(
660
+ t.email || ""
661
+ );
662
+ },
663
+ children: r("send_forgot_password_link")
664
+ }
665
+ ),
666
+ /* @__PURE__ */ e(
667
+ G,
668
+ {
669
+ color: "primary",
670
+ className: "w-100 mt-3",
671
+ onClick: () => Z(),
672
+ children: r("reset_password")
673
+ }
674
+ ),
675
+ /* @__PURE__ */ e(
676
+ G,
677
+ {
678
+ color: "success",
679
+ className: "w-100 mt-3",
680
+ onClick: () => {
681
+ z();
682
+ },
683
+ children: r("download_user_data")
684
+ }
685
+ )
686
+ ] })
687
+ ] })
688
+ ] }),
689
+ /* @__PURE__ */ e(m, { md: 4, children: /* @__PURE__ */ e(b, { children: /* @__PURE__ */ c(m, { md: 8, children: [
690
+ /* @__PURE__ */ e(
691
+ ve,
692
+ {
693
+ setFile: B,
694
+ fileName: t.profileImageFileName,
695
+ onAddImage: f,
696
+ canDelete: !0,
697
+ onDelete: () => {
698
+ B(null), i(
699
+ "profileImageFileName",
700
+ ""
701
+ ), f();
702
+ }
703
+ }
704
+ ),
705
+ !y && !t.profileImageFileName && /* @__PURE__ */ e(
706
+ "img",
707
+ {
708
+ src: Ce,
709
+ style: { maxWidth: "100%" }
710
+ }
711
+ )
712
+ ] }) }) })
713
+ ] }),
714
+ n.id === l ? /* @__PURE__ */ c("div", { children: [
715
+ /* @__PURE__ */ e("h5", { className: "mt-3", children: r(`${Ze}`) }),
716
+ /* @__PURE__ */ e(
717
+ ne,
718
+ {
719
+ initialValues: q,
720
+ enableReinitialize: !0,
721
+ validationSchema: We,
722
+ onSubmit: (s) => {
723
+ Q(s);
724
+ },
725
+ children: (s) => {
726
+ const {
727
+ values: F,
728
+ touched: se,
729
+ errors: V,
730
+ handleChange: te,
731
+ handleSubmit: he
732
+ } = s;
733
+ return /* @__PURE__ */ c(b, { className: "pt-2 pb-5", children: [
734
+ /* @__PURE__ */ e(m, { md: 7, children: /* @__PURE__ */ c(T, { children: [
735
+ /* @__PURE__ */ e(
736
+ I,
737
+ {
738
+ text: r(
739
+ "current_password"
740
+ ),
741
+ className: "text-capitalize"
742
+ }
743
+ ),
744
+ /* @__PURE__ */ e(
745
+ P,
746
+ {
747
+ name: "oldPassword",
748
+ type: "password",
749
+ value: F.oldPassword,
750
+ onChange: (Y) => {
751
+ te(Y), f();
752
+ },
753
+ onBlur: _(
754
+ "subject"
755
+ ),
756
+ placeholder: r(
757
+ "current_password"
758
+ ),
759
+ className: W["input-name"]
760
+ }
761
+ ),
762
+ se.oldPassword && V.oldPassword && /* @__PURE__ */ e(
763
+ H,
764
+ {
765
+ text: V.oldPassword
766
+ }
767
+ )
768
+ ] }) }),
769
+ /* @__PURE__ */ e(m, { md: 7, children: /* @__PURE__ */ c(T, { children: [
770
+ /* @__PURE__ */ e(
771
+ I,
772
+ {
773
+ text: r(
774
+ "new_password"
775
+ ),
776
+ className: "text-capitalize"
777
+ }
778
+ ),
779
+ /* @__PURE__ */ e(
780
+ P,
781
+ {
782
+ name: "newPassword",
783
+ type: "password",
784
+ value: F.newPassword,
785
+ onChange: (Y) => {
786
+ te(Y), f();
787
+ },
788
+ onBlur: _(
789
+ "subject"
790
+ ),
791
+ placeholder: r(
792
+ "new_password"
793
+ ),
794
+ className: W["input-name"]
795
+ }
796
+ ),
797
+ se.newPassword && V.newPassword && /* @__PURE__ */ e(
798
+ H,
799
+ {
800
+ text: V.newPassword
801
+ }
802
+ )
803
+ ] }) }),
804
+ /* @__PURE__ */ e(m, { md: 7, children: /* @__PURE__ */ c(T, { children: [
805
+ /* @__PURE__ */ e(
806
+ I,
807
+ {
808
+ text: r(
809
+ "confirm_password"
810
+ ),
811
+ className: "text-capitalize"
812
+ }
813
+ ),
814
+ /* @__PURE__ */ e(
815
+ P,
816
+ {
817
+ name: "confirmedNewPassword",
818
+ type: "password",
819
+ value: F.confirmedNewPassword,
820
+ onChange: (Y) => {
821
+ te(Y), f();
822
+ },
823
+ onBlur: _(
824
+ "subject"
825
+ ),
826
+ placeholder: r(
827
+ "confirm_password"
828
+ ),
829
+ className: W["input-name"]
830
+ }
831
+ ),
832
+ se.confirmedNewPassword && V.confirmedNewPassword && /* @__PURE__ */ e(
833
+ H,
834
+ {
835
+ text: V.confirmedNewPassword
836
+ }
837
+ )
838
+ ] }) }),
839
+ /* @__PURE__ */ e(m, { md: 12, children: /* @__PURE__ */ e(
840
+ G,
841
+ {
842
+ color: "primary",
843
+ size: "sm",
844
+ className: "px-4 pl-1 mr-2 ml-3",
845
+ onClick: () => he(),
846
+ children: r("save")
847
+ }
848
+ ) })
849
+ ] });
850
+ }
851
+ }
852
+ )
853
+ ] }) : null,
854
+ /* @__PURE__ */ e(
855
+ be,
856
+ {
857
+ confirmText: k,
858
+ onConfirm: t.roles.includes(A.STUDENT) && !l ? d : ee,
859
+ onCancel: O
860
+ }
861
+ ),
862
+ /* @__PURE__ */ c(
863
+ ge,
864
+ {
865
+ centered: !0,
866
+ isOpen: h,
867
+ toggle: () => d(),
868
+ children: [
869
+ /* @__PURE__ */ e(we, { children: "Assign Teacher" }),
870
+ /* @__PURE__ */ e(ye, { children: /* @__PURE__ */ e(
871
+ qe,
872
+ {
873
+ isMulti: !0,
874
+ value: $.filter(
875
+ (s) => t.teacherUserId?.includes(
876
+ s.value
877
+ )
878
+ ) || null,
879
+ options: $,
880
+ onChange: (s) => i(
881
+ "teacherUserId",
882
+ s.map((F) => F.value)
883
+ ),
884
+ placeholder: r("select_teacher"),
885
+ className: "flex-grow-1 mb-3"
886
+ }
887
+ ) }),
888
+ /* @__PURE__ */ c(Ne, { className: "text-right", children: [
889
+ /* @__PURE__ */ e(G, { onClick: () => d(), children: "Cancel" }),
890
+ /* @__PURE__ */ e(
891
+ G,
892
+ {
893
+ disabled: !t.teacherUserId,
894
+ color: "primary",
895
+ onClick: () => {
896
+ ee();
897
+ },
898
+ children: "Assign"
899
+ }
900
+ )
901
+ ] })
902
+ ]
903
+ }
904
+ )
905
+ ]
906
+ }
907
+ );
908
+ }
909
+ }
910
+ );
911
+ };
912
+ export {
913
+ ua as default
914
+ };