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