mario-education 2.0.147-staging → 2.0.149-staging
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,1276 @@
|
|
|
1
|
+
import { jsx as e, jsxs as l, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as J, api as P, BASE_URL as F, setModal as j, setLoading as N, setAlert as O, SearchBox as Se, LinkEditButton as be, EmptyDataAlert as Oe, CustomPagination as Ie, CustomTab as Re } from "mario-core";
|
|
3
|
+
import { Row as U, Col as m, Label as V, Input as B, Button as z, Table as Ae } from "reactstrap";
|
|
4
|
+
import { Formik as me } from "formik";
|
|
5
|
+
import * as we from "react";
|
|
6
|
+
import ne, { useRef as Le, useState as b, useCallback as I, useMemo as E, useEffect as H, forwardRef as Ue } from "react";
|
|
7
|
+
import { useDispatch as W } from "react-redux";
|
|
8
|
+
import { e as te, f as Z, g as Y } from "./index-BzA6oUpQ.js";
|
|
9
|
+
import { g as Pe } from "./userDeletedService-B3c2erm-.js";
|
|
10
|
+
import { _ as ke } from "./extends-hS2Bh-Yp.js";
|
|
11
|
+
import { _ as Ee, c as le, g as $e, a as Fe, b as ae, v as Te, d as ce, u as De, S as Ve } from "./useStateManager-7e1e8489.esm-Dg9jhVbQ.js";
|
|
12
|
+
import "@emotion/react";
|
|
13
|
+
import "react-dom";
|
|
14
|
+
import { a as X, b as ee } from "./index-Dn1cuBch.js";
|
|
15
|
+
const x = {
|
|
16
|
+
USERNAME: "Username",
|
|
17
|
+
EMAIL: "Email",
|
|
18
|
+
ROLE: "Role",
|
|
19
|
+
GRADE: "Grade"
|
|
20
|
+
}, $ = {
|
|
21
|
+
ClassLink: 0,
|
|
22
|
+
Clever: 1
|
|
23
|
+
}, ue = ({ rosterConfig: t, updateData: o, type: s }) => {
|
|
24
|
+
const { t: r } = J();
|
|
25
|
+
return /* @__PURE__ */ e(
|
|
26
|
+
me,
|
|
27
|
+
{
|
|
28
|
+
initialValues: t,
|
|
29
|
+
enableReinitialize: !0,
|
|
30
|
+
onSubmit: (a) => {
|
|
31
|
+
o(a);
|
|
32
|
+
},
|
|
33
|
+
children: (a) => {
|
|
34
|
+
const {
|
|
35
|
+
values: h,
|
|
36
|
+
handleChange: n,
|
|
37
|
+
handleBlur: d,
|
|
38
|
+
handleSubmit: i
|
|
39
|
+
} = a;
|
|
40
|
+
return /* @__PURE__ */ l(U, { children: [
|
|
41
|
+
/* @__PURE__ */ e(m, { md: 12, children: /* @__PURE__ */ l("h5", { className: "mt-4 font-weight-bold", children: [
|
|
42
|
+
r("one_roster_config"),
|
|
43
|
+
" (From ",
|
|
44
|
+
s === $.ClassLink ? "ClassLink" : "Clever",
|
|
45
|
+
")"
|
|
46
|
+
] }) }),
|
|
47
|
+
/* @__PURE__ */ l(m, { md: 12, className: "my-4 mt-2", children: [
|
|
48
|
+
/* @__PURE__ */ e(V, { className: "font-weight-bold", children: r("time_oneRoster_sync_hh") }),
|
|
49
|
+
/* @__PURE__ */ e(
|
|
50
|
+
B,
|
|
51
|
+
{
|
|
52
|
+
name: "cronjobTime",
|
|
53
|
+
placeholder: r("time_oneRoster_sync_hh"),
|
|
54
|
+
value: h.cronjobTime,
|
|
55
|
+
onChange: (c) => {
|
|
56
|
+
n(c);
|
|
57
|
+
},
|
|
58
|
+
onBlur: d("cronjobTime")
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] }),
|
|
62
|
+
/* @__PURE__ */ e(m, { md: 12, className: "my-4 mt-2", children: /* @__PURE__ */ l(U, { children: [
|
|
63
|
+
/* @__PURE__ */ l(m, { md: s === $.ClassLink ? 9 : 12, children: [
|
|
64
|
+
/* @__PURE__ */ l(V, { className: "font-weight-bold", children: [
|
|
65
|
+
r("end_point_url"),
|
|
66
|
+
":"
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ e(
|
|
69
|
+
B,
|
|
70
|
+
{
|
|
71
|
+
disabled: !0,
|
|
72
|
+
name: "endPointUrl",
|
|
73
|
+
placeholder: r("end_point_url"),
|
|
74
|
+
value: h.endPointUrl,
|
|
75
|
+
onChange: (c) => {
|
|
76
|
+
n(c);
|
|
77
|
+
},
|
|
78
|
+
onBlur: d("endPointUrl")
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
] }),
|
|
82
|
+
s === $.ClassLink && /* @__PURE__ */ l(m, { md: 3, children: [
|
|
83
|
+
/* @__PURE__ */ e(V, { className: "font-weight-bold", children: "Version:" }),
|
|
84
|
+
/* @__PURE__ */ l(
|
|
85
|
+
B,
|
|
86
|
+
{
|
|
87
|
+
disabled: !0,
|
|
88
|
+
type: "select",
|
|
89
|
+
name: "oneRosterVersion",
|
|
90
|
+
value: h.oneRosterVersion || "1.1",
|
|
91
|
+
onChange: (c) => {
|
|
92
|
+
n(c);
|
|
93
|
+
},
|
|
94
|
+
onBlur: d("oneRosterVersion"),
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ e("option", { value: "1.1", children: "1.1" }),
|
|
97
|
+
/* @__PURE__ */ e("option", { value: "1.2", children: "1.2" })
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] })
|
|
102
|
+
] }) }),
|
|
103
|
+
/* @__PURE__ */ l(m, { md: 12, className: "mb-4 mt-2", children: [
|
|
104
|
+
/* @__PURE__ */ l(V, { className: "font-weight-bold", children: [
|
|
105
|
+
r("client_id"),
|
|
106
|
+
":"
|
|
107
|
+
] }),
|
|
108
|
+
/* @__PURE__ */ e(
|
|
109
|
+
B,
|
|
110
|
+
{
|
|
111
|
+
disabled: !0,
|
|
112
|
+
name: "clientId",
|
|
113
|
+
placeholder: r("client_id"),
|
|
114
|
+
value: h.clientId,
|
|
115
|
+
onChange: (c) => {
|
|
116
|
+
n(c);
|
|
117
|
+
},
|
|
118
|
+
onBlur: d("clientId")
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ l(m, { md: 12, className: "mb-4", children: [
|
|
123
|
+
/* @__PURE__ */ l(V, { className: "font-weight-bold", children: [
|
|
124
|
+
r("client_secret"),
|
|
125
|
+
":"
|
|
126
|
+
] }),
|
|
127
|
+
/* @__PURE__ */ e(
|
|
128
|
+
B,
|
|
129
|
+
{
|
|
130
|
+
disabled: !0,
|
|
131
|
+
name: "clientSecret",
|
|
132
|
+
placeholder: r("client_secret"),
|
|
133
|
+
value: h.clientSecret,
|
|
134
|
+
onChange: (c) => {
|
|
135
|
+
n(c);
|
|
136
|
+
},
|
|
137
|
+
onBlur: d("clientSecret")
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] }),
|
|
141
|
+
/* @__PURE__ */ e(m, { md: 12, className: "d-flex justify-content-end", children: /* @__PURE__ */ e(
|
|
142
|
+
z,
|
|
143
|
+
{
|
|
144
|
+
onClick: () => i(),
|
|
145
|
+
color: "success",
|
|
146
|
+
children: r("save")
|
|
147
|
+
}
|
|
148
|
+
) })
|
|
149
|
+
] });
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}, pe = `${F}/api/oneRoster`, Be = `${F}/api/ImportOneRoster/file`, je = `${F}/api/usersOneRoster`, Me = `${F}/api/User/roster-users`, he = `${F}/api/veraCross`, ge = `${F}/api/openApply`, xe = (t) => P.get(pe, { params: { type: t } }), Je = () => P.get(he), qe = (t) => P.put(`${he}`, t), ze = (t, o) => P.put(`${pe}`, t, { params: { type: o } }), We = () => P.get(ge), Ge = (t) => P.put(`${ge}`, t), Ze = (t, o) => P.post(Be, t, {
|
|
154
|
+
onUploadProgress: o
|
|
155
|
+
}), Ye = (t) => P.get(`${je}`, {
|
|
156
|
+
params: t
|
|
157
|
+
}), He = (t) => P.post(`${Me}`, t), Ke = () => P.post(`${F}/api/ImportRestApiRoster/trigger-sync`), Qe = () => P.post(`${F}/api/clever/trigger-sync`), Xe = () => P.post(`${F}/api/ImportRestApiVeraCross/trigger-sync`), et = () => P.post(`${F}/api/ImportRestApiOpenApply/trigger-sync`), tt = "_spinner_tuwht_1", st = "_pointer_tuwht_26", k = {
|
|
158
|
+
spinner: tt,
|
|
159
|
+
"success-block": "_success-block_tuwht_14",
|
|
160
|
+
"middle-block": "_middle-block_tuwht_18",
|
|
161
|
+
"list-block": "_list-block_tuwht_22",
|
|
162
|
+
pointer: st
|
|
163
|
+
}, rt = [
|
|
164
|
+
"academicSession",
|
|
165
|
+
"classes",
|
|
166
|
+
"resources",
|
|
167
|
+
"courses",
|
|
168
|
+
"orgs",
|
|
169
|
+
"categories",
|
|
170
|
+
"lineItems",
|
|
171
|
+
"results",
|
|
172
|
+
"users",
|
|
173
|
+
"enrollments",
|
|
174
|
+
"demographics"
|
|
175
|
+
], fe = "Response status code does not indicate success: 403 ().", nt = {
|
|
176
|
+
value: 10
|
|
177
|
+
}, at = {
|
|
178
|
+
searchString: "",
|
|
179
|
+
currentPage: 1,
|
|
180
|
+
pageSize: nt.value,
|
|
181
|
+
isCreated: !1
|
|
182
|
+
}, it = [
|
|
183
|
+
"students",
|
|
184
|
+
"faculties"
|
|
185
|
+
], ot = [
|
|
186
|
+
"students",
|
|
187
|
+
"parents"
|
|
188
|
+
], lt = ({ errorImportRest: t, type: o }) => {
|
|
189
|
+
const s = W(), r = Le(null), [a, h] = b(0), [n, d] = b(), [i] = b({}), c = I(async () => {
|
|
190
|
+
if (t) {
|
|
191
|
+
s(j({
|
|
192
|
+
isOpen: !0,
|
|
193
|
+
type: "danger",
|
|
194
|
+
message: `${t} (Please make sure your changes are saved)`
|
|
195
|
+
}));
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
s(N(!0));
|
|
199
|
+
try {
|
|
200
|
+
const y = o === $.Clever ? await Qe() : await Ke();
|
|
201
|
+
s(j({
|
|
202
|
+
isOpen: !0,
|
|
203
|
+
type: "success",
|
|
204
|
+
message: y.data?.message || "Sync job has been triggered in the background. Please wait a few moments before refreshing the page."
|
|
205
|
+
}));
|
|
206
|
+
} catch (y) {
|
|
207
|
+
s(j({
|
|
208
|
+
isOpen: !0,
|
|
209
|
+
type: "danger",
|
|
210
|
+
message: y.response?.data?.message || y.response?.data?.title || y.message
|
|
211
|
+
}));
|
|
212
|
+
}
|
|
213
|
+
s(N(!1));
|
|
214
|
+
}, [t, o, s]), u = I(
|
|
215
|
+
async (y) => {
|
|
216
|
+
d({
|
|
217
|
+
error: "",
|
|
218
|
+
success: !1,
|
|
219
|
+
isUploading: !0,
|
|
220
|
+
importedFiles: "",
|
|
221
|
+
rejectedFiles: "",
|
|
222
|
+
comment: ""
|
|
223
|
+
}), s(N(!0));
|
|
224
|
+
try {
|
|
225
|
+
const g = new FormData();
|
|
226
|
+
g.append("file", y);
|
|
227
|
+
const L = await Ze(
|
|
228
|
+
g,
|
|
229
|
+
R
|
|
230
|
+
);
|
|
231
|
+
d((w) => ({
|
|
232
|
+
...w,
|
|
233
|
+
success: !0,
|
|
234
|
+
importedFiles: L.data.csvFilesImported || "",
|
|
235
|
+
rejectedFiles: L.data.cSVFilesRejected || "",
|
|
236
|
+
comment: L.data.comment || ""
|
|
237
|
+
}));
|
|
238
|
+
} catch (g) {
|
|
239
|
+
d((L) => ({
|
|
240
|
+
...L,
|
|
241
|
+
error: g.response?.data?.title || g.message
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
r.current?.value && (r.current.value = ""), d((g) => ({
|
|
245
|
+
...g,
|
|
246
|
+
isUploading: !1
|
|
247
|
+
})), s(N(!1));
|
|
248
|
+
},
|
|
249
|
+
[JSON.stringify(n)]
|
|
250
|
+
), v = () => {
|
|
251
|
+
r.current?.click();
|
|
252
|
+
}, R = (y) => {
|
|
253
|
+
const g = Math.round(
|
|
254
|
+
y.loaded / y.total * 100
|
|
255
|
+
);
|
|
256
|
+
h(g);
|
|
257
|
+
}, _ = I(async () => {
|
|
258
|
+
d(void 0), h(0);
|
|
259
|
+
const y = r.current?.files?.[0];
|
|
260
|
+
y && await u(y);
|
|
261
|
+
}, []), S = E(() => {
|
|
262
|
+
if (n)
|
|
263
|
+
return n.isUploading && a < 100 ? /* @__PURE__ */ e(
|
|
264
|
+
te,
|
|
265
|
+
{
|
|
266
|
+
color: "#999999",
|
|
267
|
+
className: `mr-2 ${k.spinner}`
|
|
268
|
+
}
|
|
269
|
+
) : n.success || a === 100 ? /* @__PURE__ */ e(Z, { color: "#28a745", className: "mr-2" }) : /* @__PURE__ */ e(Y, { color: "#dc3545", className: "mr-2" });
|
|
270
|
+
}, [JSON.stringify(n), a]), C = E(() => i === void 0 || Object.keys(i).length === 0 ? void 0 : rt.map((g) => ({
|
|
271
|
+
name: g,
|
|
272
|
+
status: i?.[g]
|
|
273
|
+
})).filter((g) => g.status != "ResourceNotFound").map((g) => /* @__PURE__ */ l("div", { children: [
|
|
274
|
+
g.status ? g.status == !0 ? /* @__PURE__ */ e(Z, { color: "#28a745", className: "mr-2" }) : /* @__PURE__ */ e(Y, { color: "#dc3545", className: "mr-2" }) : /* @__PURE__ */ e(
|
|
275
|
+
te,
|
|
276
|
+
{
|
|
277
|
+
color: "#999999",
|
|
278
|
+
className: `mr-2 ${k.spinner}`
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
/* @__PURE__ */ e("b", { children: `${g.name}: ` }),
|
|
282
|
+
g.status ? g.status == !0 ? "Import successful" : /* @__PURE__ */ e("span", { children: g.status === fe ? "Invalid Client Id and Client Secret" : g.status }) : "Importing..."
|
|
283
|
+
] })), [JSON.stringify(i)]), M = E(() => {
|
|
284
|
+
if (n)
|
|
285
|
+
return n.isUploading && a < 100 ? /* @__PURE__ */ l(ne.Fragment, { children: [
|
|
286
|
+
/* @__PURE__ */ e("b", { children: "Uploading: " }),
|
|
287
|
+
" ",
|
|
288
|
+
a,
|
|
289
|
+
"%"
|
|
290
|
+
] }) : /* @__PURE__ */ e("b", { children: n.success || a === 100 ? "Upload success" : "Upload fail" });
|
|
291
|
+
}, [JSON.stringify(n), a]), T = E(() => {
|
|
292
|
+
if (n)
|
|
293
|
+
return n.isUploading ? /* @__PURE__ */ e(
|
|
294
|
+
te,
|
|
295
|
+
{
|
|
296
|
+
color: "#999999",
|
|
297
|
+
className: `mr-2 ${k.spinner}`
|
|
298
|
+
}
|
|
299
|
+
) : n.success ? /* @__PURE__ */ e(Z, { color: "#28a745", className: "mr-2" }) : /* @__PURE__ */ e(Y, { color: "#dc3545", className: "mr-2" });
|
|
300
|
+
}, [JSON.stringify(n)]), f = E(() => {
|
|
301
|
+
if (!n) return;
|
|
302
|
+
const y = n.comment, g = n.importedFiles?.split(",")?.filter((w) => w?.trim()?.length) || [], L = n.rejectedFiles?.split(",")?.filter((w) => w?.trim()?.length) || [];
|
|
303
|
+
return n.isUploading ? /* @__PURE__ */ e("b", { children: "Importing to database..." }) : n.success ? /* @__PURE__ */ l(ne.Fragment, { children: [
|
|
304
|
+
/* @__PURE__ */ e("b", { children: "Import to database successful" }),
|
|
305
|
+
/* @__PURE__ */ l("div", { className: `${k["success-block"]}`, children: [
|
|
306
|
+
/* @__PURE__ */ l("div", { children: [
|
|
307
|
+
/* @__PURE__ */ l("div", { className: "mt-1", children: [
|
|
308
|
+
/* @__PURE__ */ e("b", { children: "List imported csv file: " }),
|
|
309
|
+
g.length === 0 && /* @__PURE__ */ e("span", { children: "No File" })
|
|
310
|
+
] }),
|
|
311
|
+
/* @__PURE__ */ e("ul", { className: `pl-4 ${k["list-block"]}`, children: g.map((w) => /* @__PURE__ */ l("li", { children: [
|
|
312
|
+
/* @__PURE__ */ e(
|
|
313
|
+
Z,
|
|
314
|
+
{
|
|
315
|
+
color: "#28a745",
|
|
316
|
+
className: "mr-2"
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
/* @__PURE__ */ e("span", { children: w })
|
|
320
|
+
] })) })
|
|
321
|
+
] }),
|
|
322
|
+
/* @__PURE__ */ l("div", { className: `${k["middle-block"]}`, children: [
|
|
323
|
+
/* @__PURE__ */ l("div", { children: [
|
|
324
|
+
/* @__PURE__ */ e("b", { children: "List rejected csv file: " }),
|
|
325
|
+
L.length === 0 && /* @__PURE__ */ e("span", { children: "No File" })
|
|
326
|
+
] }),
|
|
327
|
+
/* @__PURE__ */ e("ul", { className: `pl-4 ${k["list-block"]}`, children: L.map((w) => /* @__PURE__ */ l("li", { children: [
|
|
328
|
+
/* @__PURE__ */ e(
|
|
329
|
+
Y,
|
|
330
|
+
{
|
|
331
|
+
color: "#dc3545",
|
|
332
|
+
className: "mr-2"
|
|
333
|
+
}
|
|
334
|
+
),
|
|
335
|
+
/* @__PURE__ */ e("span", { children: w })
|
|
336
|
+
] })) })
|
|
337
|
+
] }),
|
|
338
|
+
y && /* @__PURE__ */ l("div", { children: [
|
|
339
|
+
/* @__PURE__ */ e("b", { children: "Comment: " }),
|
|
340
|
+
/* @__PURE__ */ e("span", { children: y })
|
|
341
|
+
] })
|
|
342
|
+
] })
|
|
343
|
+
] }) : /* @__PURE__ */ l(ne.Fragment, { children: [
|
|
344
|
+
/* @__PURE__ */ l("b", { children: [
|
|
345
|
+
"Import to database fail",
|
|
346
|
+
!!n.error && ": "
|
|
347
|
+
] }),
|
|
348
|
+
n.error
|
|
349
|
+
] });
|
|
350
|
+
}, [JSON.stringify(n)]);
|
|
351
|
+
return {
|
|
352
|
+
inputRef: r,
|
|
353
|
+
fileProgress: a,
|
|
354
|
+
uploadInfo: n,
|
|
355
|
+
uploadIcon: S,
|
|
356
|
+
uploadMessage: M,
|
|
357
|
+
importIcon: T,
|
|
358
|
+
importMessage: f,
|
|
359
|
+
restApiInfo: i,
|
|
360
|
+
restApiProgress: C,
|
|
361
|
+
setFileProgress: h,
|
|
362
|
+
handleFileChange: _,
|
|
363
|
+
importRosterZipFile: u,
|
|
364
|
+
handleChooseZipFile: v,
|
|
365
|
+
handleImportFromRestfulApi: c
|
|
366
|
+
};
|
|
367
|
+
}, Ce = ({ errorImportRest: t, type: o }) => {
|
|
368
|
+
const {
|
|
369
|
+
restApiProgress: s,
|
|
370
|
+
handleImportFromRestfulApi: r
|
|
371
|
+
} = lt({ errorImportRest: t, type: o }), { t: a } = J();
|
|
372
|
+
return /* @__PURE__ */ l(U, { children: [
|
|
373
|
+
/* @__PURE__ */ e(m, { md: 12, children: /* @__PURE__ */ e("h5", { className: "mt-4", style: { fontWeight: 700 }, children: a("import_one_roster") }) }),
|
|
374
|
+
/* @__PURE__ */ l(m, { md: 6, children: [
|
|
375
|
+
/* @__PURE__ */ e(
|
|
376
|
+
z,
|
|
377
|
+
{
|
|
378
|
+
color: "primary",
|
|
379
|
+
className: "w-100 mt-4 mb-1",
|
|
380
|
+
onClick: r,
|
|
381
|
+
children: a("import_from_restful_api")
|
|
382
|
+
}
|
|
383
|
+
),
|
|
384
|
+
/* @__PURE__ */ e("div", { className: "mt-2", children: s })
|
|
385
|
+
] })
|
|
386
|
+
] });
|
|
387
|
+
}, ct = {
|
|
388
|
+
cronjobTime: "",
|
|
389
|
+
clientId: "",
|
|
390
|
+
clientSecret: "",
|
|
391
|
+
endPointUrl: "",
|
|
392
|
+
oneRosterVersion: "1.1"
|
|
393
|
+
}, ye = (t) => {
|
|
394
|
+
const o = W(), [s, r] = b(ct), a = I(async (d = !0) => {
|
|
395
|
+
d && o(N(!0));
|
|
396
|
+
try {
|
|
397
|
+
const i = await xe(t);
|
|
398
|
+
r(i.data);
|
|
399
|
+
} catch (i) {
|
|
400
|
+
d && o(
|
|
401
|
+
O({
|
|
402
|
+
type: "danger",
|
|
403
|
+
message: i.response?.data?.title || i.message
|
|
404
|
+
})
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
d && o(N(!1));
|
|
408
|
+
}, []), h = I(async (d) => {
|
|
409
|
+
o(N(!0));
|
|
410
|
+
try {
|
|
411
|
+
const i = await ze(d, t);
|
|
412
|
+
r(i.data), await a(!1), o(
|
|
413
|
+
O({
|
|
414
|
+
type: "success",
|
|
415
|
+
message: "Update Roster config successfully"
|
|
416
|
+
})
|
|
417
|
+
);
|
|
418
|
+
} catch (i) {
|
|
419
|
+
o(
|
|
420
|
+
O({
|
|
421
|
+
type: "danger",
|
|
422
|
+
message: i.response?.data?.title || i.message
|
|
423
|
+
})
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
o(N(!1));
|
|
427
|
+
}, []), n = E(
|
|
428
|
+
() => !s.clientId.trim().length && !s.clientSecret.trim().length && !s.endPointUrl.trim().length ? "Client Id and Client Secret are required" : s.endPointUrl.trim().length ? s.clientId.trim().length ? s.clientSecret.trim().length ? null : "Client Secret is required" : "Client Id is required" : "End Point URL is required",
|
|
429
|
+
[JSON.stringify(s)]
|
|
430
|
+
);
|
|
431
|
+
return H(() => {
|
|
432
|
+
document.title = "OneRoster | Settings", a();
|
|
433
|
+
}, [t]), {
|
|
434
|
+
rosterConfig: s,
|
|
435
|
+
errorImportRest: n,
|
|
436
|
+
updateData: h
|
|
437
|
+
};
|
|
438
|
+
}, dt = () => {
|
|
439
|
+
const {
|
|
440
|
+
rosterConfig: t,
|
|
441
|
+
errorImportRest: o,
|
|
442
|
+
updateData: s
|
|
443
|
+
} = ye($.ClassLink);
|
|
444
|
+
return /* @__PURE__ */ e("div", { className: "fadeIn animated", children: /* @__PURE__ */ l(U, { children: [
|
|
445
|
+
/* @__PURE__ */ e(m, { md: 7, children: /* @__PURE__ */ e(
|
|
446
|
+
ue,
|
|
447
|
+
{
|
|
448
|
+
rosterConfig: t,
|
|
449
|
+
updateData: s,
|
|
450
|
+
type: $.ClassLink
|
|
451
|
+
}
|
|
452
|
+
) }),
|
|
453
|
+
/* @__PURE__ */ e(m, { md: 5 }),
|
|
454
|
+
/* @__PURE__ */ e(m, { md: 7, children: /* @__PURE__ */ e(
|
|
455
|
+
Ce,
|
|
456
|
+
{
|
|
457
|
+
errorImportRest: o,
|
|
458
|
+
type: $.ClassLink
|
|
459
|
+
}
|
|
460
|
+
) })
|
|
461
|
+
] }) });
|
|
462
|
+
}, mt = () => {
|
|
463
|
+
const t = W(), [o, s] = b([]), [r, a] = b(at), [h, n] = b(0), [d, i] = b(!1), [c, u] = b([]), [v, R] = b([]), [_, S] = b(), C = (p) => {
|
|
464
|
+
const A = {
|
|
465
|
+
...r,
|
|
466
|
+
...p
|
|
467
|
+
};
|
|
468
|
+
A.searchString && p.searchString && p.searchString != r.searchString && (A.currentPage = 1), a(A);
|
|
469
|
+
}, M = I((p) => {
|
|
470
|
+
p !== r.sortBy ? C({
|
|
471
|
+
sortBy: p,
|
|
472
|
+
orderBy: "ASC",
|
|
473
|
+
currentPage: 1
|
|
474
|
+
}) : C({
|
|
475
|
+
sortBy: p,
|
|
476
|
+
orderBy: r.orderBy !== "DESC" ? "DESC" : "ASC",
|
|
477
|
+
currentPage: 1
|
|
478
|
+
});
|
|
479
|
+
}, [JSON.stringify(r)]), T = async () => {
|
|
480
|
+
t(N(!0));
|
|
481
|
+
try {
|
|
482
|
+
const p = await Ye(r);
|
|
483
|
+
s(p?.data?.items), n(p?.data?.totalItems);
|
|
484
|
+
} catch (p) {
|
|
485
|
+
t(
|
|
486
|
+
O({
|
|
487
|
+
type: "danger",
|
|
488
|
+
message: p.response?.data?.title || p.message
|
|
489
|
+
})
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
t(N(!1));
|
|
493
|
+
}, f = async () => {
|
|
494
|
+
t(N(!0));
|
|
495
|
+
try {
|
|
496
|
+
const p = await Pe({
|
|
497
|
+
sortBy: "Email"
|
|
498
|
+
});
|
|
499
|
+
R(p?.data?.map((A) => ({
|
|
500
|
+
label: A.email,
|
|
501
|
+
value: A.id
|
|
502
|
+
})));
|
|
503
|
+
} catch (p) {
|
|
504
|
+
t(
|
|
505
|
+
O({
|
|
506
|
+
type: "danger",
|
|
507
|
+
message: p.response?.data?.title || p.message
|
|
508
|
+
})
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
t(N(!1));
|
|
512
|
+
}, y = I((p, A) => {
|
|
513
|
+
let G = v.find((D) => D.value === p);
|
|
514
|
+
S({
|
|
515
|
+
..._,
|
|
516
|
+
[A]: G
|
|
517
|
+
});
|
|
518
|
+
}, [JSON.stringify(_), JSON.stringify(v)]), g = () => {
|
|
519
|
+
i(!d), u(o.map((p) => p.sourcedId)), d && u([]);
|
|
520
|
+
}, L = (p) => {
|
|
521
|
+
const { id: A, checked: G } = p.target;
|
|
522
|
+
u([...c, A]), G || u(c.filter((D) => D !== A));
|
|
523
|
+
}, w = (p) => `${p.givenName || ""} ${p.middleName || ""} ${p.familyName || ""}`.replaceAll(" ", " ").trim(), q = I((p, A) => {
|
|
524
|
+
R([
|
|
525
|
+
...v,
|
|
526
|
+
p
|
|
527
|
+
]), S({
|
|
528
|
+
..._,
|
|
529
|
+
[A]: p
|
|
530
|
+
});
|
|
531
|
+
}, [JSON.stringify(v), JSON.stringify(_)]), K = I(() => {
|
|
532
|
+
r.currentPage == 1 ? T() : C({ currentPage: 1 }), u([]), S(void 0), i(!1);
|
|
533
|
+
}, [JSON.stringify(r)]);
|
|
534
|
+
return H(() => {
|
|
535
|
+
T();
|
|
536
|
+
}, [JSON.stringify(r)]), H(() => {
|
|
537
|
+
document.title = "OneRoster | Users", f();
|
|
538
|
+
}, []), {
|
|
539
|
+
handelSort: M,
|
|
540
|
+
handelRetrievedData: K,
|
|
541
|
+
handleCreateTeacherOption: q,
|
|
542
|
+
selectedTeachers: _,
|
|
543
|
+
handleSelectTeacher: y,
|
|
544
|
+
teachers: v,
|
|
545
|
+
getFullName: w,
|
|
546
|
+
totalItem: h,
|
|
547
|
+
userList: o,
|
|
548
|
+
filters: r,
|
|
549
|
+
changeFilters: C,
|
|
550
|
+
handleSelectAll: g,
|
|
551
|
+
handleClickCheck: L,
|
|
552
|
+
isCheckAll: d,
|
|
553
|
+
isCheck: c
|
|
554
|
+
};
|
|
555
|
+
}, ut = (t, o) => {
|
|
556
|
+
const s = W(), r = async (n) => {
|
|
557
|
+
s(N(!0));
|
|
558
|
+
try {
|
|
559
|
+
await He(n), s(
|
|
560
|
+
O({
|
|
561
|
+
type: "success",
|
|
562
|
+
message: "Create Successfully"
|
|
563
|
+
})
|
|
564
|
+
), o?.();
|
|
565
|
+
} catch (d) {
|
|
566
|
+
s(
|
|
567
|
+
O({
|
|
568
|
+
type: "danger",
|
|
569
|
+
message: d.response?.data?.title || d.message
|
|
570
|
+
})
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
s(N(!1));
|
|
574
|
+
};
|
|
575
|
+
return {
|
|
576
|
+
handleCreateMultiUsers: (n, d) => {
|
|
577
|
+
if (n.length === 0) {
|
|
578
|
+
s(
|
|
579
|
+
O({
|
|
580
|
+
type: "danger",
|
|
581
|
+
message: "Not found selected user."
|
|
582
|
+
})
|
|
583
|
+
);
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
if (n.some((u) => {
|
|
587
|
+
const v = t.find((S) => S.sourcedId == u), R = d?.[u];
|
|
588
|
+
return !!(v?.role?.includes?.("student") && !R);
|
|
589
|
+
})) {
|
|
590
|
+
s(
|
|
591
|
+
O({
|
|
592
|
+
type: "danger",
|
|
593
|
+
message: "Please select/add teacher for all selected student first."
|
|
594
|
+
})
|
|
595
|
+
);
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
const c = n.map((u) => {
|
|
599
|
+
const v = d?.[u], R = {
|
|
600
|
+
sourcedId: u
|
|
601
|
+
};
|
|
602
|
+
if (v) {
|
|
603
|
+
const _ = v?.value && typeof v?.value == "string" ? v?.value : void 0, S = v?.value && typeof v?.value == "number" ? v?.label : void 0;
|
|
604
|
+
R.teacherEmail = S, R.teacherUserId = _;
|
|
605
|
+
}
|
|
606
|
+
return R;
|
|
607
|
+
});
|
|
608
|
+
r([...c]);
|
|
609
|
+
},
|
|
610
|
+
handleCreateSingleUser: (n, d, i) => {
|
|
611
|
+
if (!i && d) {
|
|
612
|
+
s(
|
|
613
|
+
O({
|
|
614
|
+
type: "danger",
|
|
615
|
+
message: "Please select/add teacher for all selected student first."
|
|
616
|
+
})
|
|
617
|
+
);
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
const c = i?.value && typeof i?.value == "string" ? i?.value : void 0, u = i?.value && typeof i?.value == "number" ? i?.label : void 0;
|
|
621
|
+
r([
|
|
622
|
+
{
|
|
623
|
+
sourcedId: n,
|
|
624
|
+
teacherUserId: c,
|
|
625
|
+
teacherEmail: u
|
|
626
|
+
}
|
|
627
|
+
]);
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
};
|
|
631
|
+
var pt = ["allowCreateWhileLoading", "createOptionPosition", "formatCreateLabel", "isValidNewOption", "getNewOptionData", "onCreateOption", "options", "onChange"], de = function() {
|
|
632
|
+
var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", s = arguments.length > 1 ? arguments[1] : void 0, r = arguments.length > 2 ? arguments[2] : void 0, a = String(o).toLowerCase(), h = String(r.getOptionValue(s)).toLowerCase(), n = String(r.getOptionLabel(s)).toLowerCase();
|
|
633
|
+
return h === a || n === a;
|
|
634
|
+
}, ie = {
|
|
635
|
+
formatCreateLabel: function(o) {
|
|
636
|
+
return 'Create "'.concat(o, '"');
|
|
637
|
+
},
|
|
638
|
+
isValidNewOption: function(o, s, r, a) {
|
|
639
|
+
return !(!o || s.some(function(h) {
|
|
640
|
+
return de(o, h, a);
|
|
641
|
+
}) || r.some(function(h) {
|
|
642
|
+
return de(o, h, a);
|
|
643
|
+
}));
|
|
644
|
+
},
|
|
645
|
+
getNewOptionData: function(o, s) {
|
|
646
|
+
return {
|
|
647
|
+
label: s,
|
|
648
|
+
value: o,
|
|
649
|
+
__isNew__: !0
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
function ht(t) {
|
|
654
|
+
var o = t.allowCreateWhileLoading, s = o === void 0 ? !1 : o, r = t.createOptionPosition, a = r === void 0 ? "last" : r, h = t.formatCreateLabel, n = h === void 0 ? ie.formatCreateLabel : h, d = t.isValidNewOption, i = d === void 0 ? ie.isValidNewOption : d, c = t.getNewOptionData, u = c === void 0 ? ie.getNewOptionData : c, v = t.onCreateOption, R = t.options, _ = R === void 0 ? [] : R, S = t.onChange, C = Ee(t, pt), M = C.getOptionValue, T = M === void 0 ? Fe : M, f = C.getOptionLabel, y = f === void 0 ? $e : f, g = C.inputValue, L = C.isLoading, w = C.isMulti, q = C.value, K = C.name, p = E(function() {
|
|
655
|
+
return i(g, le(q), _, {
|
|
656
|
+
getOptionValue: T,
|
|
657
|
+
getOptionLabel: y
|
|
658
|
+
}) ? u(g, n(g)) : void 0;
|
|
659
|
+
}, [n, u, y, T, g, i, _, q]), A = E(function() {
|
|
660
|
+
return (s || !L) && p ? a === "first" ? [p].concat(ae(_)) : [].concat(ae(_), [p]) : _;
|
|
661
|
+
}, [s, a, L, p, _]), G = I(function(D, se) {
|
|
662
|
+
if (se.action !== "select-option")
|
|
663
|
+
return S(D, se);
|
|
664
|
+
var oe = Array.isArray(D) ? D : [D];
|
|
665
|
+
if (oe[oe.length - 1] === p) {
|
|
666
|
+
if (v) v(g);
|
|
667
|
+
else {
|
|
668
|
+
var re = u(g, g), _e = {
|
|
669
|
+
action: "create-option",
|
|
670
|
+
name: K,
|
|
671
|
+
option: re
|
|
672
|
+
};
|
|
673
|
+
S(Te(w, [].concat(ae(le(q)), [re]), re), _e);
|
|
674
|
+
}
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
S(D, se);
|
|
678
|
+
}, [u, g, w, K, p, v, S, q]);
|
|
679
|
+
return ce(ce({}, C), {}, {
|
|
680
|
+
options: A,
|
|
681
|
+
onChange: G
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
var gt = /* @__PURE__ */ Ue(function(t, o) {
|
|
685
|
+
var s = De(t), r = ht(s);
|
|
686
|
+
return /* @__PURE__ */ we.createElement(Ve, ke({
|
|
687
|
+
ref: o
|
|
688
|
+
}, r));
|
|
689
|
+
}), ft = gt;
|
|
690
|
+
const Ct = ({
|
|
691
|
+
options: t,
|
|
692
|
+
isDisabled: o,
|
|
693
|
+
scrollBottom: s,
|
|
694
|
+
onCreateOption: r,
|
|
695
|
+
...a
|
|
696
|
+
}) => {
|
|
697
|
+
const [h, n] = b(), d = (u) => String(u).toLowerCase().match(
|
|
698
|
+
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
699
|
+
);
|
|
700
|
+
return /* @__PURE__ */ l("div", { className: "w-100", children: [
|
|
701
|
+
/* @__PURE__ */ e("div", { className: "w-100", children: /* @__PURE__ */ e(
|
|
702
|
+
ft,
|
|
703
|
+
{
|
|
704
|
+
isDisabled: o,
|
|
705
|
+
options: t,
|
|
706
|
+
menuPlacement: s ? "top" : "auto",
|
|
707
|
+
onCreateOption: (u) => {
|
|
708
|
+
if (d(u))
|
|
709
|
+
n(void 0);
|
|
710
|
+
else {
|
|
711
|
+
n(`Invalid email format for email: ${u}`);
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
const v = {
|
|
715
|
+
label: u,
|
|
716
|
+
value: -(/* @__PURE__ */ new Date()).getTime()
|
|
717
|
+
};
|
|
718
|
+
r?.(v);
|
|
719
|
+
},
|
|
720
|
+
onFocus: () => {
|
|
721
|
+
n(void 0);
|
|
722
|
+
},
|
|
723
|
+
...a
|
|
724
|
+
}
|
|
725
|
+
) }),
|
|
726
|
+
!!h && /* @__PURE__ */ e("p", { className: "text-danger mb-0 mt-1", children: h })
|
|
727
|
+
] });
|
|
728
|
+
}, yt = () => {
|
|
729
|
+
const {
|
|
730
|
+
handelSort: t,
|
|
731
|
+
handelRetrievedData: o,
|
|
732
|
+
handleCreateTeacherOption: s,
|
|
733
|
+
selectedTeachers: r,
|
|
734
|
+
handleSelectTeacher: a,
|
|
735
|
+
teachers: h,
|
|
736
|
+
getFullName: n,
|
|
737
|
+
userList: d,
|
|
738
|
+
totalItem: i,
|
|
739
|
+
changeFilters: c,
|
|
740
|
+
filters: u,
|
|
741
|
+
handleSelectAll: v,
|
|
742
|
+
handleClickCheck: R,
|
|
743
|
+
isCheckAll: _,
|
|
744
|
+
isCheck: S
|
|
745
|
+
} = mt(), { t: C } = J(), { handleCreateMultiUsers: M, handleCreateSingleUser: T } = ut(d, o);
|
|
746
|
+
return /* @__PURE__ */ l("div", { className: "fadeIn animated", children: [
|
|
747
|
+
/* @__PURE__ */ e("h5", { className: "mt-4 mb-2", children: C("non_existent_users") }),
|
|
748
|
+
/* @__PURE__ */ l(U, { className: "my-2", children: [
|
|
749
|
+
/* @__PURE__ */ e(m, { md: 8, children: /* @__PURE__ */ e(
|
|
750
|
+
Se,
|
|
751
|
+
{
|
|
752
|
+
initValue: u?.searchString || "",
|
|
753
|
+
onSearch: (f) => c({ searchString: f }),
|
|
754
|
+
placeholder: C("type_something_to_search_users")
|
|
755
|
+
}
|
|
756
|
+
) }),
|
|
757
|
+
/* @__PURE__ */ l(
|
|
758
|
+
m,
|
|
759
|
+
{
|
|
760
|
+
md: 4,
|
|
761
|
+
className: "d-flex justify-content-end align-items-center",
|
|
762
|
+
children: [
|
|
763
|
+
C("total_of_users"),
|
|
764
|
+
": ",
|
|
765
|
+
i
|
|
766
|
+
]
|
|
767
|
+
}
|
|
768
|
+
)
|
|
769
|
+
] }),
|
|
770
|
+
/* @__PURE__ */ e(U, { className: "mb-2", children: /* @__PURE__ */ e(m, { children: /* @__PURE__ */ e(z, { onClick: () => M(S, r), color: "primary", children: C("create_account_for_selected_users") }) }) }),
|
|
771
|
+
/* @__PURE__ */ l(U, { className: "mb-2", children: [
|
|
772
|
+
/* @__PURE__ */ e(m, { md: 12, children: d && d.length > 0 ? /* @__PURE__ */ e("div", { children: /* @__PURE__ */ l(Ae, { bordered: !0, hover: !0, striped: !0, responsive: !0, size: "sm", children: [
|
|
773
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { children: [
|
|
774
|
+
/* @__PURE__ */ e("th", { className: "align-middle", children: /* @__PURE__ */ e(
|
|
775
|
+
"input",
|
|
776
|
+
{
|
|
777
|
+
type: "checkbox",
|
|
778
|
+
onChange: v,
|
|
779
|
+
checked: _
|
|
780
|
+
}
|
|
781
|
+
) }),
|
|
782
|
+
/* @__PURE__ */ l("th", { className: `align-top ${k.pointer}`, onClick: () => t(x.USERNAME), children: [
|
|
783
|
+
C("user_name"),
|
|
784
|
+
u.sortBy === x.USERNAME && /* @__PURE__ */ e(Q, { children: u.orderBy === "DESC" ? /* @__PURE__ */ e(X, { className: "ml-1" }) : /* @__PURE__ */ e(ee, { className: "ml-1" }) })
|
|
785
|
+
] }),
|
|
786
|
+
/* @__PURE__ */ l("th", { className: `align-top ${k.pointer}`, onClick: () => t(x.EMAIL), children: [
|
|
787
|
+
C("user_email"),
|
|
788
|
+
u.sortBy === x.EMAIL && /* @__PURE__ */ e(Q, { children: u.orderBy === "DESC" ? /* @__PURE__ */ e(X, { className: "ml-1" }) : /* @__PURE__ */ e(ee, { className: "ml-1" }) })
|
|
789
|
+
] }),
|
|
790
|
+
/* @__PURE__ */ l("th", { className: `align-top ${k.pointer}`, onClick: () => t(x.ROLE), children: [
|
|
791
|
+
C("role"),
|
|
792
|
+
u.sortBy === x.ROLE && /* @__PURE__ */ e(Q, { children: u.orderBy === "DESC" ? /* @__PURE__ */ e(X, { className: "ml-1" }) : /* @__PURE__ */ e(ee, { className: "ml-1" }) })
|
|
793
|
+
] }),
|
|
794
|
+
/* @__PURE__ */ l("th", { className: `align-top ${k.pointer}`, onClick: () => t(x.GRADE), children: [
|
|
795
|
+
C("grade"),
|
|
796
|
+
u.sortBy === x.GRADE && /* @__PURE__ */ e(Q, { children: u.orderBy === "DESC" ? /* @__PURE__ */ e(X, { className: "ml-1" }) : /* @__PURE__ */ e(ee, { className: "ml-1" }) })
|
|
797
|
+
] }),
|
|
798
|
+
/* @__PURE__ */ e("th", { className: "align-top", children: C("action") })
|
|
799
|
+
] }) }),
|
|
800
|
+
/* @__PURE__ */ e("tbody", { children: d.map((f) => /* @__PURE__ */ l("tr", { children: [
|
|
801
|
+
/* @__PURE__ */ e("td", { className: "align-middle", children: /* @__PURE__ */ e(
|
|
802
|
+
"input",
|
|
803
|
+
{
|
|
804
|
+
id: f.sourcedId,
|
|
805
|
+
type: "checkbox",
|
|
806
|
+
onChange: R,
|
|
807
|
+
checked: S.includes(
|
|
808
|
+
f.sourcedId
|
|
809
|
+
)
|
|
810
|
+
}
|
|
811
|
+
) }),
|
|
812
|
+
/* @__PURE__ */ e("td", { className: "align-middle", children: n(f) }),
|
|
813
|
+
/* @__PURE__ */ e("td", { className: "align-middle", children: f.email }),
|
|
814
|
+
/* @__PURE__ */ e("td", { className: "align-middle text-capitalize", children: !!f.role && f.role.replace?.("SecondaryTeacher", "SupportTeacher") }),
|
|
815
|
+
/* @__PURE__ */ e("td", { className: "align-middle", children: f.grades }),
|
|
816
|
+
/* @__PURE__ */ e(
|
|
817
|
+
"td",
|
|
818
|
+
{
|
|
819
|
+
className: "align-middle",
|
|
820
|
+
style: {
|
|
821
|
+
width: "30%"
|
|
822
|
+
},
|
|
823
|
+
children: f.email?.trim() && /* @__PURE__ */ l("div", { className: "d-flex", children: [
|
|
824
|
+
f.role?.includes?.("student") && /* @__PURE__ */ e(
|
|
825
|
+
Ct,
|
|
826
|
+
{
|
|
827
|
+
value: r?.[f.sourcedId] || null,
|
|
828
|
+
options: h,
|
|
829
|
+
onChange: (y) => a(y.value, f.sourcedId),
|
|
830
|
+
onCreateOption: (y) => s(y, f.sourcedId),
|
|
831
|
+
placeholder: C("select_teacher"),
|
|
832
|
+
className: "flex-grow-1 mr-2"
|
|
833
|
+
}
|
|
834
|
+
),
|
|
835
|
+
/* @__PURE__ */ e(
|
|
836
|
+
be,
|
|
837
|
+
{
|
|
838
|
+
label: C("create"),
|
|
839
|
+
onClick: () => T(
|
|
840
|
+
f.sourcedId,
|
|
841
|
+
f.role?.includes("student"),
|
|
842
|
+
r?.[f.sourcedId]
|
|
843
|
+
)
|
|
844
|
+
}
|
|
845
|
+
)
|
|
846
|
+
] })
|
|
847
|
+
}
|
|
848
|
+
)
|
|
849
|
+
] }, f.id)) })
|
|
850
|
+
] }) }) : /* @__PURE__ */ e(Oe, { label: C("user") }) }),
|
|
851
|
+
/* @__PURE__ */ e(m, { md: 12, children: /* @__PURE__ */ e(
|
|
852
|
+
Ie,
|
|
853
|
+
{
|
|
854
|
+
filters: u,
|
|
855
|
+
totalRecordCount: i,
|
|
856
|
+
changePageSize: (f) => c({ pageSize: f }),
|
|
857
|
+
changePage: (f) => c({ currentPage: f })
|
|
858
|
+
}
|
|
859
|
+
) })
|
|
860
|
+
] })
|
|
861
|
+
] });
|
|
862
|
+
}, Ne = ({ veraCrossConfig: t, updateData: o, labelTime: s = "time_vera_cross_sync_hh" }) => {
|
|
863
|
+
const { t: r } = J();
|
|
864
|
+
return /* @__PURE__ */ e(
|
|
865
|
+
me,
|
|
866
|
+
{
|
|
867
|
+
initialValues: t,
|
|
868
|
+
enableReinitialize: !0,
|
|
869
|
+
onSubmit: (a) => {
|
|
870
|
+
o(a);
|
|
871
|
+
},
|
|
872
|
+
children: (a) => {
|
|
873
|
+
const {
|
|
874
|
+
values: h,
|
|
875
|
+
handleChange: n,
|
|
876
|
+
handleBlur: d,
|
|
877
|
+
handleSubmit: i
|
|
878
|
+
} = a;
|
|
879
|
+
return /* @__PURE__ */ l(U, { children: [
|
|
880
|
+
/* @__PURE__ */ e(m, { md: 12, children: /* @__PURE__ */ e("h5", { className: "mt-4 font-weight-bold", children: r("one_roster_config") }) }),
|
|
881
|
+
/* @__PURE__ */ l(m, { md: 12, className: "my-4 mt-2", children: [
|
|
882
|
+
/* @__PURE__ */ e(V, { className: "font-weight-bold", children: r(s) }),
|
|
883
|
+
/* @__PURE__ */ e(
|
|
884
|
+
B,
|
|
885
|
+
{
|
|
886
|
+
name: "cronjobTime",
|
|
887
|
+
placeholder: r(s),
|
|
888
|
+
value: h.cronjobTime,
|
|
889
|
+
onChange: (c) => {
|
|
890
|
+
n(c);
|
|
891
|
+
},
|
|
892
|
+
onBlur: d("cronjobTime")
|
|
893
|
+
}
|
|
894
|
+
)
|
|
895
|
+
] }),
|
|
896
|
+
/* @__PURE__ */ l(m, { md: 12, className: "my-4 mt-2", children: [
|
|
897
|
+
/* @__PURE__ */ l(V, { className: "font-weight-bold", children: [
|
|
898
|
+
r("end_point_url"),
|
|
899
|
+
":"
|
|
900
|
+
] }),
|
|
901
|
+
/* @__PURE__ */ e(
|
|
902
|
+
B,
|
|
903
|
+
{
|
|
904
|
+
name: "endPointUrl",
|
|
905
|
+
placeholder: r("end_point_url"),
|
|
906
|
+
value: h.endPointUrl,
|
|
907
|
+
onChange: (c) => {
|
|
908
|
+
n(c);
|
|
909
|
+
},
|
|
910
|
+
onBlur: d("endPointUrl")
|
|
911
|
+
}
|
|
912
|
+
)
|
|
913
|
+
] }),
|
|
914
|
+
/* @__PURE__ */ l(m, { md: 12, className: "mb-4 mt-2", children: [
|
|
915
|
+
/* @__PURE__ */ l(V, { className: "font-weight-bold", children: [
|
|
916
|
+
r("client_id"),
|
|
917
|
+
":"
|
|
918
|
+
] }),
|
|
919
|
+
/* @__PURE__ */ e(
|
|
920
|
+
B,
|
|
921
|
+
{
|
|
922
|
+
name: "clientId",
|
|
923
|
+
placeholder: r("client_id"),
|
|
924
|
+
value: h.clientId,
|
|
925
|
+
onChange: (c) => {
|
|
926
|
+
n(c);
|
|
927
|
+
},
|
|
928
|
+
onBlur: d("clientId")
|
|
929
|
+
}
|
|
930
|
+
)
|
|
931
|
+
] }),
|
|
932
|
+
/* @__PURE__ */ l(m, { md: 12, className: "mb-4", children: [
|
|
933
|
+
/* @__PURE__ */ l(V, { className: "font-weight-bold", children: [
|
|
934
|
+
r("client_secret"),
|
|
935
|
+
":"
|
|
936
|
+
] }),
|
|
937
|
+
/* @__PURE__ */ e(
|
|
938
|
+
B,
|
|
939
|
+
{
|
|
940
|
+
name: "clientSecret",
|
|
941
|
+
placeholder: r("client_secret"),
|
|
942
|
+
value: h.clientSecret,
|
|
943
|
+
onChange: (c) => {
|
|
944
|
+
n(c);
|
|
945
|
+
},
|
|
946
|
+
onBlur: d("clientSecret")
|
|
947
|
+
}
|
|
948
|
+
)
|
|
949
|
+
] }),
|
|
950
|
+
/* @__PURE__ */ e(m, { md: 12, className: "d-flex justify-content-end", children: /* @__PURE__ */ e(
|
|
951
|
+
z,
|
|
952
|
+
{
|
|
953
|
+
onClick: () => i(),
|
|
954
|
+
color: "success",
|
|
955
|
+
children: r("save")
|
|
956
|
+
}
|
|
957
|
+
) })
|
|
958
|
+
] });
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
);
|
|
962
|
+
}, Nt = {
|
|
963
|
+
cronjobTime: "",
|
|
964
|
+
clientId: "",
|
|
965
|
+
clientSecret: "",
|
|
966
|
+
endPointUrl: ""
|
|
967
|
+
}, vt = () => {
|
|
968
|
+
const t = W(), [o] = b(), [s, r] = b(
|
|
969
|
+
Nt
|
|
970
|
+
), a = I(async (i = !0) => {
|
|
971
|
+
i && t(N(!0));
|
|
972
|
+
try {
|
|
973
|
+
const c = await Je();
|
|
974
|
+
r(c.data);
|
|
975
|
+
} catch (c) {
|
|
976
|
+
i && t(
|
|
977
|
+
O({
|
|
978
|
+
type: "danger",
|
|
979
|
+
message: c.response?.data?.title || c.message
|
|
980
|
+
})
|
|
981
|
+
);
|
|
982
|
+
}
|
|
983
|
+
i && t(N(!1));
|
|
984
|
+
}, []), h = I(async (i) => {
|
|
985
|
+
t(N(!0));
|
|
986
|
+
try {
|
|
987
|
+
const c = await qe(i);
|
|
988
|
+
r(c.data), await a(!1), t(
|
|
989
|
+
O({
|
|
990
|
+
type: "success",
|
|
991
|
+
message: "Update vera cross config successfully"
|
|
992
|
+
})
|
|
993
|
+
);
|
|
994
|
+
} catch (c) {
|
|
995
|
+
t(
|
|
996
|
+
O({
|
|
997
|
+
type: "danger",
|
|
998
|
+
message: c.response?.data?.title || c.message
|
|
999
|
+
})
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
1002
|
+
t(N(!1));
|
|
1003
|
+
}, []), n = E(() => !s.clientId.trim().length && !s.clientSecret.trim().length && !s.endPointUrl.trim().length ? "Client Id and Client Secret are required" : s.endPointUrl.trim().length ? s.clientId.trim().length ? s.clientSecret.trim().length ? null : "Client Secret is required" : "Client Id is required" : "End Point URL is required", [JSON.stringify(s)]), d = I(async () => {
|
|
1004
|
+
if (n) {
|
|
1005
|
+
t(
|
|
1006
|
+
j({
|
|
1007
|
+
isOpen: !0,
|
|
1008
|
+
type: "danger",
|
|
1009
|
+
message: `${n} (Please make sure your changes are saved)`
|
|
1010
|
+
})
|
|
1011
|
+
);
|
|
1012
|
+
return;
|
|
1013
|
+
}
|
|
1014
|
+
t(N(!0));
|
|
1015
|
+
try {
|
|
1016
|
+
const i = await Xe();
|
|
1017
|
+
t(
|
|
1018
|
+
j({
|
|
1019
|
+
isOpen: !0,
|
|
1020
|
+
type: "success",
|
|
1021
|
+
message: i.data?.message || "VeraCross sync job has been triggered in the background. Please wait a few moments before refreshing the page."
|
|
1022
|
+
})
|
|
1023
|
+
);
|
|
1024
|
+
} catch (i) {
|
|
1025
|
+
t(
|
|
1026
|
+
j({
|
|
1027
|
+
isOpen: !0,
|
|
1028
|
+
type: "danger",
|
|
1029
|
+
message: i.response?.data?.message || i.response?.data?.title || i.message
|
|
1030
|
+
})
|
|
1031
|
+
);
|
|
1032
|
+
}
|
|
1033
|
+
t(N(!1));
|
|
1034
|
+
}, [n, t]);
|
|
1035
|
+
return H(() => {
|
|
1036
|
+
document.title = "Veracross | Settings", a();
|
|
1037
|
+
}, []), {
|
|
1038
|
+
veraCrossConfig: s,
|
|
1039
|
+
errorImportRest: n,
|
|
1040
|
+
updateData: h,
|
|
1041
|
+
restApiInfo: o,
|
|
1042
|
+
handleImportFromRestfulApi: d
|
|
1043
|
+
};
|
|
1044
|
+
}, ve = ({
|
|
1045
|
+
restApiInfo: t,
|
|
1046
|
+
importInfo: o
|
|
1047
|
+
}) => {
|
|
1048
|
+
if (!t) return null;
|
|
1049
|
+
const r = o.map((a) => ({
|
|
1050
|
+
name: a,
|
|
1051
|
+
status: t[a]
|
|
1052
|
+
})).filter((a) => a.status !== "ResourceNotFound");
|
|
1053
|
+
return /* @__PURE__ */ e("div", { children: r.map((a) => /* @__PURE__ */ l("div", { className: "flex items-center mb-2", children: [
|
|
1054
|
+
a.status ? a.status === !0 ? /* @__PURE__ */ e(Z, { color: "#28a745", className: "mr-2" }) : /* @__PURE__ */ e(Y, { color: "#dc3545", className: "mr-2" }) : /* @__PURE__ */ e(
|
|
1055
|
+
te,
|
|
1056
|
+
{
|
|
1057
|
+
color: "#999999",
|
|
1058
|
+
className: `mr-2 ${k.spinner}`
|
|
1059
|
+
}
|
|
1060
|
+
),
|
|
1061
|
+
/* @__PURE__ */ e("b", { children: `${a.name}: ` }),
|
|
1062
|
+
" ",
|
|
1063
|
+
a.status ? a.status === !0 ? "Import successful" : /* @__PURE__ */ e("span", { children: a.status === fe ? "Invalid Client Id and Client Secret" : a.status }) : "Importing..."
|
|
1064
|
+
] }, a.name)) });
|
|
1065
|
+
}, _t = () => {
|
|
1066
|
+
const {
|
|
1067
|
+
veraCrossConfig: t,
|
|
1068
|
+
updateData: o,
|
|
1069
|
+
restApiInfo: s,
|
|
1070
|
+
handleImportFromRestfulApi: r
|
|
1071
|
+
} = vt(), { t: a } = J();
|
|
1072
|
+
return /* @__PURE__ */ e("div", { className: "fadeIn animated", children: /* @__PURE__ */ l(U, { children: [
|
|
1073
|
+
/* @__PURE__ */ e(m, { md: 7, children: /* @__PURE__ */ e(
|
|
1074
|
+
Ne,
|
|
1075
|
+
{
|
|
1076
|
+
veraCrossConfig: t,
|
|
1077
|
+
updateData: o
|
|
1078
|
+
}
|
|
1079
|
+
) }),
|
|
1080
|
+
/* @__PURE__ */ e(m, { md: 5 }),
|
|
1081
|
+
/* @__PURE__ */ e(m, { md: 7, children: /* @__PURE__ */ l(U, { children: [
|
|
1082
|
+
/* @__PURE__ */ e(m, { md: 12, children: /* @__PURE__ */ e("h5", { className: "mt-4", style: { fontWeight: 700 }, children: a("import_vera_cross") }) }),
|
|
1083
|
+
/* @__PURE__ */ e(m, { md: 6 }),
|
|
1084
|
+
/* @__PURE__ */ l(m, { md: 6, children: [
|
|
1085
|
+
/* @__PURE__ */ e(
|
|
1086
|
+
z,
|
|
1087
|
+
{
|
|
1088
|
+
color: "primary",
|
|
1089
|
+
className: "w-100 mt-4 mb-1",
|
|
1090
|
+
onClick: r,
|
|
1091
|
+
children: a("import_from_restful_api")
|
|
1092
|
+
}
|
|
1093
|
+
),
|
|
1094
|
+
/* @__PURE__ */ e("div", { className: "mt-2", children: /* @__PURE__ */ e(ve, { restApiInfo: s, importInfo: it }) })
|
|
1095
|
+
] })
|
|
1096
|
+
] }) })
|
|
1097
|
+
] }) });
|
|
1098
|
+
}, St = {
|
|
1099
|
+
cronjobTime: "",
|
|
1100
|
+
clientId: "",
|
|
1101
|
+
clientSecret: "",
|
|
1102
|
+
endPointUrl: ""
|
|
1103
|
+
}, bt = () => {
|
|
1104
|
+
const t = W(), [o] = b(), [s, r] = b(
|
|
1105
|
+
St
|
|
1106
|
+
), a = I(async (i = !0) => {
|
|
1107
|
+
i && t(N(!0));
|
|
1108
|
+
try {
|
|
1109
|
+
const c = await We();
|
|
1110
|
+
r(c.data);
|
|
1111
|
+
} catch (c) {
|
|
1112
|
+
i && t(
|
|
1113
|
+
O({
|
|
1114
|
+
type: "danger",
|
|
1115
|
+
message: c.response?.data?.title || c.message
|
|
1116
|
+
})
|
|
1117
|
+
);
|
|
1118
|
+
}
|
|
1119
|
+
i && t(N(!1));
|
|
1120
|
+
}, []), h = I(async (i) => {
|
|
1121
|
+
t(N(!0));
|
|
1122
|
+
try {
|
|
1123
|
+
const c = await Ge(i);
|
|
1124
|
+
r(c.data), await a(!1), t(
|
|
1125
|
+
O({
|
|
1126
|
+
type: "success",
|
|
1127
|
+
message: "Update vera cross config successfully"
|
|
1128
|
+
})
|
|
1129
|
+
);
|
|
1130
|
+
} catch (c) {
|
|
1131
|
+
t(
|
|
1132
|
+
O({
|
|
1133
|
+
type: "danger",
|
|
1134
|
+
message: c.response?.data?.title || c.message
|
|
1135
|
+
})
|
|
1136
|
+
);
|
|
1137
|
+
}
|
|
1138
|
+
t(N(!1));
|
|
1139
|
+
}, []), n = E(() => !s.clientId.trim().length && !s.clientSecret.trim().length && !s.endPointUrl.trim().length ? "Client Id and Client Secret are required" : s.endPointUrl.trim().length ? s.clientId.trim().length ? s.clientSecret.trim().length ? null : "Client Secret is required" : "Client Id is required" : "End Point URL is required", [JSON.stringify(s)]), d = I(async () => {
|
|
1140
|
+
if (n) {
|
|
1141
|
+
t(
|
|
1142
|
+
j({
|
|
1143
|
+
isOpen: !0,
|
|
1144
|
+
type: "danger",
|
|
1145
|
+
message: `${n} (Please make sure your changes are saved)`
|
|
1146
|
+
})
|
|
1147
|
+
);
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
t(N(!0));
|
|
1151
|
+
try {
|
|
1152
|
+
const i = await et();
|
|
1153
|
+
t(
|
|
1154
|
+
j({
|
|
1155
|
+
isOpen: !0,
|
|
1156
|
+
type: "success",
|
|
1157
|
+
message: i.data?.message || "OpenApply sync job has been triggered in the background. Please wait a few moments before refreshing the page."
|
|
1158
|
+
})
|
|
1159
|
+
);
|
|
1160
|
+
} catch (i) {
|
|
1161
|
+
t(
|
|
1162
|
+
j({
|
|
1163
|
+
isOpen: !0,
|
|
1164
|
+
type: "danger",
|
|
1165
|
+
message: i.response?.data?.message || i.response?.data?.title || i.message
|
|
1166
|
+
})
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
t(N(!1));
|
|
1170
|
+
}, [n, t]);
|
|
1171
|
+
return H(() => {
|
|
1172
|
+
document.title = "Open Apply | Settings", a();
|
|
1173
|
+
}, []), {
|
|
1174
|
+
openApplyConfig: s,
|
|
1175
|
+
errorImportRest: n,
|
|
1176
|
+
updateData: h,
|
|
1177
|
+
restApiInfo: o,
|
|
1178
|
+
handleImportFromRestfulApi: d
|
|
1179
|
+
};
|
|
1180
|
+
}, Ot = () => {
|
|
1181
|
+
const {
|
|
1182
|
+
openApplyConfig: t,
|
|
1183
|
+
updateData: o,
|
|
1184
|
+
restApiInfo: s,
|
|
1185
|
+
handleImportFromRestfulApi: r
|
|
1186
|
+
} = bt(), { t: a } = J();
|
|
1187
|
+
return /* @__PURE__ */ e("div", { className: "fadeIn animated", children: /* @__PURE__ */ l(U, { children: [
|
|
1188
|
+
/* @__PURE__ */ e(m, { md: 7, children: /* @__PURE__ */ e(
|
|
1189
|
+
Ne,
|
|
1190
|
+
{
|
|
1191
|
+
veraCrossConfig: t,
|
|
1192
|
+
updateData: o,
|
|
1193
|
+
labelTime: "time_open_apply_sync_hh"
|
|
1194
|
+
}
|
|
1195
|
+
) }),
|
|
1196
|
+
/* @__PURE__ */ e(m, { md: 5 }),
|
|
1197
|
+
/* @__PURE__ */ e(m, { md: 7, children: /* @__PURE__ */ l(U, { children: [
|
|
1198
|
+
/* @__PURE__ */ e(m, { md: 12, children: /* @__PURE__ */ e("h5", { className: "mt-4", style: { fontWeight: 700 }, children: a("import_open_apply") }) }),
|
|
1199
|
+
/* @__PURE__ */ e(m, { md: 6 }),
|
|
1200
|
+
/* @__PURE__ */ l(m, { md: 6, children: [
|
|
1201
|
+
/* @__PURE__ */ e(
|
|
1202
|
+
z,
|
|
1203
|
+
{
|
|
1204
|
+
color: "primary",
|
|
1205
|
+
className: "w-100 mt-4 mb-1",
|
|
1206
|
+
onClick: r,
|
|
1207
|
+
children: a("import_from_restful_api")
|
|
1208
|
+
}
|
|
1209
|
+
),
|
|
1210
|
+
/* @__PURE__ */ e("div", { className: "mt-2", children: /* @__PURE__ */ e(
|
|
1211
|
+
ve,
|
|
1212
|
+
{
|
|
1213
|
+
restApiInfo: s,
|
|
1214
|
+
importInfo: ot
|
|
1215
|
+
}
|
|
1216
|
+
) })
|
|
1217
|
+
] })
|
|
1218
|
+
] }) })
|
|
1219
|
+
] }) });
|
|
1220
|
+
}, It = () => {
|
|
1221
|
+
const {
|
|
1222
|
+
rosterConfig: t,
|
|
1223
|
+
errorImportRest: o,
|
|
1224
|
+
updateData: s
|
|
1225
|
+
} = ye($.Clever);
|
|
1226
|
+
return /* @__PURE__ */ e("div", { className: "fadeIn animated", children: /* @__PURE__ */ l(U, { children: [
|
|
1227
|
+
/* @__PURE__ */ e(m, { md: 7, children: /* @__PURE__ */ e(
|
|
1228
|
+
ue,
|
|
1229
|
+
{
|
|
1230
|
+
rosterConfig: t,
|
|
1231
|
+
updateData: s,
|
|
1232
|
+
type: $.Clever
|
|
1233
|
+
}
|
|
1234
|
+
) }),
|
|
1235
|
+
/* @__PURE__ */ e(m, { md: 5 }),
|
|
1236
|
+
/* @__PURE__ */ e(m, { md: 7, children: /* @__PURE__ */ e(
|
|
1237
|
+
Ce,
|
|
1238
|
+
{
|
|
1239
|
+
errorImportRest: o,
|
|
1240
|
+
type: $.Clever
|
|
1241
|
+
}
|
|
1242
|
+
) })
|
|
1243
|
+
] }) });
|
|
1244
|
+
}, Rt = [
|
|
1245
|
+
{
|
|
1246
|
+
path: "/admin/one-rosters/settings-classlink",
|
|
1247
|
+
title: "one_roster_setting",
|
|
1248
|
+
component: dt
|
|
1249
|
+
},
|
|
1250
|
+
{
|
|
1251
|
+
path: "/admin/one-rosters/settings-clever",
|
|
1252
|
+
title: "clever_setting",
|
|
1253
|
+
component: It
|
|
1254
|
+
},
|
|
1255
|
+
{
|
|
1256
|
+
path: "/admin/one-rosters/veracross-settings",
|
|
1257
|
+
title: "veracross_setting",
|
|
1258
|
+
component: _t
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
path: "/admin/one-rosters/open-apply",
|
|
1262
|
+
title: "open_apply_setting",
|
|
1263
|
+
component: Ot
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
path: "/admin/one-rosters/users",
|
|
1267
|
+
title: "users",
|
|
1268
|
+
component: yt
|
|
1269
|
+
}
|
|
1270
|
+
], At = "one_roster", Mt = () => {
|
|
1271
|
+
const { t } = J();
|
|
1272
|
+
return /* @__PURE__ */ e(Re, { title: t(At), tabs: Rt.map((o) => ({ ...o, title: t(o.title) })) });
|
|
1273
|
+
};
|
|
1274
|
+
export {
|
|
1275
|
+
Mt as default
|
|
1276
|
+
};
|