mario-core 2.0.127-release → 2.0.128-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.
- package/dist/Dashboard-Dn1Xl7SC.js +1 -0
- package/dist/Dashboard-DxrE_UdE.mjs +206 -0
- package/dist/EmailTemplateDetail-BxDmv_IB.mjs +443 -0
- package/dist/EmailTemplateDetail-c2h1KwyT.js +1 -0
- package/dist/EmailTemplateList-C6KbuCHO.mjs +170 -0
- package/dist/EmailTemplateList-Dk7gCfdy.js +1 -0
- package/dist/GalleryList-CG-GA7Go.mjs +329 -0
- package/dist/GalleryList-p6WP3Krc.js +1 -0
- package/dist/Login-BMRuV2H4.js +1 -0
- package/dist/Login-Ch1dKH9m.mjs +1700 -0
- package/dist/NotificationList-51yt2V-v.js +1 -0
- package/dist/NotificationList-bZsuTSkC.mjs +419 -0
- package/dist/SkillList-BQM2FIla.mjs +386 -0
- package/dist/SkillList-BxqOHumi.js +1 -0
- package/dist/TeacherSelector-CrH5Ji_R.mjs +30 -0
- package/dist/TeacherSelector-DYwwL8rL.js +1 -0
- package/dist/TheContent-B_P8fq4J.mjs +38 -0
- package/dist/TheContent-C5I2GeSi.js +1 -0
- package/dist/UserContainer-JB0zF0Be.js +5 -0
- package/dist/UserContainer-QmPiHlko.mjs +2698 -0
- package/dist/UserDetail-BuhWeZrj.mjs +913 -0
- package/dist/UserDetail-ClL8qEKG.js +1 -0
- package/dist/UserList-Crz4aLRP.mjs +1514 -0
- package/dist/UserList-DoZZeZzW.js +7 -0
- package/dist/constants-DF79sw6a.mjs +241 -0
- package/dist/constants-DSNqVx4Y.js +1 -0
- package/dist/index-CD8bO3wO.js +15 -0
- package/dist/index-CfBp3NrB.mjs +22670 -0
- package/dist/mailCategoryService-C9FSK6lv.js +1 -0
- package/dist/mailCategoryService-CRdM3FRx.mjs +11 -0
- package/dist/shared/gradeYear/ukYearCsv.d.ts +4 -0
- package/dist/userService-CDfW2VnH.js +1 -0
- package/dist/userService-CjQDQKT0.mjs +47 -0
- package/package.json +113 -113
|
@@ -0,0 +1,1514 @@
|
|
|
1
|
+
import { jsxs as b, jsx as a, Fragment as We } from "react/jsx-runtime";
|
|
2
|
+
import { useState as z, useMemo as ne, useCallback as G, useEffect as X, useRef as _e, Fragment as Ye } from "react";
|
|
3
|
+
import { Button as he, Popover as Xe, PopoverBody as Qe, Label as ae, Input as ie, FormGroup as me, Modal as Ze, ModalHeader as es, ModalBody as ss, ModalFooter as ts, Row as Ne, Col as le, Table as as } from "reactstrap";
|
|
4
|
+
import { useTranslation as re } from "react-i18next";
|
|
5
|
+
import { useSelector as ye, useDispatch as ue } from "react-redux";
|
|
6
|
+
import { useNavigate as ns, useLocation as rs } from "react-router-dom";
|
|
7
|
+
import { ae as xe, b as B, q as Z, af as De, ag as Fe, ah as ge, c as k, R as de, w as os, I as cs, d as Ae, N as ls, ai as is, K as oe, s as F, g as ds, aj as ms, ak as Pe, a9 as pe, B as He, i as hs, aa as Ie, ac as us, al as we, a2 as Oe, u as ps, am as gs, an as fs, t as ys, T as Ss, ao as vs, V as Es, W as bs, X as Cs, ap as Rs, aq as Ts } from "./index-CfBp3NrB.mjs";
|
|
8
|
+
import { i as _s, j as Le, s as Ns, t as xs, k as As, l as Is, m as ws, n as Os, p as Ls } from "./userService-CjQDQKT0.mjs";
|
|
9
|
+
import { d as Us, S as Y, u as Bs, e as ks, G as Ms, T as ve, f as $s, C as Ue, g as Ds, h as Fs } from "./constants-DF79sw6a.mjs";
|
|
10
|
+
import { L as Ps } from "./types-BvnbDeJF.mjs";
|
|
11
|
+
import { differenceInCalendarYears as Hs, parseISO as js } from "date-fns";
|
|
12
|
+
import Be from "papaparse";
|
|
13
|
+
const zs = () => {
|
|
14
|
+
const [e, t] = z(Us);
|
|
15
|
+
return { filters: e, setFilters: t, changeFilters: (r) => {
|
|
16
|
+
const i = {
|
|
17
|
+
...e,
|
|
18
|
+
...r
|
|
19
|
+
};
|
|
20
|
+
i.searchString && r.searchString && r.searchString != e.searchString && (i.currentPage = 1), t(i);
|
|
21
|
+
} };
|
|
22
|
+
}, Gs = "/admin/user", Vs = "/admin/create-user", Js = "User list", fe = "/home", Ks = "/home", qs = "/admin/home", Ws = "/parent", Ys = "/admin/schools", Xs = "/list-student", Qs = () => {
|
|
23
|
+
const e = ns(), n = new URLSearchParams(location.search).get("query"), r = ye((s) => s.users.userList), i = ye((s) => s.users.totalItems), { filters: c, changeFilters: o } = zs(), p = n || "", [u, R] = z([]), d = window.location.host.includes("-district"), m = ue(), { t: S } = re(), f = (s) => {
|
|
24
|
+
const l = u.find((_) => _ == s);
|
|
25
|
+
R(l ? u.filter((_) => _ != s) : u.concat([s]));
|
|
26
|
+
}, g = ne(() => (r || []).length > 0 && (r || []).every((s) => u.includes(s.id)), [r, u]), O = G(() => {
|
|
27
|
+
if (g) {
|
|
28
|
+
const l = new Set((r || []).map((_) => _.id));
|
|
29
|
+
R((_) => _.filter((v) => !l.has(v)));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const s = (r || []).map((l) => l.id).filter((l) => !u.includes(l));
|
|
33
|
+
R((l) => [...l, ...s]);
|
|
34
|
+
}, [r, g, u]), T = G(
|
|
35
|
+
async () => {
|
|
36
|
+
if (c.searchBy !== void 0 && c.searchByStrings !== void 0 && c.searchByStrings.length === 0) {
|
|
37
|
+
m(xe({ userList: [], totalItems: 0 }));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
m(B(!0));
|
|
41
|
+
try {
|
|
42
|
+
const s = Z(), l = await _s(s && c.Tiers?.length ? { ...c, Tiers: De(c.Tiers) } : c), { totalItems: _ } = l.data, v = s ? l.data.items.map(Fe) : l.data.items;
|
|
43
|
+
for (const E of v)
|
|
44
|
+
E.roles = E.roles.map((N) => N != ge.EDUTEACHER ? N : "EduTeacher"), E.msRoles && (E.msRoles = E.msRoles.map((N) => N != ge.EDUTEACHER ? N : "EduTeacher")), E.esRoles && (E.esRoles = E.esRoles.map((N) => N != ge.EDUTEACHER ? N : "EduTeacher")), E.hsRoles && (E.hsRoles = E.hsRoles.map((N) => N != ge.EDUTEACHER ? N : "EduTeacher"));
|
|
45
|
+
m(xe({ userList: v, totalItems: _ }));
|
|
46
|
+
} catch (s) {
|
|
47
|
+
m(
|
|
48
|
+
k({
|
|
49
|
+
type: "danger",
|
|
50
|
+
message: s.response?.data?.title || s.message
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
m(B(!1));
|
|
55
|
+
},
|
|
56
|
+
[m, c]
|
|
57
|
+
), V = async () => {
|
|
58
|
+
m(B(!0));
|
|
59
|
+
try {
|
|
60
|
+
const l = (await xs()).data?.message || S("sync_roster_running_in_background", "Roster synchronization is currently running in the background. Please wait a few moments before refreshing the page.");
|
|
61
|
+
m(
|
|
62
|
+
de({
|
|
63
|
+
isOpen: !0,
|
|
64
|
+
type: "success",
|
|
65
|
+
message: l
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
} catch (s) {
|
|
69
|
+
m(
|
|
70
|
+
de({
|
|
71
|
+
isOpen: !0,
|
|
72
|
+
type: "danger",
|
|
73
|
+
message: s.response?.data?.message || s.response?.data?.title || s.message
|
|
74
|
+
})
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
m(B(!1));
|
|
78
|
+
}, y = (s) => {
|
|
79
|
+
if (!s) return "";
|
|
80
|
+
const l = [], { sourcedId: _, rosterUser: v } = s;
|
|
81
|
+
if (_ && v && l.push(_), v) {
|
|
82
|
+
const { givenName: E, middleName: N, familyName: M, email: I } = v, j = [];
|
|
83
|
+
M && j.push(M), N && j.push(N), E && j.push(E), l.push(j.join(" ") || ""), l.push(I || "");
|
|
84
|
+
}
|
|
85
|
+
return l.join(" / ");
|
|
86
|
+
};
|
|
87
|
+
X(() => {
|
|
88
|
+
document.title = Js;
|
|
89
|
+
}, []), X(() => {
|
|
90
|
+
o({
|
|
91
|
+
...c,
|
|
92
|
+
searchString: p
|
|
93
|
+
});
|
|
94
|
+
}, [p]), X(() => {
|
|
95
|
+
T();
|
|
96
|
+
}, [JSON.stringify(c)]);
|
|
97
|
+
const [A, P] = z({
|
|
98
|
+
isOpen: !1,
|
|
99
|
+
userId: ""
|
|
100
|
+
}), J = G(() => {
|
|
101
|
+
P({ isOpen: !1, userId: "" });
|
|
102
|
+
}, []), h = G(
|
|
103
|
+
async (s, l) => {
|
|
104
|
+
const _ = A.userId;
|
|
105
|
+
if (_) {
|
|
106
|
+
m(B(!0));
|
|
107
|
+
try {
|
|
108
|
+
if ((await Le(_, {
|
|
109
|
+
msTransferTeacherId: s,
|
|
110
|
+
esTransferTeacherId: l
|
|
111
|
+
}))?.data?.requireTransfer) {
|
|
112
|
+
m(
|
|
113
|
+
k({
|
|
114
|
+
type: "danger",
|
|
115
|
+
message: "Please select a teacher to transfer data to."
|
|
116
|
+
})
|
|
117
|
+
);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
J(), m(
|
|
121
|
+
k({
|
|
122
|
+
type: "success",
|
|
123
|
+
message: "Remove user successfully"
|
|
124
|
+
})
|
|
125
|
+
), c.currentPage !== 1 ? o({ currentPage: 1 }) : T();
|
|
126
|
+
} catch (v) {
|
|
127
|
+
m(
|
|
128
|
+
k({
|
|
129
|
+
type: "danger",
|
|
130
|
+
message: v.response?.data?.title || v.message
|
|
131
|
+
})
|
|
132
|
+
);
|
|
133
|
+
} finally {
|
|
134
|
+
m(B(!1));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
[A.userId, J, c, o, T]
|
|
139
|
+
), L = G(
|
|
140
|
+
(s) => {
|
|
141
|
+
m(
|
|
142
|
+
de({
|
|
143
|
+
isOpen: !0,
|
|
144
|
+
type: "warning",
|
|
145
|
+
message: S("do_you_want_to_remove_this_user"),
|
|
146
|
+
onConfirm: async () => {
|
|
147
|
+
m(B(!0));
|
|
148
|
+
try {
|
|
149
|
+
const l = await Le(s);
|
|
150
|
+
l?.data?.requireTransfer ? P({
|
|
151
|
+
isOpen: !0,
|
|
152
|
+
userId: s,
|
|
153
|
+
msTeachers: l.data.ms?.teachers || [],
|
|
154
|
+
esTeachers: l.data.es?.teachers || []
|
|
155
|
+
}) : (m(
|
|
156
|
+
k({
|
|
157
|
+
type: "success",
|
|
158
|
+
message: "Remove user successfully"
|
|
159
|
+
})
|
|
160
|
+
), c.currentPage !== 1 ? o({ currentPage: 1 }) : T());
|
|
161
|
+
} catch (l) {
|
|
162
|
+
m(
|
|
163
|
+
k({
|
|
164
|
+
type: "danger",
|
|
165
|
+
message: l.response?.data?.title || l.message
|
|
166
|
+
})
|
|
167
|
+
);
|
|
168
|
+
} finally {
|
|
169
|
+
m(B(!1));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
);
|
|
174
|
+
},
|
|
175
|
+
[JSON.stringify(c)]
|
|
176
|
+
), w = [
|
|
177
|
+
{ role: "Admin", path: qs },
|
|
178
|
+
{ role: "Teacher", path: fe },
|
|
179
|
+
{ role: "Assistant", path: fe },
|
|
180
|
+
{ role: "Counselor", path: fe },
|
|
181
|
+
{ role: "SecondaryTeacher", path: fe },
|
|
182
|
+
{ role: "EduTeacher", path: Xs },
|
|
183
|
+
{ role: "Student", path: Ks },
|
|
184
|
+
{ role: "Parent", path: Ws }
|
|
185
|
+
], q = (s) => {
|
|
186
|
+
const l = sessionStorage.getItem(cs), _ = s.data?.token;
|
|
187
|
+
let v = s.data.msRoles || [], E = s.data.esRoles || [];
|
|
188
|
+
const N = s.data.roles || s.data.userRoles || [], M = (s.data.appType || "").toUpperCase();
|
|
189
|
+
v.length === 0 && E.length === 0 && N.length > 0 && (M.includes("ES") && !M.includes("MS") ? E = N : M.includes("MS") && !M.includes("ES") ? v = N : (v = N, E = N));
|
|
190
|
+
const I = s.data?.id || s.data?.userId, D = ((I ? localStorage.getItem(`PREFERRED_ROLE_${I}`) : null) || "").split(",").map((ee) => ee.trim()).filter(Boolean), $ = D[0];
|
|
191
|
+
let x = "MS", U = "/home", Q = !1;
|
|
192
|
+
if (!(v.includes("Admin") || E.includes("Admin")) && $ && (v.includes($) || E.includes($))) {
|
|
193
|
+
x = v.includes($) ? "MS" : "ES";
|
|
194
|
+
const se = w.find((te) => te.role === $);
|
|
195
|
+
se && (U = se.path, Q = !0);
|
|
196
|
+
}
|
|
197
|
+
if (!Q)
|
|
198
|
+
for (const { role: ee, path: se } of w) {
|
|
199
|
+
const te = v.includes(ee), qe = E.includes(ee);
|
|
200
|
+
if (!(!te && !qe)) {
|
|
201
|
+
x = te ? "MS" : "ES", U = se, Q = !0;
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
Q || (x = v.length > 0 ? "MS" : E.length > 0 ? "ES" : "MS");
|
|
206
|
+
const W = x === "ES" ? E : v;
|
|
207
|
+
l ? sessionStorage.setItem(Ae, _) : localStorage.setItem(Ae, _);
|
|
208
|
+
let K = "";
|
|
209
|
+
W.includes("Admin") ? K = "Admin" : D.length > 0 && D.every((se) => W.includes(se)) ? D.length > 1 ? K = D.every((te) => te === "Teacher" || te === "Assistant") ? "Teacher,Assistant" : D[0] : K = D[0] : W.includes("Teacher") ? K = W.includes("Assistant") ? "Teacher,Assistant" : "Teacher" : W.includes("Assistant") ? K = "Assistant" : W.includes("Counselor") ? K = "Counselor" : W.includes("SecondaryTeacher") ? K = "SecondaryTeacher" : W.includes("EduTeacher") ? K = "EduTeacher" : W.includes("Student") ? K = "Student" : W.includes("Parent") ? K = "Parent" : W.length > 0 && (K = W[0]), K && (localStorage.setItem("ROLES", K), sessionStorage.setItem("ACTIVE_ROLE", K)), localStorage.removeItem(ls), d && (U = Ys);
|
|
210
|
+
const Je = (String(s.data.preferredAppType || "").split(",").map((ee) => ee.trim().toUpperCase()).filter(Boolean)[0] || "") === "HS" ? "HS" : "MS";
|
|
211
|
+
Z() || localStorage.setItem("ACTIVE_TIER", Je);
|
|
212
|
+
const Ke = x === "ES" && !W.includes("Admin") ? `/es${U}` : U;
|
|
213
|
+
window.location.href = Ke;
|
|
214
|
+
}, C = G(
|
|
215
|
+
async (s) => {
|
|
216
|
+
try {
|
|
217
|
+
const _ = (await Ns(s)).data;
|
|
218
|
+
m(
|
|
219
|
+
de({
|
|
220
|
+
isOpen: !0,
|
|
221
|
+
type: "warning",
|
|
222
|
+
message: S("do_you_want_to_impersonate_this_user"),
|
|
223
|
+
onConfirm: async () => {
|
|
224
|
+
m(B(!0));
|
|
225
|
+
try {
|
|
226
|
+
const v = {
|
|
227
|
+
email: _.email,
|
|
228
|
+
password: "default",
|
|
229
|
+
accessToken: _.token,
|
|
230
|
+
loginType: Ps.Impersonate
|
|
231
|
+
}, E = await os(v), N = {};
|
|
232
|
+
for (let M = 0; M < localStorage.length; M++) {
|
|
233
|
+
const I = localStorage.key(M);
|
|
234
|
+
I && (I === "SELECTED_TIER" || I.startsWith("SELECTED_TIER_") || I.startsWith("PREFERRED_ROLE_")) && (N[I] = localStorage.getItem(I) || "");
|
|
235
|
+
}
|
|
236
|
+
localStorage.clear(), Object.keys(N).forEach((M) => {
|
|
237
|
+
localStorage.setItem(M, N[M]);
|
|
238
|
+
}), q(E);
|
|
239
|
+
} catch (v) {
|
|
240
|
+
k({
|
|
241
|
+
type: "danger",
|
|
242
|
+
message: v.response?.data?.title || v.message
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
m(B(!1));
|
|
246
|
+
}
|
|
247
|
+
})
|
|
248
|
+
);
|
|
249
|
+
} catch (l) {
|
|
250
|
+
m(
|
|
251
|
+
k({
|
|
252
|
+
type: "danger",
|
|
253
|
+
message: l.response?.data?.title || l.message
|
|
254
|
+
})
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
[c]
|
|
259
|
+
);
|
|
260
|
+
return {
|
|
261
|
+
userList: r,
|
|
262
|
+
totalItems: i,
|
|
263
|
+
filters: c,
|
|
264
|
+
queryName: n,
|
|
265
|
+
fullName: p,
|
|
266
|
+
getData: T,
|
|
267
|
+
removeData: L,
|
|
268
|
+
changeFilters: o,
|
|
269
|
+
reDirectDetailPage: (s) => {
|
|
270
|
+
const l = s ? `${Gs}/${s}` : Vs;
|
|
271
|
+
e(l);
|
|
272
|
+
},
|
|
273
|
+
switchUser: C,
|
|
274
|
+
handleSyncRosterUsers: V,
|
|
275
|
+
rosterUserInfo: y,
|
|
276
|
+
userIds: u,
|
|
277
|
+
onSelectAllUser: O,
|
|
278
|
+
onSelectUser: f,
|
|
279
|
+
isCheckAll: g,
|
|
280
|
+
transferModal: A,
|
|
281
|
+
closeTransferModal: J,
|
|
282
|
+
confirmTransferRemove: h
|
|
283
|
+
};
|
|
284
|
+
}, Zs = {
|
|
285
|
+
fontWeight: 500
|
|
286
|
+
}, et = {
|
|
287
|
+
height: 38,
|
|
288
|
+
background: "#316cd9"
|
|
289
|
+
}, st = ({
|
|
290
|
+
text: e,
|
|
291
|
+
onClick: t,
|
|
292
|
+
className: n = ""
|
|
293
|
+
}) => /* @__PURE__ */ b(
|
|
294
|
+
he,
|
|
295
|
+
{
|
|
296
|
+
onClick: t,
|
|
297
|
+
color: "primary",
|
|
298
|
+
style: et,
|
|
299
|
+
className: `d-flex align-items-center ${n} gap-2`,
|
|
300
|
+
children: [
|
|
301
|
+
/* @__PURE__ */ a(is, {}),
|
|
302
|
+
/* @__PURE__ */ a("span", { style: Zs, children: e })
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
);
|
|
306
|
+
function tt(e) {
|
|
307
|
+
return oe({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M21 3H5a1 1 0 0 0-1 1v2.59c0 .523.213 1.037.583 1.407L10 13.414V21a1.001 1.001 0 0 0 1.447.895l4-2c.339-.17.553-.516.553-.895v-5.586l5.417-5.417c.37-.37.583-.884.583-1.407V4a1 1 0 0 0-1-1zm-6.707 9.293A.996.996 0 0 0 14 13v5.382l-2 1V13a.996.996 0 0 0-.293-.707L6 6.59V5h14.001l.002 1.583-5.71 5.71z" } }] })(e);
|
|
308
|
+
}
|
|
309
|
+
function at(e) {
|
|
310
|
+
return oe({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M19.023 16.977a35.13 35.13 0 0 1-1.367-1.384c-.372-.378-.596-.653-.596-.653l-2.8-1.337A6.962 6.962 0 0 0 16 9c0-3.859-3.14-7-7-7S2 5.141 2 9s3.14 7 7 7c1.763 0 3.37-.66 4.603-1.739l1.337 2.8s.275.224.653.596c.387.363.896.854 1.384 1.367l1.358 1.392.604.646 2.121-2.121-.646-.604c-.379-.372-.885-.866-1.391-1.36zM9 14c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5z" } }] })(e);
|
|
311
|
+
}
|
|
312
|
+
function nt(e) {
|
|
313
|
+
return oe({ attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M3 3a1 1 0 011-1h12a1 1 0 011 1v3a1 1 0 01-.293.707L12 11.414V15a1 1 0 01-.293.707l-2 2A1 1 0 018 17v-5.586L3.293 6.707A1 1 0 013 6V3z", clipRule: "evenodd" } }] })(e);
|
|
314
|
+
}
|
|
315
|
+
function Jt(e) {
|
|
316
|
+
return oe({ attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] })(e);
|
|
317
|
+
}
|
|
318
|
+
function je(e) {
|
|
319
|
+
return oe({ attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M839.6 433.8L749 150.5a9.24 9.24 0 0 0-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 0 0-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 0 0-9.2-9.3zM416 702h-76V172c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v530h-76c-6.7 0-10.5 7.8-6.3 13l112 141.9a8 8 0 0 0 12.6 0l112-141.9c4.1-5.2.4-13-6.3-13z" } }] })(e);
|
|
320
|
+
}
|
|
321
|
+
function ze(e) {
|
|
322
|
+
return oe({ attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M839.6 433.8L749 150.5a9.24 9.24 0 0 0-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 0 0-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 0 0-9.2-9.3zM310.3 167.1a8 8 0 0 0-12.6 0L185.7 309c-4.2 5.3-.4 13 6.3 13h76v530c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V322h76c6.7 0 10.5-7.8 6.3-13l-112-141.9z" } }] })(e);
|
|
323
|
+
}
|
|
324
|
+
const rt = (e, t) => {
|
|
325
|
+
X(() => {
|
|
326
|
+
function n(r) {
|
|
327
|
+
e.current && !e.current.contains(r.target) && t?.();
|
|
328
|
+
}
|
|
329
|
+
return document.addEventListener("mousedown", n), () => {
|
|
330
|
+
document.removeEventListener("mousedown", n);
|
|
331
|
+
};
|
|
332
|
+
}, [e.current]);
|
|
333
|
+
}, ot = (e) => {
|
|
334
|
+
const {
|
|
335
|
+
isOpen: t,
|
|
336
|
+
sortBy: n,
|
|
337
|
+
filters: r,
|
|
338
|
+
users: i,
|
|
339
|
+
searchBy: c,
|
|
340
|
+
defaultOptions: o,
|
|
341
|
+
selectedOptions: p,
|
|
342
|
+
searchKey: u,
|
|
343
|
+
onChangeSearchKey: R,
|
|
344
|
+
onOptionsChange: d,
|
|
345
|
+
onSearch: m,
|
|
346
|
+
onClose: S,
|
|
347
|
+
onChangeFilters: f,
|
|
348
|
+
getOption: g
|
|
349
|
+
} = e, [O, T] = z(), [V, y] = z([]), [A, P] = z(r?.ExactRoleMatch ?? !1), J = _e(null), h = _e(null);
|
|
350
|
+
rt(J, S);
|
|
351
|
+
const { t: L } = re(), w = G(
|
|
352
|
+
() => {
|
|
353
|
+
if (!t) return;
|
|
354
|
+
const I = u?.trim?.() ?? "";
|
|
355
|
+
c != null && !o && m?.(I, c), c != null && o && y(o.filter((j) => j.label.toLowerCase().includes(I.toLowerCase())));
|
|
356
|
+
},
|
|
357
|
+
[c, u, JSON.stringify(o), t]
|
|
358
|
+
), q = () => {
|
|
359
|
+
h.current && clearTimeout(h.current), h.current = setTimeout(w, 500);
|
|
360
|
+
}, C = (I) => {
|
|
361
|
+
const j = I.target.value;
|
|
362
|
+
R(j);
|
|
363
|
+
}, H = G(() => {
|
|
364
|
+
const I = c === Y.Role ? { ExactRoleMatch: A } : {};
|
|
365
|
+
d?.(O, c, I), S?.();
|
|
366
|
+
}, [JSON.stringify(O), A, c]), s = G((I) => {
|
|
367
|
+
const j = I.target.value ?? "";
|
|
368
|
+
let D = O ?? [], $ = D.indexOf(j);
|
|
369
|
+
$ > -1 ? D.splice($, 1) : D = [...D, j], T(D == null ? D : [...D]);
|
|
370
|
+
}, [JSON.stringify(O)]), l = G((I) => {
|
|
371
|
+
const j = I.target.checked;
|
|
372
|
+
T(j ? void 0 : []);
|
|
373
|
+
}, []), _ = G(() => {
|
|
374
|
+
f?.({
|
|
375
|
+
...r,
|
|
376
|
+
sortBy: n,
|
|
377
|
+
isDescending: !0
|
|
378
|
+
}), S?.();
|
|
379
|
+
}, [JSON.stringify(r), c]), v = G(() => {
|
|
380
|
+
f?.({
|
|
381
|
+
...r,
|
|
382
|
+
sortBy: n,
|
|
383
|
+
isDescending: !1
|
|
384
|
+
}), S?.();
|
|
385
|
+
}, [JSON.stringify(r), c]), E = ne(() => g ? i.map((I) => g(I, L)) : [], [JSON.stringify(i), JSON.stringify(g)]), N = r?.isDescending == !1 && r.sortBy === n, M = !!r?.isDescending && r.sortBy === n;
|
|
386
|
+
return X(() => {
|
|
387
|
+
T(p ? [...p] : void 0);
|
|
388
|
+
}, [JSON.stringify(p), t]), X(() => {
|
|
389
|
+
y(o || []);
|
|
390
|
+
}, [JSON.stringify(o)]), X(() => {
|
|
391
|
+
P(r?.ExactRoleMatch ?? !1);
|
|
392
|
+
}, [r?.ExactRoleMatch, t]), X(() => {
|
|
393
|
+
q();
|
|
394
|
+
}, [u, t]), {
|
|
395
|
+
ref: J,
|
|
396
|
+
options: E,
|
|
397
|
+
inputRef: h,
|
|
398
|
+
sOptions: O,
|
|
399
|
+
isAscending: N,
|
|
400
|
+
isDescending: M,
|
|
401
|
+
filteredOptions: V,
|
|
402
|
+
searchKey: u,
|
|
403
|
+
handleSearch: w,
|
|
404
|
+
handleApplyFilter: H,
|
|
405
|
+
handleOptionSelected: s,
|
|
406
|
+
handleOptionSelectedAll: l,
|
|
407
|
+
handleSortDesc: _,
|
|
408
|
+
handleSortAsc: v,
|
|
409
|
+
handleChangeSearchKey: C,
|
|
410
|
+
isExactRoleMatch: A,
|
|
411
|
+
setIsExactRoleMatch: P
|
|
412
|
+
};
|
|
413
|
+
}, ct = (e) => {
|
|
414
|
+
const {
|
|
415
|
+
defaultOptions: t,
|
|
416
|
+
onClose: n,
|
|
417
|
+
getOption: r,
|
|
418
|
+
searchBy: i
|
|
419
|
+
} = e, { t: c } = re(), {
|
|
420
|
+
ref: o,
|
|
421
|
+
inputRef: p,
|
|
422
|
+
options: u,
|
|
423
|
+
sOptions: R,
|
|
424
|
+
isAscending: d,
|
|
425
|
+
isDescending: m,
|
|
426
|
+
filteredOptions: S,
|
|
427
|
+
searchKey: f,
|
|
428
|
+
handleChangeSearchKey: g,
|
|
429
|
+
handleApplyFilter: O,
|
|
430
|
+
handleOptionSelected: T,
|
|
431
|
+
handleOptionSelectedAll: V,
|
|
432
|
+
handleSortDesc: y,
|
|
433
|
+
handleSortAsc: A,
|
|
434
|
+
isExactRoleMatch: P,
|
|
435
|
+
setIsExactRoleMatch: J
|
|
436
|
+
} = ot(e);
|
|
437
|
+
return /* @__PURE__ */ a(Xe, { ...e, hideArrow: !0, className: F["popover-zindex"], children: /* @__PURE__ */ a(Qe, { className: "pb-3", children: /* @__PURE__ */ b("div", { ref: o, className: F.popover, children: [
|
|
438
|
+
/* @__PURE__ */ b(
|
|
439
|
+
"div",
|
|
440
|
+
{
|
|
441
|
+
className: `d-flex flex-column ${F.popover__sort}`,
|
|
442
|
+
children: [
|
|
443
|
+
/* @__PURE__ */ a(ae, { className: "font-weight-bold", children: "Sort" }),
|
|
444
|
+
/* @__PURE__ */ b(
|
|
445
|
+
"div",
|
|
446
|
+
{
|
|
447
|
+
className: `px-1 ${F.popover__sort__item} ${d && F["popover__sort__item--active"]}`,
|
|
448
|
+
onClick: A,
|
|
449
|
+
children: [
|
|
450
|
+
/* @__PURE__ */ a(je, { className: "mr-1" }),
|
|
451
|
+
"Ascending"
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
),
|
|
455
|
+
/* @__PURE__ */ b(
|
|
456
|
+
"div",
|
|
457
|
+
{
|
|
458
|
+
className: `px-1 mt-1 ${F.popover__sort__item} ${m && F["popover__sort__item--active"]}`,
|
|
459
|
+
onClick: y,
|
|
460
|
+
children: [
|
|
461
|
+
/* @__PURE__ */ a(ze, { className: "mr-1" }),
|
|
462
|
+
"Descending"
|
|
463
|
+
]
|
|
464
|
+
}
|
|
465
|
+
)
|
|
466
|
+
]
|
|
467
|
+
}
|
|
468
|
+
),
|
|
469
|
+
(typeof r < "u" || !!t) && /* @__PURE__ */ b(Ye, { children: [
|
|
470
|
+
/* @__PURE__ */ a("div", { className: "border border-top-1 border-bottom-0 mx-1 my-2" }),
|
|
471
|
+
/* @__PURE__ */ b("div", { className: "d-flex flex-column", children: [
|
|
472
|
+
/* @__PURE__ */ b("div", { className: "d-flex justify-content-between align-items-center mb-2 px-1", children: [
|
|
473
|
+
/* @__PURE__ */ a(ae, { className: "font-weight-bold mb-0", children: "Filter" }),
|
|
474
|
+
i === Y.Role && /* @__PURE__ */ b(
|
|
475
|
+
"div",
|
|
476
|
+
{
|
|
477
|
+
className: "d-flex align-items-center",
|
|
478
|
+
style: { gap: "5px", cursor: "pointer" },
|
|
479
|
+
onClick: () => J(!P),
|
|
480
|
+
children: [
|
|
481
|
+
/* @__PURE__ */ a(
|
|
482
|
+
"input",
|
|
483
|
+
{
|
|
484
|
+
type: "checkbox",
|
|
485
|
+
id: "exact-role-match-checkbox",
|
|
486
|
+
checked: P,
|
|
487
|
+
onChange: (h) => J(h.target.checked),
|
|
488
|
+
onClick: (h) => h.stopPropagation(),
|
|
489
|
+
style: { cursor: "pointer", margin: 0 }
|
|
490
|
+
}
|
|
491
|
+
),
|
|
492
|
+
/* @__PURE__ */ a(
|
|
493
|
+
"label",
|
|
494
|
+
{
|
|
495
|
+
htmlFor: "exact-role-match-checkbox",
|
|
496
|
+
className: "small font-weight-normal text-muted mb-0",
|
|
497
|
+
style: { cursor: "pointer", userSelect: "none", fontSize: "12px" },
|
|
498
|
+
onClick: (h) => h.stopPropagation(),
|
|
499
|
+
children: c("exact_match", "Exact match")
|
|
500
|
+
}
|
|
501
|
+
)
|
|
502
|
+
]
|
|
503
|
+
}
|
|
504
|
+
)
|
|
505
|
+
] }),
|
|
506
|
+
/* @__PURE__ */ b("div", { className: `position-relative px-1 ${F.popover__search}`, children: [
|
|
507
|
+
/* @__PURE__ */ a(
|
|
508
|
+
at,
|
|
509
|
+
{
|
|
510
|
+
className: `position-absolute ${F.popover__search__icon}`
|
|
511
|
+
}
|
|
512
|
+
),
|
|
513
|
+
/* @__PURE__ */ a(
|
|
514
|
+
ie,
|
|
515
|
+
{
|
|
516
|
+
ref: p,
|
|
517
|
+
className: F.popover__search__input,
|
|
518
|
+
value: f,
|
|
519
|
+
onChange: g
|
|
520
|
+
}
|
|
521
|
+
)
|
|
522
|
+
] }),
|
|
523
|
+
/* @__PURE__ */ b(
|
|
524
|
+
"div",
|
|
525
|
+
{
|
|
526
|
+
className: `mx-1 mt-2 p-2 bg-light ${F.popover__options}`,
|
|
527
|
+
children: [
|
|
528
|
+
/* @__PURE__ */ b(
|
|
529
|
+
me,
|
|
530
|
+
{
|
|
531
|
+
className: "d-flex align-items-center",
|
|
532
|
+
check: !0,
|
|
533
|
+
style: { gap: "8px" },
|
|
534
|
+
children: [
|
|
535
|
+
/* @__PURE__ */ a(
|
|
536
|
+
ie,
|
|
537
|
+
{
|
|
538
|
+
type: "checkbox",
|
|
539
|
+
onChange: V,
|
|
540
|
+
checked: R == null
|
|
541
|
+
}
|
|
542
|
+
),
|
|
543
|
+
" ",
|
|
544
|
+
/* @__PURE__ */ a(ae, { check: !0, children: "(Select all)" })
|
|
545
|
+
]
|
|
546
|
+
}
|
|
547
|
+
),
|
|
548
|
+
!!r && !t && u.map((h) => /* @__PURE__ */ b(
|
|
549
|
+
me,
|
|
550
|
+
{
|
|
551
|
+
className: "d-flex align-items-center",
|
|
552
|
+
check: !0,
|
|
553
|
+
style: { gap: "8px" },
|
|
554
|
+
children: [
|
|
555
|
+
/* @__PURE__ */ a(
|
|
556
|
+
ie,
|
|
557
|
+
{
|
|
558
|
+
type: "checkbox",
|
|
559
|
+
value: h.value,
|
|
560
|
+
onChange: T,
|
|
561
|
+
checked: R?.includes(h.value) || R == null
|
|
562
|
+
}
|
|
563
|
+
),
|
|
564
|
+
" ",
|
|
565
|
+
/* @__PURE__ */ a(ae, { check: !0, children: h.label })
|
|
566
|
+
]
|
|
567
|
+
},
|
|
568
|
+
h.value
|
|
569
|
+
)),
|
|
570
|
+
!!t && S.map((h) => /* @__PURE__ */ b(
|
|
571
|
+
me,
|
|
572
|
+
{
|
|
573
|
+
className: "d-flex align-items-center",
|
|
574
|
+
check: !0,
|
|
575
|
+
style: { gap: "8px" },
|
|
576
|
+
children: [
|
|
577
|
+
/* @__PURE__ */ a(
|
|
578
|
+
ie,
|
|
579
|
+
{
|
|
580
|
+
type: "checkbox",
|
|
581
|
+
value: h.value,
|
|
582
|
+
onChange: T,
|
|
583
|
+
checked: R?.includes(h.value) || R == null
|
|
584
|
+
}
|
|
585
|
+
),
|
|
586
|
+
" ",
|
|
587
|
+
/* @__PURE__ */ a(ae, { check: !0, children: h.label })
|
|
588
|
+
]
|
|
589
|
+
},
|
|
590
|
+
h.value
|
|
591
|
+
))
|
|
592
|
+
]
|
|
593
|
+
}
|
|
594
|
+
)
|
|
595
|
+
] }),
|
|
596
|
+
/* @__PURE__ */ b("div", { className: "d-flex justify-content-end mt-3", style: { gap: "8px" }, children: [
|
|
597
|
+
/* @__PURE__ */ a(
|
|
598
|
+
he,
|
|
599
|
+
{
|
|
600
|
+
color: "primary",
|
|
601
|
+
className: "mr-2",
|
|
602
|
+
size: "sm",
|
|
603
|
+
onClick: O,
|
|
604
|
+
children: "Apply Filter"
|
|
605
|
+
}
|
|
606
|
+
),
|
|
607
|
+
/* @__PURE__ */ a(
|
|
608
|
+
he,
|
|
609
|
+
{
|
|
610
|
+
color: "secondary",
|
|
611
|
+
size: "sm",
|
|
612
|
+
onClick: n,
|
|
613
|
+
children: "Cancel"
|
|
614
|
+
}
|
|
615
|
+
)
|
|
616
|
+
] })
|
|
617
|
+
] })
|
|
618
|
+
] }) }) });
|
|
619
|
+
}, lt = ({
|
|
620
|
+
data: e,
|
|
621
|
+
popoverId: t,
|
|
622
|
+
filters: n,
|
|
623
|
+
searchString: r,
|
|
624
|
+
users: i,
|
|
625
|
+
selectedOptions: c,
|
|
626
|
+
onOptionsChange: o,
|
|
627
|
+
onSearch: p,
|
|
628
|
+
onChangeFilters: u,
|
|
629
|
+
onOpenFilter: R,
|
|
630
|
+
onClose: d,
|
|
631
|
+
isCenter: m,
|
|
632
|
+
isActive: S = !1
|
|
633
|
+
}) => {
|
|
634
|
+
const { t: f } = re(), [g, O] = z(""), T = ne(
|
|
635
|
+
() => e.sortBy != null ? Bs[e.sortBy] : "",
|
|
636
|
+
[e.sortBy]
|
|
637
|
+
), V = ne(() => t === T, [T, t]), y = () => {
|
|
638
|
+
R?.(T, e.searchBy, g, e.sortBy);
|
|
639
|
+
}, A = (P) => {
|
|
640
|
+
O(P);
|
|
641
|
+
};
|
|
642
|
+
return /* @__PURE__ */ a("th", { className: e.className, children: T && e.sortBy !== void 0 ? /* @__PURE__ */ b("div", { className: `w-100 d-flex ${m ? "justify-content-center" : "justify-content-between"} align-items-center ${F["table-filter-icon"]}`, children: [
|
|
643
|
+
f(e.name),
|
|
644
|
+
/* @__PURE__ */ b(
|
|
645
|
+
"div",
|
|
646
|
+
{
|
|
647
|
+
className: "ml-2 p-1",
|
|
648
|
+
id: T,
|
|
649
|
+
onClick: y,
|
|
650
|
+
style: {
|
|
651
|
+
cursor: "pointer"
|
|
652
|
+
},
|
|
653
|
+
children: [
|
|
654
|
+
e.sortBy !== void 0 && e.sortBy === n?.sortBy && /* @__PURE__ */ a("span", { children: n.isDescending ? /* @__PURE__ */ a(ze, {}) : /* @__PURE__ */ a(je, {}) }),
|
|
655
|
+
n?.searchByStrings?.length && e.searchBy === n?.searchBy ? /* @__PURE__ */ a(nt, { color: S ? "#007bff" : "#242424" }) : /* @__PURE__ */ a(tt, { color: S ? "#007bff" : "#242424" })
|
|
656
|
+
]
|
|
657
|
+
}
|
|
658
|
+
),
|
|
659
|
+
/* @__PURE__ */ a(
|
|
660
|
+
ct,
|
|
661
|
+
{
|
|
662
|
+
placement: "bottom-end",
|
|
663
|
+
target: T,
|
|
664
|
+
users: i,
|
|
665
|
+
isOpen: V,
|
|
666
|
+
filters: n,
|
|
667
|
+
sortBy: e.sortBy,
|
|
668
|
+
searchKey: g,
|
|
669
|
+
searchBy: e.searchBy,
|
|
670
|
+
searchString: r,
|
|
671
|
+
defaultOptions: e.options,
|
|
672
|
+
selectedOptions: c,
|
|
673
|
+
onClose: d,
|
|
674
|
+
onSearch: p,
|
|
675
|
+
getOption: e.getOption,
|
|
676
|
+
onChangeFilters: u,
|
|
677
|
+
onOptionsChange: o,
|
|
678
|
+
onChangeSearchKey: A
|
|
679
|
+
}
|
|
680
|
+
)
|
|
681
|
+
] }) : f(e.name) });
|
|
682
|
+
}, it = () => {
|
|
683
|
+
try {
|
|
684
|
+
const e = ds()?.split(".")[1];
|
|
685
|
+
if (!e) return null;
|
|
686
|
+
const t = atob(e.replace(/-/g, "+").replace(/_/g, "/"));
|
|
687
|
+
return JSON.parse(decodeURIComponent(t.split("").map((n) => "%" + n.charCodeAt(0).toString(16).padStart(2, "0")).join("")));
|
|
688
|
+
} catch {
|
|
689
|
+
return null;
|
|
690
|
+
}
|
|
691
|
+
}, dt = (e = it()) => {
|
|
692
|
+
const t = ["es", "ms", "hs"].filter((n) => String(e?.[`${n}_roles`] ?? "").split(",").some((r) => r.trim().toLowerCase() === "admin"));
|
|
693
|
+
return t.length === 0 ? ks : (Z() && (t.includes("ms") || t.includes("hs")) && t.push("ms", "hs"), Ms.filter((n) => t.includes(n.schoolLevel)).map((n) => n.value));
|
|
694
|
+
}, Kt = (e, t) => {
|
|
695
|
+
const n = [];
|
|
696
|
+
if (t === ve.Teacher)
|
|
697
|
+
for (const i of e)
|
|
698
|
+
for (const c of i.teachers || [])
|
|
699
|
+
n.push({
|
|
700
|
+
label: c.mainTeacherEmail,
|
|
701
|
+
value: c.teacherUserId,
|
|
702
|
+
name: c.mainTeacherName
|
|
703
|
+
});
|
|
704
|
+
else if (t === ve.Assistant)
|
|
705
|
+
for (const i of e)
|
|
706
|
+
i.assistantEmail && i.assistantUserId && n.push({
|
|
707
|
+
label: i.assistantEmail,
|
|
708
|
+
value: i.assistantUserId,
|
|
709
|
+
name: i.assistantName || ""
|
|
710
|
+
});
|
|
711
|
+
else if (t === ve.Counselor)
|
|
712
|
+
for (const i of e)
|
|
713
|
+
for (const c of i.counselors || [])
|
|
714
|
+
n.push({
|
|
715
|
+
label: c.counselorEmail,
|
|
716
|
+
value: c.counselorUserId,
|
|
717
|
+
name: c.counselorName
|
|
718
|
+
});
|
|
719
|
+
const r = /* @__PURE__ */ new Map();
|
|
720
|
+
for (const i of n)
|
|
721
|
+
r.has(i.value) || r.set(i.value, i);
|
|
722
|
+
return Array.from(r.values()).sort(
|
|
723
|
+
(i, c) => i.label.localeCompare(c.label)
|
|
724
|
+
);
|
|
725
|
+
}, mt = ["K", "1", "2", "3", "4", "5"], ht = ["6", "7", "8"], ut = ["9", "10", "11", "12", "12/13", "PCS"], pt = (e) => {
|
|
726
|
+
const t = e.gradeLevel ? String(e.gradeLevel).trim() : "";
|
|
727
|
+
if (t) {
|
|
728
|
+
if (ut.includes(t)) return "hs";
|
|
729
|
+
if (mt.includes(t)) return "es";
|
|
730
|
+
if (ht.includes(t)) return "ms";
|
|
731
|
+
}
|
|
732
|
+
return e.schoolLevel ? e.schoolLevel.toLowerCase() : "ms";
|
|
733
|
+
}, gt = (e) => {
|
|
734
|
+
if (!e) return;
|
|
735
|
+
const t = pt(e);
|
|
736
|
+
return Z() && t === "hs" ? "ms" : t;
|
|
737
|
+
}, ft = (e, t) => {
|
|
738
|
+
if (!t) return !0;
|
|
739
|
+
const n = e?.schoolLevel ? String(e.schoolLevel).toLowerCase() : "";
|
|
740
|
+
return !n || Z() && t === "ms" && n.includes("hs") ? !0 : n === t || n.includes(t) || n === "both";
|
|
741
|
+
}, qt = (e, t, n) => {
|
|
742
|
+
const r = t?.[0], i = n?.find((o) => o.id === r), c = gt(i);
|
|
743
|
+
return e.filter((o) => ft(o, c));
|
|
744
|
+
}, yt = (e) => {
|
|
745
|
+
const {
|
|
746
|
+
headers: t,
|
|
747
|
+
filters: n,
|
|
748
|
+
onChangeFilters: r,
|
|
749
|
+
isStudentFilter: i,
|
|
750
|
+
teacherOptions: c,
|
|
751
|
+
assistantOptions: o,
|
|
752
|
+
counselorOptions: p,
|
|
753
|
+
secondaryTeacherOptions: u
|
|
754
|
+
} = e, [R, d] = z(), [m, S] = z([]), [f, g] = z({
|
|
755
|
+
...$s,
|
|
756
|
+
isDescending: n.isDescending,
|
|
757
|
+
searchString: n.searchString
|
|
758
|
+
}), O = ue(), T = rs(), V = G(
|
|
759
|
+
async (h) => {
|
|
760
|
+
try {
|
|
761
|
+
const w = (i ? await Is(f) : await As({ ...f, byStudent: h })).data?.items || [];
|
|
762
|
+
S(w);
|
|
763
|
+
} catch (L) {
|
|
764
|
+
O(
|
|
765
|
+
k({
|
|
766
|
+
type: "danger",
|
|
767
|
+
message: L.response?.data?.title || L.message
|
|
768
|
+
})
|
|
769
|
+
);
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
[JSON.stringify(f), i]
|
|
773
|
+
), y = G((h, L, w, q) => {
|
|
774
|
+
d(h), g({
|
|
775
|
+
...f,
|
|
776
|
+
searchBy: L,
|
|
777
|
+
searchStringBy: w,
|
|
778
|
+
isDescending: n.sortBy === q ? n.isDescending : void 0,
|
|
779
|
+
searchString: n.searchString
|
|
780
|
+
});
|
|
781
|
+
}, [JSON.stringify(f), n.isDescending, n.searchString]), A = () => {
|
|
782
|
+
d("");
|
|
783
|
+
}, P = G((h, L) => {
|
|
784
|
+
g({
|
|
785
|
+
...f,
|
|
786
|
+
searchBy: L,
|
|
787
|
+
searchStringBy: h
|
|
788
|
+
});
|
|
789
|
+
}, [JSON.stringify(f)]), J = G((h, L, w) => {
|
|
790
|
+
L && r?.({
|
|
791
|
+
...n,
|
|
792
|
+
...w,
|
|
793
|
+
currentPage: 1,
|
|
794
|
+
[Y[L]]: h
|
|
795
|
+
});
|
|
796
|
+
}, [JSON.stringify(n)]);
|
|
797
|
+
return X(() => {
|
|
798
|
+
if (!T.pathname.includes("users/assign-student")) return;
|
|
799
|
+
const h = (w) => w.sort((q, C) => q.localeCompare(C)), L = f.searchStringBy?.toLowerCase() || "";
|
|
800
|
+
if (f.searchBy === Y.Grade)
|
|
801
|
+
S(dt());
|
|
802
|
+
else {
|
|
803
|
+
let w = [];
|
|
804
|
+
switch (f.searchBy) {
|
|
805
|
+
case Y.Name:
|
|
806
|
+
V(!0);
|
|
807
|
+
break;
|
|
808
|
+
case Y.Teacher:
|
|
809
|
+
w = c?.map((s) => s.label).filter(Boolean) || [];
|
|
810
|
+
break;
|
|
811
|
+
case Y.Assistant:
|
|
812
|
+
w = o?.map((s) => s.label).filter(Boolean) || [];
|
|
813
|
+
break;
|
|
814
|
+
case Y.Counselor:
|
|
815
|
+
w = p?.map((s) => s.label).filter(Boolean) || [];
|
|
816
|
+
break;
|
|
817
|
+
case Y.SecondaryTeacher:
|
|
818
|
+
w = u?.map((s) => s.label).filter(Boolean) || [];
|
|
819
|
+
break;
|
|
820
|
+
}
|
|
821
|
+
const q = Array.from(new Set(w)), C = L ? q.filter(
|
|
822
|
+
(s) => s.toLowerCase().includes(L)
|
|
823
|
+
) : q, H = h(C);
|
|
824
|
+
S(H);
|
|
825
|
+
}
|
|
826
|
+
}, [
|
|
827
|
+
JSON.stringify(f),
|
|
828
|
+
c,
|
|
829
|
+
o,
|
|
830
|
+
p,
|
|
831
|
+
u,
|
|
832
|
+
T.pathname
|
|
833
|
+
]), X(() => {
|
|
834
|
+
if (f.searchBy === void 0) return;
|
|
835
|
+
const h = t?.find((w) => w.searchBy === f.searchBy);
|
|
836
|
+
if (h?.options && h.options.length > 0 || !h?.getOption)
|
|
837
|
+
return;
|
|
838
|
+
T.pathname.includes("users/assign-student") || V();
|
|
839
|
+
}, [
|
|
840
|
+
JSON.stringify(f),
|
|
841
|
+
T.pathname,
|
|
842
|
+
t
|
|
843
|
+
]), {
|
|
844
|
+
popoverFilters: f,
|
|
845
|
+
popoverId: R,
|
|
846
|
+
users: m,
|
|
847
|
+
handleFilterIcon: y,
|
|
848
|
+
handleCloseFilter: A,
|
|
849
|
+
handleSearch: P,
|
|
850
|
+
handleChangeFilters: J
|
|
851
|
+
};
|
|
852
|
+
}, St = ({
|
|
853
|
+
headers: e,
|
|
854
|
+
filters: t,
|
|
855
|
+
onChangeFilters: n,
|
|
856
|
+
isStudentFilter: r,
|
|
857
|
+
teacherOptions: i = [],
|
|
858
|
+
assistantOptions: c = [],
|
|
859
|
+
counselorOptions: o = [],
|
|
860
|
+
secondaryTeacherOptions: p = []
|
|
861
|
+
}) => {
|
|
862
|
+
const {
|
|
863
|
+
popoverId: u,
|
|
864
|
+
users: R,
|
|
865
|
+
handleFilterIcon: d,
|
|
866
|
+
handleCloseFilter: m,
|
|
867
|
+
handleSearch: S,
|
|
868
|
+
handleChangeFilters: f
|
|
869
|
+
} = yt({
|
|
870
|
+
headers: e,
|
|
871
|
+
filters: t,
|
|
872
|
+
onChangeFilters: n,
|
|
873
|
+
isStudentFilter: r,
|
|
874
|
+
teacherOptions: i,
|
|
875
|
+
assistantOptions: c,
|
|
876
|
+
counselorOptions: o,
|
|
877
|
+
secondaryTeacherOptions: p
|
|
878
|
+
}), g = Object.entries(t).filter(
|
|
879
|
+
([y, A]) => A !== "" && !(Array.isArray(A) && A.length === 0) && A !== null && A !== void 0
|
|
880
|
+
).map(([y]) => y), O = Object.entries(Y).filter(([y, A]) => isNaN(Number(y))), T = g.map((y) => O.find(([A]) => A === y)).filter((y) => !!y), V = (y) => {
|
|
881
|
+
if (y.searchBy === void 0) return;
|
|
882
|
+
const A = t[Y[y.searchBy]];
|
|
883
|
+
return Array.isArray(A) ? A : t.searchBy === y.searchBy ? t.searchByStrings : void 0;
|
|
884
|
+
};
|
|
885
|
+
return /* @__PURE__ */ a("tr", { children: e.map((y) => y.onSelectAll ? /* @__PURE__ */ a("th", { className: `align-middle text-center ${y.className}`, children: /* @__PURE__ */ a(
|
|
886
|
+
"input",
|
|
887
|
+
{
|
|
888
|
+
type: "checkbox",
|
|
889
|
+
onChange: () => y.onSelectAll?.(),
|
|
890
|
+
checked: y.isCheckAll ?? !1
|
|
891
|
+
}
|
|
892
|
+
) }, y.name) : /* @__PURE__ */ a(
|
|
893
|
+
lt,
|
|
894
|
+
{
|
|
895
|
+
users: R,
|
|
896
|
+
data: y,
|
|
897
|
+
isCenter: y.isCenter,
|
|
898
|
+
filters: t,
|
|
899
|
+
popoverId: u,
|
|
900
|
+
selectedOptions: V(y),
|
|
901
|
+
onSearch: S,
|
|
902
|
+
onClose: m,
|
|
903
|
+
onOpenFilter: d,
|
|
904
|
+
onChangeFilters: n,
|
|
905
|
+
onOptionsChange: f,
|
|
906
|
+
isActive: typeof y.searchBy == "number" && T.some(([A, P]) => P === y.searchBy)
|
|
907
|
+
},
|
|
908
|
+
y.name
|
|
909
|
+
)) });
|
|
910
|
+
}, vt = () => {
|
|
911
|
+
const e = ue(), t = ye((p) => p?.common?.user?.schoolName) || "", n = async (p) => {
|
|
912
|
+
e(B(!0));
|
|
913
|
+
try {
|
|
914
|
+
const u = Z(), R = await Os(u && p.Tiers?.length ? { ...p, Tiers: De(p.Tiers) } : p), d = R.data.items || R.data, m = u ? d.map(Fe) : d, S = r(m), f = document.createElement("a");
|
|
915
|
+
f.href = S, f.download = `${t}_Users_Report.csv`, f.click();
|
|
916
|
+
} catch (u) {
|
|
917
|
+
e(
|
|
918
|
+
k({
|
|
919
|
+
type: "danger",
|
|
920
|
+
message: u.response?.data?.title || u.message
|
|
921
|
+
})
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
e(B(!1));
|
|
925
|
+
}, r = (p) => {
|
|
926
|
+
let u = `First Name,Last Name,Email,Phone,Age,Grade,Tiers,Role,Active Status,Create Time,Roster Sourced Id,Roster Status,Roster Family Name,Roster Middle Name,Roster Given Name,Roster Email,Roster Role,Roster Grades,Teachers,Assistants,Counselors,SupportTeachers,EduTeachers
|
|
927
|
+
`;
|
|
928
|
+
const R = p.map((d) => {
|
|
929
|
+
const m = d.dateOfBirth !== ms ? Hs(
|
|
930
|
+
/* @__PURE__ */ new Date(),
|
|
931
|
+
js(d.dateOfBirth)
|
|
932
|
+
) : "";
|
|
933
|
+
return `${o(d.firstName)},${o(d.lastName)},${o(d.email)},${o(d.phoneNumber)},${m},${o(d.grade)},${o(d.appType || "")},${o(d.roles.join(", ").replace("SecondaryTeacher", "SupportTeacher"))},${d.isActive ? "Active" : "Inactive"},${Pe(d?.createTime, "yyyy-MM-dd HH:mm")},${o(d.sourcedId)},${o(d.rosterUser?.status)},${o(d.rosterUser?.familyName)},${o(d.rosterUser?.middleName)},${o(d.rosterUser?.givenName)},${o(d.rosterUser?.email)},${o(d.rosterUser?.role)},${o(d.rosterUser?.grades)},${o(d.teachers)},${o(d.assistants)},${o(d.counselors)},${o(d.supportTeachers)},${o(d.eduTeachers)}`;
|
|
934
|
+
}).join(`
|
|
935
|
+
`);
|
|
936
|
+
return `${Ue}${u}${encodeURIComponent(R)}`;
|
|
937
|
+
}, i = async (p) => {
|
|
938
|
+
e(B(!0));
|
|
939
|
+
try {
|
|
940
|
+
const u = await ws(p), R = u?.data?.items || u?.data || [], d = c(R), m = document.createElement("a");
|
|
941
|
+
m.href = d, m.download = "Classcode.csv", m.click();
|
|
942
|
+
} catch (u) {
|
|
943
|
+
e(
|
|
944
|
+
k({
|
|
945
|
+
type: "danger",
|
|
946
|
+
message: u.response?.data?.title || u.message
|
|
947
|
+
})
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
e(B(!1));
|
|
951
|
+
}, c = (p) => {
|
|
952
|
+
let u = `Teacher name,Teacher Email,Teacher code
|
|
953
|
+
`;
|
|
954
|
+
const m = (Array.isArray(p) ? p : []).filter((S) => S.roles && S.roles.includes("Teacher")).map((S) => `${o(S.fullName)},${o(S.email)},${o(S?.assignCode || "")}`).join(`
|
|
955
|
+
`);
|
|
956
|
+
return `${Ue}${u}${encodeURIComponent(m)}`;
|
|
957
|
+
}, o = (p) => p ? `"${p.replace(/"/g, '""').replaceAll(/\n/g, " ")}"` : "";
|
|
958
|
+
return {
|
|
959
|
+
exportUsers: n,
|
|
960
|
+
exportClassCodes: i
|
|
961
|
+
};
|
|
962
|
+
}, Ge = `${He}/api/ImportCsv/csv`, Se = `${He}/api/Teacher`, Et = (e, t) => pe.post(`${Ge}/${t}`, e), ke = (e) => pe.post(`${Ge}/importClassReflection`, e), bt = (e, t) => pe.post(`${Se}/adminImportStudentByTeacherId/${e}`, t), Ct = (e) => pe.post(`${Se}/adminImport`, e), Rt = (e = !0) => hs.get(`${Se}/download-template-file-user?hasEsSchool=${e}`), Wt = (e, t, n = !0) => pe.post(`${Se}/validate-csv-template-student/${t}?hasEsSchool=${n}`, e);
|
|
963
|
+
var Ve = /* @__PURE__ */ ((e) => (e.Students = "students", e.Subjects = "subjects", e.Grades = "grades", e.Attendances = "attendances", e.ClassReflection = "classReflection", e.Others = "others", e.AllUser = "allUser", e))(Ve || {});
|
|
964
|
+
const Ee = "csvupload", Me = {
|
|
965
|
+
teacherName: "",
|
|
966
|
+
teacherEmail: "",
|
|
967
|
+
studentIds: [],
|
|
968
|
+
file: ""
|
|
969
|
+
}, Tt = () => {
|
|
970
|
+
const e = ue(), t = ye((C) => C.common.isLoading), [n, r] = z(null), [i, c] = z(), [o, p] = z([]), [u, R] = z(
|
|
971
|
+
Me
|
|
972
|
+
), [d, m] = z(), S = window.location.hostname, f = S.includes("isb") || S.includes("stage"), [g, O] = z(0), [T, V] = z(""), y = async () => {
|
|
973
|
+
e(B(!0));
|
|
974
|
+
try {
|
|
975
|
+
const s = await Rt();
|
|
976
|
+
var C = new Blob([us(s.data.content)], { type: "text/csv" });
|
|
977
|
+
const l = window.URL.createObjectURL(C);
|
|
978
|
+
var H = document.createElement("a");
|
|
979
|
+
H.href = l, H.setAttribute("download", s.data.nameFile), H.click(), e(
|
|
980
|
+
k({
|
|
981
|
+
type: "success",
|
|
982
|
+
message: "Download successfully"
|
|
983
|
+
})
|
|
984
|
+
);
|
|
985
|
+
} catch (s) {
|
|
986
|
+
e(
|
|
987
|
+
k({
|
|
988
|
+
type: "danger",
|
|
989
|
+
message: s.message
|
|
990
|
+
})
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
e(B(!1));
|
|
994
|
+
}, A = G(
|
|
995
|
+
async (C) => {
|
|
996
|
+
if (!n || !C) return;
|
|
997
|
+
e(B(!0));
|
|
998
|
+
try {
|
|
999
|
+
C = await Ie(C);
|
|
1000
|
+
const _ = new FormData();
|
|
1001
|
+
if (_.append("file", C, C.name), n == "allUser") {
|
|
1002
|
+
let E = (await C.text()).trim();
|
|
1003
|
+
const N = E.split(`
|
|
1004
|
+
`).map((U) => U.trim()), M = N.findIndex(
|
|
1005
|
+
(U) => U.split(",").includes("FirstName")
|
|
1006
|
+
);
|
|
1007
|
+
if (M === 0)
|
|
1008
|
+
throw new Error("Invalid CSV: Missing header row.");
|
|
1009
|
+
E = N.slice(M).join(`
|
|
1010
|
+
`);
|
|
1011
|
+
const I = Be.parse(E, {
|
|
1012
|
+
header: !0,
|
|
1013
|
+
skipEmptyLines: !0
|
|
1014
|
+
}), j = I.meta.fields, D = I.data;
|
|
1015
|
+
if (!j)
|
|
1016
|
+
throw new Error("Unable to determine header from CSV file");
|
|
1017
|
+
const $ = 20, x = [];
|
|
1018
|
+
for (let U = 0; U < D.length; U += $) {
|
|
1019
|
+
const Q = D.slice(U, U + $), ce = Be.unparse({
|
|
1020
|
+
fields: j,
|
|
1021
|
+
data: Q
|
|
1022
|
+
});
|
|
1023
|
+
x.push(ce);
|
|
1024
|
+
}
|
|
1025
|
+
for (let U = 0; U < x.length; U++) {
|
|
1026
|
+
const Q = new Blob([x[U]], { type: "text/csv" }), ce = new FormData();
|
|
1027
|
+
ce.append(
|
|
1028
|
+
"file",
|
|
1029
|
+
Q,
|
|
1030
|
+
`students_chunk${U + 1}.csv`
|
|
1031
|
+
), await Ct(ce);
|
|
1032
|
+
}
|
|
1033
|
+
} else
|
|
1034
|
+
f ? n == "classReflection" && await ke(_) : await Et(_, n.toString());
|
|
1035
|
+
e(
|
|
1036
|
+
k({
|
|
1037
|
+
type: "success",
|
|
1038
|
+
message: "Import CSV successfully"
|
|
1039
|
+
})
|
|
1040
|
+
);
|
|
1041
|
+
} catch (_) {
|
|
1042
|
+
e(
|
|
1043
|
+
k({
|
|
1044
|
+
type: "danger",
|
|
1045
|
+
message: _.response?.data?.title || _.message
|
|
1046
|
+
})
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
e(B(!1));
|
|
1050
|
+
const H = document.getElementById(Ee), s = document.getElementById("import-student"), l = document.getElementById(
|
|
1051
|
+
"import-classReflection"
|
|
1052
|
+
);
|
|
1053
|
+
H && (H.value = ""), s && (s.value = ""), l && (l.value = "");
|
|
1054
|
+
},
|
|
1055
|
+
[n]
|
|
1056
|
+
), P = async (C) => {
|
|
1057
|
+
if (!g) {
|
|
1058
|
+
e(
|
|
1059
|
+
k({
|
|
1060
|
+
type: "danger",
|
|
1061
|
+
message: "Select teacher before import csv"
|
|
1062
|
+
})
|
|
1063
|
+
);
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
if (!n || !C) return;
|
|
1067
|
+
e(B(!0));
|
|
1068
|
+
try {
|
|
1069
|
+
C = await Ie(C);
|
|
1070
|
+
const s = new FormData();
|
|
1071
|
+
s.append("file", C, C.name), await bt(g, s), e(
|
|
1072
|
+
k({
|
|
1073
|
+
type: "success",
|
|
1074
|
+
message: "Import CSV successfully"
|
|
1075
|
+
})
|
|
1076
|
+
);
|
|
1077
|
+
} catch (s) {
|
|
1078
|
+
e(
|
|
1079
|
+
k({
|
|
1080
|
+
type: "danger",
|
|
1081
|
+
message: s.response?.data?.title || s.message
|
|
1082
|
+
})
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1085
|
+
e(B(!1));
|
|
1086
|
+
const H = document.getElementById("teacherSelector");
|
|
1087
|
+
H && (H.value = "");
|
|
1088
|
+
}, J = async (C) => {
|
|
1089
|
+
if (!i || !i) return;
|
|
1090
|
+
e(B(!0));
|
|
1091
|
+
try {
|
|
1092
|
+
const s = new FormData();
|
|
1093
|
+
s.append("file", i, i.name), s.append("teacherName", C.teacherName), s.append("teacherEmail", C.teacherEmail), C.studentIds.forEach((l) => {
|
|
1094
|
+
s.append("studentIds", l);
|
|
1095
|
+
}), await ke(s), e(
|
|
1096
|
+
k({
|
|
1097
|
+
type: "success",
|
|
1098
|
+
message: "Import CSV successfully"
|
|
1099
|
+
})
|
|
1100
|
+
), R(Me);
|
|
1101
|
+
} catch (s) {
|
|
1102
|
+
e(
|
|
1103
|
+
k({
|
|
1104
|
+
type: "danger",
|
|
1105
|
+
message: s.response?.data?.title || s.message
|
|
1106
|
+
})
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
e(B(!1));
|
|
1110
|
+
const H = document.getElementById(Ee);
|
|
1111
|
+
H && (H.value = "");
|
|
1112
|
+
}, h = (C) => {
|
|
1113
|
+
O(C.value);
|
|
1114
|
+
}, L = (C) => {
|
|
1115
|
+
m(C), V(C?.name || "");
|
|
1116
|
+
}, w = () => {
|
|
1117
|
+
if (!d) {
|
|
1118
|
+
e(
|
|
1119
|
+
k({
|
|
1120
|
+
type: "danger",
|
|
1121
|
+
message: "Select CSV to import"
|
|
1122
|
+
})
|
|
1123
|
+
);
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
P(d);
|
|
1127
|
+
};
|
|
1128
|
+
return {
|
|
1129
|
+
isLoading: t,
|
|
1130
|
+
id: Ee,
|
|
1131
|
+
setType: r,
|
|
1132
|
+
upload: A,
|
|
1133
|
+
initImportReflection: u,
|
|
1134
|
+
setInitImportReflection: R,
|
|
1135
|
+
onConfirm: J,
|
|
1136
|
+
CSVType: Ve,
|
|
1137
|
+
dataFile: i,
|
|
1138
|
+
setDataFile: c,
|
|
1139
|
+
setArrStudent: p,
|
|
1140
|
+
arrStudent: o,
|
|
1141
|
+
isCheckDomainIBS: f,
|
|
1142
|
+
onChangeTeacher: h,
|
|
1143
|
+
uploadByTeacherId: P,
|
|
1144
|
+
setDataFileImportStudent: L,
|
|
1145
|
+
onUpLoadStudentFile: w,
|
|
1146
|
+
defaultTeacher: g,
|
|
1147
|
+
fileName: T,
|
|
1148
|
+
onStudentSubmit: () => {
|
|
1149
|
+
e(
|
|
1150
|
+
de({
|
|
1151
|
+
isOpen: !0,
|
|
1152
|
+
type: "warning",
|
|
1153
|
+
message: "Are you sure upload this file?",
|
|
1154
|
+
onConfirm: () => {
|
|
1155
|
+
w();
|
|
1156
|
+
}
|
|
1157
|
+
})
|
|
1158
|
+
);
|
|
1159
|
+
},
|
|
1160
|
+
downloadTemplateUser: y
|
|
1161
|
+
};
|
|
1162
|
+
}, _t = () => {
|
|
1163
|
+
const e = ue(), t = async (i) => {
|
|
1164
|
+
e(B(!0));
|
|
1165
|
+
try {
|
|
1166
|
+
await Ls(i), e(
|
|
1167
|
+
k({
|
|
1168
|
+
type: "success",
|
|
1169
|
+
message: "Send Successfully"
|
|
1170
|
+
})
|
|
1171
|
+
);
|
|
1172
|
+
} catch (c) {
|
|
1173
|
+
e(
|
|
1174
|
+
k({
|
|
1175
|
+
type: "danger",
|
|
1176
|
+
message: c.response?.data?.title || c.message
|
|
1177
|
+
})
|
|
1178
|
+
);
|
|
1179
|
+
}
|
|
1180
|
+
e(B(!1));
|
|
1181
|
+
};
|
|
1182
|
+
return {
|
|
1183
|
+
handleSendMultiUsers: (i) => {
|
|
1184
|
+
t({ userIds: [...i] });
|
|
1185
|
+
},
|
|
1186
|
+
handleSendSingleUser: (i) => {
|
|
1187
|
+
t({ userIds: [i] });
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
}, Nt = ({ state: e, onClose: t, onConfirm: n }) => {
|
|
1191
|
+
const { t: r } = re(), [i, c] = z(null), [o, p] = z(null), u = !!(e.msTeachers && e.msTeachers.length > 0), R = !!(e.esTeachers && e.esTeachers.length > 0), d = ne(() => (e.msTeachers || []).map((g) => {
|
|
1192
|
+
const O = g.name || g.fullName || "";
|
|
1193
|
+
return {
|
|
1194
|
+
label: O ? `${O} (${g.email})` : g.email,
|
|
1195
|
+
value: g.id
|
|
1196
|
+
};
|
|
1197
|
+
}), [e.msTeachers]), m = ne(() => (e.esTeachers || []).map((g) => {
|
|
1198
|
+
const O = g.name || g.fullName || "";
|
|
1199
|
+
return {
|
|
1200
|
+
label: O ? `${O} (${g.email})` : g.email,
|
|
1201
|
+
value: g.id
|
|
1202
|
+
};
|
|
1203
|
+
}), [e.esTeachers]), S = (!u || !!i) && (!R || !!o), f = () => {
|
|
1204
|
+
S && n(i?.value, o?.value);
|
|
1205
|
+
};
|
|
1206
|
+
return /* @__PURE__ */ b(Ze, { centered: !0, isOpen: e.isOpen, toggle: t, zIndex: 1201, children: [
|
|
1207
|
+
/* @__PURE__ */ a(es, { toggle: t, children: r("transfer_data_before_delete", "Transfer Data Before Deletion") }),
|
|
1208
|
+
/* @__PURE__ */ b(ss, { children: [
|
|
1209
|
+
/* @__PURE__ */ a("p", { className: "text-muted mb-3", children: r(
|
|
1210
|
+
"user_has_associated_data_notice",
|
|
1211
|
+
"This educator currently has associated students, sessions, or records. Please select an active teacher to receive their data before removing."
|
|
1212
|
+
) }),
|
|
1213
|
+
u && /* @__PURE__ */ b(me, { className: "mb-3", children: [
|
|
1214
|
+
/* @__PURE__ */ b(ae, { className: "font-weight-bold", children: [
|
|
1215
|
+
we(Z() ? r("middle_high_school_transfer_teacher", "Middle & High School (MS & HS) - Select Replacement Teacher") : r("middle_school_transfer_teacher", "Middle School (MS) - Select Replacement Teacher"), "Secondary - Select Replacement Teacher"),
|
|
1216
|
+
" *"
|
|
1217
|
+
] }),
|
|
1218
|
+
/* @__PURE__ */ a(
|
|
1219
|
+
Oe,
|
|
1220
|
+
{
|
|
1221
|
+
value: i,
|
|
1222
|
+
options: d,
|
|
1223
|
+
placeholder: r("select_teacher", "Select teacher"),
|
|
1224
|
+
className: F["custom-chip-teacher-select"],
|
|
1225
|
+
onChange: (g) => c(g),
|
|
1226
|
+
isClearable: !0
|
|
1227
|
+
}
|
|
1228
|
+
)
|
|
1229
|
+
] }),
|
|
1230
|
+
R && /* @__PURE__ */ b(me, { className: "mb-3", children: [
|
|
1231
|
+
/* @__PURE__ */ b(ae, { className: "font-weight-bold", children: [
|
|
1232
|
+
we(r("elementary_school_transfer_teacher", "Elementary School (ES) - Select Replacement Teacher"), "Primary - Select Replacement Teacher"),
|
|
1233
|
+
" *"
|
|
1234
|
+
] }),
|
|
1235
|
+
/* @__PURE__ */ a(
|
|
1236
|
+
Oe,
|
|
1237
|
+
{
|
|
1238
|
+
value: o,
|
|
1239
|
+
options: m,
|
|
1240
|
+
placeholder: r("select_teacher", "Select teacher"),
|
|
1241
|
+
className: F["custom-chip-teacher-select"],
|
|
1242
|
+
onChange: (g) => p(g),
|
|
1243
|
+
isClearable: !0
|
|
1244
|
+
}
|
|
1245
|
+
)
|
|
1246
|
+
] })
|
|
1247
|
+
] }),
|
|
1248
|
+
/* @__PURE__ */ b(ts, { children: [
|
|
1249
|
+
/* @__PURE__ */ a(he, { color: "secondary", onClick: t, children: r("cancel", "Cancel") }),
|
|
1250
|
+
/* @__PURE__ */ a(he, { color: "primary", onClick: f, disabled: !S, children: r("confirm_and_delete", "Confirm & Delete") })
|
|
1251
|
+
] })
|
|
1252
|
+
] });
|
|
1253
|
+
}, be = {
|
|
1254
|
+
fontWeight: 500
|
|
1255
|
+
}, Ce = {
|
|
1256
|
+
height: 38,
|
|
1257
|
+
backgroundColor: "#2eb85c",
|
|
1258
|
+
borderColor: "#2eb85c"
|
|
1259
|
+
}, xt = {
|
|
1260
|
+
display: "inline-block",
|
|
1261
|
+
fontSize: 11,
|
|
1262
|
+
fontWeight: 700,
|
|
1263
|
+
color: "#3b4ba8",
|
|
1264
|
+
backgroundColor: "#e9ecfb",
|
|
1265
|
+
borderRadius: 4,
|
|
1266
|
+
padding: "1px 6px",
|
|
1267
|
+
marginRight: 6,
|
|
1268
|
+
textTransform: "uppercase"
|
|
1269
|
+
}, Re = (e) => Ts() ? Array.from(new Set(e.split(",").map((t) => t.trim() === "ES" ? "P1" : "S2"))).join(", ") : e, $e = ({ label: e }) => /* @__PURE__ */ a("span", { style: xt, children: e }), At = ({ label: e }) => /* @__PURE__ */ a("span", { style: {
|
|
1270
|
+
display: "inline-flex",
|
|
1271
|
+
alignItems: "center",
|
|
1272
|
+
justifyContent: "center",
|
|
1273
|
+
fontSize: 11,
|
|
1274
|
+
fontWeight: 700,
|
|
1275
|
+
color: "#3b4ba8",
|
|
1276
|
+
backgroundColor: "#e9ecfb",
|
|
1277
|
+
borderRadius: 4,
|
|
1278
|
+
padding: "3px 8px",
|
|
1279
|
+
textTransform: "uppercase"
|
|
1280
|
+
}, children: e }), It = ({ isActive: e, t }) => /* @__PURE__ */ b("span", { style: {
|
|
1281
|
+
display: "inline-flex",
|
|
1282
|
+
alignItems: "center",
|
|
1283
|
+
fontSize: 12,
|
|
1284
|
+
fontWeight: 600,
|
|
1285
|
+
color: e ? "#047857" : "#6b7280",
|
|
1286
|
+
backgroundColor: e ? "#d1fae5" : "#f3f4f6",
|
|
1287
|
+
borderRadius: "20px",
|
|
1288
|
+
padding: "4px 12px"
|
|
1289
|
+
}, children: [
|
|
1290
|
+
/* @__PURE__ */ a("span", { style: {
|
|
1291
|
+
width: "6px",
|
|
1292
|
+
height: "6px",
|
|
1293
|
+
borderRadius: "50%",
|
|
1294
|
+
backgroundColor: e ? "#10b981" : "#9ca3af",
|
|
1295
|
+
marginRight: "8px"
|
|
1296
|
+
} }),
|
|
1297
|
+
t(e ? "active" : "inactive")
|
|
1298
|
+
] }), Te = (e) => (e || []).map((t) => t === "SecondaryTeacher" ? "SupportTeacher" : t).join(", "), wt = "user", Ot = () => {
|
|
1299
|
+
const {
|
|
1300
|
+
queryName: e,
|
|
1301
|
+
userList: t,
|
|
1302
|
+
totalItems: n,
|
|
1303
|
+
filters: r,
|
|
1304
|
+
fullName: i,
|
|
1305
|
+
removeData: c,
|
|
1306
|
+
changeFilters: o,
|
|
1307
|
+
reDirectDetailPage: p,
|
|
1308
|
+
switchUser: u,
|
|
1309
|
+
handleSyncRosterUsers: R,
|
|
1310
|
+
rosterUserInfo: d,
|
|
1311
|
+
onSelectUser: m,
|
|
1312
|
+
userIds: S,
|
|
1313
|
+
onSelectAllUser: f,
|
|
1314
|
+
isCheckAll: g,
|
|
1315
|
+
transferModal: O,
|
|
1316
|
+
closeTransferModal: T,
|
|
1317
|
+
confirmTransferRemove: V
|
|
1318
|
+
} = Qs(), { handleSendMultiUsers: y } = _t(), { upload: A } = Tt(), {
|
|
1319
|
+
exportUsers: P,
|
|
1320
|
+
exportClassCodes: J
|
|
1321
|
+
} = vt(), { t: h } = re(), { getLabel: L, system: w } = ps(), q = () => P(r), C = () => J(r), H = ne(() => [
|
|
1322
|
+
{
|
|
1323
|
+
name: "",
|
|
1324
|
+
isCenter: !0,
|
|
1325
|
+
onSelectAll: f,
|
|
1326
|
+
isCheckAll: g
|
|
1327
|
+
}
|
|
1328
|
+
].concat(Ds.map((s) => s.searchBy === Y.Tiers && Z() ? { ...s, options: (s.options || []).filter((l) => !l.value.includes("HS")) } : s.searchBy === Y.Grade ? {
|
|
1329
|
+
...s,
|
|
1330
|
+
name: w === "UK" ? "Year" : "grade",
|
|
1331
|
+
options: (s.options || Fs).map((l) => ({
|
|
1332
|
+
...l,
|
|
1333
|
+
label: L(l.value)
|
|
1334
|
+
}))
|
|
1335
|
+
} : s)), [f, g, w, L]);
|
|
1336
|
+
return /* @__PURE__ */ b("div", { className: `fadeIn animated h-100 ${Rs <= 767 ? F["p-0-12"] : ""}`, children: [
|
|
1337
|
+
/* @__PURE__ */ a("h5", { className: "mt-4 mb-2", children: h(`${wt}`) }),
|
|
1338
|
+
/* @__PURE__ */ b(Ne, { className: "my-2", children: [
|
|
1339
|
+
/* @__PURE__ */ a(le, { md: 8, children: /* @__PURE__ */ a(
|
|
1340
|
+
gs,
|
|
1341
|
+
{
|
|
1342
|
+
text: h("create_user"),
|
|
1343
|
+
onClick: () => p(),
|
|
1344
|
+
initValue: e || "",
|
|
1345
|
+
onSearch: (s) => o({
|
|
1346
|
+
searchString: s
|
|
1347
|
+
}),
|
|
1348
|
+
placeholder: h("type_something_to_search_by_user_name")
|
|
1349
|
+
}
|
|
1350
|
+
) }),
|
|
1351
|
+
/* @__PURE__ */ b(
|
|
1352
|
+
le,
|
|
1353
|
+
{
|
|
1354
|
+
md: 4,
|
|
1355
|
+
className: "d-flex justify-content-end align-items-center",
|
|
1356
|
+
children: [
|
|
1357
|
+
h("total_of_users"),
|
|
1358
|
+
" : ",
|
|
1359
|
+
n
|
|
1360
|
+
]
|
|
1361
|
+
}
|
|
1362
|
+
),
|
|
1363
|
+
/* @__PURE__ */ b(le, { md: 12, className: "d-flex justify-content-end my-2 flex-wrap", style: { gap: "8px" }, children: [
|
|
1364
|
+
/* @__PURE__ */ a(
|
|
1365
|
+
"button",
|
|
1366
|
+
{
|
|
1367
|
+
className: "btn btn-success d-flex align-items-center border-0",
|
|
1368
|
+
style: Ce,
|
|
1369
|
+
onClick: () => y(S),
|
|
1370
|
+
children: /* @__PURE__ */ a("p", { className: `${F["button-content"]} mb-0`, style: be, children: h("welcome_email_resend") })
|
|
1371
|
+
}
|
|
1372
|
+
),
|
|
1373
|
+
/* @__PURE__ */ a(
|
|
1374
|
+
ie,
|
|
1375
|
+
{
|
|
1376
|
+
id: "import-user",
|
|
1377
|
+
className: "d-none",
|
|
1378
|
+
type: "file",
|
|
1379
|
+
onChange: (s) => A(s.target.files[0]),
|
|
1380
|
+
accept: "text/csv"
|
|
1381
|
+
}
|
|
1382
|
+
),
|
|
1383
|
+
/* @__PURE__ */ a(st, { text: h("sync_roster_users"), onClick: R }),
|
|
1384
|
+
/* @__PURE__ */ b(
|
|
1385
|
+
"button",
|
|
1386
|
+
{
|
|
1387
|
+
className: "btn btn-success d-flex align-items-center border-0 p-0",
|
|
1388
|
+
style: Ce,
|
|
1389
|
+
onClick: C,
|
|
1390
|
+
children: [
|
|
1391
|
+
/* @__PURE__ */ a("div", { className: `${F["button-icon"]}`, children: /* @__PURE__ */ a("img", { src: "images/export-icon.svg", alt: "" }) }),
|
|
1392
|
+
/* @__PURE__ */ a("p", { className: `${F["button-content"]} mb-0`, style: be, children: h("export_class_code_to_csv") })
|
|
1393
|
+
]
|
|
1394
|
+
}
|
|
1395
|
+
),
|
|
1396
|
+
/* @__PURE__ */ b(
|
|
1397
|
+
"button",
|
|
1398
|
+
{
|
|
1399
|
+
className: "btn btn-success d-flex align-items-center border-0 p-0",
|
|
1400
|
+
style: Ce,
|
|
1401
|
+
onClick: q,
|
|
1402
|
+
children: [
|
|
1403
|
+
/* @__PURE__ */ a("div", { className: `${F["button-icon"]}`, children: /* @__PURE__ */ a("img", { src: "images/export-icon.svg", alt: "" }) }),
|
|
1404
|
+
/* @__PURE__ */ a("p", { className: `${F["button-content"]} mb-0`, style: be, children: h("export_to_csv") })
|
|
1405
|
+
]
|
|
1406
|
+
}
|
|
1407
|
+
)
|
|
1408
|
+
] })
|
|
1409
|
+
] }),
|
|
1410
|
+
/* @__PURE__ */ b(Ne, { className: "mb-2", children: [
|
|
1411
|
+
/* @__PURE__ */ a(le, { md: 12, children: /* @__PURE__ */ a("div", { style: { overflow: "auto" }, children: /* @__PURE__ */ b(as, { bordered: !0, hover: !0, striped: !0, size: "sm", children: [
|
|
1412
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a(
|
|
1413
|
+
St,
|
|
1414
|
+
{
|
|
1415
|
+
headers: H,
|
|
1416
|
+
filters: r,
|
|
1417
|
+
fullName: i,
|
|
1418
|
+
onChangeFilters: o
|
|
1419
|
+
}
|
|
1420
|
+
) }),
|
|
1421
|
+
/* @__PURE__ */ b("tbody", { children: [
|
|
1422
|
+
t && t.length > 0 && t.map((s) => {
|
|
1423
|
+
const l = new Set(
|
|
1424
|
+
(s.appType || "").split(",").map((x) => x.trim().toUpperCase()).filter(Boolean)
|
|
1425
|
+
);
|
|
1426
|
+
l.size === 0 && (s.esRoles && s.esRoles.length > 0 && l.add("ES"), s.msRoles && s.msRoles.length > 0 && l.add("MS"), s.hsRoles && s.hsRoles.length > 0 && l.add("HS"));
|
|
1427
|
+
let v = ["ES", "MS", "HS"].filter((x) => l.has(x));
|
|
1428
|
+
const E = (s.roles || []).some((x) => x.toLowerCase() === "student") || (s.esRoles || []).some((x) => x.toLowerCase() === "student") || (s.msRoles || []).some((x) => x.toLowerCase() === "student") || (s.hsRoles || []).some((x) => x.toLowerCase() === "student"), N = String(s.grade || s.gradeLevel || s.rosterUser?.grades || "").trim().replace(/^0+(?=\d)/, "");
|
|
1429
|
+
if (E) {
|
|
1430
|
+
const x = String(s.grade || s.gradeLevel || "").trim(), U = String(s.preferredAppType || "").trim().toUpperCase();
|
|
1431
|
+
v = [!Z() && (U === "HS" || fs.includes(x)) ? "HS" : U === "ES" || ys.includes(x) ? "ES" : "MS"];
|
|
1432
|
+
}
|
|
1433
|
+
const M = v.includes("MS"), I = v.includes("HS"), j = v.includes("ES"), D = M && I && (s.msRoles || []).slice().sort().join(",") === (s.hsRoles || []).slice().sort().join(","), $ = [];
|
|
1434
|
+
return j && $.push({ tierLabel: "ES", roles: s.esRoles && s.esRoles.length > 0 ? s.esRoles : E ? s.roles : s.esRoles }), D ? $.push({ tierLabel: "MS, HS", roles: s.msRoles || s.hsRoles }) : (M && $.push({ tierLabel: "MS", roles: s.msRoles && s.msRoles.length > 0 ? s.msRoles : E ? s.roles : s.msRoles }), I && $.push({ tierLabel: "HS", roles: s.hsRoles && s.hsRoles.length > 0 ? s.hsRoles : E ? s.roles : s.hsRoles })), /* @__PURE__ */ b("tr", { children: [
|
|
1435
|
+
/* @__PURE__ */ a("td", { className: "align-middle", children: /* @__PURE__ */ a(
|
|
1436
|
+
"input",
|
|
1437
|
+
{
|
|
1438
|
+
type: "checkbox",
|
|
1439
|
+
onChange: () => m(s.id),
|
|
1440
|
+
checked: S.includes(s.id) ?? !1
|
|
1441
|
+
}
|
|
1442
|
+
) }),
|
|
1443
|
+
/* @__PURE__ */ a("td", { className: "align-middle", children: /* @__PURE__ */ a(
|
|
1444
|
+
Ss,
|
|
1445
|
+
{
|
|
1446
|
+
label: `${s.fullName}`,
|
|
1447
|
+
onClick: () => p(s.id)
|
|
1448
|
+
}
|
|
1449
|
+
) }),
|
|
1450
|
+
/* @__PURE__ */ a("td", { className: "align-middle", children: s.email }),
|
|
1451
|
+
/* @__PURE__ */ a("td", { className: "align-middle", children: E ? L(N) : "" }),
|
|
1452
|
+
/* @__PURE__ */ a("td", { className: "align-middle", children: $.length > 1 ? /* @__PURE__ */ a(We, { children: $.map((x, U) => /* @__PURE__ */ b("div", { className: U > 0 ? "mt-1" : "", children: [
|
|
1453
|
+
/* @__PURE__ */ a($e, { label: Re(x.tierLabel) }),
|
|
1454
|
+
Te(x.roles)
|
|
1455
|
+
] }, x.tierLabel)) }) : $.length === 1 ? /* @__PURE__ */ b("div", { children: [
|
|
1456
|
+
/* @__PURE__ */ a($e, { label: Re($[0].tierLabel) }),
|
|
1457
|
+
Te($[0].roles || s.roles)
|
|
1458
|
+
] }) : !!s.roles && Te(s.roles) }),
|
|
1459
|
+
/* @__PURE__ */ a("td", { className: "align-middle text-uppercase", children: v.length > 0 && /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column", gap: "4px", alignItems: "center", width: "fit-content" }, children: Re(v.join(", ")).split(", ").map((x) => /* @__PURE__ */ a(At, { label: x }, x)) }) }),
|
|
1460
|
+
/* @__PURE__ */ a("td", { className: "align-middle", children: /* @__PURE__ */ a(It, { isActive: s.isActive, t: h }) }),
|
|
1461
|
+
/* @__PURE__ */ a("td", { className: "align-middle", children: Pe(s?.createTime, "yyyy-MM-dd HH:mm") }),
|
|
1462
|
+
/* @__PURE__ */ a("td", { children: d(s) }),
|
|
1463
|
+
/* @__PURE__ */ a("td", { className: "align-middle", children: /* @__PURE__ */ a(
|
|
1464
|
+
vs,
|
|
1465
|
+
{
|
|
1466
|
+
style: { fontSize: "18px", margin: "0 10px", cursor: "pointer" },
|
|
1467
|
+
onClick: () => u(s.id)
|
|
1468
|
+
}
|
|
1469
|
+
) }),
|
|
1470
|
+
/* @__PURE__ */ a("td", { className: "align-middle", style: { padding: "0 15px" }, children: /* @__PURE__ */ a(
|
|
1471
|
+
Es,
|
|
1472
|
+
{
|
|
1473
|
+
onClick: () => c(s.id)
|
|
1474
|
+
}
|
|
1475
|
+
) })
|
|
1476
|
+
] }, `${s.id}_${s.appType || ""}`);
|
|
1477
|
+
}),
|
|
1478
|
+
(!t || !t.length) && /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: 12, className: "p-0", children: /* @__PURE__ */ a(bs, { className: "mb-0", label: h("user") }) }) })
|
|
1479
|
+
] })
|
|
1480
|
+
] }) }) }),
|
|
1481
|
+
/* @__PURE__ */ a(le, { md: 12, children: /* @__PURE__ */ a(
|
|
1482
|
+
Cs,
|
|
1483
|
+
{
|
|
1484
|
+
filters: r,
|
|
1485
|
+
totalRecordCount: n,
|
|
1486
|
+
changePageSize: (s) => o({ pageSize: s }),
|
|
1487
|
+
changePage: (s) => o({ currentPage: s })
|
|
1488
|
+
}
|
|
1489
|
+
) })
|
|
1490
|
+
] }),
|
|
1491
|
+
/* @__PURE__ */ a(
|
|
1492
|
+
Nt,
|
|
1493
|
+
{
|
|
1494
|
+
state: O,
|
|
1495
|
+
onClose: T,
|
|
1496
|
+
onConfirm: V
|
|
1497
|
+
}
|
|
1498
|
+
)
|
|
1499
|
+
] });
|
|
1500
|
+
}, Yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1501
|
+
__proto__: null,
|
|
1502
|
+
default: Ot
|
|
1503
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1504
|
+
export {
|
|
1505
|
+
Jt as A,
|
|
1506
|
+
St as T,
|
|
1507
|
+
Ot as U,
|
|
1508
|
+
Yt as a,
|
|
1509
|
+
Kt as e,
|
|
1510
|
+
qt as f,
|
|
1511
|
+
ft as m,
|
|
1512
|
+
gt as r,
|
|
1513
|
+
Wt as v
|
|
1514
|
+
};
|