mario-education 2.1.17-staging → 2.1.19-staging

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.
@@ -0,0 +1,1166 @@
1
+ import { jsx as s, jsxs as l } from "react/jsx-runtime";
2
+ import { Input as Ge, Label as je } from "reactstrap";
3
+ import { setAlert as F, useTranslation as Ie, useGradeLabel as ze, setLoading as q, DATE_FORMAT as Ye, getFileUrl as Je, getStaticFileUrl as W } from "mario-core";
4
+ import { i as ge, e as He } from "./constants-BhIsKVVC.js";
5
+ import { useState as k, useCallback as J, useEffect as ne, useRef as Ke, useMemo as We } from "react";
6
+ import { useDispatch as Fe, useSelector as Ue } from "react-redux";
7
+ import { Formik as Oe } from "formik";
8
+ import * as E from "yup";
9
+ import { Select as fe, MenuItem as Z, CircularProgress as Xe, TextField as ye, ToggleButtonGroup as Ze, ToggleButton as pe, Radio as Qe, Checkbox as es, ListItemText as ss } from "@mui/material";
10
+ import { LocalizationProvider as rs, DatePicker as os } from "@mui/x-date-pickers";
11
+ import as from "moment";
12
+ import { V as Re, g as ke, b as ns, d as ts, e as is, f as ls, h as cs, i as Le, s as ds, j as ps } from "./VisibilityOff-B2VnkAn4.js";
13
+ import { D as Be } from "./constants-sFhSqXv_.js";
14
+ import { D as qe } from "./DoneCheckInIcon-3Yg4kjqY.js";
15
+ import { g as us, a as ms } from "./userService-C7yjwsZq.js";
16
+ import { s as fs } from "./styles.module-BJ4dhumc.js";
17
+ import { A as hs } from "./AdapterMoment-CeMS9jLD.js";
18
+ import { V as Ne } from "./Visibility-Bz5s572I.js";
19
+ import { F as be, O as Ee, I as De } from "./FormControl-rxsIlAoZ.js";
20
+ import { I as Ce } from "./IconButton-Bomem_7D.js";
21
+ import { useNavigate as gs, useParams as _s } from "react-router-dom";
22
+ import { format as vs } from "date-fns";
23
+ const Ss = "_name_1koi9_205", ws = "_role_1koi9_217", Ts = "_item_1koi9_230", ys = "_gender_1koi9_323", Rs = "_gender__item_1koi9_328", o = {
24
+ "profile-value": "_profile-value_1koi9_77",
25
+ "input-error": "_input-error_1koi9_94",
26
+ "user-profile-container-admin": "_user-profile-container-admin_1koi9_122",
27
+ "user-profile-container-admin__left": "_user-profile-container-admin__left_1koi9_135",
28
+ "user-profile-container-admin__left--information": "_user-profile-container-admin__left--information_1koi9_146",
29
+ "image-user-container": "_image-user-container_1koi9_154",
30
+ "image-user-container__image": "_image-user-container__image_1koi9_169",
31
+ "image-user-container__edit-btn": "_image-user-container__edit-btn_1koi9_176",
32
+ "image-user-container__delete-btn": "_image-user-container__delete-btn_1koi9_190",
33
+ "name-role-container": "_name-role-container_1koi9_205",
34
+ name: Ss,
35
+ role: ws,
36
+ "user-profile-container-admin__left--btn-control": "_user-profile-container-admin__left--btn-control_1koi9_224",
37
+ item: Ts,
38
+ "item-active": "_item-active_1koi9_246",
39
+ "user-profile-container-admin__right": "_user-profile-container-admin__right_1koi9_274",
40
+ "edit-profile-container": "_edit-profile-container_1koi9_285",
41
+ "edit-profile-container__title": "_edit-profile-container__title_1koi9_290",
42
+ "edit-profile-container__form": "_edit-profile-container__form_1koi9_297",
43
+ "edit-profile-container__form--row": "_edit-profile-container__form--row_1koi9_302",
44
+ "edit-profile-container__form--field": "_edit-profile-container__form--field_1koi9_307",
45
+ gender: ys,
46
+ gender__item: Rs,
47
+ "edit-profile-container__form--width-50": "_edit-profile-container__form--width-50_1koi9_334",
48
+ "edit-profile-container__form--width-30": "_edit-profile-container__form--width-30_1koi9_337",
49
+ "edit-profile-container__form--width-70": "_edit-profile-container__form--width-70_1koi9_340",
50
+ "edit-profile-container__form--btn-group": "_edit-profile-container__form--btn-group_1koi9_343",
51
+ "btn-save": "_btn-save_1koi9_349",
52
+ "btn-cancel": "_btn-cancel_1koi9_371"
53
+ };
54
+ var X = /* @__PURE__ */ ((a) => (a.Info = "info", a.ForgotPassword = "forgotPassword", a.DownloadUserData = "downloadUserData", a.ChangePassword = "changePassword", a))(X || {});
55
+ const ue = [
56
+ {
57
+ value: "info",
58
+ label: "Personal Information",
59
+ icon: "/images/user/User.svg",
60
+ isControl: !0
61
+ },
62
+ {
63
+ value: "changePassword",
64
+ label: "Change Password",
65
+ icon: "/images/user/Lock.svg",
66
+ isControl: !1
67
+ },
68
+ {
69
+ value: "forgotPassword",
70
+ label: "Send Forgot Password Link",
71
+ icon: "/images/user/Lock.svg",
72
+ isControl: !1
73
+ },
74
+ {
75
+ value: "downloadUserData",
76
+ label: "Download User Data",
77
+ icon: "/images/user/Log-out.svg",
78
+ isControl: !1
79
+ }
80
+ ], Ae = ["Admin", "Assistant", "Teacher", "Counselor", "General ED teacher", "SecondaryTeacher", "Parent", "Student"], Ns = Ae, bs = Ae, Es = Ae.filter((a) => a !== "SecondaryTeacher"), Ds = (a) => a === "both" ? ["MS", "ES", "HS"] : [a.toUpperCase()], Cs = (a) => a === "both" ? "ES, MS, HS" : a.toUpperCase(), he = (a, t, _) => {
81
+ if (_) {
82
+ if (G.includes(_)) return "hs";
83
+ if (V.includes(_)) return "ms";
84
+ if (x.includes(_)) return "es";
85
+ }
86
+ const w = (a || "").toUpperCase();
87
+ if (w === "ES, MS" || w === "ES, MS, HS" || w.includes(",")) return "both";
88
+ if (w === "ES") return "es";
89
+ if (w === "HS") return "hs";
90
+ if (w === "MS") return "ms";
91
+ const h = (t || []).includes("MS"), u = (t || []).includes("ES"), R = (t || []).includes("HS");
92
+ return R && !h && !u ? "hs" : (h || R) && u ? "both" : u && !h ? "es" : "ms";
93
+ }, f = {
94
+ ADMIN: "Admin",
95
+ TEACHER: "Teacher",
96
+ ASSISTANT: "Assistant",
97
+ EDUTEACHER: "General ED teacher",
98
+ STUDENT: "Student",
99
+ PARENT: "Parent"
100
+ }, Us = [
101
+ {
102
+ value: !0,
103
+ label: "Active"
104
+ },
105
+ {
106
+ value: !1,
107
+ label: "Inactive"
108
+ }
109
+ ], me = [
110
+ "K",
111
+ "1",
112
+ "2",
113
+ "3",
114
+ "4",
115
+ "5",
116
+ "6",
117
+ "7",
118
+ "8",
119
+ "9",
120
+ "10",
121
+ "11",
122
+ "12",
123
+ ...ge ? ["12/13"] : [],
124
+ ...He ? ["PCS"] : []
125
+ ], x = ["K", "1", "2", "3", "4", "5", ...ge ? ["6"] : []], V = [...ge ? [] : ["6"], "7", "8"], G = ["9", "10", "11", "12", ...ge ? ["12/13"] : [], ...He ? ["PCS"] : []], Me = ["Student"], As = E.object({
126
+ firstName: E.string().required("First name is required"),
127
+ lastName: E.string().required("Last name is required"),
128
+ email: E.string().email("Email is invalid").required("Email is required"),
129
+ appTypes: E.array().of(E.string()).min(1, "School tier is required"),
130
+ msRoles: E.array().of(E.string()).test(
131
+ "ms-role-required",
132
+ "Role is required",
133
+ (a, t) => {
134
+ const _ = he(t.parent.preferredAppType, t.parent.appTypes, t.parent.gradeLevel);
135
+ return _ === "ms" ? !!a && a.length > 0 : _ === "both" ? (a?.length || 0) + (t.parent.hsRoles?.length || 0) + (t.parent.esRoles?.length || 0) > 0 : !0;
136
+ }
137
+ ),
138
+ hsRoles: E.array().of(E.string()).test(
139
+ "hs-role-required",
140
+ "HS role is required",
141
+ (a, t) => he(t.parent.preferredAppType, t.parent.appTypes, t.parent.gradeLevel) === "hs" ? !!a && a.length > 0 : !0
142
+ ),
143
+ esRoles: E.array().of(E.string()).test(
144
+ "es-role-required",
145
+ "ES role is required",
146
+ (a, t) => he(t.parent.preferredAppType, t.parent.appTypes, t.parent.gradeLevel) === "es" ? !!a && a.length > 0 : !0
147
+ ),
148
+ gradeLevel: E.string().nullable().test(
149
+ "grade-level-required",
150
+ "Grade level is required",
151
+ (a, t) => {
152
+ const _ = t.parent.msRoles || [], w = t.parent.esRoles || [], h = t.parent.hsRoles || [];
153
+ return _.includes("Student") || w.includes("Student") || h.includes("Student") ? !!a : !0;
154
+ }
155
+ )
156
+ }), Ps = {
157
+ currentPage: 1,
158
+ pageSize: 100
159
+ }, ks = (a, t) => {
160
+ const [_, w] = k([]), [h, u] = k(!1), [R, T] = k(Ps), [$, N] = k(), g = Fe(), O = J(async () => {
161
+ u(!0);
162
+ try {
163
+ const r = (await us(R)).data?.items || [];
164
+ w(L(r));
165
+ } catch {
166
+ g(F({
167
+ type: "error",
168
+ message: "Cannot get roster users"
169
+ }));
170
+ }
171
+ u(!1);
172
+ }, [JSON.stringify(R)]), Q = J(async () => {
173
+ if (!t) return;
174
+ const i = _.find((r) => r.value === t);
175
+ if (i) {
176
+ N(i);
177
+ return;
178
+ }
179
+ u(!0);
180
+ try {
181
+ const H = (await ms(t)).data;
182
+ N({
183
+ label: B(H),
184
+ value: H.sourcedId
185
+ });
186
+ } catch (r) {
187
+ console.log("err:", r);
188
+ }
189
+ u(!1);
190
+ }, [t]), L = (i) => i.map((r) => ({
191
+ label: B(r),
192
+ value: r.sourcedId
193
+ })), B = (i) => {
194
+ const r = [], { givenName: H, middleName: y, familyName: b, email: A, role: D } = i, v = [];
195
+ return H && v.push(H), y && v.push(y), b && v.push(b), v.length && r.push(v.join(" ")), A && r.push(A), `${r.join(" - ")}${D ? ` (${D})` : ""}`;
196
+ }, j = (i) => {
197
+ T((r) => ({ ...r, searchString: i }));
198
+ }, I = J((i) => {
199
+ T({
200
+ ...R,
201
+ ...i
202
+ });
203
+ }, [JSON.stringify(R)]);
204
+ return ne(() => {
205
+ R.roles?.length && O();
206
+ }, [JSON.stringify(R)]), ne(() => {
207
+ I({
208
+ roles: a
209
+ });
210
+ }, [JSON.stringify(a)]), ne(() => {
211
+ Q();
212
+ }, [t]), {
213
+ users: _,
214
+ isLoading: h,
215
+ user: $,
216
+ handleInputChange: j
217
+ };
218
+ }, Ls = ({ value: a, roles: t, onChange: _ }) => {
219
+ const {
220
+ users: w,
221
+ isLoading: h,
222
+ user: u,
223
+ handleInputChange: R
224
+ } = ks(t, a);
225
+ return /* @__PURE__ */ s(
226
+ fe,
227
+ {
228
+ label: "Select user",
229
+ value: u?.value || "",
230
+ onChange: (T) => {
231
+ _(T.target.value);
232
+ },
233
+ onOpen: () => R(""),
234
+ disabled: h,
235
+ className: `${fs["profile-value"]}`,
236
+ variant: "outlined",
237
+ children: h ? /* @__PURE__ */ s(Z, { disabled: !0, children: /* @__PURE__ */ s(Xe, { size: 20 }) }) : w.length > 0 ? w.map((T) => /* @__PURE__ */ s(Z, { value: T.value, children: `${T.label}` }, T.value)) : /* @__PURE__ */ s(Z, { disabled: !0, children: "No users found" })
238
+ }
239
+ );
240
+ }, Ms = ({
241
+ userDetail: a,
242
+ confirmData: t,
243
+ goBack: _,
244
+ teacherOptions: w,
245
+ getDataTeachers: h,
246
+ id: u,
247
+ checkHasTeacher: R,
248
+ setCheckHasTeacher: T,
249
+ userHasData: $,
250
+ currentRoles: N
251
+ }) => {
252
+ const { t: g } = Ie(), O = Ke(null), L = Ue((I) => I.common.user)?.hasEsSchool !== !1, { getLabel: B, system: j } = ze();
253
+ return /* @__PURE__ */ l("div", { className: o["edit-profile-container"], children: [
254
+ /* @__PURE__ */ s("div", { className: o["edit-profile-container__title"], children: `${u ? "Edit User Profile" : "Create User"}` }),
255
+ /* @__PURE__ */ s(
256
+ Oe,
257
+ {
258
+ initialValues: a,
259
+ enableReinitialize: !0,
260
+ onSubmit: (I) => {
261
+ t(I);
262
+ },
263
+ validationSchema: As,
264
+ children: (I) => {
265
+ const { values: i, setFieldValue: r, handleSubmit: H, errors: y, touched: b } = I, A = Object.keys(y);
266
+ A.length && document.querySelector(`input[name=${A[0]}]`)?.scrollIntoView({
267
+ behavior: "smooth",
268
+ block: "center"
269
+ });
270
+ const D = i?.appTypes || [], v = D.includes("MS"), _e = D.includes("ES"), ee = D.includes("HS"), se = i?.msRoles || [], K = i?.esRoles || [], te = i?.hsRoles || [], U = se.includes(f.STUDENT) || K.includes(f.STUDENT) || te.includes(f.STUDENT), re = U && (i?.preferredAppType === "HS" || i?.preferredAppType === "MS") ? i.preferredAppType.toLowerCase() : he(i?.preferredAppType, D, i?.gradeLevel), M = !L && re === "es" ? "ms" : re, ie = M === "ms" || M === "both", ve = M === "hs" || M === "both", oe = L && (M === "es" || M === "both"), le = U ? M === "es" ? me.filter((n) => x.includes(n)) : M === "hs" ? me.filter((n) => G.includes(n)) : me.filter((n) => V.includes(n)) : me, Se = (n) => {
271
+ const m = n.target.value;
272
+ r("gradeLevel", m), U && (G.includes(m) ? (r("preferredAppType", "HS"), r("hsRoles", [f.STUDENT]), r("msRoles", []), r("esRoles", []), u || r("appTypes", ["HS"])) : V.includes(m) ? (r("preferredAppType", "MS"), r("msRoles", [f.STUDENT]), r("hsRoles", []), r("esRoles", []), u || r("appTypes", ["MS"])) : x.includes(m) && (r("preferredAppType", "ES"), r("esRoles", [f.STUDENT]), r("msRoles", []), r("hsRoles", []), u || r("appTypes", ["ES"])));
273
+ }, ce = (n, m) => {
274
+ if (!m) return;
275
+ const e = Ds(m).filter((p) => L || p !== "ES"), c = L ? Cs(m) : e.join(", "), S = (p) => {
276
+ const d = a?.gradeLevel;
277
+ return p === "hs" ? d && G.includes(d) ? d : G[0] : p === "ms" ? d && V.includes(d) ? d : V[0] ?? "6" : p === "es" ? d && x.includes(d) ? d : x[0] : i?.gradeLevel;
278
+ };
279
+ if (!u)
280
+ r("appTypes", e), r("preferredAppType", c), U && (m === "es" ? (r("esRoles", [f.STUDENT]), r("msRoles", []), r("hsRoles", [])) : m === "hs" ? (r("hsRoles", [f.STUDENT]), r("msRoles", []), r("esRoles", [])) : m === "ms" && (r("msRoles", [f.STUDENT]), r("hsRoles", []), r("esRoles", [])), h(m === "es" ? "ES" : "MS"), m === "hs" && i?.gradeLevel && G.includes(i.gradeLevel) || m === "ms" && i?.gradeLevel && V.includes(i.gradeLevel) || m === "es" && i?.gradeLevel && x.includes(i.gradeLevel) || r("gradeLevel", S(m)));
281
+ else {
282
+ const p = Array.from(/* @__PURE__ */ new Set([...i?.appTypes || [], ...e]));
283
+ r("appTypes", p), r("preferredAppType", c), U && (m === "es" ? (r("esRoles", [f.STUDENT]), r("msRoles", []), r("hsRoles", [])) : m === "hs" ? (r("hsRoles", [f.STUDENT]), r("msRoles", []), r("esRoles", [])) : m === "ms" && (r("msRoles", [f.STUDENT]), r("hsRoles", []), r("esRoles", [])), m === "hs" && i?.gradeLevel && G.includes(i.gradeLevel) || m === "ms" && i?.gradeLevel && V.includes(i.gradeLevel) || m === "es" && i?.gradeLevel && x.includes(i.gradeLevel) || r("gradeLevel", S(m)));
284
+ }
285
+ }, de = N?.MS?.includes(f.STUDENT) || N?.ES?.includes(f.STUDENT) || N?.HS?.includes(f.STUDENT), we = (n) => (m) => {
286
+ const e = m.target.value, c = n === "MS" ? "msRoles" : n === "ES" ? "esRoles" : "hsRoles", S = n === "MS" ? ["esRoles", "hsRoles"] : n === "ES" ? ["msRoles", "hsRoles"] : ["msRoles", "esRoles"], p = O.current, d = $?.[n] ?? {};
287
+ if (u && (d.isHasTeacherData && p === "Teacher" || d.isHasAssistantData && p === "Assistant" || d.isHasCounselorData && p === "Counselor" || d.isHasSecondaryTeacherData && p === "SecondaryTeacher" || p === "Student" && (d.isHasAssistantData || d.isHasCounselorData || d.isHasSecondaryTeacherData || d.isHasTeacherData))) {
288
+ alert("Please switch data before removing the role");
289
+ return;
290
+ }
291
+ if (de && !e.includes(f.STUDENT)) {
292
+ alert("Student account cannot be changed to another role");
293
+ return;
294
+ }
295
+ const P = i?.[c] || [], Te = e.some((Y) => Me.includes(Y)) ? p && !P.includes(p) ? [p] : [e.find((Y) => Me.includes(Y))].filter(Boolean) : e, xe = P.includes(f.STUDENT), Pe = Te.includes(f.STUDENT);
296
+ if (r(c, Te), O.current = null, Pe) {
297
+ const Y = n;
298
+ r("preferredAppType", Y), S.forEach((Ve) => r(Ve, [])), u || (r("appTypes", [Y]), h(n === "ES" ? "ES" : "MS"));
299
+ } else xe && !Pe && S.forEach((Y) => r(Y, []));
300
+ }, ae = (n) => {
301
+ const m = n === "MS" ? "msRoles" : n === "ES" ? "esRoles" : "hsRoles", e = n === "MS" ? se : n === "ES" ? K : i?.hsRoles || [], c = n === "MS" ? Ns : n === "ES" ? Es : bs, S = N?.[n] || [];
302
+ return /* @__PURE__ */ l("div", { className: `${o["edit-profile-container__form--field"]} ${ie && oe ? o["edit-profile-container__form--width-50"] : ""}`, children: [
303
+ /* @__PURE__ */ l("p", { children: [
304
+ L && /* @__PURE__ */ s("span", { style: {
305
+ display: "inline-block",
306
+ fontSize: 11,
307
+ fontWeight: 700,
308
+ color: "#3b4ba8",
309
+ backgroundColor: "#e9ecfb",
310
+ borderRadius: 4,
311
+ padding: "1px 6px",
312
+ marginRight: 6,
313
+ verticalAlign: "middle"
314
+ }, children: n }),
315
+ L ? n === "HS" ? "High school roles" : n === "MS" ? "Middle school roles" : "Elementary school roles" : n === "HS" ? "High school roles" : n === "MS" ? "Middle school roles" : "Roles",
316
+ " ",
317
+ M !== "both" ? /* @__PURE__ */ s("sup", { children: "*" }) : null
318
+ ] }),
319
+ /* @__PURE__ */ s(
320
+ fe,
321
+ {
322
+ variant: "outlined",
323
+ multiple: !0,
324
+ name: m,
325
+ value: e,
326
+ renderValue: (p) => p.map((d) => d === "SecondaryTeacher" ? "Support Teacher" : d).join(", "),
327
+ onChange: we(n),
328
+ className: `${o["profile-value"]}`,
329
+ children: c.map((p) => {
330
+ const d = u ? de ? p !== f.STUDENT : p === f.STUDENT || ["Parent"].includes(p) || S.some((P) => ["Student", "Parent", "General ED teacher"].includes(P)) : ["Parent"].includes(p) || U && p !== f.STUDENT;
331
+ return /* @__PURE__ */ l(
332
+ Z,
333
+ {
334
+ value: p,
335
+ disabled: d,
336
+ onClick: () => {
337
+ O.current = p;
338
+ },
339
+ children: [
340
+ /* @__PURE__ */ s(es, { checked: e.includes(p) }),
341
+ /* @__PURE__ */ s(ss, { primary: p === "SecondaryTeacher" ? "Support Teacher" : p })
342
+ ]
343
+ },
344
+ p
345
+ );
346
+ })
347
+ }
348
+ ),
349
+ y[m] && b[m] ? /* @__PURE__ */ s("div", { className: `${o["input-error"]}`, children: y[m] }) : null
350
+ ] });
351
+ };
352
+ return /* @__PURE__ */ l("div", { className: o["edit-profile-container__form"], children: [
353
+ /* @__PURE__ */ l("div", { className: o["edit-profile-container__form--row"], children: [
354
+ /* @__PURE__ */ l("div", { className: `${o["edit-profile-container__form--field"]} ${o["edit-profile-container__form--width-50"]}`, children: [
355
+ /* @__PURE__ */ l("p", { children: [
356
+ g("first_name"),
357
+ " ",
358
+ /* @__PURE__ */ s("sup", { children: "*" })
359
+ ] }),
360
+ /* @__PURE__ */ s(
361
+ ye,
362
+ {
363
+ name: "firstName",
364
+ variant: "outlined",
365
+ value: i?.firstName || "",
366
+ onChange: (n) => r("firstName", n.target.value)
367
+ }
368
+ ),
369
+ y.firstName && b.firstName ? /* @__PURE__ */ s("div", { className: `${o["input-error"]}`, children: y.firstName }) : null
370
+ ] }),
371
+ /* @__PURE__ */ l("div", { className: `${o["edit-profile-container__form--field"]} ${o["edit-profile-container__form--width-50"]}`, children: [
372
+ /* @__PURE__ */ l("p", { children: [
373
+ g("last_name"),
374
+ " ",
375
+ /* @__PURE__ */ s("sup", { children: "*" })
376
+ ] }),
377
+ /* @__PURE__ */ s(
378
+ ye,
379
+ {
380
+ name: "lastName",
381
+ variant: "outlined",
382
+ className: `${o["profile-value"]}`,
383
+ value: i?.lastName || "",
384
+ onChange: (n) => r("lastName", n.target.value)
385
+ }
386
+ ),
387
+ y.lastName && b.lastName ? /* @__PURE__ */ s("div", { className: `${o["input-error"]}`, children: y.lastName }) : null
388
+ ] })
389
+ ] }),
390
+ /* @__PURE__ */ l("div", { className: o["edit-profile-container__form--row"], children: [
391
+ /* @__PURE__ */ l("div", { className: `${o["edit-profile-container__form--field"]} ${o["edit-profile-container__form--width-30"]}`, children: [
392
+ /* @__PURE__ */ l("p", { children: [
393
+ " ",
394
+ g("date_of_birth")
395
+ ] }),
396
+ /* @__PURE__ */ s(rs, { dateAdapter: hs, children: /* @__PURE__ */ s(
397
+ os,
398
+ {
399
+ format: "Do MMM YYYY",
400
+ value: i?.dateOfBirth && !Be.includes(i?.dateOfBirth) ? as(i?.dateOfBirth) : null,
401
+ onChange: (n) => {
402
+ if (n) {
403
+ const m = n.format("YYYY-MM-DD");
404
+ r("dateOfBirth", m);
405
+ } else
406
+ r("dateOfBirth", null);
407
+ },
408
+ slotProps: {
409
+ textField: {
410
+ variant: "outlined",
411
+ id: "time-picker",
412
+ className: `${o["profile-value"]}`
413
+ },
414
+ openPickerButton: {
415
+ "aria-label": "change date"
416
+ }
417
+ }
418
+ }
419
+ ) })
420
+ ] }),
421
+ /* @__PURE__ */ l("div", { className: `${o["edit-profile-container__form--field"]} ${o["edit-profile-container__form--width-70"]}`, children: [
422
+ /* @__PURE__ */ l("p", { children: [
423
+ g("email"),
424
+ " ",
425
+ /* @__PURE__ */ s("sup", { children: "*" })
426
+ ] }),
427
+ /* @__PURE__ */ s(
428
+ ye,
429
+ {
430
+ name: "email",
431
+ variant: "outlined",
432
+ className: `${o["profile-value"]}`,
433
+ value: i?.email || "",
434
+ onChange: (n) => r("email", n.target.value)
435
+ }
436
+ ),
437
+ y.email && b.email ? /* @__PURE__ */ s("div", { className: `${o["input-error"]}`, children: y.email }) : null
438
+ ] })
439
+ ] }),
440
+ /* @__PURE__ */ l("div", { style: { border: "1px solid #e0e0e0", borderRadius: "12px", marginBottom: "24px", overflow: "hidden" }, children: [
441
+ /* @__PURE__ */ s("div", { style: { backgroundColor: "#f8f9fa", padding: "16px 24px", borderBottom: "1px solid #e0e0e0" }, children: /* @__PURE__ */ l("div", { className: `${o["edit-profile-container__form--field"]}`, style: { marginBottom: 0, width: "100%" }, children: [
442
+ /* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
443
+ /* @__PURE__ */ l("div", { children: [
444
+ /* @__PURE__ */ l("p", { style: { marginBottom: 4, fontWeight: 600, fontSize: 16 }, children: [
445
+ "School tier ",
446
+ /* @__PURE__ */ s("sup", { children: "*" })
447
+ ] }),
448
+ /* @__PURE__ */ s("p", { style: { fontSize: 13, color: "#6c757d", marginTop: 0, marginBottom: 0 }, children: M === "both" ? "Roles can be assigned across tiers (at least one tier required)." : "Pick a tier. Roles are assigned per tier." })
449
+ ] }),
450
+ /* @__PURE__ */ l(
451
+ Ze,
452
+ {
453
+ exclusive: !0,
454
+ value: M,
455
+ onChange: ce,
456
+ size: "small",
457
+ sx: {
458
+ border: "1px solid #e0e0e0",
459
+ borderRadius: "30px",
460
+ padding: "4px",
461
+ backgroundColor: "#fff",
462
+ "& .MuiToggleButton-root": {
463
+ border: "none",
464
+ borderRadius: "30px !important",
465
+ textTransform: "none",
466
+ padding: "6px 20px",
467
+ margin: "0",
468
+ color: "#6c757d",
469
+ fontWeight: 500,
470
+ fontSize: 14,
471
+ "&.Mui-selected": {
472
+ backgroundColor: "#2b65d9",
473
+ color: "#fff",
474
+ "&:hover": {
475
+ backgroundColor: "#1d4ed8"
476
+ }
477
+ }
478
+ }
479
+ },
480
+ children: [
481
+ /* @__PURE__ */ s(pe, { value: "ms", disabled: !!u && !v && !ee && U, children: "Middle school" }),
482
+ /* @__PURE__ */ s(pe, { value: "hs", disabled: !!u && !v && !ee && U, children: "High school" }),
483
+ L && /* @__PURE__ */ s(pe, { value: "es", disabled: !!u && !_e && U, children: "Elementary" }),
484
+ !U && /* @__PURE__ */ s(pe, { value: "both", disabled: !1, children: "All" })
485
+ ]
486
+ }
487
+ )
488
+ ] }),
489
+ y.appTypes && b.appTypes ? /* @__PURE__ */ s("div", { className: `${o["input-error"]}`, children: y.appTypes }) : null
490
+ ] }) }),
491
+ /* @__PURE__ */ l("div", { style: { backgroundColor: "#fff", padding: "24px", display: "flex", flexDirection: "column", gap: "24px" }, children: [
492
+ /* @__PURE__ */ l("div", { className: o["edit-profile-container__form--row"], style: { margin: 0 }, children: [
493
+ oe && ae("ES"),
494
+ ie && ae("MS")
495
+ ] }),
496
+ ve && /* @__PURE__ */ s("div", { className: o["edit-profile-container__form--row"], style: { margin: 0 }, children: ae("HS") })
497
+ ] })
498
+ ] }),
499
+ /* @__PURE__ */ s("div", { className: o["edit-profile-container__form--row"], children: /* @__PURE__ */ l("div", { className: `${o["edit-profile-container__form--field"]} ${o["edit-profile-container__form--width-50"]}`, children: [
500
+ /* @__PURE__ */ s("p", { children: g("status") }),
501
+ /* @__PURE__ */ s("div", { className: `${o.gender}`, children: Us.map((n) => /* @__PURE__ */ l("div", { className: `${o.gender__item}`, children: [
502
+ /* @__PURE__ */ s(
503
+ Qe,
504
+ {
505
+ color: "primary",
506
+ value: n.value,
507
+ checked: i?.isActive === n.value,
508
+ onChange: () => r("isActive", n.value),
509
+ disabled: !!u && !!i?.isImportedFromIntegration
510
+ }
511
+ ),
512
+ n.label
513
+ ] }, n.label)) })
514
+ ] }) }),
515
+ U && !u && !!w && /* @__PURE__ */ s("div", { className: o["edit-profile-container__form--row"], children: /* @__PURE__ */ l("div", { className: `${o["edit-profile-container__form--field"]}`, children: [
516
+ /* @__PURE__ */ l("p", { children: [
517
+ "Assign Teacher ",
518
+ /* @__PURE__ */ s("sup", { children: "*" })
519
+ ] }),
520
+ /* @__PURE__ */ s(
521
+ fe,
522
+ {
523
+ multiple: !0,
524
+ variant: "outlined",
525
+ name: "teacherUserId",
526
+ value: i?.teacherUserId || [],
527
+ renderValue: (n) => w.filter((m) => n.includes(m.value)).map((m) => m.label).join(", "),
528
+ onChange: (n) => {
529
+ const m = n.target.value;
530
+ r("teacherUserId", m), T(!!m.length);
531
+ },
532
+ className: `${o["profile-value"]}`,
533
+ children: w?.map((n) => /* @__PURE__ */ s(Z, { value: n.value, children: n.label }, n.value))
534
+ }
535
+ ),
536
+ !R && /* @__PURE__ */ s("div", { className: `${o["input-error"]}`, children: "Teacher is required" })
537
+ ] }) }),
538
+ U && /* @__PURE__ */ s("div", { className: o["edit-profile-container__form--row"], children: /* @__PURE__ */ l("div", { className: `${o["edit-profile-container__form--field"]} ${o["edit-profile-container__form--width-50"]}`, children: [
539
+ /* @__PURE__ */ l("p", { children: [
540
+ " ",
541
+ j === "UK" ? "Year" : g("grade_level"),
542
+ " ",
543
+ /* @__PURE__ */ s("sup", { children: "*" })
544
+ ] }),
545
+ /* @__PURE__ */ l(
546
+ fe,
547
+ {
548
+ variant: "outlined",
549
+ value: i?.gradeLevel ?? "",
550
+ renderValue: (n) => B(n),
551
+ onChange: Se,
552
+ className: `${o["profile-value"]}`,
553
+ children: [
554
+ i?.gradeLevel && !le.includes(i.gradeLevel) && /* @__PURE__ */ s(Z, { value: i.gradeLevel, sx: { display: "none" }, children: B(i.gradeLevel) }, "__current__"),
555
+ le.map((n) => /* @__PURE__ */ s(Z, { value: n, children: B(n) }, n))
556
+ ]
557
+ }
558
+ ),
559
+ y.gradeLevel && b.gradeLevel ? /* @__PURE__ */ s("div", { className: `${o["input-error"]}`, children: y.gradeLevel }) : null
560
+ ] }) }),
561
+ !U && (!!se.length || !!K.length) && !!u && /* @__PURE__ */ s("div", { className: o["edit-profile-container__form--row"], children: /* @__PURE__ */ l("div", { className: `${o["edit-profile-container__form--field"]} ${o["edit-profile-container__form--width-50"]}`, children: [
562
+ /* @__PURE__ */ s("p", { children: g("Map from Roster") }),
563
+ /* @__PURE__ */ s(
564
+ Ls,
565
+ {
566
+ roles: [...se, ...K],
567
+ value: i.sourcedId,
568
+ onChange: (n) => r("sourcedId", n)
569
+ }
570
+ )
571
+ ] }) }),
572
+ /* @__PURE__ */ l("div", { className: o["edit-profile-container__form--btn-group"], children: [
573
+ /* @__PURE__ */ s(
574
+ "button",
575
+ {
576
+ type: "button",
577
+ className: o["btn-cancel"],
578
+ onClick: () => _(),
579
+ children: g("cancel")
580
+ }
581
+ ),
582
+ /* @__PURE__ */ l(
583
+ "button",
584
+ {
585
+ type: "button",
586
+ className: o["btn-save"],
587
+ onClick: () => H(),
588
+ children: [
589
+ /* @__PURE__ */ s(qe, { color: "#fff" }),
590
+ g("save_changes")
591
+ ]
592
+ }
593
+ )
594
+ ] })
595
+ ] });
596
+ }
597
+ }
598
+ )
599
+ ] });
600
+ }, C = {
601
+ "input-error": "_input-error_gmvmh_1",
602
+ "change-password-container": "_change-password-container_gmvmh_6",
603
+ "change-password-container__title": "_change-password-container__title_gmvmh_11",
604
+ "change-password-container__form": "_change-password-container__form_gmvmh_19",
605
+ "change-password-container__form--field": "_change-password-container__form--field_gmvmh_24",
606
+ "change-password-container__form--description": "_change-password-container__form--description_gmvmh_38",
607
+ "change-password-container__form--btn-group": "_change-password-container__form--btn-group_gmvmh_54",
608
+ "btn-save": "_btn-save_gmvmh_60",
609
+ "btn-cancel": "_btn-cancel_gmvmh_82"
610
+ }, $s = E.object({
611
+ oldPassword: E.string().required("Old password is required"),
612
+ newPassword: E.string().required("New password is required"),
613
+ confirmedNewPassword: E.string().oneOf([E.ref("newPassword"), void 0], "New password must match").required("Confirm your new password")
614
+ }), Is = ({ confirmChangePassword: a, goBack: t }) => {
615
+ const { t: _ } = Ie();
616
+ return /* @__PURE__ */ l("div", { className: C["change-password-container"], children: [
617
+ /* @__PURE__ */ s("div", { className: C["change-password-container__title"], children: _("change_password") }),
618
+ /* @__PURE__ */ s(
619
+ Oe,
620
+ {
621
+ initialValues: {
622
+ oldPassword: "",
623
+ newPassword: "",
624
+ confirmedNewPassword: "",
625
+ showOldPassword: !1,
626
+ showNewPassword: !1,
627
+ showConfirmNewPassword: !1
628
+ },
629
+ enableReinitialize: !0,
630
+ onSubmit: (w) => {
631
+ a(w);
632
+ },
633
+ validateOnChange: !1,
634
+ validateOnBlur: !1,
635
+ validationSchema: $s,
636
+ children: (w) => {
637
+ const { values: h, setFieldValue: u, handleSubmit: R, errors: T, touched: $ } = w, N = Object.keys(T);
638
+ return N.length && document.querySelector(
639
+ `input[name=${N[0]}]`
640
+ )?.scrollIntoView({
641
+ behavior: "smooth",
642
+ block: "center"
643
+ }), /* @__PURE__ */ l("div", { className: C["change-password-container__form"], children: [
644
+ /* @__PURE__ */ l("div", { className: `${C["change-password-container__form--field"]}`, children: [
645
+ /* @__PURE__ */ s("p", { children: _("old_password") }),
646
+ /* @__PURE__ */ s(
647
+ be,
648
+ {
649
+ variant: "outlined",
650
+ className: `${C["input-field"]}`,
651
+ children: /* @__PURE__ */ s(
652
+ Ee,
653
+ {
654
+ type: h.showOldPassword ? "text" : "password",
655
+ value: h?.oldPassword,
656
+ onChange: (g) => u(
657
+ "oldPassword",
658
+ g.target.value.trim()
659
+ ),
660
+ endAdornment: /* @__PURE__ */ s(De, { position: "end", children: /* @__PURE__ */ s(
661
+ Ce,
662
+ {
663
+ "aria-label": "toggle password visibility",
664
+ onClick: () => u(
665
+ "showOldPassword",
666
+ !h.showOldPassword
667
+ ),
668
+ onMouseDown: (g) => g.preventDefault(),
669
+ children: h.showOldPassword ? /* @__PURE__ */ s(Ne, { color: "primary" }) : /* @__PURE__ */ s(Re, { color: "primary" })
670
+ }
671
+ ) })
672
+ }
673
+ )
674
+ }
675
+ ),
676
+ T.oldPassword && $.oldPassword && /* @__PURE__ */ s("div", { className: `${C["input-error"]}`, children: T.oldPassword })
677
+ ] }),
678
+ /* @__PURE__ */ l("div", { className: `${C["change-password-container__form--field"]}`, children: [
679
+ /* @__PURE__ */ s("p", { children: _("new_password") }),
680
+ /* @__PURE__ */ s(
681
+ be,
682
+ {
683
+ variant: "outlined",
684
+ className: `${C["input-field"]}`,
685
+ children: /* @__PURE__ */ s(
686
+ Ee,
687
+ {
688
+ type: h.showNewPassword ? "text" : "password",
689
+ value: h?.newPassword,
690
+ onChange: (g) => u(
691
+ "newPassword",
692
+ g.target.value.trim()
693
+ ),
694
+ endAdornment: /* @__PURE__ */ s(De, { position: "end", children: /* @__PURE__ */ s(
695
+ Ce,
696
+ {
697
+ "aria-label": "toggle password visibility",
698
+ onClick: () => u(
699
+ "showNewPassword",
700
+ !h.showNewPassword
701
+ ),
702
+ onMouseDown: (g) => g.preventDefault(),
703
+ children: h.showNewPassword ? /* @__PURE__ */ s(Ne, { color: "primary" }) : /* @__PURE__ */ s(Re, { color: "primary" })
704
+ }
705
+ ) })
706
+ }
707
+ )
708
+ }
709
+ ),
710
+ T.newPassword && $.newPassword && /* @__PURE__ */ s("div", { className: `${C["input-error"]}`, children: T.newPassword }),
711
+ /* @__PURE__ */ l("div", { className: `${C["change-password-container__form--description"]}`, children: [
712
+ "Password must contain at least: 1 uppercase letter, 1 lowercase letter,",
713
+ /* @__PURE__ */ s("br", {}),
714
+ " 1 number, and 1 special character"
715
+ ] })
716
+ ] }),
717
+ /* @__PURE__ */ l("div", { className: `${C["change-password-container__form--field"]}`, children: [
718
+ /* @__PURE__ */ s("p", { children: _("confirm_new_password") }),
719
+ /* @__PURE__ */ s(
720
+ be,
721
+ {
722
+ variant: "outlined",
723
+ className: `${C["input-field"]}`,
724
+ children: /* @__PURE__ */ s(
725
+ Ee,
726
+ {
727
+ type: h.showConfirmNewPassword ? "text" : "password",
728
+ value: h?.confirmedNewPassword,
729
+ onChange: (g) => u(
730
+ "confirmedNewPassword",
731
+ g.target.value.trim()
732
+ ),
733
+ endAdornment: /* @__PURE__ */ s(De, { position: "end", children: /* @__PURE__ */ s(
734
+ Ce,
735
+ {
736
+ "aria-label": "toggle password visibility",
737
+ onClick: () => u(
738
+ "showConfirmNewPassword",
739
+ !h.showConfirmNewPassword
740
+ ),
741
+ onMouseDown: (g) => g.preventDefault(),
742
+ children: h.showConfirmNewPassword ? /* @__PURE__ */ s(Ne, { color: "primary" }) : /* @__PURE__ */ s(Re, { color: "primary" })
743
+ }
744
+ ) })
745
+ }
746
+ )
747
+ }
748
+ ),
749
+ T.confirmedNewPassword && $.confirmedNewPassword && /* @__PURE__ */ s("div", { className: `${C["input-error"]}`, children: T.confirmedNewPassword })
750
+ ] }),
751
+ /* @__PURE__ */ l("div", { className: C["change-password-container__form--btn-group"], children: [
752
+ /* @__PURE__ */ s(
753
+ "button",
754
+ {
755
+ type: "button",
756
+ className: C["btn-cancel"],
757
+ onClick: () => {
758
+ t();
759
+ },
760
+ children: _("cancel")
761
+ }
762
+ ),
763
+ /* @__PURE__ */ l(
764
+ "button",
765
+ {
766
+ type: "button",
767
+ className: C["btn-save"],
768
+ onClick: () => R(),
769
+ children: [
770
+ /* @__PURE__ */ s(qe, { color: "#fff" }),
771
+ _("save_new_password")
772
+ ]
773
+ }
774
+ )
775
+ ] })
776
+ ] });
777
+ }
778
+ }
779
+ )
780
+ ] });
781
+ }, Hs = {
782
+ id: "",
783
+ firstName: "",
784
+ lastName: "",
785
+ email: "",
786
+ dateOfBirth: Be,
787
+ msRoles: [],
788
+ esRoles: [],
789
+ hsRoles: [],
790
+ isActive: !0,
791
+ profileImageFileName: "",
792
+ teacherUserId: [],
793
+ gradeLevel: "",
794
+ currentGradeLevel: "",
795
+ isImportedFromIntegration: !1,
796
+ // Man tao moi mac dinh MS; man edit se duoc getData ghi de bang appType tu API
797
+ appTypes: ["MS"],
798
+ preferredAppType: "MS"
799
+ }, $e = "/admin/users/user-list", Fs = "User detail", Os = 12, Bs = 20, qs = (a) => {
800
+ const t = Fe(), _ = gs(), w = Ue((e) => e.common.user), h = Ue((e) => e.common?.defaultFontSize), [u, R] = k(Hs), [T, $] = k(null), [N, g] = k(!1), [O, Q] = k({ MS: [], ES: [], HS: [] }), [L, B] = k([]), [j, I] = k(!1), [i, r] = k(X.Info), [H, y] = k(!0), [b, A] = k({}), D = async () => {
801
+ localStorage.setItem(window.location.href, "true"), g(!0);
802
+ }, v = () => {
803
+ I(!j);
804
+ }, _e = We(() => h == Bs ? "font-large" : h == Os ? "font-small" : "", [h]);
805
+ ne(() => {
806
+ document.title = Fs, g(!1), localStorage.getItem(window.location.href) && localStorage.removeItem(window.location.href);
807
+ }, []), ne(() => {
808
+ a && se(), !a && oe();
809
+ }, [a]);
810
+ const ee = (e = []) => e.includes("EduTeacher") ? [...e.filter((c) => c !== "EduTeacher"), f.EDUTEACHER] : e, se = J(async () => {
811
+ t(q(!0));
812
+ try {
813
+ const e = await ke(a), c = (e.data.appTypeRaw || e.data.appType || "MS").toUpperCase(), S = c.includes("MS"), p = c.includes("ES"), d = c.includes("HS"), P = [];
814
+ p && P.push("ES"), S && P.push("MS"), d && P.push("HS"), P.length === 0 && P.push("MS");
815
+ let z = e.data.preferredAppType || c;
816
+ ((e.data.roles || []).includes("Student") || (e.data.msRoles || []).includes("Student") || (e.data.esRoles || []).includes("Student")) && e.data.gradeLevel && (G.includes(e.data.gradeLevel) ? z = "HS" : V.includes(e.data.gradeLevel) ? z = "MS" : x.includes(e.data.gradeLevel) && (z = "ES")), R({
817
+ ...e.data,
818
+ dateOfBirth: vs(new Date(e.data.dateOfBirth), Ye),
819
+ msRoles: ee(e.data.msRoles),
820
+ esRoles: ee(e.data.esRoles),
821
+ hsRoles: ee(e.data.hsRoles),
822
+ currentGradeLevel: e.data.gradeLevel,
823
+ appTypes: P,
824
+ preferredAppType: z
825
+ }), Q({ MS: e.data.msRoles ?? [], ES: e.data.esRoles ?? [], HS: e.data.hsRoles ?? [] }), document.title = e.data?.fullName, (S || d) && K("MS"), p && K("ES");
826
+ } catch (e) {
827
+ t(
828
+ F({
829
+ type: "danger",
830
+ message: e.response?.data?.title || e.message
831
+ })
832
+ );
833
+ }
834
+ t(q(!1));
835
+ }, [a]), K = J(async (e) => {
836
+ t(q(!0));
837
+ try {
838
+ const c = await ns(a, e);
839
+ A((S) => ({ ...S, [e]: c.data }));
840
+ } catch (c) {
841
+ t(
842
+ F({
843
+ type: "danger",
844
+ message: c.response?.data?.title || c.message
845
+ })
846
+ );
847
+ }
848
+ t(q(!1));
849
+ }, [a]), te = J((e) => {
850
+ _(e && typeof e == "string" ? $e + `?query=${e}` : $e);
851
+ }, []), U = (e) => ["Student", "Parent", "EduTeacher"].includes(e), re = (e = []) => e.includes(f.EDUTEACHER) ? [...e.filter((c) => c !== f.EDUTEACHER), "EduTeacher"] : e, M = J(
852
+ async (e) => {
853
+ const c = e.msRoles?.includes(f.STUDENT) || e.esRoles?.includes(f.STUDENT) || e.hsRoles?.includes(f.STUDENT);
854
+ if (c && !a && !e.teacherUserId) {
855
+ y(!1);
856
+ return;
857
+ }
858
+ c && e.gradeLevel && (G.includes(e.gradeLevel) ? (e.preferredAppType = "HS", e.hsRoles = [f.STUDENT], e.msRoles = [], e.esRoles = []) : V.includes(e.gradeLevel) ? (e.preferredAppType = "MS", e.msRoles = [f.STUDENT], e.hsRoles = [], e.esRoles = []) : x.includes(e.gradeLevel) && (e.preferredAppType = "ES", e.esRoles = [f.STUDENT], e.msRoles = [], e.hsRoles = [])), t(q(!0));
859
+ try {
860
+ if (w?.hasEsSchool === !1)
861
+ if (e.esRoles = [], c)
862
+ e.preferredAppType !== "HS" ? (e.appTypes = ["MS"], e.preferredAppType = "MS") : e.appTypes = ["HS"];
863
+ else {
864
+ const d = (e.appTypes || []).filter((P) => P !== "ES");
865
+ e.appTypes = d.length > 0 ? d : ["MS"];
866
+ }
867
+ const S = a ? ts : is;
868
+ if (!a && delete e.id, e.teacherUserId = c ? e.teacherUserId : [], e.msRoles = re(e.msRoles), e.esRoles = re(e.esRoles), e.hsRoles = re(e.hsRoles), !a && !c) {
869
+ const d = (e.preferredAppType || "MS").toUpperCase();
870
+ d.includes("MS") || (e.msRoles = []), d.includes("HS") || (e.hsRoles = []), d.includes("ES") || (e.esRoles = []);
871
+ }
872
+ if (!c) {
873
+ const d = [];
874
+ e.esRoles && e.esRoles.length > 0 && d.push("ES"), e.msRoles && e.msRoles.length > 0 && d.push("MS"), e.hsRoles && e.hsRoles.length > 0 && d.push("HS"), d.length > 0 && ((e.preferredAppType || "").includes(",") && (e.preferredAppType = d.join(", ")), a || (e.appTypes = d));
875
+ }
876
+ c && (e.preferredAppType === "HS" ? (e.hsRoles = [f.STUDENT], e.msRoles = [], e.esRoles = []) : e.preferredAppType === "ES" ? (e.esRoles = [f.STUDENT], e.msRoles = [], e.hsRoles = []) : (e.msRoles = [f.STUDENT], e.hsRoles = [], e.esRoles = [])), a || (e.profileImageFileName = T || "");
877
+ const p = await S(e);
878
+ p && ke(p.data.id).then((d) => {
879
+ te(d.data.fullName);
880
+ }), a || alert("Password of " + p.data.email + ` is "${p.data.password}"`), t(
881
+ F({
882
+ type: "success",
883
+ message: `${a ? "Update" : "Create"} user successfully`
884
+ })
885
+ );
886
+ } catch (S) {
887
+ t(
888
+ F({
889
+ type: "danger",
890
+ message: S.response?.data?.title || S.message
891
+ })
892
+ );
893
+ }
894
+ t(q(!1));
895
+ },
896
+ [a, T]
897
+ ), ie = async (e) => {
898
+ t(q(!0));
899
+ try {
900
+ await ps(e), t(
901
+ F({
902
+ type: "success",
903
+ message: "Change password successfully"
904
+ })
905
+ );
906
+ } catch (c) {
907
+ t(
908
+ F({
909
+ type: "danger",
910
+ message: c.response?.data?.title || c.message
911
+ })
912
+ );
913
+ }
914
+ t(q(!1));
915
+ }, ve = J(async (e) => {
916
+ t(q(!0));
917
+ try {
918
+ await ls(e), t(
919
+ F({
920
+ type: "success",
921
+ message: "Send forgot password link successfully"
922
+ })
923
+ );
924
+ } catch (c) {
925
+ t(
926
+ F({
927
+ type: "danger",
928
+ message: c.response?.data?.title || c.message || "Error occured"
929
+ })
930
+ );
931
+ }
932
+ t(q(!1));
933
+ }, []), oe = async (e) => {
934
+ try {
935
+ const c = await cs({
936
+ sortBy: "Email"
937
+ }, e);
938
+ c.data && B(
939
+ (c.data.map?.((S) => ({
940
+ label: S.email,
941
+ value: S.id
942
+ })) || []).sort((S, p) => S.label.localeCompare(p.label))
943
+ );
944
+ } catch (c) {
945
+ t(
946
+ F({
947
+ type: "danger",
948
+ message: c.response?.data?.title || c.message
949
+ })
950
+ );
951
+ }
952
+ }, le = 20097152, [Se, ce] = k(""), de = (e) => {
953
+ e.preventDefault();
954
+ let c = new FileReader(), S = e.target.files[0];
955
+ if (S.size > le) {
956
+ t(
957
+ F({
958
+ type: "danger",
959
+ message: "File can't be larger than 2MB"
960
+ })
961
+ );
962
+ return;
963
+ }
964
+ c.onloadend = async () => {
965
+ if (ce(c.result), S) {
966
+ const p = new FormData(), { name: d } = S;
967
+ p.append("file", S, d);
968
+ const z = (await ds(p))?.data?.key;
969
+ a ? await Le(u.id || "", z) : $(z);
970
+ }
971
+ }, S && c.readAsDataURL(S);
972
+ }, we = async () => {
973
+ await Le(u.id || "", ""), ce("");
974
+ }, ae = Se || Je(u?.profileImageFileName), n = u?.profileImageFileName || "";
975
+ return {
976
+ userDetail: u,
977
+ getDataTeachers: oe,
978
+ backToList: te,
979
+ confirmData: M,
980
+ file: T,
981
+ setFile: $,
982
+ edited: N,
983
+ currentRoles: O,
984
+ setEdited: g,
985
+ setEditedTrue: D,
986
+ confirmChangePassword: ie,
987
+ forgotPasswordRequest: ve,
988
+ handleDisableRoles: U,
989
+ classFontSize: _e,
990
+ teacherOptions: L,
991
+ handleToggleModel: v,
992
+ openModel: j,
993
+ user: w,
994
+ activeTab: i,
995
+ setActiveTab: r,
996
+ imageSrc: ae,
997
+ imageUse: n,
998
+ handleImageChange: de,
999
+ handleDeleteAvatar: we,
1000
+ getFile: () => {
1001
+ var e = window.location.origin + "/api/ExportDataUser/" + a;
1002
+ window.open(e);
1003
+ },
1004
+ checkHasTeacher: H,
1005
+ setCheckHasTeacher: y,
1006
+ userHasData: b
1007
+ };
1008
+ }, xs = "/images/image-default.png", dr = () => {
1009
+ const { id: a } = _s(), {
1010
+ userDetail: t,
1011
+ getDataTeachers: _,
1012
+ backToList: w,
1013
+ confirmData: h,
1014
+ confirmChangePassword: u,
1015
+ forgotPasswordRequest: R,
1016
+ teacherOptions: T,
1017
+ user: $,
1018
+ activeTab: N,
1019
+ setActiveTab: g,
1020
+ imageSrc: O,
1021
+ handleImageChange: Q,
1022
+ handleDeleteAvatar: L,
1023
+ getFile: B,
1024
+ currentRoles: j,
1025
+ handleDisableRoles: I,
1026
+ checkHasTeacher: i,
1027
+ setCheckHasTeacher: r,
1028
+ userHasData: H
1029
+ } = qs(a), y = [
1030
+ {
1031
+ value: X.Info,
1032
+ component: /* @__PURE__ */ s(
1033
+ Ms,
1034
+ {
1035
+ id: a,
1036
+ goBack: w,
1037
+ userDetail: t,
1038
+ confirmData: h,
1039
+ teacherOptions: T,
1040
+ getDataTeachers: _,
1041
+ currentRoles: j,
1042
+ handleDisableRoles: I,
1043
+ checkHasTeacher: i,
1044
+ setCheckHasTeacher: r,
1045
+ userHasData: H
1046
+ }
1047
+ )
1048
+ },
1049
+ {
1050
+ value: X.ChangePassword,
1051
+ component: /* @__PURE__ */ s(
1052
+ Is,
1053
+ {
1054
+ confirmChangePassword: u,
1055
+ goBack: w
1056
+ }
1057
+ )
1058
+ }
1059
+ ], b = ue.find((v) => v.value === X.ForgotPassword), A = ue.find((v) => v.value === X.DownloadUserData), D = ue.find((v) => v.value === X.ChangePassword);
1060
+ return /* @__PURE__ */ l("div", { className: o["user-profile-container-admin"], children: [
1061
+ /* @__PURE__ */ l("div", { className: o["user-profile-container-admin__left"], children: [
1062
+ /* @__PURE__ */ l("div", { className: o["user-profile-container-admin__left--information"], children: [
1063
+ /* @__PURE__ */ l("div", { className: o["image-user-container"], children: [
1064
+ /* @__PURE__ */ s(
1065
+ Ge,
1066
+ {
1067
+ className: "d-none",
1068
+ type: "file",
1069
+ id: "uploadFile",
1070
+ onChange: Q,
1071
+ accept: "image/*"
1072
+ }
1073
+ ),
1074
+ /* @__PURE__ */ s(
1075
+ "img",
1076
+ {
1077
+ src: O || W(xs),
1078
+ alt: "avatar",
1079
+ className: `${o["image-user-container__image"]}`
1080
+ }
1081
+ ),
1082
+ /* @__PURE__ */ s(
1083
+ je,
1084
+ {
1085
+ htmlFor: "uploadFile",
1086
+ role: "button",
1087
+ tabIndex: 0,
1088
+ children: /* @__PURE__ */ s("div", { className: o["image-user-container__edit-btn"], children: /* @__PURE__ */ s("img", { src: W("/images/user/Edit.svg"), alt: "edit-avatar" }) })
1089
+ }
1090
+ ),
1091
+ a && /* @__PURE__ */ s(
1092
+ "button",
1093
+ {
1094
+ type: "button",
1095
+ onClick: () => L(),
1096
+ className: o["image-user-container__delete-btn"],
1097
+ children: /* @__PURE__ */ s("img", { src: W("/images/user/DeleteAvatar.svg"), alt: "delete-avatar" })
1098
+ }
1099
+ )
1100
+ ] }),
1101
+ /* @__PURE__ */ l("div", { className: o["name-role-container"], children: [
1102
+ /* @__PURE__ */ s("div", { className: o.name, children: `${t?.firstName || ""} ${t?.lastName || ""}` }),
1103
+ /* @__PURE__ */ s("div", { className: o.role, children: Array.from(/* @__PURE__ */ new Set([...t?.msRoles || [], ...t?.esRoles || [], ...t?.hsRoles || []])).map((v) => v === "SecondaryTeacher" ? "Support Teacher" : v).join(", ") })
1104
+ ] })
1105
+ ] }),
1106
+ /* @__PURE__ */ l("div", { className: o["user-profile-container-admin__left--btn-control"], children: [
1107
+ ue.filter((v) => v.isControl).map((v) => /* @__PURE__ */ l(
1108
+ "button",
1109
+ {
1110
+ type: "button",
1111
+ className: `${o.item} ${N === v.value ? o["item-active"] : ""}`,
1112
+ onClick: () => g(v.value),
1113
+ children: [
1114
+ /* @__PURE__ */ s("img", { src: W(v.icon), alt: v.icon }),
1115
+ v.label
1116
+ ]
1117
+ },
1118
+ v.value
1119
+ )),
1120
+ !!a && !!D && $?.id === a && /* @__PURE__ */ l(
1121
+ "button",
1122
+ {
1123
+ type: "button",
1124
+ className: `${o.item} ${N === D.value ? o["item-active"] : ""}`,
1125
+ onClick: () => g(D.value),
1126
+ children: [
1127
+ /* @__PURE__ */ s("img", { src: W(D.icon), alt: D.icon }),
1128
+ D.label
1129
+ ]
1130
+ },
1131
+ D.value
1132
+ ),
1133
+ a && b && /* @__PURE__ */ l(
1134
+ "button",
1135
+ {
1136
+ type: "button",
1137
+ className: `${o.item} ${N === b.value ? o["item-active"] : ""}`,
1138
+ onClick: () => R({ email: t?.email || "" }),
1139
+ children: [
1140
+ /* @__PURE__ */ s("img", { src: W(b.icon), alt: b.icon }),
1141
+ b.label
1142
+ ]
1143
+ },
1144
+ b.value
1145
+ ),
1146
+ a && A && /* @__PURE__ */ l(
1147
+ "button",
1148
+ {
1149
+ type: "button",
1150
+ className: `${o.item} ${N === A.value ? o["item-active"] : ""}`,
1151
+ onClick: () => B(),
1152
+ children: [
1153
+ /* @__PURE__ */ s("img", { src: W(A.icon), alt: A.icon }),
1154
+ A.label
1155
+ ]
1156
+ },
1157
+ A.value
1158
+ )
1159
+ ] })
1160
+ ] }),
1161
+ /* @__PURE__ */ s("div", { className: o["user-profile-container-admin__right"], children: y.find((v) => v.value === N)?.component })
1162
+ ] });
1163
+ };
1164
+ export {
1165
+ dr as default
1166
+ };