mario-core 2.0.125-release → 2.0.126-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-DghZp-DY.mjs +206 -0
- package/dist/Dashboard-DlYSjl_v.js +1 -0
- package/dist/EmailTemplateDetail-CTm45E9v.mjs +443 -0
- package/dist/EmailTemplateDetail-gEFgDpUL.js +1 -0
- package/dist/EmailTemplateList-BMUfPdlS.mjs +170 -0
- package/dist/EmailTemplateList-ONLWbg1A.js +1 -0
- package/dist/GalleryList-4orsP-Hj.js +1 -0
- package/dist/GalleryList-DUjEqWiL.mjs +329 -0
- package/dist/Login-DYY40AhH.mjs +1699 -0
- package/dist/Login-mv6rU86S.js +1 -0
- package/dist/NotificationList-B8QA__0a.mjs +3658 -0
- package/dist/NotificationList-BNkeEQdH.js +2 -0
- package/dist/SkillList-CU_1-Iaz.js +1 -0
- package/dist/SkillList-_CGxFVan.mjs +386 -0
- package/dist/TeacherSelector-C9HSJpwB.js +1 -0
- package/dist/TeacherSelector-CeQStIjC.mjs +30 -0
- package/dist/TheContent-CRdTKAO2.js +1 -0
- package/dist/TheContent-DhAC2Pag.mjs +38 -0
- package/dist/UserContainer-BG88LrHG.js +5 -0
- package/dist/UserContainer-CZnWnIxe.mjs +2696 -0
- package/dist/UserDetail-8VoY0zAK.mjs +912 -0
- package/dist/UserDetail-XxeFBQb0.js +1 -0
- package/dist/UserList-drpkL0az.js +7 -0
- package/dist/UserList-tJN8p4bW.mjs +1512 -0
- package/dist/constants-DMGfBpO6.js +1 -0
- package/dist/constants-KowNPaKI.mjs +241 -0
- package/dist/index-B0KHEYvr.js +15 -0
- package/dist/index-BpI8f2Tq.mjs +19607 -0
- package/dist/index.js +1 -1
- package/dist/index.modern.js +150 -147
- package/dist/mailCategoryService-CleISU3d.mjs +11 -0
- package/dist/mailCategoryService-LdvLPQRm.js +1 -0
- package/dist/shared/gradeYear/index.d.ts +1 -0
- package/dist/shared/gradeYear/tierLabel.d.ts +3 -0
- package/dist/userService-Ce6Rl3kx.js +1 -0
- package/dist/userService-CkO5JV9X.mjs +47 -0
- package/package.json +113 -113
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { jsx as t, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v, useEffect as I, forwardRef as q, useCallback as N, useRef as z } from "react";
|
|
3
|
+
import { Row as T, Col as y, Input as M, Label as V, Table as U } from "reactstrap";
|
|
4
|
+
import { useTranslation as B } from "react-i18next";
|
|
5
|
+
import { i as E, B as O, a2 as H, a3 as K, $ as Q, E as W, O as X, b as f, a4 as G, c as S, R as J, _ as Y, S as Z, T as ee, V as te, W as se, X as ae } from "./index-BpI8f2Tq.mjs";
|
|
6
|
+
import { Formik as le } from "formik";
|
|
7
|
+
import * as R from "yup";
|
|
8
|
+
import { useSelector as j, useDispatch as A } from "react-redux";
|
|
9
|
+
const L = `${O}/api/Skill`, P = (e) => E.get(L, { params: e }), ne = (e) => E.get(`${L}/${e}`), ie = (e) => E.post(L, e), re = (e) => E.put(`${L}/${e.id}`, e), oe = (e) => E.delete(`${L}/${e}`), ce = (e) => {
|
|
10
|
+
const [s, c] = v([]);
|
|
11
|
+
I(() => {
|
|
12
|
+
o();
|
|
13
|
+
}, []);
|
|
14
|
+
const o = async () => {
|
|
15
|
+
try {
|
|
16
|
+
const i = await P();
|
|
17
|
+
c(i.data.items);
|
|
18
|
+
} catch (i) {
|
|
19
|
+
console.error(i.message);
|
|
20
|
+
}
|
|
21
|
+
}, { id: m, isDisabled: l } = e, u = s.map((i) => ({
|
|
22
|
+
id: i.id,
|
|
23
|
+
value: i.id,
|
|
24
|
+
label: i.path ? `${i.path}/${i.name}` : i.name
|
|
25
|
+
}));
|
|
26
|
+
return /* @__PURE__ */ t(
|
|
27
|
+
H,
|
|
28
|
+
{
|
|
29
|
+
options: u,
|
|
30
|
+
defaultValue: m,
|
|
31
|
+
...e,
|
|
32
|
+
isDisabled: l
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}, de = R.object({
|
|
36
|
+
name: R.string().required("Name is required"),
|
|
37
|
+
description: R.string()
|
|
38
|
+
}), me = (e, s) => {
|
|
39
|
+
const {
|
|
40
|
+
header: c,
|
|
41
|
+
confirmText: o,
|
|
42
|
+
onConfirm: m,
|
|
43
|
+
skillDetail: l,
|
|
44
|
+
onCancel: u,
|
|
45
|
+
edited: i,
|
|
46
|
+
setEdited: n,
|
|
47
|
+
setEditedTrue: r,
|
|
48
|
+
setEditedFalse: k,
|
|
49
|
+
isDisabled: b
|
|
50
|
+
} = e, { t: d } = B();
|
|
51
|
+
return /* @__PURE__ */ t(
|
|
52
|
+
le,
|
|
53
|
+
{
|
|
54
|
+
initialValues: l,
|
|
55
|
+
enableReinitialize: !0,
|
|
56
|
+
validationSchema: de,
|
|
57
|
+
onSubmit: (g, p) => {
|
|
58
|
+
m(g), p.resetForm();
|
|
59
|
+
},
|
|
60
|
+
children: (g) => {
|
|
61
|
+
const {
|
|
62
|
+
values: p,
|
|
63
|
+
touched: x,
|
|
64
|
+
errors: C,
|
|
65
|
+
handleChange: D,
|
|
66
|
+
handleBlur: w,
|
|
67
|
+
handleSubmit: $,
|
|
68
|
+
resetForm: F
|
|
69
|
+
} = g;
|
|
70
|
+
return /* @__PURE__ */ t(
|
|
71
|
+
K,
|
|
72
|
+
{
|
|
73
|
+
header: c,
|
|
74
|
+
confirmText: o,
|
|
75
|
+
onConfirm: $,
|
|
76
|
+
ref: s,
|
|
77
|
+
onCancel: () => {
|
|
78
|
+
u(), F();
|
|
79
|
+
},
|
|
80
|
+
edited: i,
|
|
81
|
+
setEdited: n,
|
|
82
|
+
setEditedFalse: k,
|
|
83
|
+
children: /* @__PURE__ */ h(T, { children: [
|
|
84
|
+
/* @__PURE__ */ h(y, { md: 12, className: "mb-2", children: [
|
|
85
|
+
/* @__PURE__ */ t(Q, { text: d("name") }),
|
|
86
|
+
/* @__PURE__ */ t(
|
|
87
|
+
M,
|
|
88
|
+
{
|
|
89
|
+
name: "name",
|
|
90
|
+
placeholder: d("name"),
|
|
91
|
+
value: p.name,
|
|
92
|
+
onChange: (a) => {
|
|
93
|
+
D(a), r();
|
|
94
|
+
},
|
|
95
|
+
onBlur: w("name")
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
x.name && C.name && /* @__PURE__ */ t(
|
|
99
|
+
W,
|
|
100
|
+
{
|
|
101
|
+
text: C.name
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ h(y, { md: 12, className: "mb-2", children: [
|
|
106
|
+
/* @__PURE__ */ t(V, { children: d("description") }),
|
|
107
|
+
/* @__PURE__ */ t(
|
|
108
|
+
M,
|
|
109
|
+
{
|
|
110
|
+
type: "textarea",
|
|
111
|
+
rows: 5,
|
|
112
|
+
name: "description",
|
|
113
|
+
placeholder: d("description"),
|
|
114
|
+
value: p.description,
|
|
115
|
+
onChange: (a) => {
|
|
116
|
+
D(a), r();
|
|
117
|
+
},
|
|
118
|
+
onBlur: w("description")
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ h(y, { md: 12, className: "mb-2", children: [
|
|
123
|
+
/* @__PURE__ */ t(V, { children: d("parent_category") }),
|
|
124
|
+
/* @__PURE__ */ t(
|
|
125
|
+
ce,
|
|
126
|
+
{
|
|
127
|
+
isDisabled: b,
|
|
128
|
+
onChange: (a) => {
|
|
129
|
+
g.setFieldValue(
|
|
130
|
+
"parentSkillId",
|
|
131
|
+
a.value
|
|
132
|
+
), r();
|
|
133
|
+
},
|
|
134
|
+
id: p.parentSkillId
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
] })
|
|
138
|
+
] })
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
}, ue = q(me), he = "Skill list", pe = () => {
|
|
145
|
+
const e = j((n) => n.skills.skillList), s = j((n) => n.skills.totalItems), { t: c } = B(), { filters: o, changeFilters: m } = X(), l = A(), u = N(async () => {
|
|
146
|
+
l(f(!0));
|
|
147
|
+
try {
|
|
148
|
+
const n = await P(o), { items: r, totalItems: k } = n.data;
|
|
149
|
+
l(G({ skillList: r, totalItems: k }));
|
|
150
|
+
} catch (n) {
|
|
151
|
+
l(
|
|
152
|
+
S({
|
|
153
|
+
type: "danger",
|
|
154
|
+
message: n.response?.data?.title || n.message
|
|
155
|
+
})
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
l(f(!1));
|
|
159
|
+
}, [l, o]), i = N(
|
|
160
|
+
(n) => {
|
|
161
|
+
l(f(!0));
|
|
162
|
+
try {
|
|
163
|
+
l(
|
|
164
|
+
J({
|
|
165
|
+
isOpen: !0,
|
|
166
|
+
type: "warning",
|
|
167
|
+
message: c("do_you_want_to_remove_this_skill"),
|
|
168
|
+
onConfirm: async () => {
|
|
169
|
+
try {
|
|
170
|
+
await oe(n), l(
|
|
171
|
+
S({
|
|
172
|
+
type: "success",
|
|
173
|
+
message: c("remove_skill_successfully")
|
|
174
|
+
})
|
|
175
|
+
), m({ currentPage: 1 });
|
|
176
|
+
} catch (r) {
|
|
177
|
+
l(
|
|
178
|
+
S({
|
|
179
|
+
type: "danger",
|
|
180
|
+
message: r.response?.data?.title || r.message || "Error occured"
|
|
181
|
+
})
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
);
|
|
187
|
+
} catch (r) {
|
|
188
|
+
l(
|
|
189
|
+
S({
|
|
190
|
+
type: "danger",
|
|
191
|
+
message: r.response?.data?.title || r.message || "Error occured"
|
|
192
|
+
})
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
l(f(!1));
|
|
196
|
+
},
|
|
197
|
+
[o]
|
|
198
|
+
);
|
|
199
|
+
return I(() => {
|
|
200
|
+
document.title = he;
|
|
201
|
+
}, []), I(() => {
|
|
202
|
+
u();
|
|
203
|
+
}, [o]), {
|
|
204
|
+
skillList: e,
|
|
205
|
+
totalItems: s,
|
|
206
|
+
filters: o,
|
|
207
|
+
changeFilters: m,
|
|
208
|
+
getData: u,
|
|
209
|
+
removeData: i
|
|
210
|
+
};
|
|
211
|
+
}, _ = {
|
|
212
|
+
name: "",
|
|
213
|
+
description: "",
|
|
214
|
+
path: "",
|
|
215
|
+
parentSkillId: null
|
|
216
|
+
}, ge = () => {
|
|
217
|
+
const e = A(), [s, c] = v(0), [o, m] = v(_), [l, u] = v(!1), i = async () => {
|
|
218
|
+
localStorage.setItem(window.location.href, "true"), u(!0);
|
|
219
|
+
}, n = async () => {
|
|
220
|
+
localStorage.getItem(window.location.href) && localStorage.removeItem(window.location.href), u(!1);
|
|
221
|
+
};
|
|
222
|
+
I(() => {
|
|
223
|
+
s ? k() : m(_);
|
|
224
|
+
}, [s]);
|
|
225
|
+
const r = () => {
|
|
226
|
+
c(0), m(_);
|
|
227
|
+
};
|
|
228
|
+
I(() => {
|
|
229
|
+
n();
|
|
230
|
+
}, []);
|
|
231
|
+
const k = N(async () => {
|
|
232
|
+
e(f(!0));
|
|
233
|
+
try {
|
|
234
|
+
const d = await ne(s);
|
|
235
|
+
m(d.data);
|
|
236
|
+
} catch (d) {
|
|
237
|
+
e(
|
|
238
|
+
S({
|
|
239
|
+
type: "danger",
|
|
240
|
+
message: d.response?.data?.title || d.message
|
|
241
|
+
})
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
e(f(!1));
|
|
245
|
+
}, [s]), b = N(
|
|
246
|
+
async (d, g) => {
|
|
247
|
+
e(f(!0));
|
|
248
|
+
try {
|
|
249
|
+
await (s ? re : ie)(d), e(
|
|
250
|
+
S({
|
|
251
|
+
type: "success",
|
|
252
|
+
message: `${s ? "Update" : "Create"} skill successfully`
|
|
253
|
+
})
|
|
254
|
+
), g && g(), s && c(0);
|
|
255
|
+
} catch (p) {
|
|
256
|
+
e(
|
|
257
|
+
S({
|
|
258
|
+
type: "danger",
|
|
259
|
+
message: p.response?.data?.title || p.message
|
|
260
|
+
})
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
e(f(!1));
|
|
264
|
+
},
|
|
265
|
+
[s, o]
|
|
266
|
+
);
|
|
267
|
+
return {
|
|
268
|
+
id: s,
|
|
269
|
+
setId: c,
|
|
270
|
+
skillDetail: o,
|
|
271
|
+
confirmData: b,
|
|
272
|
+
initValue: _,
|
|
273
|
+
reset: r,
|
|
274
|
+
edited: l,
|
|
275
|
+
setEdited: u,
|
|
276
|
+
setEditedTrue: i,
|
|
277
|
+
setEditedFalse: n
|
|
278
|
+
};
|
|
279
|
+
}, Ie = () => {
|
|
280
|
+
const e = z(null), { t: s } = B(), {
|
|
281
|
+
skillList: c,
|
|
282
|
+
totalItems: o,
|
|
283
|
+
filters: m,
|
|
284
|
+
changeFilters: l,
|
|
285
|
+
getData: u,
|
|
286
|
+
removeData: i
|
|
287
|
+
} = pe(), {
|
|
288
|
+
id: n,
|
|
289
|
+
setId: r,
|
|
290
|
+
skillDetail: k,
|
|
291
|
+
confirmData: b,
|
|
292
|
+
reset: d,
|
|
293
|
+
edited: g,
|
|
294
|
+
setEdited: p,
|
|
295
|
+
setEditedTrue: x,
|
|
296
|
+
setEditedFalse: C
|
|
297
|
+
} = ge(), D = (a) => {
|
|
298
|
+
r(a || 0), e && e.current && e.current.toggle();
|
|
299
|
+
}, w = (a) => {
|
|
300
|
+
b(a, () => {
|
|
301
|
+
e && e.current && e.current.toggle(), u();
|
|
302
|
+
}), C();
|
|
303
|
+
}, $ = (a) => {
|
|
304
|
+
i(a);
|
|
305
|
+
}, F = () => d();
|
|
306
|
+
return /* @__PURE__ */ h("div", { className: "fadeIn animated", children: [
|
|
307
|
+
/* @__PURE__ */ t(
|
|
308
|
+
ue,
|
|
309
|
+
{
|
|
310
|
+
ref: e,
|
|
311
|
+
header: s(n ? "edit_skill" : "create_skill"),
|
|
312
|
+
confirmText: s(n ? "update" : "create"),
|
|
313
|
+
onCancel: F,
|
|
314
|
+
onConfirm: w,
|
|
315
|
+
skillDetail: k,
|
|
316
|
+
edited: g,
|
|
317
|
+
setEdited: p,
|
|
318
|
+
setEditedTrue: x,
|
|
319
|
+
setEditedFalse: C,
|
|
320
|
+
isDisabled: n
|
|
321
|
+
}
|
|
322
|
+
),
|
|
323
|
+
/* @__PURE__ */ t(Y, { when: g }),
|
|
324
|
+
/* @__PURE__ */ h(T, { className: "my-2", children: [
|
|
325
|
+
/* @__PURE__ */ t(y, { md: 4, children: /* @__PURE__ */ t(
|
|
326
|
+
Z,
|
|
327
|
+
{
|
|
328
|
+
text: s("create_skill"),
|
|
329
|
+
onClick: () => D()
|
|
330
|
+
}
|
|
331
|
+
) }),
|
|
332
|
+
/* @__PURE__ */ h(
|
|
333
|
+
y,
|
|
334
|
+
{
|
|
335
|
+
md: 4,
|
|
336
|
+
className: "d-flex align-items-center justify-content-end",
|
|
337
|
+
children: [
|
|
338
|
+
s("total_of_skills"),
|
|
339
|
+
": ",
|
|
340
|
+
o
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
] }),
|
|
345
|
+
/* @__PURE__ */ h(T, { className: "mb-2", children: [
|
|
346
|
+
/* @__PURE__ */ t(y, { md: 8, children: c && c.length > 0 ? /* @__PURE__ */ h(U, { bordered: !0, hover: !0, striped: !0, responsive: !0, size: "sm", children: [
|
|
347
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ h("tr", { children: [
|
|
348
|
+
/* @__PURE__ */ t("th", { className: "align-top", children: s("name") }),
|
|
349
|
+
/* @__PURE__ */ t("th", { className: "align-top", children: s("description") }),
|
|
350
|
+
/* @__PURE__ */ t("th", { className: "text-center", children: s("action") })
|
|
351
|
+
] }) }),
|
|
352
|
+
/* @__PURE__ */ t("tbody", { children: c.map((a) => /* @__PURE__ */ h("tr", { children: [
|
|
353
|
+
/* @__PURE__ */ h("td", { className: "align-middle", children: [
|
|
354
|
+
/* @__PURE__ */ t(
|
|
355
|
+
ee,
|
|
356
|
+
{
|
|
357
|
+
label: a.name,
|
|
358
|
+
onClick: () => D(a.id)
|
|
359
|
+
}
|
|
360
|
+
),
|
|
361
|
+
!!a.path && /* @__PURE__ */ t("p", { className: "mb-0 pl-3", children: /* @__PURE__ */ t("i", { children: a.path }) })
|
|
362
|
+
] }),
|
|
363
|
+
/* @__PURE__ */ t("td", { className: "align-middle", children: a.description }),
|
|
364
|
+
/* @__PURE__ */ t("td", { className: "text-center align-middle", children: /* @__PURE__ */ t(
|
|
365
|
+
te,
|
|
366
|
+
{
|
|
367
|
+
onClick: () => $(a.id)
|
|
368
|
+
}
|
|
369
|
+
) })
|
|
370
|
+
] }, a.id)) })
|
|
371
|
+
] }) : /* @__PURE__ */ t(se, { label: s("skill") }) }),
|
|
372
|
+
/* @__PURE__ */ t(y, { md: 8, className: "text-right", children: /* @__PURE__ */ t(
|
|
373
|
+
ae,
|
|
374
|
+
{
|
|
375
|
+
totalRecordCount: o,
|
|
376
|
+
filters: m,
|
|
377
|
+
changePageSize: (a) => l({ pageSize: a }),
|
|
378
|
+
changePage: (a) => l({ currentPage: a })
|
|
379
|
+
}
|
|
380
|
+
) })
|
|
381
|
+
] })
|
|
382
|
+
] });
|
|
383
|
+
};
|
|
384
|
+
export {
|
|
385
|
+
Ie as default
|
|
386
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),i=require("react"),l=require("./index-B0KHEYvr.js"),u=({options:t,isDisabled:r,scrollBottom:c,onCreateOption:d,...a})=>{const[s,n]=i.useState(),o=()=>{n(void 0)};return e.jsxs("div",{className:"w-100",children:[e.jsx("div",{className:"w-100",children:e.jsx(l.CreatableSelect$1,{isDisabled:r,options:t,menuPlacement:c?"top":"auto",onFocus:o,...a})}),!!s&&e.jsx("p",{className:"text-danger mb-0 mt-1",children:s})]})};exports.TeacherSelector=u;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m } from "react";
|
|
3
|
+
import { au as l } from "./index-BpI8f2Tq.mjs";
|
|
4
|
+
const x = ({
|
|
5
|
+
options: s,
|
|
6
|
+
isDisabled: o,
|
|
7
|
+
scrollBottom: t,
|
|
8
|
+
onCreateOption: i,
|
|
9
|
+
...a
|
|
10
|
+
}) => {
|
|
11
|
+
const [r, c] = m();
|
|
12
|
+
return /* @__PURE__ */ n("div", { className: "w-100", children: [
|
|
13
|
+
/* @__PURE__ */ e("div", { className: "w-100", children: /* @__PURE__ */ e(
|
|
14
|
+
l,
|
|
15
|
+
{
|
|
16
|
+
isDisabled: o,
|
|
17
|
+
options: s,
|
|
18
|
+
menuPlacement: t ? "top" : "auto",
|
|
19
|
+
onFocus: () => {
|
|
20
|
+
c(void 0);
|
|
21
|
+
},
|
|
22
|
+
...a
|
|
23
|
+
}
|
|
24
|
+
) }),
|
|
25
|
+
!!r && /* @__PURE__ */ e("p", { className: "text-danger mb-0 mt-1", children: r })
|
|
26
|
+
] });
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
x as T
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),s=require("react-router-dom"),r=require("@coreui/react"),m=require("./index-B0KHEYvr.js"),u=e.jsx("div",{className:"app-initial-loader",style:{position:"relative",height:"100%",minHeight:"400px",backgroundColor:"transparent",width:"100%"},children:e.jsxs("div",{className:"loader-container",children:[e.jsx("img",{src:"/images/mario-logo.png",alt:"Mario Education Logo",className:"loader-logo",style:{maxWidth:"220px"}}),e.jsx("div",{className:"loading-text",children:"Loading your page..."}),e.jsxs("div",{className:"loading-dots",children:[e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"}),e.jsx("span",{className:"dot"})]})]})}),x=({routes:o})=>{const i=s.useLocation(),{pathname:a}=i,l=a.includes("/admin")?"":"box-container",c=a.includes("/admin")?"p-4":"";return e.jsx("main",{className:`c-main ${l}`,style:{height:"100%"},children:e.jsx(r.CContainer,{fluid:!0,className:`h-100 ${c}`,style:{flex:1},children:e.jsx(n.Suspense,{fallback:u,children:e.jsxs(s.Routes,{children:[o.map((t,d)=>e.jsx(s.Route,{path:t.path,element:e.jsx(t.component,{})},d)),e.jsx(s.Route,{path:"*",element:e.jsx(m.NotFound,{})})]})})})})},h=n.memo(x);exports.default=h;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as a, jsxs as e } from "react/jsx-runtime";
|
|
2
|
+
import { memo as m, Suspense as r } from "react";
|
|
3
|
+
import { useLocation as p, Routes as h, Route as t } from "react-router-dom";
|
|
4
|
+
import { CContainer as g } from "@coreui/react";
|
|
5
|
+
import { L as u } from "./index-BpI8f2Tq.mjs";
|
|
6
|
+
const N = /* @__PURE__ */ a("div", { className: "app-initial-loader", style: { position: "relative", height: "100%", minHeight: "400px", backgroundColor: "transparent", width: "100%" }, children: /* @__PURE__ */ e("div", { className: "loader-container", children: [
|
|
7
|
+
/* @__PURE__ */ a(
|
|
8
|
+
"img",
|
|
9
|
+
{
|
|
10
|
+
src: "/images/mario-logo.png",
|
|
11
|
+
alt: "Mario Education Logo",
|
|
12
|
+
className: "loader-logo",
|
|
13
|
+
style: { maxWidth: "220px" }
|
|
14
|
+
}
|
|
15
|
+
),
|
|
16
|
+
/* @__PURE__ */ a("div", { className: "loading-text", children: "Loading your page..." }),
|
|
17
|
+
/* @__PURE__ */ e("div", { className: "loading-dots", children: [
|
|
18
|
+
/* @__PURE__ */ a("span", { className: "dot" }),
|
|
19
|
+
/* @__PURE__ */ a("span", { className: "dot" }),
|
|
20
|
+
/* @__PURE__ */ a("span", { className: "dot" })
|
|
21
|
+
] })
|
|
22
|
+
] }) }), f = ({ routes: i }) => {
|
|
23
|
+
const s = p(), { pathname: o } = s, l = o.includes("/admin") ? "" : "box-container", d = o.includes("/admin") ? "p-4" : "";
|
|
24
|
+
return /* @__PURE__ */ a("main", { className: `c-main ${l}`, style: { height: "100%" }, children: /* @__PURE__ */ a(g, { fluid: !0, className: `h-100 ${d}`, style: { flex: 1 }, children: /* @__PURE__ */ a(r, { fallback: N, children: /* @__PURE__ */ e(h, { children: [
|
|
25
|
+
i.map((n, c) => /* @__PURE__ */ a(
|
|
26
|
+
t,
|
|
27
|
+
{
|
|
28
|
+
path: n.path,
|
|
29
|
+
element: /* @__PURE__ */ a(n.component, {})
|
|
30
|
+
},
|
|
31
|
+
c
|
|
32
|
+
)),
|
|
33
|
+
/* @__PURE__ */ a(t, { path: "*", element: /* @__PURE__ */ a(u, {}) })
|
|
34
|
+
] }) }) }) });
|
|
35
|
+
}, L = m(f);
|
|
36
|
+
export {
|
|
37
|
+
L as default
|
|
38
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-B0KHEYvr.js"),W=require("./UserList-drpkL0az.js"),i=require("react"),l=require("reactstrap"),re=require("react-i18next"),j=require("./constants-DMGfBpO6.js"),Se=require("react-redux"),ne=require("./userService-Ce6Rl3kx.js"),qe=require("./TeacherSelector-C9HSJpwB.js"),Qe=require("react-select"),Xe=require("formik"),Ze=require("yup"),et=require("papaparse");function tt(s){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(o,r,c.get?c:{enumerable:!0,get:()=>s[r]})}}return o.default=s,Object.freeze(o)}const Ie=tt(Ze),Ve="Cannot update two school levels at the same time.",Te=s=>W.resolveStudentTier(s),He=s=>{const o=Object.entries(s).filter(([r])=>r!=="currentPage"&&r!=="cursor").sort(([r],[c])=>r.localeCompare(c));return JSON.stringify(o)},st=s=>{if(s===void 0)return;const o=j.UserOrder[s];return o?o.charAt(0).toLowerCase()+o.slice(1):void 0},at=()=>{const s=Se.useDispatch(),[o,r]=i.useState([]),[c,y]=i.useState(j.DEFAULT_STUDENT_FILTER),[n,I]=i.useState(0),[f,m]=i.useState([]),[S,E]=i.useState([]),[h,b]=i.useState(j.initAssignStd),k="",L=i.useRef({}),C=i.useRef(""),_=i.useMemo(()=>{const T=S.find(p=>!!Te(p));return Te(T)},[S]),R=T=>{const p=Object.keys(T).every(N=>N==="currentPage"),d={...c,...T};p||(d.currentPage=1,L.current={},C.current=He(d)),y(d)},U=i.useMemo(()=>{const T=o.filter(d=>f.includes(d.id)).flatMap(d=>d.teachers),p=new Map;return T.forEach(d=>{p.has(d.teacherUserId)||p.set(d.teacherUserId,d)}),Array.from(p.values()).map(d=>({value:d.teacherUserId,label:d.mainTeacherEmail}))},[S,f]),z=i.useMemo(()=>{const T=o.filter(d=>f.includes(d.id)).flatMap(d=>d.counselors),p=new Map;return T.forEach(d=>{p.has(d.counselorUserId)||p.set(d.counselorUserId,d)}),Array.from(p.values()).map(d=>({value:d.counselorUserId,label:d.counselorEmail}))},[S,f]),X=i.useMemo(()=>{const T=o.filter(d=>f.includes(d.id)&&d.assistantUserId).map(d=>({value:d.assistantUserId,label:d.assistantEmail})),p=new Map;return T.forEach(d=>{p.has(d.value)||p.set(d.value,d)}),Array.from(p.values())},[o,f]),ie=i.useMemo(()=>{const T=o.filter(d=>f.includes(d.id)&&d.secondaryTeacherUserId).map(d=>({value:d.secondaryTeacherUserId,label:d.secondaryTeacherEmail})),p=new Map;return T.forEach(d=>{p.has(d.value)||p.set(d.value,d)}),Array.from(p.values())},[o,f]),de=i.useCallback(T=>{T!==c.sortBy?R({sortBy:T,orderBy:"ASC",currentPage:1}):R({sortBy:T,orderBy:c.orderBy!=="DESC"?"DESC":"ASC",currentPage:1})},[JSON.stringify(c)]),Q=async()=>{s(t.setLoading(!0));try{const T=c.currentPage||1,p=He(c);C.current!==p&&(L.current={},C.current=p);const d=Object.entries(c).filter(([J,se])=>se!==void 0).reduce((J,[se,oe])=>(J[se]=oe,J),{}),N={};for(const J in d){if(J==="currentPage"){N.page=d[J];continue}if(J==="orderBy"||J==="cursor")continue;if(J==="sortBy"){const oe=st(d[J]);oe!==void 0&&(N.sortBy=oe);continue}const se=J.charAt(0).toLowerCase()+J.slice(1);N[se]=d[J]}N.isDescending=c.isDescending??c.orderBy==="DESC";const P=Object.prototype.hasOwnProperty.call(L.current,T);T===1?N.cursor="":P&&(N.cursor=L.current[T]);const te=(await ne.getAssignStudentApi(N))?.data||{},ue=te?.nextCursor||te?.pagination?.nextCursor;ue?L.current[T+1]=ue:delete L.current[T+1],r(te?.items||te?.pagination?.items||[]),I(te?.totalItems||te?.pagination?.totalItems||0)}catch(T){s(t.setAlert({type:"danger",message:T.response?.data?.title||T.message}))}s(t.setLoading(!1))},v=i.useMemo(()=>T=>{const p=Te(T);return!!_&&!!p&&p!==_},[_]),F=i.useMemo(()=>{const T=o.filter(p=>!v(p));return T.length>0&&T.every(p=>f.includes(p.id))},[o,f,v]),O=()=>{if(F){const d=new Set(o.map(N=>N.id));m(N=>N.filter(P=>!d.has(P))),E(N=>N.filter(P=>!d.has(P.id)));return}const T=_??Te(o.find(d=>!!Te(d))),p=o.filter(d=>{const N=Te(d);return!N||!T||N===T});if(p.length===0&&o.length>0){ee();return}m(d=>{const N=p.map(P=>P.id).filter(P=>!d.includes(P));return[...d,...N]}),E(d=>{const N=new Set(d.map(H=>H.id)),P=p.filter(H=>!N.has(H.id));return[...d,...P]})},ee=()=>{s(t.setAlert({type:"warning",message:Ve}))},pe=T=>{const{id:p,checked:d}=T.target,N=o.find(P=>P.id===p);if(d&&N&&v(N)){ee();return}d?(m(P=>[...P,p]),N&&E(P=>[...P,N])):(m(P=>P.filter(H=>H!==p)),E(P=>P.filter(H=>H.id!==p)))},A=i.useCallback(()=>{c.currentPage==1?Q():R({currentPage:1}),m([]),E([])},[JSON.stringify(c)]);return i.useEffect(()=>{Q()},[JSON.stringify(c)]),i.useEffect(()=>{document.title="User | Assign student"},[]),i.useEffect(()=>{R({...c,searchString:k})},[k]),{handelSort:de,handleRetrievedData:A,totalItem:n,userList:o,filters:c,changeFilters:R,handleSelectAll:O,handleClickCheck:pe,isCheckAll:F,isCheck:f,fullName:k,selectedUser:h,setSelectedUser:b,userSelected:S,getDataUserList:Q,studentTeacherSelected:U,studentCounselorSelected:z,studentAssistantSelected:X,studentSecondaryTeacherSelected:ie,isStudentSelectionDisabled:v,handleBlockedSchoolLevelSelection:ee,schoolLevelConflictMessage:Ve}},nt=(s,o,r,c,y,n,I,f)=>{const m=Se.useDispatch(),[S,E]=i.useState(!1),[h,b]=i.useState(j.initialStaffBulk),[k,L]=i.useState(!1),[C,_]=i.useState(!1),[R,U]=i.useState(j.TeacherType.Teacher),[z,X]=i.useState([]),[ie,de]=i.useState([]),[Q,v]=i.useState([]),[F,O]=i.useState({header:"",titleSelect:"",selectPlaceholder:"",changeTitle:"",changePlaceholder:""}),[ee,pe]=i.useState(""),[A,T]=i.useState(""),[p,d]=i.useState(!1),[N,P]=i.useState(0),[H,te]=i.useState([]),[ue,J]=i.useState(""),[se,oe]=i.useState(!1),[he,le]=i.useState(!1),[G,me]=i.useState(j.initStaffDeleteBulk),K=u=>{me({...G,...u})},ge=u=>{if(u&&u.length===0){m(t.setAlert({type:"danger",message:"Please select students!"}));return}le(!he),b({...j.initialStaffBulk}),me({...j.initStaffDeleteBulk})},fe=()=>{oe(!se),J("")},ye=u=>{H.includes(u)?te(H.filter(g=>g!==u)):te([...H,u])},ve=u=>{P(g=>g===u?-1:u)},je=u=>{if(u&&u.length===0){m(t.setAlert({type:"danger",message:"Please select students!"}));return}E(!S),b({...j.initialStaffBulk})},we=(u,g,x)=>{if(u&&u.length===0){m(t.setAlert({type:"danger",message:"Please select students!"}));return}switch(v(u),de(W.extractStaffList(u,g)),U(g),g){case j.TeacherType.Teacher:O({header:"switch_teacher",titleSelect:"current_teacher_name",selectPlaceholder:"select_teacher",changeTitle:"select_teacher_change",changePlaceholder:"select_teacher_change"});break;case j.TeacherType.Assistant:O({header:"switch_assistant",titleSelect:"current_assistant_name",selectPlaceholder:"",changeTitle:"",changePlaceholder:"select_assistant_change"});break;case j.TeacherType.Counselor:O({header:"switch_counselor",titleSelect:"current_counselor_name",selectPlaceholder:"select_counselor",changeTitle:"select_counselor_change",changePlaceholder:"select_counselor_change"});break;case j.TeacherType.SecondaryTeacher:O({header:"switch_support_teacher",titleSelect:"current_assistant_name",selectPlaceholder:"",changeTitle:"",changePlaceholder:"select_support_teacher_change"});break}_(!C),X(x)},xe=()=>{X([]),_(!1),d(!1),U(j.TeacherType.Teacher),de([]),pe(""),T(""),O({header:"",titleSelect:"",selectPlaceholder:"",changeTitle:"",changePlaceholder:""}),te([])},Ne=()=>{d(!1),P(0),te([])},Le=async(u,g)=>{m(t.setModal({isOpen:!0,type:"warning",message:`Do you want to change ${g===j.TeacherType.Teacher?"teacher":g===j.TeacherType.Assistant?"assistant":g===j.TeacherType.SecondaryTeacher?"support teacher":"counselor"} for ${u.length} student(s)?`,onConfirm:async()=>{m(t.setLoading(!0));try{const x=g===j.TeacherType.Teacher?await ne.changeMultiTeacherOfStudent(u):g===j.TeacherType.Assistant?await ne.changeAssistantOfStudents(u):g===j.TeacherType.Counselor?await ne.changeMultiCounselorsOfStudent(u):await ne.changeSecondaryTeacherOfStudents(u);x&&x?.data&&(xe(),y?.(),await I(),m(t.setAlert({type:"success",message:`Change ${g===j.TeacherType.Teacher?"teacher":g===j.TeacherType.Assistant?"assistant":g===j.TeacherType.SecondaryTeacher?"support teacher":"counselor"} successfully`})))}catch(x){m(t.setAlert({type:"danger",message:x.response?.data?.title||x.message}))}m(t.setLoading(!1))}}))},Ae=()=>{let u=[];switch(R){case j.TeacherType.Teacher:u=Q.filter(g=>{const x=g.teachers.map(D=>D.teacherUserId);return x.includes(A)&&!x.includes(ee)}).map(g=>({studentId:g.studentId,teacher:A,teacherChange:ee}));break;case j.TeacherType.Counselor:u=Q.filter(g=>{const x=g.counselors.map(D=>D.counselorUserId);return x.includes(A)&&!x.includes(ee)}).map(g=>({studentId:g.studentId,counselor:A,counselorChange:ee}));break;case j.TeacherType.Assistant:u=Q.filter(g=>g?.assistantUserId&&g?.teachers?.length>0).map(g=>({studentId:g.studentId,assistantUserId:ee}));break;case j.TeacherType.SecondaryTeacher:u=Q.filter(g=>g?.secondaryTeacherUserId&&g?.teachers?.length>0).map(g=>({studentId:g.studentId,secondaryTeacherId:ee}));break}if(u.length===0){m(t.setAlert({type:"danger",message:"No change to update!"}));return}Le(u||[],R)},Me=u=>{if(u&&u.length===0){m(t.setAlert({type:"danger",message:"Please select student(s)!"}));return}L(!k)},Ee=(u,g)=>{switch(u){case"assistant":b({...h,assistantId:g.value,assistantEmail:g.label});break;case"secondary":b({...h,secondaryTeacherId:g.value,secondaryTeacherEmail:g.label});break;case"grade":b({...h,gradeLevel:g.value});break}},ke=u=>{b({...h,teacher:u})},Ue=u=>{b({...h,counselors:u})},Ce=async u=>{m(t.setLoading(!0));try{await ne.assignStudentsApi(u),m(t.setAlert({type:"success",message:"Student assigned successfully"})),y?.(),xe()}catch(g){m(t.setAlert({type:"danger",message:g.response?.data?.title||g.message}))}m(t.setLoading(!1))},Be=i.useCallback(u=>{if(u.length===0){m(t.setAlert({type:"danger",message:"Not found selected student."}));return}if(u.some(D=>{const B=s?.[D],w=o?.[D],V=r?.[D],q=c?.[D];return!B&&!w&&!V&&!q})){m(t.setAlert({type:"danger",message:"Please select/add teacher for all selected student first."}));return}const x=u.map(D=>{const B=s?.[D],w=o?.[D],V=r?.[D],q=c?.[D],Y=f?.find(Z=>Z.id===D),ce={id:D,schoolLevel:Y?.schoolLevel};return B&&(ce.mainTeacherUserId=B?B.map(Z=>Z.value):void 0,ce.mainTeacherEmail=B?B.map(Z=>Z.label):void 0),w&&(ce.assistantUserId=w?.value&&typeof w?.value=="string"?w?.value:void 0,ce.assistantEmail=w?.value&&typeof w?.value=="number"?w?.label:void 0),V&&(ce.counselorUserIds=V?V.map(Z=>Z.value):void 0,ce.counselorEmails=V?V.map(Z=>Z.label):void 0),q&&(ce.secondaryTeacherUserId=q?.value&&typeof q?.value=="string"?q?.value:void 0,ce.secondaryTeacherEmail=q?.value&&typeof q?.value=="number"?q?.label:void 0),ce});Ce([...x])},[JSON.stringify(s),JSON.stringify(o),JSON.stringify(r),JSON.stringify(c)]),Oe=i.useCallback(u=>{const g=s?.[u],x=o?.[u],D=r?.[u],B=c?.[u];if(!g&&!x&&!D&&!B){m(t.setAlert({type:"danger",message:"Please select/add teacher for selected student first."}));return}const w=f?.find(q=>q.id===u),V={id:u,schoolLevel:w?.schoolLevel};g&&(V.mainTeacherUserId=g?g.map(q=>q.value):void 0,V.mainTeacherEmail=g?g.map(q=>q.label):void 0),x&&(V.assistantUserId=x?.value&&typeof x?.value=="string"?x?.value:void 0,V.assistantEmail=x?.value&&typeof x?.value=="number"?x?.label:void 0),D&&(V.counselorUserIds=D?D.map(q=>q.value):void 0,V.counselorEmails=D?D.map(q=>q.label):void 0),B&&(V.secondaryTeacherUserId=B?.value&&typeof B?.value=="string"?B?.value:void 0,V.secondaryTeacherEmail=B?.value&&typeof B?.value=="number"?B?.label:void 0),Ce([V])},[JSON.stringify(s),JSON.stringify(o),JSON.stringify(r),JSON.stringify(c)]),De=async u=>{if(u.length===0){m(t.setAlert({type:"danger",message:"Not found selected student."}));return}if(h.teacher.length===0&&h.counselors.length===0&&!h.assistantId&&!h.secondaryTeacherId){m(t.setAlert({type:"danger",message:"No change to assign!"}));return}const g=f?.filter(x=>u?.includes(x.id))?.every(x=>Array.isArray(x.teachers)&&x.teachers.length>0)??!1;if(h.teacher.length===0&&!g){m(t.setAlert({type:"danger",message:"Please assign a teacher to each student before giving other educators access to them"}));return}m(t.setLoading(!0));try{if(h.teacher.length>0&&f&&f.length>0){const B=f.filter(w=>u.includes(w.id)).map(w=>{const V=w.teachers?.map(Y=>Y.teacherUserId)||[],q=h.teacher.filter(Y=>!V.includes(Y.id));return{id:w.id,schoolLevel:w.schoolLevel,mainTeacherUserId:q.map(Y=>Y.id),mainTeacherEmail:q.map(Y=>Y.email)}}).filter(w=>w.mainTeacherUserId.length>0||w.mainTeacherEmail.length>0);B.length>0&&await ne.assignStudentsApi(B)}if(h.counselors.length>0&&f&&f.length>0){const B=f.filter(w=>u.includes(w.id)).map(w=>{const V=w.counselors?.map(Y=>Y.counselorUserId)||[],q=h.counselors.filter(Y=>!V.includes(Y.id));return{id:w.id,schoolLevel:w.schoolLevel,counselorUserIds:q.map(Y=>Y.id),counselorEmails:q.map(Y=>Y.email)}}).filter(w=>w.counselorUserIds.length>0||w.counselorEmails.length>0);B.length>0&&await ne.assignStudentsApi(B)}const x=f?.filter(B=>!B.assistantUserId);if(x&&x?.length>0&&h.assistantId){const B=x.map(w=>({id:w.id,schoolLevel:w.schoolLevel,assistantUserId:h.assistantId,assistantEmail:h.assistantEmail}));await ne.assignStudentsApi(B.filter(w=>w!==void 0))}const D=f?.filter(B=>!B.secondaryTeacherUserId);if(D&&D?.length>0&&h.secondaryTeacherId){const B=D.map(w=>({id:w.id,schoolLevel:w.schoolLevel,secondaryTeacherUserId:h.secondaryTeacherId,secondaryTeacherEmail:h.secondaryTeacherEmail}));await ne.assignStudentsApi(B.filter(w=>w!==void 0))}m(t.setAlert({type:"success",message:"Student assigned successfully"})),y?.(),xe(),je()}catch(x){m(t.setAlert({type:"danger",message:x.response?.data?.title||x.message}))}m(t.setLoading(!1))},Re=async u=>{if(h.teacher.length===0){m(t.setAlert({type:"danger",message:"Please select teacher before assign!"}));return}if(H.length>0&&!u){oe(!0);return}const g={id:n?.id||"",schoolLevel:n?.schoolLevel,mainTeacherUserId:h.teacher.filter(x=>!n?.teachers?.some(D=>D.teacherUserId===x.id)).map(x=>x.id)||[],mainTeacherEmail:h.teacher.filter(x=>!n?.teachers?.some(D=>D.teacherUserId===x.id)).map(x=>x.email)||[],assistantUserId:h?.assistantId?h?.assistantId:void 0,assistantEmail:h?.assistantEmail?h?.assistantEmail:void 0,counselorUserIds:h.counselors.map(x=>x.id)||[],counselorEmails:h.counselors.map(x=>x.email)||[],secondaryTeacherUserId:h?.secondaryTeacherId?h?.secondaryTeacherId:void 0,secondaryTeacherEmail:h?.secondaryTeacherEmail?h?.secondaryTeacherEmail:void 0,removeTeacherUserIds:H,teacherSwitchUserId:u||""};h?.gradeLevel&&h.gradeLevel!==n?.gradeLevel&&await ne.addGradeToStudent(n?.id||"",h?.gradeLevel,n?.schoolLevel),Ce([g])},$e=async(u,g)=>{m(t.setLoading(!0));try{(await ne.updateStatusAll(u)).status==200&&(m(t.setAlert({type:"success",message:`Inactive ${u.length} Students successfully`})),g())}catch(x){m(t.setAlert({type:"danger",message:x.response?.data?.title||x.message}))}L(!k),m(t.setLoading(!1))},Fe=i.useCallback(async u=>{if(G.assistantRemoveUserId.length&&!G.assistantSwitchDataUserId){m(t.setAlert({type:"danger",message:"Please select an assistant to transfer data!"}));return}if(G.teacherRemoveUserIds.length&&!G.teacherSwitchDataUserId){m(t.setAlert({type:"danger",message:"Please select a teacher to transfer data!"}));return}if(G.counselorRemoveUserIds.length&&!G.counselorSwitchDataUserId){m(t.setAlert({type:"danger",message:"Please select a counselor to transfer data!"}));return}if(G.supportTeacherRemoveUserIds.length&&!G.supportTeacherSwitchDataUserId){m(t.setAlert({type:"danger",message:"Please select a support teacher to transfer data!"}));return}m(t.setLoading(!0));try{const g=u?.[0],D=f?.find(B=>B.id===g)?.schoolLevel;await ne.removeBulkStaff({...G,studentUserIds:u||[],schoolLevel:D}),y?.(),await I()}catch(g){m(t.setAlert({type:"danger",message:g.response?.data?.title||g.message}))}ge(),m(t.setLoading(!1))},[G]);return i.useEffect(()=>(n?.id&&b({teacher:n?.teachers?.map(u=>({id:u.teacherUserId,email:u.mainTeacherEmail})),assistantId:n?.assistantUserId,assistantEmail:n?.assistantEmail,counselors:n?.counselors?.map(u=>({id:u.counselorUserId,email:u.counselorEmail})),secondaryTeacherEmail:n?.secondaryTeacherEmail,secondaryTeacherId:n?.secondaryTeacherUserId,gradeLevel:n?.gradeLevel}),()=>{b(j.initialStaffBulk)}),[n]),{handleAssignSingleStudent:Oe,handleAssignMultiStudent:Be,openModelBulk:S,handleToggleModel:je,handleChangeStaffBulk:Ee,staffBulkAssign:h,onAssignStaffToStudents:De,handleToggleInactiveModal:Me,openInactiveModal:k,handleInactiveStudents:$e,handleChangeTeacherBulk:ke,handleEditAssignForStudents:Re,handleToggleSwitchModel:we,openSwitchModal:C,optionsSwitch:z,modalType:R,textModal:F,teacherSwitchList:ie,onCloseSwitchModal:xe,handleUpdateSwitch:Ae,setTeacherChangeUserId:pe,setTeacherSelectForChangeUserId:T,teacherSelectForChangeUserId:A,openDetailModal:p,setOpenDetailModal:d,toggleCollapse:ve,activeIndex:N,handleChangeCounselorBulk:Ue,onClose:Ne,removeTeacherUserIds:H,onSelectRemoveTeacher:ye,openModelSwitchDataTeacher:se,onToggleModelSwitchDataTeacher:fe,teacherSwitchUserId:ue,setTeacherSwitchUserId:J,onToggleModelDeleteBulk:ge,openModelDeleteBulk:he,handelChangeStaffRemove:K,switchStaffUsers:G,handleRemoveBulkStaff:Fe}};function lt(s){return t.GenIcon({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M228.9 79.9L51.8 403.1C40.6 423.3 55.5 448 78.9 448h354.3c23.3 0 38.2-24.7 27.1-44.9L283.1 79.9c-11.7-21.2-42.5-21.2-54.2 0zM273.6 214L270 336h-28l-3.6-122h35.2zM256 402.4c-10.7 0-19.1-8.1-19.1-18.4s8.4-18.4 19.1-18.4 19.1 8.1 19.1 18.4-8.4 18.4-19.1 18.4z"}}]})(s)}const rt=s=>{const{textModal:o,isOpen:r,teachers:c,options:y,onClose:n,onSave:I,modalType:f,setTeacherChangeUserId:m,setTeacherSelectForChangeUserId:S,teacherSelectForChangeUserId:E}=s,{t:h}=re.useTranslation();return e.jsxs(l.Modal,{centered:!0,isOpen:r,toggle:n,zIndex:1201,children:[e.jsx(l.ModalHeader,{className:t.styles["header-assign-for-student"],children:h(o.header)}),e.jsxs(l.ModalBody,{children:[f!==j.TeacherType.Assistant||f!==j.TeacherType.SecondaryTeacher&&e.jsxs(i.Fragment,{children:[e.jsx("div",{children:h(o.titleSelect)}),e.jsx("ul",{style:{maxHeight:200,overflow:"auto"},children:c.map(b=>e.jsxs("li",{children:[b.name,"-",b.label]},b.label))})]}),(f===j.TeacherType.Teacher||f===j.TeacherType.Counselor)&&e.jsxs(i.Fragment,{children:[e.jsx("div",{children:h(o.selectPlaceholder)}),e.jsx(t.CustomSelector,{options:c,value:c.filter(b=>b.value===E),placeholder:h(o.selectPlaceholder),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:b=>{S(b.value)},isClearable:!0,style:{maxWidth:120}})]}),e.jsx("div",{children:h(o.changeTitle)}),e.jsx(qe.TeacherSelector,{options:y,onChange:b=>{f!==j.TeacherType.SecondaryTeacher?m(b.value):m(b.id)},placeholder:h(o.changePlaceholder),className:"flex-grow-1 mb-3"})]}),e.jsxs(l.ModalFooter,{className:"textModal-right",children:[e.jsx(l.Button,{onClick:()=>n(!1),children:h("cancel")}),e.jsx(l.Button,{color:"primary",onClick:()=>{I()},children:h("save")})]})]})},ot=i.forwardRef(rt),ct=({openDetailModal:s,onClose:o,selectedUser:r,staffBulkAssign:c,teacherOptions:y,handleChangeTeacherBulk:n,handleChangeCounselorBulk:I,assistantOptions:f,counselorOptions:m,secondaryTeacherOptions:S,handleChangeStaffBulk:E,handleEditAssignForStudents:h,toggleCollapse:b,activeIndex:k})=>{const{t:L}=re.useTranslation(),{getLabel:C,system:_}=t.useGradeLabel(),R=[r?.teachers||[],r?.counselors||[]],U=W.resolveStudentTier(r),z=v=>W.matchesStudentTier(v,U),X=y.filter(v=>!r.teachers?.some(F=>F.teacherUserId===v.value)).filter(z),ie=f.filter(z),de=m.filter(v=>!r.counselors?.some(F=>F.counselorUserId===v.value)).filter(z),Q=S.filter(z);return e.jsxs(l.Modal,{centered:!0,isOpen:s,toggle:()=>o(),zIndex:1201,children:[e.jsxs(l.ModalHeader,{className:t.styles["header-assign-for-student"],children:[e.jsxs("div",{children:["Assign student ",r?.fullName]}),e.jsx("div",{children:C(r?.gradeLevel)})]}),e.jsxs(l.ModalBody,{children:[R.map((v,F)=>e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:`btn ${t.styles["btn-collapse"]} ${k===F?"btn-link ":""}`,onClick:()=>b(F),children:[L(F===0?"current_teacher_name":"current_counselor_name")," ",`(${v.length})`," ",e.jsx("i",{className:`fa fa-angle-${k===F?"up":"down"}`})]}),e.jsx(l.Collapse,{isOpen:k===F,children:e.jsx(l.Card,{children:e.jsx(l.CardBody,{children:v.length>0?v.map(O=>F===0?e.jsxs("li",{children:[O.mainTeacherName," - ",O.mainTeacherEmail]},O.mainTeacherEmail):e.jsxs("li",{children:[O.counselorName," - ",O.counselorEmail]},O.counselorUserId)):e.jsx("div",{children:L("no_data")})})})})]},F)),e.jsx("div",{children:L("teacher_email")}),e.jsx(t.CustomSelector,{isMulti:!0,value:c.teacher.filter(v=>!r.teachers?.some(F=>F.teacherUserId===v.id)).map(v=>({label:v.email,value:v.id})),options:X,placeholder:L("select_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:v=>{const F=v.map(O=>({id:O.value,email:O.label}));n(F)},isClearable:!0,style:{maxWidth:120}}),e.jsx("div",{children:L("assistant_email")}),e.jsx(qe.TeacherSelector,{value:f.find(v=>v.value==c.assistantId||v.label==c.assistantEmail)||null,options:ie,onChange:v=>{E("assistant",v)},placeholder:L("select_assistant"),className:"flex-grow-1 mb-3"}),e.jsx("div",{children:L("counselor_email")}),e.jsx(t.CustomSelector,{isMulti:!0,value:c.counselors.filter(v=>!r.counselors?.some(F=>F.counselorUserId===v.id)).map(v=>({label:v.email,value:v.id})),options:de,placeholder:L("select_counselor"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:v=>{const F=v.map(O=>({id:O.value,email:O.label}));I(F)},isClearable:!0,style:{maxWidth:120}}),e.jsx("div",{children:L("support_teacher_email")}),e.jsx(qe.TeacherSelector,{value:S.find(v=>v.value==c.secondaryTeacherId||v.label==c.secondaryTeacherEmail)||null,options:Q,onChange:v=>{E("secondary",v)},placeholder:L("select_support_teacher"),className:"flex-grow-1"}),e.jsx("div",{children:_==="UK"?"Year":L("grade")}),e.jsx(Qe,{value:j.GRADE_DEFAULT.filter(v=>v.schoolLevel===U).map(v=>({...v,label:C(v.value)})).find(v=>v.value===c.gradeLevel)||null,options:j.GRADE_DEFAULT.filter(v=>v.schoolLevel===U).map(v=>({...v,label:C(v.value)})),placeholder:_==="UK"?"Select year":L("select_grade"),className:"flex-grow-1 mb-3",onChange:v=>{E("grade",v)},styles:{container:v=>({...v,maxWidth:120})}})]}),e.jsxs(l.ModalFooter,{className:"text-right",children:[e.jsx(l.Button,{onClick:()=>o(),children:L("cancel")}),e.jsx(l.Button,{color:"primary",onClick:()=>{h()},children:L("save")})]})]})},it=({open:s,onClose:o,teachers:r,onConfirm:c,teacherSwitchUserId:y,setTeacherSwitchUserId:n})=>{const{t:I}=re.useTranslation();return e.jsxs(l.Modal,{centered:!0,isOpen:s,toggle:()=>o(),zIndex:1201,children:[e.jsx(l.ModalHeader,{className:t.styles["header-assign-for-student"],children:e.jsx("div",{children:"Select teacher switch data"})}),e.jsx(l.ModalBody,{className:"p-0",children:e.jsx("div",{className:t.styles["switch-data-teachers"],children:r.map(f=>e.jsx("p",{onClick:()=>n(f.teacherUserId),className:`${t.styles["switch-data-teacher-item"]} ${f.teacherUserId==y?t.styles["item-checked"]:""}`,children:f.mainTeacherName}))})}),e.jsxs(l.ModalFooter,{className:"text-right",children:[e.jsx(l.Button,{onClick:()=>o(),children:I("cancel")}),e.jsx(l.Button,{disabled:!y,color:"primary",onClick:async()=>{await c(y),o()},children:I("save")})]})]})},dt=({teachers:s,onChangeStaffRemove:o,switchStaffUsers:r,teacherOptions:c})=>{const{t:y}=re.useTranslation();return e.jsxs("div",{children:[e.jsx("h6",{children:"Select teacher to remove"}),e.jsx(t.CustomSelector,{isMulti:!0,value:s.filter(n=>r.teacherRemoveUserIds.includes(n.value))||[],options:s.filter(n=>!r.teacherRemoveUserIds.includes(n.value)&&n.value!==r.teacherSwitchDataUserId)||[],placeholder:y("select_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:n=>{o({teacherRemoveUserIds:n.map(I=>I.value)})},isClearable:!0}),e.jsx("h6",{className:"mt-3",children:"Select the teacher to transfer data to"}),e.jsx(t.CustomSelector,{value:c.find(n=>r.teacherSwitchDataUserId==n.value)||null,options:c.filter(n=>!r.teacherRemoveUserIds.includes(n.value)&&n.value!==r.teacherSwitchDataUserId)||[],placeholder:y("select_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:n=>{console.log("value",n),o({teacherSwitchDataUserId:n?.value})},isClearable:!0})]})},ut=({counselors:s,onChangeStaffRemove:o,switchStaffUsers:r,counselorOptions:c})=>{const{t:y}=re.useTranslation();return e.jsxs("div",{children:[e.jsx("h6",{children:"Select counselor to remove"}),e.jsx(t.CustomSelector,{isMulti:!0,value:s.filter(n=>r.counselorRemoveUserIds.includes(n.value))||[],options:s.filter(n=>!r.counselorRemoveUserIds.includes(n.value)&&n.value!==r.counselorSwitchDataUserId)||[],placeholder:y("select_counselor"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:n=>{o({counselorRemoveUserIds:n.map(I=>I.value)})},isClearable:!0}),e.jsx("h6",{className:"mt-3",children:"Select the counselor to transfer data to"}),e.jsx(t.CustomSelector,{value:c.find(n=>r.counselorSwitchDataUserId==n.value)||null,options:c.filter(n=>!r.counselorRemoveUserIds.includes(n.value)&&n.value!==r.counselorSwitchDataUserId)||[],placeholder:y("select_counselor"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-counselor-select"]}`,onChange:n=>{o({counselorSwitchDataUserId:n?.value})},isClearable:!0})]})},ht=({tabs:s})=>{const{t:o}=re.useTranslation(),[r,c]=i.useState(0),y=I=>{c(I)},n=()=>e.jsx(l.Row,{children:e.jsxs(l.Col,{xl:12,children:[e.jsx(l.Nav,{tabs:!0,children:s.map((I,f)=>{const m=f===r;return e.jsx(l.NavItem,{children:e.jsx(l.NavLink,{className:`${m?"active":""} cursor-pointer`,onClick:()=>y(f),style:{color:m?"#316CD9":"#242424"},children:o(I.title)})},f)})}),e.jsx(l.TabContent,{activeTab:r,className:"border-bottom-0 border-left-0 border-right-0 p-3",children:s.map((I,f)=>e.jsx(l.TabPane,{tabId:f,children:e.jsx(I.component,{})},f))})]})});return e.jsx("div",{className:"animated fadeIn",children:n()})},mt=({assistants:s,onChangeStaffRemove:o,switchStaffUsers:r,assistantOptions:c})=>{const{t:y}=re.useTranslation();return e.jsxs("div",{children:[e.jsx("h6",{children:"Select assistant to remove"}),e.jsx(t.CustomSelector,{isMulti:!0,value:s.filter(n=>r.assistantRemoveUserId.includes(n.value))||[],options:s.filter(n=>!r.assistantRemoveUserId.includes(n.value)&&n.value!==r.assistantSwitchDataUserId)||[],placeholder:y("select_assistant"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:n=>{o({assistantRemoveUserId:n.map(I=>I.value)})},isClearable:!0}),e.jsx("h6",{className:"mt-3",children:"Select the assistant to transfer data to"}),e.jsx(t.CustomSelector,{value:c.find(n=>r.assistantSwitchDataUserId==n.value)||null,options:c.filter(n=>!r.assistantRemoveUserId.includes(n.value)&&n.value!==r.assistantSwitchDataUserId)||[],placeholder:y("select_assistant"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-assistant-select"]}`,onChange:n=>{console.log("value",n),o({assistantSwitchDataUserId:n?.value})},isClearable:!0})]})},pt=({secondaryTeachers:s,onChangeStaffRemove:o,switchStaffUsers:r,secondaryTeacherOptions:c})=>{const{t:y}=re.useTranslation();return e.jsxs("div",{children:[e.jsx("h6",{children:"Select support teacher to remove"}),e.jsx(t.CustomSelector,{isMulti:!0,value:s.filter(n=>r.supportTeacherRemoveUserIds.includes(n.value))||[],options:s.filter(n=>!r.supportTeacherRemoveUserIds.includes(n.value)&&n.value!==r.supportTeacherSwitchDataUserId)||[],placeholder:y("select_support_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:n=>{o({supportTeacherRemoveUserIds:n.map(I=>I.value)})},isClearable:!0}),e.jsx("h6",{className:"mt-3",children:"Select the support teacher to transfer data to"}),e.jsx(t.CustomSelector,{value:c.find(n=>r.supportTeacherSwitchDataUserId==n.value)||null,options:c.filter(n=>!r.supportTeacherRemoveUserIds.includes(n.value)&&n.value!==r.supportTeacherSwitchDataUserId)||[],placeholder:y("select_support_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:n=>{o({supportTeacherSwitchDataUserId:n?.value})},isClearable:!0})]})},gt=({open:s,onClose:o,teachers:r,onChangeStaffRemove:c,switchStaffUsers:y,assistants:n,onRemoveBulkStaff:I,counselors:f,studentUserIds:m,secondaryTeachers:S,teacherOptions:E,assistantOptions:h,counselorOptions:b,secondaryTeacherOptions:k})=>{const{t:L}=re.useTranslation(),C=[{title:"Remove Teacher",component:()=>e.jsx(dt,{teachers:r,onChangeStaffRemove:c,switchStaffUsers:y,teacherOptions:E})},{title:"Remove Assistant",component:()=>e.jsx(mt,{assistants:n,onChangeStaffRemove:c,switchStaffUsers:y,assistantOptions:h})},{title:"Remove Counselor",component:()=>e.jsx(ut,{counselors:f,onChangeStaffRemove:c,switchStaffUsers:y,counselorOptions:b})},{title:"Remove Support Teacher",component:()=>e.jsx(pt,{secondaryTeachers:S,onChangeStaffRemove:c,switchStaffUsers:y,secondaryTeacherOptions:k})}];return e.jsxs(l.Modal,{size:"lg",centered:!0,isOpen:s,toggle:()=>o(),zIndex:1201,children:[e.jsx(l.ModalHeader,{className:`${t.styles["header-assign-for-student"]} border-0`,children:e.jsx("div",{children:"Remove Bulk"})}),e.jsx(l.ModalBody,{className:"p-0",children:e.jsx(ht,{tabs:C})}),e.jsxs(l.ModalFooter,{className:"text-right",children:[e.jsx(l.Button,{onClick:()=>o(),children:L("cancel")}),e.jsx(l.Button,{disabled:!y.teacherRemoveUserIds.length&&!y.assistantRemoveUserId&&!y.counselorRemoveUserIds.length,color:"primary",onClick:async()=>{await I(m)},children:"Remove"})]})]})},ft=()=>{const{t:s}=re.useTranslation(),{getLabel:o}=t.useGradeLabel(),[r,c]=i.useState(),[y,n]=i.useState(),[I,f]=i.useState(),[m,S]=i.useState(),[E,h]=i.useState([]),[b,k]=i.useState([]),[L,C]=i.useState([]),[_,R]=i.useState([]);i.useEffect(()=>{ne.getEducatorsOptionsApi().then(a=>{a.data&&(h(a.data.teachers||[]),k(a.data.assistants||[]),C(a.data.counselors||[]),R(a.data.secondaryTeachers||[]))}).catch(a=>{console.error("Failed to load educators options",a)})},[]);const{isCheck:U,userList:z,filters:X,totalItem:ie,handleClickCheck:de,changeFilters:Q,fullName:v,handleRetrievedData:F,selectedUser:O,setSelectedUser:ee,getDataUserList:pe,userSelected:A,studentTeacherSelected:T,studentCounselorSelected:p,studentAssistantSelected:d,studentSecondaryTeacherSelected:N,isStudentSelectionDisabled:P,handleBlockedSchoolLevelSelection:H,schoolLevelConflictMessage:te,handleSelectAll:ue,isCheckAll:J}=at(),se=()=>{F(),c(void 0),n(void 0),f(void 0),S(void 0)},{openModelBulk:oe,handleToggleModel:he,staffBulkAssign:le,handleChangeStaffBulk:G,onAssignStaffToStudents:me,handleToggleInactiveModal:K,openInactiveModal:ge,handleInactiveStudents:fe,handleChangeTeacherBulk:ye,handleChangeCounselorBulk:ve,handleEditAssignForStudents:je,modalType:we,openSwitchModal:xe,optionsSwitch:Ne,textModal:Le,teacherSwitchList:Ae,onCloseSwitchModal:Me,handleUpdateSwitch:Ee,setTeacherChangeUserId:ke,setTeacherSelectForChangeUserId:Ue,teacherSelectForChangeUserId:Ce,openDetailModal:Be,setOpenDetailModal:Oe,toggleCollapse:De,activeIndex:Re,onClose:$e,removeTeacherUserIds:Fe,openModelSwitchDataTeacher:u,onToggleModelSwitchDataTeacher:g,teacherSwitchUserId:x,setTeacherSwitchUserId:D,onToggleModelDeleteBulk:B,openModelDeleteBulk:w,handelChangeStaffRemove:V,switchStaffUsers:q,handleRemoveBulkStaff:Y}=nt(r,y,I,m,se,O,pe,A),ce=[{name:"",isCenter:!0,onSelectAll:ue,isCheckAll:J,className:`align-top ${t.styles["fixed-width-40"]}`},{name:"student_name",isCenter:!0,sortBy:j.UserOrder.Name,className:`align-top ${t.styles["fixed-width"]}`},{name:"grade",isCenter:!0,sortBy:j.UserOrder.Grade,searchBy:j.SearchBy.Grade,className:`align-center justify-center ${t.styles["fixed-width-120"]}`,getOption:a=>({label:a?o(a):"empty",value:a})},{name:"teacher_emails",isCenter:!0,className:"align-center justify-center",sortBy:j.UserOrder.Teacher,searchBy:j.SearchBy.Teacher,getOption:a=>({label:a||"empty",value:a})},{name:"assistant_email",isCenter:!0,className:"align-center justify-center",sortBy:j.UserOrder.Assistant,searchBy:j.SearchBy.Assistant,getOption:a=>({label:a||"empty",value:a})},{name:"counselor_emails",isCenter:!0,className:"align-center justify-center",sortBy:j.UserOrder.Counselor,searchBy:j.SearchBy.Counselor,getOption:a=>({label:a||"empty",value:a})},{name:"support_teacher_email",isCenter:!0,className:"align-center justify-center",sortBy:j.UserOrder.SecondaryTeacher,searchBy:j.SearchBy.SecondaryTeacher,getOption:a=>({label:a||"empty",value:a})}],[Z,Ye]=i.useState(null),ae=a=>{Ye(M=>M===a?null:a)};return e.jsxs("div",{className:"fadeIn animated",children:[e.jsx("h5",{className:"mt-4 mb-2",children:s("assign_student")}),e.jsxs(l.Row,{className:"my-2",children:[e.jsx(l.Col,{md:3,children:e.jsx(t.SearchBox,{initValue:X?.searchString||"",onSearch:a=>Q({searchString:a}),placeholder:s("type_something_to_search_students")})}),e.jsx(l.Col,{md:8,className:"d-flex justify-content-end align-items-center",children:e.jsx(l.Row,{className:"mb-2",children:e.jsxs(l.Col,{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:4},children:[e.jsx(l.Button,{onClick:()=>he(U),color:"primary",style:{background:"#316cd9"},children:s("assign_bulk")}),e.jsx(l.Button,{onClick:()=>B(U),color:"primary",style:{background:"#316cd9"},children:s("delete_bulk")}),e.jsx(l.Button,{onClick:()=>K(U),color:"primary",style:{background:"#316cd9"},children:s("inactive_students")})]})})}),e.jsxs(l.Col,{md:1,className:"d-flex justify-content-end align-items-center",style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:[s("total_of_users"),": ",ie]})]}),e.jsxs(l.Modal,{centered:!0,isOpen:oe,toggle:()=>he(),zIndex:1201,children:[e.jsx(l.ModalHeader,{children:s("assign_bulk_student")}),e.jsxs(l.ModalBody,{children:[e.jsx(t.CustomSelector,{isMulti:!0,value:le.teacher.map(a=>({label:a.email,value:a.id})),options:W.filterOptionsBySchoolLevel(E,U,A),placeholder:s("select_teacher"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{const M=a.map($=>({id:$.value,email:$.label}));ye(M)},isClearable:!0,style:{maxWidth:120}}),e.jsx(t.CustomSelector,{value:b.find(a=>a.value==le.assistantId||a.label==le.assistantEmail)||null,options:W.filterOptionsBySchoolLevel(b,U,A),onChange:a=>G("assistant",a),placeholder:s("select_assistant"),className:"flex-grow-1 mb-3"}),e.jsx(t.CustomSelector,{isMulti:!0,value:le.counselors.map(a=>({label:a.email,value:a.id})),options:W.filterOptionsBySchoolLevel(L,U,A),placeholder:s("select_counselor"),className:`flex-grow-1 mb-3 ${t.styles["custom-chip-teacher-select"]}`,onChange:a=>{const M=a.map($=>({id:$.value,email:$.label,schoolLevel:$.schoolLevel}));ve(M)},isClearable:!0,style:{maxWidth:120}}),e.jsx(t.CustomSelector,{value:_.find(a=>a.value==le.secondaryTeacherId||a.label==le.secondaryTeacherEmail)||null,options:W.filterOptionsBySchoolLevel(_,U,A),onChange:a=>G("secondary",a),placeholder:s("select_support_teacher"),className:"flex-grow-1"})]}),e.jsxs(l.ModalFooter,{className:"text-right",children:[e.jsx(l.Button,{onClick:()=>he(),children:s("cancel")}),e.jsx(l.Button,{color:"primary",onClick:()=>me(U),children:s("assign")})]})]}),e.jsxs(l.Modal,{centered:!0,isOpen:ge,toggle:()=>K(),zIndex:1201,children:[e.jsx(l.ModalHeader,{children:s("inactive_students")}),e.jsxs(l.ModalBody,{style:{display:"flex",gap:12},children:[e.jsx(lt,{color:"red",size:30}),e.jsx(l.CardText,{style:{fontSize:20,margin:0,display:"flex",alignItems:"center"},children:s("are_you_sure_you_want_to_inactive_students",{number:U.length})})]}),e.jsxs(l.ModalFooter,{className:"text-right",children:[e.jsx(l.Button,{onClick:()=>K(),children:s("cancel")}),e.jsx(l.Button,{color:"primary",onClick:()=>fe(U,se),children:s("confirm")})]})]}),e.jsxs(l.Row,{className:"my-2",children:[e.jsx(l.Col,{md:12,children:e.jsx("div",{children:e.jsxs(l.Table,{bordered:!0,hover:!0,striped:!0,size:"sm",className:`${t.styles["table-fixed"]}`,children:[e.jsx("thead",{children:e.jsx(W.TableHeader,{headers:ce,filters:X,fullName:v,onChangeFilters:Q,teacherOptions:E,assistantOptions:b,counselorOptions:L,secondaryTeacherOptions:_})}),z&&z.length>0?e.jsx("tbody",{children:z.map((a,M)=>e.jsxs("tr",{children:[e.jsx("td",{className:`align-middle text-center ${t.styles["fixed-width-40"]}`,children:(()=>{const $=P(a),_e=`student_checkbox_${a.id}_${M}`;return e.jsxs("span",{id:_e,onClick:()=>{$&&H()},onMouseEnter:()=>{$&&ae(_e)},onMouseLeave:()=>{$&&ae(_e)},style:{display:"inline-block"},children:[e.jsx("input",{id:a.id,type:"checkbox",onChange:de,checked:U.includes(a.id),disabled:$,style:{pointerEvents:$?"none":void 0}}),$&&e.jsx(l.Tooltip,{placement:"right",isOpen:Z===_e,target:_e,children:te})]})})()}),e.jsxs("td",{className:`align-middle ${t.styles["fixed-width"]}`,id:`student_name_${a.id}_${M}`,onMouseEnter:()=>ae(`student_name_${a.id}_${M}`),onMouseLeave:()=>ae(`student_name_${a.id}_${M}`),children:[e.jsx("button",{type:"button",className:`${t.styles["button-user-name"]} btn-link`,onClick:()=>{ee(a),Oe(!0)},children:a.fullName}),e.jsx(l.Tooltip,{placement:"top",isOpen:Z===`student_name_${a.id}_${M}`,target:`student_name_${a.id}_${M}`,children:a.fullName})]}),e.jsxs("td",{className:`align-middle text-center ${t.styles["fixed-width-120"]}`,id:`student_grade_${a.id}_${M}`,onMouseEnter:()=>ae(`student_grade_${a.id}_${M}`),onMouseLeave:()=>ae(`student_grade_${a.id}_${M}`),children:[e.jsx("p",{className:"mb-0",children:o(a.gradeLevel)}),!!o(a.gradeLevel)&&e.jsx(l.Tooltip,{placement:"top",isOpen:Z===`student_grade_${a.id}_${M}`,target:`student_grade_${a.id}_${M}`,children:o(a.gradeLevel)})]}),e.jsxs("td",{className:`align-middle ${t.styles["equal-width"]}`,id:`student_teacher_${a.id}_${M}`,onMouseEnter:()=>ae(`student_teacher_${a.id}_${M}`),onMouseLeave:()=>ae(`student_teacher_${a.id}_${M}`),children:[!!a.teachers&&a.teachers.length>0&&e.jsx(i.Fragment,{children:a.teachers.map($=>e.jsxs("p",{className:"mb-0",children:[$.mainTeacherName," - ",$.mainTeacherEmail]},$.mainTeacherEmail))}),!!a.teachers&&a.teachers.length>0&&e.jsx(l.Tooltip,{placement:"top",isOpen:Z===`student_teacher_${a.id}_${M}`,target:`student_teacher_${a.id}_${M}`,children:a.teachers.map($=>e.jsxs("p",{className:"mb-0",children:[$.mainTeacherName," - ",$.mainTeacherEmail]},$.mainTeacherEmail))})]}),e.jsxs("td",{className:`align-middle ${t.styles["equal-width"]}`,id:`student_assistant_${a.id}_${M}`,onMouseEnter:()=>ae(`student_assistant_${a.id}_${M}`),onMouseLeave:()=>ae(`student_assistant_${a.id}_${M}`),children:[!!a.assistantEmail&&e.jsxs("p",{className:"mb-0",children:[a.assistantName," - ",a.assistantEmail]}),!!a.assistantEmail&&e.jsxs(l.Tooltip,{placement:"top",isOpen:Z===`student_assistant_${a.id}_${M}`,target:`student_assistant_${a.id}_${M}`,children:[a.assistantName,"-",a.assistantEmail]})]}),e.jsxs("td",{className:`align-middle ${t.styles["equal-width"]}`,id:`student_counselor_${a.id}_${M}`,onMouseEnter:()=>ae(`student_counselor_${a.id}_${M}`),onMouseLeave:()=>ae(`student_counselor_${a.id}_${M}`),children:[!!a.counselors&&a.counselors.length>0&&e.jsx(i.Fragment,{children:a.counselors.map($=>e.jsxs("p",{className:"mb-0",children:[$.counselorName," - ",$.counselorEmail]},$.counselorUserId))}),!!a.counselors&&a.counselors.length>0&&e.jsx(l.Tooltip,{placement:"top",isOpen:Z===`student_counselor_${a.id}_${M}`,target:`student_counselor_${a.id}_${M}`,children:a.counselors.map($=>e.jsxs("p",{className:"mb-0",children:[$.counselorName," - ",$.counselorEmail]},$.counselorUserId))})]}),e.jsxs("td",{className:`align-middle ${t.styles["equal-width"]}`,id:`student_secondary_teacher_${a.id}_${M}`,onMouseEnter:()=>ae(`student_secondary_teacher_${a.id}_${M}`),onMouseLeave:()=>ae(`student_secondary_teacher_${a.id}_${M}`),children:[!!a.secondaryTeacherEmail&&e.jsxs("p",{className:"mb-0",children:[a.secondaryTeacherName," - ",a.secondaryTeacherEmail]}),!!a.secondaryTeacherEmail&&e.jsxs(l.Tooltip,{placement:"top",isOpen:Z===`student_secondary_teacher_${a.id}_${M}`,target:`student_secondary_teacher_${a.id}_${M}`,children:[a.secondaryTeacherName," - ",a.secondaryTeacherEmail]})]})]},`${a.id}_${M}`))}):e.jsx("div",{style:{width:"max-content",padding:20},children:s("no_data")})]})})}),e.jsx(l.Col,{md:12,children:e.jsx(t.CustomPagination,{filters:X,totalRecordCount:ie,changePageSize:a=>Q({pageSize:a}),changePage:a=>Q({currentPage:a})})})]}),e.jsx(ct,{openDetailModal:Be,onClose:$e,selectedUser:O,staffBulkAssign:le,teacherOptions:W.filterOptionsBySchoolLevel(E,[O?.id],[O]),handleChangeTeacherBulk:ye,handleChangeCounselorBulk:ve,assistantOptions:W.filterOptionsBySchoolLevel(b,[O?.id],[O]),counselorOptions:W.filterOptionsBySchoolLevel(L,[O?.id],[O]),secondaryTeacherOptions:W.filterOptionsBySchoolLevel(_,[O?.id],[O]),handleChangeStaffBulk:G,handleEditAssignForStudents:je,toggleCollapse:De,activeIndex:Re}),e.jsx(ot,{textModal:Le,isOpen:xe,teachers:Ae,options:Ne,onClose:Me,onSave:Ee,modalType:we,setTeacherChangeUserId:ke,setTeacherSelectForChangeUserId:Ue,teacherSelectForChangeUserId:Ce}),e.jsx(it,{open:u,onClose:g,teachers:O?.teachers?.filter(a=>!Fe.includes(a.teacherUserId))||[],onConfirm:je,teacherSwitchUserId:x,setTeacherSwitchUserId:D}),e.jsx(gt,{open:w,onClose:B,teachers:T,onChangeStaffRemove:V,switchStaffUsers:q,counselors:p,assistants:d,onRemoveBulkStaff:Y,studentUserIds:U,secondaryTeachers:N,teacherOptions:W.filterOptionsBySchoolLevel(E,U,A),assistantOptions:W.filterOptionsBySchoolLevel(b,U,A),counselorOptions:W.filterOptionsBySchoolLevel(L,U,A),secondaryTeacherOptions:W.filterOptionsBySchoolLevel(_,U,A)})]})},yt=()=>{const s=Se.useDispatch(),[o,r]=i.useState(j.initialUserChoice),[c,y]=i.useState([]),[n,I]=i.useState(""),f=async()=>{try{const S=await t.getTeacher();y(S.data)}catch(S){s(t.setAlert({type:"danger",message:S.response?.data?.title||S.message}))}},m=c.map(S=>({label:`${S.name} - ${S.email}`,value:S.id}));return i.useEffect(()=>{o.roles?.includes("Teacher")&&f()},[o]),{userChoiced:o,setUserChoiced:r,teacherList:c,options:m,setTeacherChangeId:I,teacherChangeId:n}},vt="User deleted list",xt=()=>{const{userChoiced:s,setUserChoiced:o,options:r,teacherChangeId:c,setTeacherChangeId:y}=yt(),[n,I]=i.useState([]),[f,m]=i.useState(0),{filters:S,changeFilters:E}=t.useFilters(),h=Se.useDispatch(),b=i.useRef(null),k=()=>{b&&b.current&&b.current.toggle()},L=()=>{y(""),o(j.initialUserChoice)},C=i.useCallback(async()=>{h(t.setLoading(!0));try{const R=await t.get(S),{items:U,totalItems:z}=R.data;I(U),m(z)}catch(R){h(t.setAlert({type:"danger",message:R.response?.data?.title||R.message}))}h(t.setLoading(!1))},[h,S]);i.useEffect(()=>{document.title=vt},[]),i.useEffect(()=>{C()},[S]);const _=i.useCallback(R=>{h(t.setModal({isOpen:!0,type:"warning",message:"Do you want to remove this user?",onConfirm:async()=>{h(t.setLoading(!0));try{s.roles.includes("Teacher")?await t.remove(R,c):await t.remove(R),h(t.setAlert({type:"success",message:"Remove user successfully"})),k(),L(),E({currentPage:1})}catch(U){h(t.setAlert({type:"danger",message:U.response?.data?.title||U.message}))}h(t.setLoading(!1))}}))},[S,c,s]);return{userList:n,totalItems:f,filters:S,getData:C,removeData:_,changeFilters:E,modal:b,openModal:k,userChoiced:s,setUserChoiced:o,options:r,teacherChangeId:c,setTeacherChangeId:y,resetData:L}},Tt=(s,o)=>{const{header:r,removeData:c,resetData:y,userChoiced:n,options:I,teacherChangeId:f,setTeacherChangeId:m}=s,{t:S}=re.useTranslation(),E=()=>{var h=window.location.origin+"/api/ExportDataUser/"+n.id;window.open(h)};return e.jsx(t.CommonModal,{header:r,ref:o,onCancel:()=>{y()},children:e.jsx(l.Row,{children:e.jsxs(l.Col,{md:12,className:"mb-2",children:[e.jsx("p",{children:S("export_user_data")}),e.jsx("div",{className:"pb-3",children:e.jsx(l.Button,{color:"success",onClick:()=>{E()},style:{color:"#fff"},children:S("download_users_data")})}),e.jsx("p",{children:"Delete user"}),!!n&&e.jsxs("div",{children:[n.roles.includes("Student")&&e.jsxs("div",{children:[e.jsx(l.Alert,{color:"danger",children:S("alert_delete_user")}),e.jsx(l.Button,{color:"danger",onClick:()=>c(n.id),style:{color:"#fff"},children:S("delete_user")})]}),n.roles.includes("Admin")&&e.jsxs("div",{children:[e.jsx(l.Alert,{color:"danger",children:S("alert_delete_user")}),e.jsx(l.Button,{color:"danger",onClick:()=>c(n.id),children:S("delete_user")})]}),n.roles.includes("Teacher")&&e.jsxs("div",{children:[e.jsx(l.Alert,{color:"warning",children:S("alert_delete_user")}),e.jsx(t.CustomSelector,{options:I,defaultValue:f,placeholder:"select_teacher_change",onChange:h=>m(h.value)}),!!f&&e.jsxs("div",{className:"mt-2",children:[e.jsx(l.Alert,{color:"danger",children:S("alert_delete_user")}),e.jsx(l.Button,{color:"danger",onClick:()=>c(n.id),children:S("delete_user")})]})]}),(n.roles.includes("Parent")||n.roles.includes("Counselor")||n.roles.includes("SecondaryTeacher"))&&e.jsxs("div",{children:[e.jsx(l.Alert,{color:"danger",children:S("alert_delete_user")}),e.jsx(l.Button,{color:"danger",onClick:()=>c(n.id),children:S("delete_user")})]})]})]})})})},St=i.forwardRef(Tt),jt="user_deleted",Ct=()=>{const{userList:s,totalItems:o,filters:r,changeFilters:c,removeData:y,openModal:n,modal:I,userChoiced:f,setUserChoiced:m,options:S,teacherChangeId:E,setTeacherChangeId:h,resetData:b}=xt(),{t:k}=re.useTranslation(),L=C=>{C&&m(C),n()};return e.jsxs("div",{className:"fadeIn animated",children:[e.jsx("h5",{className:"mt-4 mb-2",children:k(jt)}),e.jsxs(l.Row,{className:"my-2",children:[e.jsx(l.Col,{md:8,children:e.jsx(t.SearchBox,{initValue:r.searchString,onSearch:C=>c({searchString:C}),placeholder:k("type_something_to_search_reflection_result")})}),e.jsxs(l.Col,{md:4,className:"d-flex justify-content-end align-items-center",children:[k("total_of_users"),": ",o]})]}),e.jsxs(l.Row,{className:"mb-2",children:[e.jsx(l.Col,{md:12,children:s&&s.length>0?e.jsx("div",{children:e.jsxs(l.Table,{bordered:!0,hover:!0,striped:!0,responsive:!0,size:"sm",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"align-top",children:k("name")}),e.jsx("th",{className:"align-top",children:k("email")}),e.jsx("th",{className:"align-top",children:k("role")})]})}),e.jsx("tbody",{children:s.map(C=>e.jsxs("tr",{children:[e.jsx("td",{className:"align-middle",children:e.jsx(t.LinkEditButton,{label:`${C.fullName}`,onClick:()=>L(C)})}),e.jsx("td",{className:"align-middle",children:C.email}),e.jsx("td",{className:"align-middle",children:!!C.roles&&C.roles.map(_=>_==="SecondaryTeacher"?"SupportTeacher":_).join(", ")})]},C.id))})]})}):e.jsx(t.EmptyDataAlert,{label:k("user")})}),e.jsx(l.Col,{md:12,children:e.jsx(t.CustomPagination,{filters:r,totalRecordCount:o,changePageSize:C=>c({pageSize:C}),changePage:C=>c({currentPage:C})})})]}),e.jsx(St,{ref:I,header:f.fullName,onCancel:()=>{},userChoiced:f,removeData:y,options:S,teacherChangeId:E,setTeacherChangeId:h,resetData:b})]})},_t={padding:"4px 8px",marginBottom:0,borderRadius:"4px",color:"#fff",fontWeight:500,fontSize:"14px",height:"56px",justifyContent:"center"},be=({htmlFor:s,isDisabled:o,text:r,backgroundColor:c,onClick:y,isClassReflection:n})=>e.jsxs(l.Label,{htmlFor:s,role:"button",tabIndex:0,className:`d-flex align-items-center justfy-content-center mr-2
|
|
2
|
+
${n?"w-25":""}
|
|
3
|
+
${o?"":"cursor-pointer hover-opacity"}`,style:{..._t,backgroundColor:c,opacity:o?.5:1,gap:"8px"},onClick:I=>y(),children:[e.jsx("i",{className:"fa fa-paperclip mr-1","aria-hidden":"true"}),r]}),Ge=`${t.BASE_URL}/api/ImportCsv/csv`,ze=`${t.BASE_URL}/api/Teacher`,It=(s,o)=>t.apiUpload.post(`${Ge}/${o}`,s),Je=s=>t.apiUpload.post(`${Ge}/importClassReflection`,s),bt=(s,o)=>t.apiUpload.post(`${ze}/adminImportStudentByTeacherId/${s}`,o),wt=s=>t.api.post(`${ze}/adminImportChunkUser`,s),Nt=(s=!0)=>t.api.get(`${ze}/download-template-file-user?hasEsSchool=${s}`);var Ke=(s=>(s.Students="students",s.Subjects="subjects",s.Grades="grades",s.Attendances="attendances",s.ClassReflection="classReflection",s.Others="others",s.AllUser="allUser",s))(Ke||{});const Lt=[{text:"import_users",backgroundColor:"#0abde3",type:"allUser"}],At=[{text:"import_class_reflection",backgroundColor:"#e74c3c",type:"classReflection"}],Mt="CSV Import",Pe="csvupload",We={teacherName:"",teacherEmail:"",studentIds:[],file:""},Et=()=>{const s=Se.useDispatch(),o=Se.useSelector(A=>A.common.isLoading),[r,c]=i.useState(null),[y,n]=i.useState(),[I,f]=i.useState([]),[m,S]=i.useState(We),[E,h]=i.useState(),[b,k]=i.useState([]),C=window.location.hostname.includes("isb"),[_,R]=i.useState(0),[U,z]=i.useState("");i.useEffect(()=>{document.title=Mt},[]);const X=C?Lt:At,ie=async()=>{s(t.setLoading(!0));try{const p=await Nt(!0);var A=new Blob([p.data.content],{type:"text/csv"});const d=window.URL.createObjectURL(A);var T=document.createElement("a");T.href=d,T.setAttribute("download",p.data.nameFile),T.click(),s(t.setAlert({type:"success",message:"Download successfully"}))}catch(p){s(t.setAlert({type:"danger",message:p.message}))}s(t.setLoading(!1))},de=i.useCallback(async A=>{if(!r||!A)return;s(t.setLoading(!0));try{const N=new FormData;N.append("file",A,A.name);const P=r==="allUser"?t.CsvImportType.Admin:t.CsvImportType.Teacher,H=await W.validateCsvApi(N,P,!0);if(H.data&&H.data.length>0){k(H.data),s(t.setLoading(!1)),s(t.setAlert({type:"danger",message:"Please use the file as per the template."}));return}if(r=="allUser"){let ue=(await A.text()).trim();const J=ue.split(`
|
|
4
|
+
`).map(K=>K.trim()),se=J.findIndex(K=>K.split(",").includes("First Name"));if(se===0)throw new Error("Invalid CSV: Missing header row.");ue=J.slice(se).join(`
|
|
5
|
+
`);const oe=et.parse(ue,{header:!0,skipEmptyLines:!0}),he=oe.meta.fields,le=oe.data;if(!le.length){s(t.setLoading(!1)),s(t.setAlert({type:"danger",message:"The file has no data or some column names are misformed."}));return}const G=10,me=[];for(let K=0;K<le.length;K+=G){const fe=le.slice(K,K+G).map(ye=>Object.values(ye).map(ve=>(ve??"").toString().trim()));he&&fe.unshift(he),me.push(fe)}for(let K=0;K<me.length;K++)await wt({index:K,chunks:me[K]}),await new Promise(ge=>setTimeout(ge,500))}else C?r=="classReflection"&&await Je(N):await It(N,r.toString());s(t.setAlert({type:"success",message:"Import CSV successfully"}))}catch(N){console.error("❌ Upload failed",N),s(t.setAlert({type:"danger",message:N.response?.data?.title||N.message}))}s(t.setLoading(!1));const T=document.getElementById(Pe),p=document.getElementById("import-student"),d=document.getElementById("import-classReflection");T&&(T.value=""),p&&(p.value=""),d&&(d.value="")},[r]),Q=async A=>{if(!_){s(t.setAlert({type:"danger",message:"Select teacher before import csv"}));return}if(!r||!A)return;s(t.setLoading(!0));try{const p=new FormData;p.append("file",A,A.name),await bt(_,p),s(t.setAlert({type:"success",message:"Import CSV successfully"}))}catch(p){s(t.setAlert({type:"danger",message:p.response?.data?.title||p.message}))}s(t.setLoading(!1));const T=document.getElementById("teacherSelector");T&&(T.value="")},v=async A=>{if(!y||!y)return;s(t.setLoading(!0));try{const p=new FormData;p.append("file",y,y.name),p.append("teacherName",A.teacherName),p.append("teacherEmail",A.teacherEmail),A.studentIds.forEach(d=>{p.append("studentIds",d)}),await Je(p),s(t.setAlert({type:"success",message:"Import CSV successfully"})),S(We)}catch(p){s(t.setAlert({type:"danger",message:p.response?.data?.title||p.message}))}s(t.setLoading(!1));const T=document.getElementById(Pe);T&&(T.value="")},F=A=>{R(A.value)},O=A=>{h(A),z(A?.name||"")},ee=()=>{if(!E){s(t.setAlert({type:"danger",message:"Select CSV to import"}));return}Q(E)};return{isLoading:o,buttons:X,id:Pe,setType:c,upload:de,initImportReflection:m,setInitImportReflection:S,onConfirm:v,CSVType:Ke,dataFile:y,setDataFile:n,setArrStudent:f,arrStudent:I,isCheckDomainIBS:C,onChangeTeacher:F,uploadByTeacherId:Q,setDataFileImportStudent:O,onUpLoadStudentFile:ee,defaultTeacher:_,fileName:U,onStudentSubmit:()=>{s(t.setModal({isOpen:!0,type:"warning",message:"Are you sure upload this file?",onConfirm:()=>{ee()}}))},downloadTemplateUser:ie,errorsValidate:b,setErrorsValidate:k}},kt=Ie.object({teacherName:Ie.string()?.trim().required(),teacherEmail:Ie.string()?.trim().email("Invalid email").required(),studentIds:Ie.array().required().test("test students","Please choose student",function(){return!!this.parent.studentIds&&!!this.parent.studentIds.length}),file:Ie.string()?.trim().required()}),Ut=()=>{const{initImportReflection:s,onConfirm:o,isLoading:r,setType:c,id:y,CSVType:n,dataFile:I,setDataFile:f,setArrStudent:m,buttons:S,upload:E,isCheckDomainIBS:h,downloadTemplateUser:b,errorsValidate:k,setErrorsValidate:L}=Et(),{t:C}=re.useTranslation();return e.jsx("div",{className:"animated fadeIn pt-3",children:h?e.jsxs(e.Fragment,{children:[e.jsx(l.Input,{className:"d-none",type:"file",id:"import-user",onChange:_=>E(_.target.files[0]),accept:"text/csv"}),e.jsx(l.Input,{className:"d-none",type:"file",id:"import-classReflection",onChange:_=>E(_.target.files[0]),accept:"text/csv"}),e.jsx("div",{className:"class-reflection",children:e.jsx(Xe.Formik,{initialValues:s,enableReinitialize:!0,validationSchema:kt,onSubmit:(_,R)=>{o(_),f(""),m([]),R.resetForm()},children:_=>{const{touched:R,errors:U}=_;return e.jsxs(l.Row,{className:"mb-2",children:[e.jsx(l.Input,{className:"d-none",type:"file",id:y,onChange:z=>{f(z.target.files[0]),_.setFieldValue("file","imported");const X=document.getElementById(y);X&&(X.value="")},accept:"text/csv"}),e.jsx(l.Col,{md:6,className:"mb-2 d-flex mt-5",children:e.jsxs(l.Row,{className:"w-100 flex-column",children:[e.jsxs(l.Col,{md:12,className:"",children:[e.jsx(t.RequiredLabel,{text:C("import_class_reflection")}),e.jsx(be,{htmlFor:"import-classReflection",text:C("import_class_reflection"),isDisabled:r,backgroundColor:"#e74c3c",onClick:()=>{c(n.ClassReflection)}},"Import class reflections"),!!I&&e.jsx("p",{style:{color:"#007bff",fontStyle:"italic",marginTop:"5px"},children:I.name})]}),!I&&e.jsx(l.Col,{md:12,className:"mb-2",children:R.file&&U.file&&e.jsx(t.ErrorHandler,{text:U.file})})]})}),e.jsx(l.Col,{md:6,className:"mb-2",children:e.jsxs(l.Row,{className:"flex-column",children:[e.jsx(l.Col,{md:12,className:"mb-2 text-right",style:{textAlign:"right"},children:e.jsx(l.Button,{role:"button",color:"primary",onClick:()=>b(),children:e.jsxs("p",{className:"d-flex align-items-center mb-0",children:[C("download_template")," ",e.jsx(W.AiOutlineDownload,{size:20,className:"ml-2"})]})})}),e.jsxs(l.Col,{md:12,className:"mb-2",children:[e.jsx(t.RequiredLabel,{text:C("import_users")}),S.map(z=>e.jsx(be,{htmlFor:"import-user",text:z.text,isDisabled:r,backgroundColor:z.backgroundColor,onClick:()=>c(z.type)},z.text))]}),k?.length>0&&k.map((z,X)=>e.jsx(t.ErrorHandler,{text:z},X))]})})]})}})})]}):e.jsx(e.Fragment,{children:e.jsxs(l.Row,{children:[e.jsx(l.Col,{md:12,className:"mt-2 mb-2 text-left",children:e.jsx(l.Button,{role:"button",color:"primary",onClick:()=>b(),children:e.jsxs("p",{className:"d-flex align-items-center mb-0",children:[C("download_template")," ",e.jsx(W.AiOutlineDownload,{size:20,className:"ml-2"})]})})}),e.jsxs(l.Col,{md:6,className:"mb-3",children:[e.jsx(l.Input,{id:"import-user",className:"d-none",type:"file",onChange:_=>E(_.target.files[0]),accept:"text/csv"}),e.jsx(t.RequiredLabel,{text:C("import_users")}),e.jsx(be,{htmlFor:"import-user",text:C("import_users"),isDisabled:r,backgroundColor:"#0abde3",onClick:()=>{c(n.AllUser),k.length>0&&L([])}},"import-users")]}),k.length>0&&k.map((_,R)=>e.jsx(t.ErrorHandler,{text:_},R)),e.jsxs(l.Col,{md:6,className:"mb-3",children:[e.jsx(l.Input,{className:"d-none",type:"file",id:y,onChange:_=>E(_.target.files[0]),accept:"text/csv"}),S.map(_=>e.jsxs(e.Fragment,{children:[e.jsx(t.RequiredLabel,{text:C(_.text)}),e.jsx(be,{htmlFor:y,text:C(_.text),isDisabled:r,backgroundColor:_.backgroundColor,onClick:()=>c(_.type)},_.text)]}))]})]})})})},Bt=[{path:"/admin/users/user-list",title:"user_list",component:W.UserList},{path:"/admin/users/assign-student",title:"assign_student",component:ft},{path:"/admin/users/user-deleted",title:"user_deleted",component:Ct},{path:"/admin/users/import-csv",title:"csv_import",component:Ut}],Ot=()=>e.jsx(t.CustomTabs,{tabs:Bt});exports.default=Ot;
|