mario-education 2.0.217-staging → 2.0.218-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.
- package/dist/CreateSurveyAdminV2-DPvUhnY7.js +2835 -0
- package/dist/CreateSurveyAdminV2-Dyu5kfoG.cjs +1 -0
- package/dist/DropDownComponent-D7BjrL6t.cjs +1 -0
- package/dist/DropDownComponent-qvsmWtVb.js +755 -0
- package/dist/InterventionDialog-B08VqsVc.js +871 -0
- package/dist/InterventionDialog-CrsuMlP5.cjs +22 -0
- package/dist/PreviewSurveyAdmin-CX-NQSmo.js +906 -0
- package/dist/PreviewSurveyAdmin-xQW0cuAb.cjs +27 -0
- package/dist/SurveyIndexAdmin-CURcO-Up.js +304 -0
- package/dist/SurveyIndexAdmin-lBTeVTpn.cjs +1 -0
- package/dist/SurveyResultAdmin-BCarl4xj.js +163 -0
- package/dist/SurveyResultAdmin-BT4AF1I8.cjs +1 -0
- package/dist/components/QuestionTypes/EmotionComponent.d.ts +1 -1
- package/dist/constant-CPGwX7qv.cjs +2 -0
- package/dist/constant-CrMQa9rf.js +768 -0
- package/dist/index.js +1 -1
- package/dist/index.modern.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,2835 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e, Fragment as Re } from "react/jsx-runtime";
|
|
2
|
+
import { useState as M, useCallback as We, useEffect as se, useMemo as Y, useRef as De } from "react";
|
|
3
|
+
import { Box as i, Button as G, Stack as $, Typography as b, Chip as ae, Grid as Pe, TableContainer as yt, Table as Te, TableHead as Ne, TableRow as j, TableCell as B, TableBody as ve, Dialog as He, DialogTitle as Qe, DialogContent as Oe, DialogContentText as bt, DialogActions as St, TextField as J, FormControl as we, Select as xe, MenuItem as Fe, InputAdornment as Tt, Autocomplete as Nt, Checkbox as ze, TableSortLabel as me, TablePagination as vt, Tooltip as Me, tooltipClasses as Ie, styled as wt, IconButton as xt, Avatar as Ft } from "@mui/material";
|
|
4
|
+
import { useDispatch as Ye, useSelector as Ge } from "react-redux";
|
|
5
|
+
import { useNavigate as $e } from "react-router-dom";
|
|
6
|
+
import ke from "moment";
|
|
7
|
+
import { setLoading as le, setAlert as he, getFileUrl as It, getStaticFileUrl as At } from "mario-core";
|
|
8
|
+
import { q as Bt, s as Lt, r as Rt } from "./surveyService-CaYOE76V.js";
|
|
9
|
+
import { e as Et } from "./questionCategoryService-Cy4o2SXv.js";
|
|
10
|
+
import { A as Ue } from "./ArrowBack-DytrysgX.js";
|
|
11
|
+
import { C as Ve } from "./Check-D8k_l7WO.js";
|
|
12
|
+
import { A as Ke } from "./ArrowForward-DxhjtaZw.js";
|
|
13
|
+
import { d as Ae, b as Dt } from "./createSvgIcon-Bge4D-o7.js";
|
|
14
|
+
import { A as je } from "./Add-6ex8DhwL.js";
|
|
15
|
+
import { LocalizationProvider as kt, DateTimePicker as Pt } from "@mui/x-date-pickers";
|
|
16
|
+
import { A as zt } from "./AdapterMoment-CeMS9jLD.js";
|
|
17
|
+
import { S as qt } from "./Search-srkT1jtT.js";
|
|
18
|
+
import { C as Wt } from "./Close-Z8xNZb_y.js";
|
|
19
|
+
import { a as Ht, M as Qt, S as Ot, E as Mt, D as Yt } from "./DropDownComponent-qvsmWtVb.js";
|
|
20
|
+
const be = [
|
|
21
|
+
{ stepNumber: 1, stepCode: "CHOOSE_TEMPLATE", label: "Choose Template" },
|
|
22
|
+
{ stepNumber: 2, stepCode: "CHECK_DETAILS", label: "Check Details" },
|
|
23
|
+
{ stepNumber: 3, stepCode: "CREATE_SURVEY", label: "Create Survey" },
|
|
24
|
+
{ stepNumber: 4, stepCode: "SELECT_STUDENTS", label: "Select Students" },
|
|
25
|
+
{ stepNumber: 5, stepCode: "REVIEW_PUBLISH", label: "Review & Publish" }
|
|
26
|
+
], Gt = [
|
|
27
|
+
"All",
|
|
28
|
+
"School Climate",
|
|
29
|
+
"Well-being",
|
|
30
|
+
"Health & Wellness"
|
|
31
|
+
], $t = [
|
|
32
|
+
{
|
|
33
|
+
id: 1,
|
|
34
|
+
title: "Stress",
|
|
35
|
+
description: "Assess stress levels and identify stressors affecting students",
|
|
36
|
+
questionCount: 13,
|
|
37
|
+
category: "Well-being"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 2,
|
|
41
|
+
title: "Grows",
|
|
42
|
+
description: "Measure student growth mindset and learning attitudes",
|
|
43
|
+
questionCount: 6,
|
|
44
|
+
category: "School Climate"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 3,
|
|
48
|
+
title: "Climate Survey",
|
|
49
|
+
description: "Evaluate overall school climate and student experiences",
|
|
50
|
+
questionCount: 9,
|
|
51
|
+
category: "School Climate"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 4,
|
|
55
|
+
title: "Happiness",
|
|
56
|
+
description: "Track student happiness and emotional well-being",
|
|
57
|
+
questionCount: 8,
|
|
58
|
+
category: "Well-being"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 5,
|
|
62
|
+
title: "Climate Survey: Connections with Adults & Peers",
|
|
63
|
+
description: "Assess the quality of relationships with adults and peers in school",
|
|
64
|
+
questionCount: 14,
|
|
65
|
+
category: "School Climate"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 6,
|
|
69
|
+
title: "Climate Survey: Holistic Learning Experiences",
|
|
70
|
+
description: "Evaluate overall school climate and student experiences",
|
|
71
|
+
questionCount: 18,
|
|
72
|
+
category: "Well-being"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 7,
|
|
76
|
+
title: "Climate Survey: My Health and Well-being",
|
|
77
|
+
description: "Monitor student physical and mental health and wellness",
|
|
78
|
+
questionCount: 21,
|
|
79
|
+
category: "Health & Wellness"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 8,
|
|
83
|
+
title: "Well-being",
|
|
84
|
+
description: "General assessment of student wellness and quality of life",
|
|
85
|
+
questionCount: 10,
|
|
86
|
+
category: "Well-being"
|
|
87
|
+
}
|
|
88
|
+
], Ut = (a) => {
|
|
89
|
+
const s = Ye(), u = $e(), C = Ge((m) => m?.common?.language || "en"), [l, r] = M(a?.activeStep ?? 0), [h, f] = M(a?.selectedCategory ?? "All"), [d, S] = M(a?.selectedTemplateId ?? null), [c, _] = M($t), [y, w] = M(!1), [E, k] = M(a?.editingTemplate ?? null), v = We(async () => {
|
|
90
|
+
try {
|
|
91
|
+
w(!0), s(le(!0));
|
|
92
|
+
const m = await Bt(C);
|
|
93
|
+
if (m?.data && Array.isArray(m.data) && m.data.length > 0) {
|
|
94
|
+
const I = m.data.map((o) => {
|
|
95
|
+
let x = "Well-being";
|
|
96
|
+
const A = (o.name || "").toLowerCase();
|
|
97
|
+
A.includes("climate") || A.includes("grow") ? x = "School Climate" : A.includes("health") && (x = "Health & Wellness");
|
|
98
|
+
const Q = /* @__PURE__ */ new Set();
|
|
99
|
+
o.questionTemplates && Array.isArray(o.questionTemplates) && o.questionTemplates.forEach((P) => {
|
|
100
|
+
const K = P.category ?? P.categoryName ?? P.categoryTitle ?? P.title ?? x;
|
|
101
|
+
K && typeof K == "string" && Q.add(K.trim());
|
|
102
|
+
});
|
|
103
|
+
const p = Array.from(Q);
|
|
104
|
+
return {
|
|
105
|
+
id: o.id,
|
|
106
|
+
title: o.name,
|
|
107
|
+
description: o.description,
|
|
108
|
+
questionCount: o.numberQuestion ?? o.questionTemplates?.length ?? 0,
|
|
109
|
+
category: x,
|
|
110
|
+
categories: p.length > 0 ? p : [x],
|
|
111
|
+
rawTemplate: o
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
_(I), a?.selectedTemplateId || S((o) => o || (I.length > 0 ? I[0].id : null));
|
|
115
|
+
}
|
|
116
|
+
} catch (m) {
|
|
117
|
+
console.error("Error fetching survey templates:", m), s(
|
|
118
|
+
he({
|
|
119
|
+
type: "danger",
|
|
120
|
+
message: m?.message || "Failed to fetch survey templates"
|
|
121
|
+
})
|
|
122
|
+
);
|
|
123
|
+
} finally {
|
|
124
|
+
w(!1), s(le(!1));
|
|
125
|
+
}
|
|
126
|
+
}, [C, s]);
|
|
127
|
+
se(() => {
|
|
128
|
+
v();
|
|
129
|
+
}, [v]);
|
|
130
|
+
const D = Y(() => {
|
|
131
|
+
const m = /* @__PURE__ */ new Set();
|
|
132
|
+
return c.forEach((I) => {
|
|
133
|
+
I.categories && Array.isArray(I.categories) ? I.categories.forEach((o) => m.add(o)) : I.category && m.add(I.category);
|
|
134
|
+
}), m.size === 0 ? Gt : ["All", ...Array.from(m)];
|
|
135
|
+
}, [c]), F = Y(() => h === "All" ? c : c.filter((m) => m.categories && Array.isArray(m.categories) ? m.categories.some((I) => I.toLowerCase() === h.toLowerCase()) : m.category?.toLowerCase() === h.toLowerCase()), [c, h]), g = Y(() => c.find((m) => m.id === d) || null, [c, d]), R = (m) => {
|
|
136
|
+
f(m);
|
|
137
|
+
}, W = (m) => {
|
|
138
|
+
S(m);
|
|
139
|
+
}, H = () => {
|
|
140
|
+
S("BLANK"), r((m) => Math.min(m + 1, be.length - 1));
|
|
141
|
+
}, Z = (m, I) => {
|
|
142
|
+
I.stopPropagation(), k(m), S(m.id);
|
|
143
|
+
}, V = () => {
|
|
144
|
+
k(null);
|
|
145
|
+
}, ee = async (m) => {
|
|
146
|
+
try {
|
|
147
|
+
s(le(!0));
|
|
148
|
+
const I = m.rawTemplate?.questionTemplates?.map((A) => A.questionId || A.id)?.filter((A) => typeof A == "number" || !String(A).startsWith("q-"))?.map((A) => Number(A)) || [], o = {
|
|
149
|
+
id: m.id,
|
|
150
|
+
name: m.title,
|
|
151
|
+
description: m.description,
|
|
152
|
+
isFavorite: m.rawTemplate?.isFavorite ?? !1,
|
|
153
|
+
questionIds: I
|
|
154
|
+
};
|
|
155
|
+
await Et(o), _(
|
|
156
|
+
(A) => A.map((Q) => Q.id === m.id ? m : Q)
|
|
157
|
+
), k(null);
|
|
158
|
+
const x = localStorage.getItem("create_survey_draft");
|
|
159
|
+
if (x)
|
|
160
|
+
try {
|
|
161
|
+
const A = JSON.parse(x);
|
|
162
|
+
A.editingTemplateFormData && (delete A.editingTemplateFormData, localStorage.setItem("create_survey_draft", JSON.stringify(A)));
|
|
163
|
+
} catch {
|
|
164
|
+
}
|
|
165
|
+
await v(), s(he({ type: "success", message: "Update template successfully" }));
|
|
166
|
+
} catch (I) {
|
|
167
|
+
s(he({ type: "danger", message: I.response?.data?.title || "Update template failed" }));
|
|
168
|
+
} finally {
|
|
169
|
+
s(le(!1));
|
|
170
|
+
}
|
|
171
|
+
}, X = () => {
|
|
172
|
+
u("/admin/survey-dashboard/list-survey");
|
|
173
|
+
};
|
|
174
|
+
return {
|
|
175
|
+
steps: be,
|
|
176
|
+
activeStep: l,
|
|
177
|
+
categories: D,
|
|
178
|
+
selectedCategory: h,
|
|
179
|
+
selectedTemplateId: d,
|
|
180
|
+
selectedTemplate: g,
|
|
181
|
+
templates: F,
|
|
182
|
+
rawTemplates: c,
|
|
183
|
+
isLoading: y,
|
|
184
|
+
editingTemplate: E,
|
|
185
|
+
handleSelectCategory: R,
|
|
186
|
+
handleSelectTemplate: W,
|
|
187
|
+
handleCreateBlankSurvey: H,
|
|
188
|
+
handleEditTemplate: Z,
|
|
189
|
+
handleCloseEditTemplate: V,
|
|
190
|
+
handleSaveEditTemplate: ee,
|
|
191
|
+
handleGoBackToDashboard: X,
|
|
192
|
+
handlePreviousStep: () => {
|
|
193
|
+
l > 0 ? r((m) => m - 1) : X();
|
|
194
|
+
},
|
|
195
|
+
handleNextStep: () => {
|
|
196
|
+
l < be.length - 1 && r((m) => m + 1);
|
|
197
|
+
},
|
|
198
|
+
handleGoToStep: (m) => {
|
|
199
|
+
m >= 0 && m < be.length && r(m);
|
|
200
|
+
},
|
|
201
|
+
refetchTemplates: v
|
|
202
|
+
};
|
|
203
|
+
}, Se = (a, s) => !a || !Array.isArray(a) || a.length === 0 ? [] : a.map((u, C) => {
|
|
204
|
+
let l = [];
|
|
205
|
+
return Array.isArray(u.options) && u.options.length > 0 ? l = u.options.map((r) => typeof r == "string" ? r : r?.text ?? r?.answerText ?? r?.name ?? r?.title ?? String(r)).filter((r) => !!(r && r.trim())) : Array.isArray(u.answers) && u.answers.length > 0 && (l = u.answers.map((r) => typeof r == "string" ? r : r?.text ?? r?.answerText ?? r?.name ?? r?.title ?? String(r)).filter((r) => !!(r && r.trim()))), {
|
|
206
|
+
id: u.questionId ?? u.id ?? `q-${C + 1}`,
|
|
207
|
+
orderNumber: u.orderDefaultQuestionTemplate ?? u.orderNumber ?? C + 1,
|
|
208
|
+
questionText: u.questionText ?? u.text ?? `Question ${C + 1}`,
|
|
209
|
+
type: String(u.type || "Text"),
|
|
210
|
+
category: u.category ?? u.categoryName ?? u.categoryTitle ?? u.title ?? s ?? "General",
|
|
211
|
+
options: l,
|
|
212
|
+
numberOfStars: u.numberOfStars ?? 5,
|
|
213
|
+
fromLabel: u.fromLabel,
|
|
214
|
+
toLabel: u.toLabel
|
|
215
|
+
};
|
|
216
|
+
}), Ee = [
|
|
217
|
+
{
|
|
218
|
+
id: "q-1",
|
|
219
|
+
orderNumber: 1,
|
|
220
|
+
questionText: "How would you rate your overall well-being?",
|
|
221
|
+
type: "Rating",
|
|
222
|
+
category: "Overall Well-being"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
id: "q-2",
|
|
226
|
+
orderNumber: 2,
|
|
227
|
+
questionText: "Do you feel balanced in your daily life?",
|
|
228
|
+
type: "YesNo",
|
|
229
|
+
category: "Life Balance"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: "q-3",
|
|
233
|
+
orderNumber: 3,
|
|
234
|
+
questionText: "What contributes most to your well-being?",
|
|
235
|
+
type: "Text",
|
|
236
|
+
category: "Well-being Factors"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
id: "q-4",
|
|
240
|
+
orderNumber: 4,
|
|
241
|
+
questionText: "How satisfied are you with your life?",
|
|
242
|
+
type: "Rating",
|
|
243
|
+
category: "Life Satisfaction"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: "q-5",
|
|
247
|
+
orderNumber: 5,
|
|
248
|
+
questionText: "Do you have people who support you?",
|
|
249
|
+
type: "YesNo",
|
|
250
|
+
category: "Social Support"
|
|
251
|
+
}
|
|
252
|
+
], Vt = (a, s, u) => {
|
|
253
|
+
const C = Y(() => s?.rawTemplate ? Se(s.rawTemplate.questionTemplates, s?.category || "Well-being") : Ee, [s]), [l, r] = M(() => u?.step2FormData ? u.step2FormData : a === "BLANK" ? {
|
|
254
|
+
templateName: "",
|
|
255
|
+
description: "",
|
|
256
|
+
showLandingPageFlag: !1,
|
|
257
|
+
questions: [],
|
|
258
|
+
selectedCategoryFilter: "All"
|
|
259
|
+
} : {
|
|
260
|
+
templateName: s?.title || "Well-being",
|
|
261
|
+
description: s?.description || "General assessment of student wellness and quality of life",
|
|
262
|
+
showLandingPageFlag: !1,
|
|
263
|
+
questions: C,
|
|
264
|
+
selectedCategoryFilter: "All"
|
|
265
|
+
}), h = De(u?.selectedTemplateId ?? (a === "BLANK" ? "BLANK" : s ? s.id : null));
|
|
266
|
+
se(() => {
|
|
267
|
+
if (s) {
|
|
268
|
+
if (h.current === s.id)
|
|
269
|
+
return;
|
|
270
|
+
h.current = s.id;
|
|
271
|
+
const v = s.rawTemplate ? Se(s.rawTemplate.questionTemplates, s.category || "Well-being") : Ee;
|
|
272
|
+
r((D) => ({
|
|
273
|
+
...D,
|
|
274
|
+
templateName: s.title || "",
|
|
275
|
+
description: s.description || "",
|
|
276
|
+
questions: v,
|
|
277
|
+
selectedCategoryFilter: "All"
|
|
278
|
+
}));
|
|
279
|
+
} else if (a === "BLANK") {
|
|
280
|
+
if (h.current === "BLANK") return;
|
|
281
|
+
h.current = "BLANK", r((v) => ({
|
|
282
|
+
...v,
|
|
283
|
+
templateName: "",
|
|
284
|
+
description: "",
|
|
285
|
+
questions: [],
|
|
286
|
+
selectedCategoryFilter: "All"
|
|
287
|
+
}));
|
|
288
|
+
}
|
|
289
|
+
}, [s, a]);
|
|
290
|
+
const f = Y(() => {
|
|
291
|
+
const v = /* @__PURE__ */ new Set();
|
|
292
|
+
l.questions.forEach((F) => {
|
|
293
|
+
const g = F.category?.trim();
|
|
294
|
+
g && v.add(g);
|
|
295
|
+
});
|
|
296
|
+
const D = Array.from(v);
|
|
297
|
+
return D.length > 0 ? ["All", ...D] : ["All"];
|
|
298
|
+
}, [l.questions]), d = Y(() => l.selectedCategoryFilter === "All" ? l.questions : l.questions.filter(
|
|
299
|
+
(v) => v.category === l.selectedCategoryFilter
|
|
300
|
+
), [l.questions, l.selectedCategoryFilter]), S = (v) => {
|
|
301
|
+
r((D) => ({ ...D, templateName: v }));
|
|
302
|
+
}, c = (v) => {
|
|
303
|
+
r((D) => ({ ...D, description: v }));
|
|
304
|
+
}, _ = (v) => {
|
|
305
|
+
r((D) => ({ ...D, selectedCategoryFilter: v }));
|
|
306
|
+
}, y = (v) => {
|
|
307
|
+
console.log("Edit question:", v);
|
|
308
|
+
}, w = (v) => {
|
|
309
|
+
r((D) => ({
|
|
310
|
+
...D,
|
|
311
|
+
questions: D.questions.filter((F) => F.id !== v).map((F, g) => ({ ...F, orderNumber: g + 1 }))
|
|
312
|
+
}));
|
|
313
|
+
}, E = () => {
|
|
314
|
+
const v = `q-${Date.now()}`, D = l.questions.length + 1, F = {
|
|
315
|
+
id: v,
|
|
316
|
+
orderNumber: D,
|
|
317
|
+
questionText: "New Question",
|
|
318
|
+
type: "Rating",
|
|
319
|
+
category: "General"
|
|
320
|
+
};
|
|
321
|
+
r((g) => ({
|
|
322
|
+
...g,
|
|
323
|
+
questions: [...g.questions, F]
|
|
324
|
+
}));
|
|
325
|
+
}, k = (v) => {
|
|
326
|
+
const D = v.rawTemplate ? Se(v.rawTemplate.questionTemplates, v.category || "Well-being") : Ee;
|
|
327
|
+
r({
|
|
328
|
+
templateName: v.title || "",
|
|
329
|
+
description: v.description || "",
|
|
330
|
+
showLandingPageFlag: !1,
|
|
331
|
+
questions: D,
|
|
332
|
+
selectedCategoryFilter: "All"
|
|
333
|
+
}), h.current = v.id;
|
|
334
|
+
};
|
|
335
|
+
return {
|
|
336
|
+
formData: l,
|
|
337
|
+
questionCategories: f,
|
|
338
|
+
filteredQuestions: d,
|
|
339
|
+
totalQuestionsCount: l.questions.length,
|
|
340
|
+
handleTemplateNameChange: S,
|
|
341
|
+
handleDescriptionChange: c,
|
|
342
|
+
handleCategoryFilterChange: _,
|
|
343
|
+
handleEditQuestion: y,
|
|
344
|
+
handleRemoveQuestion: w,
|
|
345
|
+
handleAddQuestion: E,
|
|
346
|
+
resetFormDataWithTemplate: k
|
|
347
|
+
};
|
|
348
|
+
}, Kt = (a, {
|
|
349
|
+
initialTitle: s = "",
|
|
350
|
+
initialDeadline: u = ke().add(1, "days").format("DD.MM.YYYY hh:mm A")
|
|
351
|
+
} = {}) => {
|
|
352
|
+
const [C, l] = M(() => a?.step3FormData ? a.step3FormData : {
|
|
353
|
+
title: s || "",
|
|
354
|
+
deadline: u || ""
|
|
355
|
+
});
|
|
356
|
+
return {
|
|
357
|
+
formData: C,
|
|
358
|
+
handleTitleChange: (f) => {
|
|
359
|
+
l((d) => ({ ...d, title: f }));
|
|
360
|
+
},
|
|
361
|
+
handleDeadlineChange: (f) => {
|
|
362
|
+
l((d) => ({ ...d, deadline: f }));
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
}, jt = At("/images/image-default.png"), Jt = [
|
|
366
|
+
{ label: "All Flags", value: "all" },
|
|
367
|
+
{ label: "Red Flag", value: "red" },
|
|
368
|
+
{ label: "Yellow Flag", value: "yellow" },
|
|
369
|
+
{ label: "Green Flag", value: "green" }
|
|
370
|
+
], Zt = (a) => {
|
|
371
|
+
const [s, u] = M([]), [C, l] = M(a?.selectedStudentIds ?? []), [r, h] = M([]), [f, d] = M(Jt), [S, c] = M(["All Teachers"]), [_, y] = M({
|
|
372
|
+
searchQuery: "",
|
|
373
|
+
selectedGrade: "All Grades",
|
|
374
|
+
selectedFlag: "all",
|
|
375
|
+
selectedTeacher: "All Teachers",
|
|
376
|
+
page: 0,
|
|
377
|
+
rowsPerPage: 10,
|
|
378
|
+
sortBy: "name",
|
|
379
|
+
sortOrder: "asc"
|
|
380
|
+
}), w = We(async () => {
|
|
381
|
+
try {
|
|
382
|
+
const T = await Lt({
|
|
383
|
+
roles: ["Admin"]
|
|
384
|
+
});
|
|
385
|
+
if (T?.data?.items && Array.isArray(T.data.items) && T.data.items.length > 0) {
|
|
386
|
+
const N = T.data.items.map((p) => {
|
|
387
|
+
let P = "none";
|
|
388
|
+
if (typeof p.flag == "string") {
|
|
389
|
+
const oe = p.flag.toLowerCase();
|
|
390
|
+
oe.includes("red") ? P = "red" : oe.includes("yellow") ? P = "yellow" : oe.includes("green") && (P = "green");
|
|
391
|
+
} else
|
|
392
|
+
p.redFlags > 0 || p.flag === 1 ? P = "red" : p.yellowFlags > 0 || p.flag === 2 ? P = "yellow" : (p.greenFlags > 0 || p.flag === 3) && (P = "green");
|
|
393
|
+
const K = p.fullName || p.studentName, te = p.gradeLevel, ne = p.email, _e = p.userId || (typeof p.id == "string" ? p.id : ""), ie = typeof p.studentId == "number" ? p.studentId : typeof p.id == "number" ? p.id : void 0, Be = _e || (ie !== void 0 ? String(ie) : `student-${Math.random()}`), Le = (p.schoolLevel || (p.userId && p.id === void 0 ? "ES" : "MS")).toUpperCase();
|
|
394
|
+
return {
|
|
395
|
+
id: Be,
|
|
396
|
+
userId: _e,
|
|
397
|
+
studentId: ie,
|
|
398
|
+
schoolLevel: Le,
|
|
399
|
+
name: K,
|
|
400
|
+
avatarUrl: p.profileImageFileName ? It(p.profileImageFileName) : jt,
|
|
401
|
+
flag: P,
|
|
402
|
+
flagTooltip: p.flagTooltip || void 0,
|
|
403
|
+
flagDetail: p.flagDetail,
|
|
404
|
+
lastSafetyAnswer: p.lastSafetyAnswer,
|
|
405
|
+
lastStressAnswer: p.lastStressAnswer,
|
|
406
|
+
flagSessionId: p.flagSessionId,
|
|
407
|
+
flagSessionResultId: p.flagSessionResultId,
|
|
408
|
+
grade: te,
|
|
409
|
+
email: ne,
|
|
410
|
+
listTeachers: p.listTeachers || []
|
|
411
|
+
};
|
|
412
|
+
});
|
|
413
|
+
u(N);
|
|
414
|
+
const m = Array.from(new Set(N.map((p) => p.grade))).filter((p) => p && p !== "N/A"), I = (p) => {
|
|
415
|
+
if (!p || p === "N/A") return -999;
|
|
416
|
+
const P = p.toString().toUpperCase().replace(/TH|RD|ND|ST/g, "").trim();
|
|
417
|
+
if (P === "PK") return -2;
|
|
418
|
+
if (P === "K") return -1;
|
|
419
|
+
if (P === "G") return 0;
|
|
420
|
+
const K = P.match(/^(\d+)/);
|
|
421
|
+
return K ? parseInt(K[1], 10) : 999;
|
|
422
|
+
};
|
|
423
|
+
m.sort((p, P) => I(p) - I(P)), h(["All Grades", ...m]);
|
|
424
|
+
const o = Array.from(new Set(N.map((p) => p.flag))), x = [{ label: "All Flags", value: "all" }];
|
|
425
|
+
o.includes("red") && x.push({ label: "Red Flag", value: "red" }), o.includes("yellow") && x.push({ label: "Yellow Flag", value: "yellow" }), o.includes("green") && x.push({ label: "Green Flag", value: "green" }), d(x);
|
|
426
|
+
const A = /* @__PURE__ */ new Set();
|
|
427
|
+
N.forEach((p) => {
|
|
428
|
+
p.listTeachers && p.listTeachers.length > 0 && p.listTeachers.forEach((P) => {
|
|
429
|
+
P.name && A.add(P.name.trim());
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
const Q = Array.from(A).sort((p, P) => p.localeCompare(P));
|
|
433
|
+
c(["All Teachers", ...Q]);
|
|
434
|
+
}
|
|
435
|
+
} catch (T) {
|
|
436
|
+
console.error("Error fetching students list:", T);
|
|
437
|
+
}
|
|
438
|
+
}, []);
|
|
439
|
+
se(() => {
|
|
440
|
+
w();
|
|
441
|
+
}, [w]);
|
|
442
|
+
const E = (T) => {
|
|
443
|
+
y((N) => ({ ...N, searchQuery: T, page: 0 }));
|
|
444
|
+
}, k = (T) => {
|
|
445
|
+
y((N) => ({ ...N, selectedGrade: T, page: 0 }));
|
|
446
|
+
}, v = (T) => {
|
|
447
|
+
y((N) => ({ ...N, selectedFlag: T, page: 0 }));
|
|
448
|
+
}, D = (T) => {
|
|
449
|
+
y((N) => ({ ...N, selectedTeacher: T, page: 0 }));
|
|
450
|
+
}, F = (T, N) => {
|
|
451
|
+
y((m) => ({ ...m, page: N }));
|
|
452
|
+
}, g = (T) => {
|
|
453
|
+
y((N) => ({ ...N, rowsPerPage: parseInt(T.target.value, 10), page: 0 }));
|
|
454
|
+
}, R = Y(() => s.filter((T) => {
|
|
455
|
+
if (_.searchQuery.trim()) {
|
|
456
|
+
const N = (x) => (x || "").normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), m = N(_.searchQuery.trim()), I = N(T.name).includes(m), o = N(T.email).includes(m);
|
|
457
|
+
if (!I && !o) return !1;
|
|
458
|
+
}
|
|
459
|
+
return !(_.selectedGrade !== "All Grades" && (T.grade || "").toLowerCase() !== (_.selectedGrade || "").toLowerCase() || _.selectedFlag !== "all" && T.flag !== _.selectedFlag || _.selectedTeacher && _.selectedTeacher !== "All Teachers" && (!T.listTeachers || T.listTeachers.length === 0 || !T.listTeachers.some((m) => m.name && m.name.trim() === _.selectedTeacher)));
|
|
460
|
+
}), [s, _]), W = (T) => {
|
|
461
|
+
y((N) => ({
|
|
462
|
+
...N,
|
|
463
|
+
sortBy: T,
|
|
464
|
+
sortOrder: N.sortBy === T && N.sortOrder === "asc" ? "desc" : "asc"
|
|
465
|
+
}));
|
|
466
|
+
}, H = Y(() => [...R].sort((N, m) => {
|
|
467
|
+
let I = N[_.sortBy], o = m[_.sortBy];
|
|
468
|
+
if (_.sortBy === "flag") {
|
|
469
|
+
const x = { red: 3, yellow: 2, green: 1, none: 0 };
|
|
470
|
+
I = x[N.flag] || 0, o = x[m.flag] || 0;
|
|
471
|
+
} else if (_.sortBy === "grade") {
|
|
472
|
+
const x = (A) => {
|
|
473
|
+
if (!A || A === "N/A") return -999;
|
|
474
|
+
const Q = A.toString().toUpperCase().replace(/TH|RD|ND|ST/g, "").trim();
|
|
475
|
+
if (Q === "PK") return -2;
|
|
476
|
+
if (Q === "K") return -1;
|
|
477
|
+
if (Q === "G") return 0;
|
|
478
|
+
const p = Q.match(/^(\d+)/);
|
|
479
|
+
return p ? parseInt(p[1], 10) : 999;
|
|
480
|
+
};
|
|
481
|
+
I = x(N.grade), o = x(m.grade);
|
|
482
|
+
} else _.sortBy === "teacher" ? (I = N.listTeachers && N.listTeachers.length > 0 ? N.listTeachers.map((x) => x.name).join(", ").toLowerCase() : "", o = m.listTeachers && m.listTeachers.length > 0 ? m.listTeachers.map((x) => x.name).join(", ").toLowerCase() : "") : typeof I == "string" && typeof o == "string" && (I = I.toLowerCase(), o = o.toLowerCase());
|
|
483
|
+
return I < o ? _.sortOrder === "asc" ? -1 : 1 : I > o ? _.sortOrder === "asc" ? 1 : -1 : 0;
|
|
484
|
+
}), [R, _.sortBy, _.sortOrder]), Z = Y(() => {
|
|
485
|
+
const T = _.page * _.rowsPerPage;
|
|
486
|
+
return H.slice(T, T + _.rowsPerPage);
|
|
487
|
+
}, [H, _.page, _.rowsPerPage]), V = Y(() => R.length === 0 ? !1 : R.every((T) => C.includes(T.id)), [R, C]), ee = Y(() => {
|
|
488
|
+
if (R.length === 0) return !1;
|
|
489
|
+
const T = R.filter((N) => C.includes(N.id));
|
|
490
|
+
return T.length > 0 && T.length < R.length;
|
|
491
|
+
}, [R, C]), X = () => {
|
|
492
|
+
if (V) {
|
|
493
|
+
const T = R.map((N) => N.id);
|
|
494
|
+
l((N) => N.filter((m) => !T.includes(m)));
|
|
495
|
+
} else {
|
|
496
|
+
const T = /* @__PURE__ */ new Set([...C, ...R.map((N) => N.id)]);
|
|
497
|
+
l(Array.from(T));
|
|
498
|
+
}
|
|
499
|
+
}, re = (T) => {
|
|
500
|
+
l((N) => N.includes(T) ? N.filter((m) => m !== T) : [...N, T]);
|
|
501
|
+
};
|
|
502
|
+
return {
|
|
503
|
+
students: Z,
|
|
504
|
+
allFilteredStudents: R,
|
|
505
|
+
allStudents: s,
|
|
506
|
+
totalStudentsCount: R.length,
|
|
507
|
+
totalSelectedCount: C.length,
|
|
508
|
+
selectedStudentIds: C,
|
|
509
|
+
filters: _,
|
|
510
|
+
gradeOptions: r,
|
|
511
|
+
flagOptions: f,
|
|
512
|
+
teacherOptions: S,
|
|
513
|
+
isAllSelected: V,
|
|
514
|
+
isIndeterminate: ee,
|
|
515
|
+
handleSortChange: W,
|
|
516
|
+
handleSearchChange: E,
|
|
517
|
+
handleGradeFilterChange: k,
|
|
518
|
+
handleFlagFilterChange: v,
|
|
519
|
+
handleTeacherFilterChange: D,
|
|
520
|
+
handlePageChange: F,
|
|
521
|
+
handleRowsPerPageChange: g,
|
|
522
|
+
handleToggleSelectAll: X,
|
|
523
|
+
handleToggleStudent: re
|
|
524
|
+
};
|
|
525
|
+
}, Xt = "_createSurveyPage_16fff_1", en = "_headerTopBar_16fff_16", tn = "_contentBody_16fff_28", nn = "_stepperContainer_16fff_39", an = "_backButton_16fff_44", sn = "_stepperProgress_16fff_58", rn = "_stepColumn_16fff_66", ln = "_stepColumnLast_16fff_72", on = "_stepCircleRow_16fff_77", cn = "_stepCircle_16fff_77", dn = "_active_16fff_96", un = "_completed_16fff_100", mn = "_stepConnectorLine_16fff_105", hn = "_stepLabelStack_16fff_115", fn = "_stepInnerDot_16fff_119", pn = "_stepNumberLabel_16fff_133", gn = "_stepTextLabel_16fff_145", _n = "_chooseTemplateCard_16fff_157", Cn = "_headerSection_16fff_173", yn = "_headerTitle_16fff_177", bn = "_headerSubtitle_16fff_192", Sn = "_bannerContainer_16fff_199", Tn = "_bannerIconBox_16fff_219", Nn = "_bannerTitle_16fff_228", vn = "_bannerSubtitle_16fff_235", wn = "_bannerActionBtn_16fff_240", xn = "_sectionTitle_16fff_258", Fn = "_filterPillsContainer_16fff_266", In = "_filterPill_16fff_266", An = "_templateCard_16fff_301", Bn = "_selected_16fff_319", Ln = "_templateCardTitle_16fff_324", Rn = "_templateEditBtn_16fff_332", En = "_templateDescription_16fff_346", Dn = "_chipItem_16fff_353", kn = "_wizardFooter_16fff_367", Pn = "_previousBtn_16fff_387", zn = "_disabled_16fff_409", qn = "_stepCounterText_16fff_427", Wn = "_nextBtn_16fff_433", Hn = "_editTemplateHeaderSection_16fff_453", Qn = "_editTemplateCancelBtn_16fff_460", On = "_editTemplateSaveBtn_16fff_472", Mn = "_formFieldBlock_16fff_514", Yn = "_formFieldLabel_16fff_520", Gn = "_requiredAsterisk_16fff_528", $n = "_customTextField_16fff_532", Un = "_formFieldHelperText_16fff_549", Vn = "_questionsHeaderSection_16fff_577", Kn = "_questionsTitle_16fff_585", jn = "_questionsCountNumber_16fff_591", Jn = "_filterByRow_16fff_597", Zn = "_filterByLabel_16fff_605", Xn = "_categoryFilterFormControl_16fff_611", ea = "_categorySelectInput_16fff_616", ta = "_tableContainerWrapper_16fff_634", na = "_questionsTable_16fff_642", aa = "_tableHeaderRow_16fff_647", sa = "_tableBodyRow_16fff_660", ra = "_thNumber_16fff_674", la = "_tdNumber_16fff_675", ia = "_thQuestion_16fff_684", oa = "_tdQuestion_16fff_685", ca = "_questionText_16fff_691", da = "_thType_16fff_710", ua = "_tdType_16fff_711", ma = "_thCategory_16fff_717", ha = "_tdCategory_16fff_718", fa = "_categoryText_16fff_724", pa = "_thActions_16fff_731", ga = "_tdActions_16fff_732", _a = "_questionTypeBadge_16fff_738", Ca = "_badgeTextLabel_16fff_748", ya = "_badgeRating_16fff_754", ba = "_badgeYesNo_16fff_761", Sa = "_badgeText_16fff_748", Ta = "_tableEditBtn_16fff_782", Na = "_tableRemoveBtn_16fff_797", va = "_addQuestionWrapper_16fff_812", wa = "_addQuestionBtn_16fff_820", xa = "_selectedCountSection_16fff_839", Fa = "_selectedCountText_16fff_844", Ia = "_selectedCountHighlight_16fff_850", Aa = "_studentsToolbar_16fff_856", Ba = "_searchBarContainer_16fff_864", La = "_studentSearchInput_16fff_869", Ra = "_filterDropdownWrapper_16fff_895", Ea = "_teacherFilterWrapper_16fff_899", Da = "_teacherAutocomplete_16fff_903", ka = "_teacherAutocompletePaper_16fff_960", Pa = "_teacherAutocompleteListbox_16fff_968", za = "_teacherOptionItem_16fff_985", qa = "_filterSelectBox_16fff_1029", Wa = "_studentsTableContainer_16fff_1055", Ha = "_studentsTable_16fff_1055", Qa = "_studentsTableHeaderRow_16fff_1069", Oa = "_checkboxHeaderCell_16fff_1080", Ma = "_tableHeaderCell_16fff_1088", Ya = "_checkboxBodyCell_16fff_1104", Ga = "_studentTableRow_16fff_1112", $a = "_selectedRow_16fff_1119", Ua = "_studentNameCell_16fff_1126", Va = "_studentNameText_16fff_1131", Ka = "_flagCell_16fff_1137", ja = "_gradeCell_16fff_1142", Ja = "_gradeText_16fff_1147", Za = "_emailCell_16fff_1152", Xa = "_emailText_16fff_1157", es = "_studentsPagination_16fff_1162", ts = "_reviewSectionBlock_16fff_1180", ns = "_reviewSectionHeader_16fff_1189", as = "_reviewSectionTitle_16fff_1196", ss = "_reviewEditSectionBtn_16fff_1202", rs = "_reviewFieldGroup_16fff_1213", ls = "_reviewFieldLabel_16fff_1217", is = "_reviewFieldValue_16fff_1225", os = "_reviewQuestionsTableContainer_16fff_1231", cs = "_previewSurveyBtn_16fff_1237", ds = "_publishBtn_16fff_1253", t = {
|
|
526
|
+
createSurveyPage: Xt,
|
|
527
|
+
headerTopBar: en,
|
|
528
|
+
contentBody: tn,
|
|
529
|
+
stepperContainer: nn,
|
|
530
|
+
backButton: an,
|
|
531
|
+
stepperProgress: sn,
|
|
532
|
+
stepColumn: rn,
|
|
533
|
+
stepColumnLast: ln,
|
|
534
|
+
stepCircleRow: on,
|
|
535
|
+
stepCircle: cn,
|
|
536
|
+
active: dn,
|
|
537
|
+
completed: un,
|
|
538
|
+
stepConnectorLine: mn,
|
|
539
|
+
stepLabelStack: hn,
|
|
540
|
+
stepInnerDot: fn,
|
|
541
|
+
stepNumberLabel: pn,
|
|
542
|
+
stepTextLabel: gn,
|
|
543
|
+
chooseTemplateCard: _n,
|
|
544
|
+
headerSection: Cn,
|
|
545
|
+
headerTitle: yn,
|
|
546
|
+
headerSubtitle: bn,
|
|
547
|
+
bannerContainer: Sn,
|
|
548
|
+
bannerIconBox: Tn,
|
|
549
|
+
bannerTitle: Nn,
|
|
550
|
+
bannerSubtitle: vn,
|
|
551
|
+
bannerActionBtn: wn,
|
|
552
|
+
sectionTitle: xn,
|
|
553
|
+
filterPillsContainer: Fn,
|
|
554
|
+
filterPill: In,
|
|
555
|
+
templateCard: An,
|
|
556
|
+
selected: Bn,
|
|
557
|
+
templateCardTitle: Ln,
|
|
558
|
+
templateEditBtn: Rn,
|
|
559
|
+
templateDescription: En,
|
|
560
|
+
chipItem: Dn,
|
|
561
|
+
wizardFooter: kn,
|
|
562
|
+
previousBtn: Pn,
|
|
563
|
+
disabled: zn,
|
|
564
|
+
stepCounterText: qn,
|
|
565
|
+
nextBtn: Wn,
|
|
566
|
+
editTemplateHeaderSection: Hn,
|
|
567
|
+
editTemplateCancelBtn: Qn,
|
|
568
|
+
editTemplateSaveBtn: On,
|
|
569
|
+
formFieldBlock: Mn,
|
|
570
|
+
formFieldLabel: Yn,
|
|
571
|
+
requiredAsterisk: Gn,
|
|
572
|
+
customTextField: $n,
|
|
573
|
+
formFieldHelperText: Un,
|
|
574
|
+
questionsHeaderSection: Vn,
|
|
575
|
+
questionsTitle: Kn,
|
|
576
|
+
questionsCountNumber: jn,
|
|
577
|
+
filterByRow: Jn,
|
|
578
|
+
filterByLabel: Zn,
|
|
579
|
+
categoryFilterFormControl: Xn,
|
|
580
|
+
categorySelectInput: ea,
|
|
581
|
+
tableContainerWrapper: ta,
|
|
582
|
+
questionsTable: na,
|
|
583
|
+
tableHeaderRow: aa,
|
|
584
|
+
tableBodyRow: sa,
|
|
585
|
+
thNumber: ra,
|
|
586
|
+
tdNumber: la,
|
|
587
|
+
thQuestion: ia,
|
|
588
|
+
tdQuestion: oa,
|
|
589
|
+
questionText: ca,
|
|
590
|
+
thType: da,
|
|
591
|
+
tdType: ua,
|
|
592
|
+
thCategory: ma,
|
|
593
|
+
tdCategory: ha,
|
|
594
|
+
categoryText: fa,
|
|
595
|
+
thActions: pa,
|
|
596
|
+
tdActions: ga,
|
|
597
|
+
questionTypeBadge: _a,
|
|
598
|
+
badgeTextLabel: Ca,
|
|
599
|
+
badgeRating: ya,
|
|
600
|
+
badgeYesNo: ba,
|
|
601
|
+
badgeText: Sa,
|
|
602
|
+
tableEditBtn: Ta,
|
|
603
|
+
tableRemoveBtn: Na,
|
|
604
|
+
addQuestionWrapper: va,
|
|
605
|
+
addQuestionBtn: wa,
|
|
606
|
+
selectedCountSection: xa,
|
|
607
|
+
selectedCountText: Fa,
|
|
608
|
+
selectedCountHighlight: Ia,
|
|
609
|
+
studentsToolbar: Aa,
|
|
610
|
+
searchBarContainer: Ba,
|
|
611
|
+
studentSearchInput: La,
|
|
612
|
+
filterDropdownWrapper: Ra,
|
|
613
|
+
teacherFilterWrapper: Ea,
|
|
614
|
+
teacherAutocomplete: Da,
|
|
615
|
+
teacherAutocompletePaper: ka,
|
|
616
|
+
teacherAutocompleteListbox: Pa,
|
|
617
|
+
teacherOptionItem: za,
|
|
618
|
+
filterSelectBox: qa,
|
|
619
|
+
studentsTableContainer: Wa,
|
|
620
|
+
studentsTable: Ha,
|
|
621
|
+
studentsTableHeaderRow: Qa,
|
|
622
|
+
checkboxHeaderCell: Oa,
|
|
623
|
+
tableHeaderCell: Ma,
|
|
624
|
+
checkboxBodyCell: Ya,
|
|
625
|
+
studentTableRow: Ga,
|
|
626
|
+
selectedRow: $a,
|
|
627
|
+
studentNameCell: Ua,
|
|
628
|
+
studentNameText: Va,
|
|
629
|
+
flagCell: Ka,
|
|
630
|
+
gradeCell: ja,
|
|
631
|
+
gradeText: Ja,
|
|
632
|
+
emailCell: Za,
|
|
633
|
+
emailText: Xa,
|
|
634
|
+
studentsPagination: es,
|
|
635
|
+
reviewSectionBlock: ts,
|
|
636
|
+
reviewSectionHeader: ns,
|
|
637
|
+
reviewSectionTitle: as,
|
|
638
|
+
reviewEditSectionBtn: ss,
|
|
639
|
+
reviewFieldGroup: rs,
|
|
640
|
+
reviewFieldLabel: ls,
|
|
641
|
+
reviewFieldValue: is,
|
|
642
|
+
reviewQuestionsTableContainer: os,
|
|
643
|
+
previewSurveyBtn: cs,
|
|
644
|
+
publishBtn: ds
|
|
645
|
+
}, us = ({
|
|
646
|
+
steps: a,
|
|
647
|
+
activeStep: s,
|
|
648
|
+
onBack: u
|
|
649
|
+
}) => /* @__PURE__ */ n(i, { className: t.stepperContainer, children: [
|
|
650
|
+
/* @__PURE__ */ e(
|
|
651
|
+
G,
|
|
652
|
+
{
|
|
653
|
+
onClick: u,
|
|
654
|
+
startIcon: /* @__PURE__ */ e(Ue, { fontSize: "small" }),
|
|
655
|
+
className: t.backButton,
|
|
656
|
+
children: "Back to Surveys Dashboard"
|
|
657
|
+
}
|
|
658
|
+
),
|
|
659
|
+
/* @__PURE__ */ e(i, { className: t.stepperProgress, children: a.map((C, l) => {
|
|
660
|
+
const r = l === s, h = l < s, f = l === a.length - 1;
|
|
661
|
+
return /* @__PURE__ */ n(
|
|
662
|
+
i,
|
|
663
|
+
{
|
|
664
|
+
className: `${t.stepColumn} ${f ? t.stepColumnLast : ""}`,
|
|
665
|
+
children: [
|
|
666
|
+
/* @__PURE__ */ n(i, { className: t.stepCircleRow, children: [
|
|
667
|
+
/* @__PURE__ */ n(
|
|
668
|
+
i,
|
|
669
|
+
{
|
|
670
|
+
className: `${t.stepCircle} ${r ? t.active : h ? t.completed : ""}`,
|
|
671
|
+
children: [
|
|
672
|
+
r && /* @__PURE__ */ e(i, { className: t.stepInnerDot }),
|
|
673
|
+
h && /* @__PURE__ */ e(Ve, { sx: { fontSize: 16, color: "#ffffff" } })
|
|
674
|
+
]
|
|
675
|
+
}
|
|
676
|
+
),
|
|
677
|
+
!f && /* @__PURE__ */ e(
|
|
678
|
+
i,
|
|
679
|
+
{
|
|
680
|
+
className: `${t.stepConnectorLine} ${h ? t.completed : ""}`
|
|
681
|
+
}
|
|
682
|
+
)
|
|
683
|
+
] }),
|
|
684
|
+
/* @__PURE__ */ n(
|
|
685
|
+
$,
|
|
686
|
+
{
|
|
687
|
+
alignItems: "flex-start",
|
|
688
|
+
spacing: 0.25,
|
|
689
|
+
className: t.stepLabelStack,
|
|
690
|
+
children: [
|
|
691
|
+
/* @__PURE__ */ n(
|
|
692
|
+
b,
|
|
693
|
+
{
|
|
694
|
+
variant: "caption",
|
|
695
|
+
className: `${t.stepNumberLabel} ${r ? t.active : ""}`,
|
|
696
|
+
children: [
|
|
697
|
+
"STEP ",
|
|
698
|
+
C.stepNumber
|
|
699
|
+
]
|
|
700
|
+
}
|
|
701
|
+
),
|
|
702
|
+
/* @__PURE__ */ e(
|
|
703
|
+
b,
|
|
704
|
+
{
|
|
705
|
+
variant: "body2",
|
|
706
|
+
className: `${t.stepTextLabel} ${r ? t.active : ""}`,
|
|
707
|
+
children: C.label
|
|
708
|
+
}
|
|
709
|
+
)
|
|
710
|
+
]
|
|
711
|
+
}
|
|
712
|
+
)
|
|
713
|
+
]
|
|
714
|
+
},
|
|
715
|
+
C.stepCode
|
|
716
|
+
);
|
|
717
|
+
}) })
|
|
718
|
+
] }), ms = ({
|
|
719
|
+
onCreateBlank: a
|
|
720
|
+
}) => /* @__PURE__ */ n(i, { className: t.bannerContainer, children: [
|
|
721
|
+
/* @__PURE__ */ n($, { direction: "row", spacing: 2, alignItems: "center", children: [
|
|
722
|
+
/* @__PURE__ */ e(i, { className: t.bannerIconBox, children: /* @__PURE__ */ e("img", { src: "/images/scratch-icon.png", alt: "Start from Scratch" }) }),
|
|
723
|
+
/* @__PURE__ */ n(i, { children: [
|
|
724
|
+
/* @__PURE__ */ e(b, { variant: "subtitle1", className: t.bannerTitle, children: "Start from Scratch" }),
|
|
725
|
+
/* @__PURE__ */ e(b, { variant: "body2", className: t.bannerSubtitle, children: "Create a custom survey tailored to your specific needs" })
|
|
726
|
+
] })
|
|
727
|
+
] }),
|
|
728
|
+
/* @__PURE__ */ e(
|
|
729
|
+
G,
|
|
730
|
+
{
|
|
731
|
+
onClick: a,
|
|
732
|
+
endIcon: /* @__PURE__ */ e(Ke, { sx: { fontSize: 16 } }),
|
|
733
|
+
className: t.bannerActionBtn,
|
|
734
|
+
children: "CREATE BLANK SURVEY"
|
|
735
|
+
}
|
|
736
|
+
)
|
|
737
|
+
] }), hs = ({
|
|
738
|
+
categories: a,
|
|
739
|
+
selectedCategory: s,
|
|
740
|
+
onSelectCategory: u
|
|
741
|
+
}) => /* @__PURE__ */ e(i, { className: t.filterPillsContainer, children: /* @__PURE__ */ e($, { direction: "row", spacing: 1.5, alignItems: "center", children: a.map((C) => {
|
|
742
|
+
const l = s.toLowerCase() === C.toLowerCase();
|
|
743
|
+
return /* @__PURE__ */ e(
|
|
744
|
+
ae,
|
|
745
|
+
{
|
|
746
|
+
label: C,
|
|
747
|
+
onClick: () => u(C),
|
|
748
|
+
className: `${t.filterPill} ${l ? t.active : ""}`
|
|
749
|
+
},
|
|
750
|
+
C
|
|
751
|
+
);
|
|
752
|
+
}) }) }), fe = Ae(/* @__PURE__ */ e("path", {
|
|
753
|
+
d: "m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"
|
|
754
|
+
}), "EditOutlined"), fs = ({
|
|
755
|
+
template: a,
|
|
756
|
+
isSelected: s,
|
|
757
|
+
onSelect: u,
|
|
758
|
+
onEdit: C
|
|
759
|
+
}) => {
|
|
760
|
+
const l = a.categories && a.categories.length > 0 ? a.categories : a.category ? [a.category] : [], r = De(null), h = De(null), [f, d] = M(l.length);
|
|
761
|
+
return se(() => {
|
|
762
|
+
const S = r.current, c = h.current;
|
|
763
|
+
if (!S || !c) return;
|
|
764
|
+
const _ = () => {
|
|
765
|
+
const w = S.clientWidth, E = Array.from(c.children);
|
|
766
|
+
if (E.length === 0) return;
|
|
767
|
+
const k = 6;
|
|
768
|
+
let v = 0;
|
|
769
|
+
const D = E[0].getBoundingClientRect().width, F = E[E.length - 1].getBoundingClientRect().width;
|
|
770
|
+
v += D;
|
|
771
|
+
let g = 0;
|
|
772
|
+
const R = E.length - 2;
|
|
773
|
+
for (let W = 0; W < R; W++) {
|
|
774
|
+
const H = E[W + 1].getBoundingClientRect().width;
|
|
775
|
+
if ((W === R - 1 ? v + k + H : v + k + H + k + F) <= w)
|
|
776
|
+
v += k + H, g++;
|
|
777
|
+
else
|
|
778
|
+
break;
|
|
779
|
+
}
|
|
780
|
+
d(g);
|
|
781
|
+
}, y = new ResizeObserver(() => {
|
|
782
|
+
_();
|
|
783
|
+
});
|
|
784
|
+
return y.observe(S), _(), () => y.disconnect();
|
|
785
|
+
}, [l]), /* @__PURE__ */ n(
|
|
786
|
+
i,
|
|
787
|
+
{
|
|
788
|
+
onClick: () => u(a.id),
|
|
789
|
+
className: `${t.templateCard} ${s ? t.selected : ""}`,
|
|
790
|
+
children: [
|
|
791
|
+
/* @__PURE__ */ n(i, { children: [
|
|
792
|
+
/* @__PURE__ */ n(
|
|
793
|
+
$,
|
|
794
|
+
{
|
|
795
|
+
direction: "row",
|
|
796
|
+
alignItems: "flex-start",
|
|
797
|
+
justifyContent: "space-between",
|
|
798
|
+
spacing: 1,
|
|
799
|
+
children: [
|
|
800
|
+
/* @__PURE__ */ e(b, { variant: "h6", className: t.templateCardTitle, children: a.title }),
|
|
801
|
+
/* @__PURE__ */ e(
|
|
802
|
+
G,
|
|
803
|
+
{
|
|
804
|
+
size: "small",
|
|
805
|
+
onClick: (S) => C(a, S),
|
|
806
|
+
startIcon: /* @__PURE__ */ e(fe, { sx: { fontSize: 14 } }),
|
|
807
|
+
className: t.templateEditBtn,
|
|
808
|
+
children: "EDIT"
|
|
809
|
+
}
|
|
810
|
+
)
|
|
811
|
+
]
|
|
812
|
+
}
|
|
813
|
+
),
|
|
814
|
+
/* @__PURE__ */ e(b, { variant: "body2", className: t.templateDescription, children: a.description })
|
|
815
|
+
] }),
|
|
816
|
+
/* @__PURE__ */ n(i, { ref: r, sx: { position: "relative", width: "100%", height: 24, overflow: "hidden" }, children: [
|
|
817
|
+
/* @__PURE__ */ n($, { direction: "row", spacing: 1, alignItems: "center", sx: { gap: 0.75, flexWrap: "nowrap" }, children: [
|
|
818
|
+
/* @__PURE__ */ e(
|
|
819
|
+
ae,
|
|
820
|
+
{
|
|
821
|
+
label: `${a.questionCount} questions`,
|
|
822
|
+
size: "small",
|
|
823
|
+
className: t.chipItem,
|
|
824
|
+
sx: { flexShrink: 0 }
|
|
825
|
+
}
|
|
826
|
+
),
|
|
827
|
+
l.slice(0, f).map((S, c) => /* @__PURE__ */ e(
|
|
828
|
+
ae,
|
|
829
|
+
{
|
|
830
|
+
label: S,
|
|
831
|
+
size: "small",
|
|
832
|
+
className: t.chipItem,
|
|
833
|
+
sx: { flexShrink: 0 }
|
|
834
|
+
},
|
|
835
|
+
c
|
|
836
|
+
)),
|
|
837
|
+
f < l.length && /* @__PURE__ */ e(
|
|
838
|
+
ae,
|
|
839
|
+
{
|
|
840
|
+
label: "...",
|
|
841
|
+
size: "small",
|
|
842
|
+
className: t.chipItem,
|
|
843
|
+
sx: { flexShrink: 0 }
|
|
844
|
+
}
|
|
845
|
+
)
|
|
846
|
+
] }),
|
|
847
|
+
/* @__PURE__ */ n(
|
|
848
|
+
$,
|
|
849
|
+
{
|
|
850
|
+
ref: h,
|
|
851
|
+
direction: "row",
|
|
852
|
+
spacing: 1,
|
|
853
|
+
alignItems: "center",
|
|
854
|
+
sx: {
|
|
855
|
+
gap: 0.75,
|
|
856
|
+
flexWrap: "nowrap",
|
|
857
|
+
position: "absolute",
|
|
858
|
+
top: 0,
|
|
859
|
+
left: 0,
|
|
860
|
+
visibility: "hidden",
|
|
861
|
+
pointerEvents: "none",
|
|
862
|
+
zIndex: -1,
|
|
863
|
+
width: "max-content"
|
|
864
|
+
},
|
|
865
|
+
children: [
|
|
866
|
+
/* @__PURE__ */ e(
|
|
867
|
+
ae,
|
|
868
|
+
{
|
|
869
|
+
label: `${a.questionCount} questions`,
|
|
870
|
+
size: "small",
|
|
871
|
+
className: t.chipItem
|
|
872
|
+
}
|
|
873
|
+
),
|
|
874
|
+
l.map((S, c) => /* @__PURE__ */ e(
|
|
875
|
+
ae,
|
|
876
|
+
{
|
|
877
|
+
label: S,
|
|
878
|
+
size: "small",
|
|
879
|
+
className: t.chipItem
|
|
880
|
+
},
|
|
881
|
+
c
|
|
882
|
+
)),
|
|
883
|
+
/* @__PURE__ */ e(
|
|
884
|
+
ae,
|
|
885
|
+
{
|
|
886
|
+
label: "...",
|
|
887
|
+
size: "small",
|
|
888
|
+
className: t.chipItem
|
|
889
|
+
}
|
|
890
|
+
)
|
|
891
|
+
]
|
|
892
|
+
}
|
|
893
|
+
)
|
|
894
|
+
] })
|
|
895
|
+
]
|
|
896
|
+
}
|
|
897
|
+
);
|
|
898
|
+
}, ps = Ae(/* @__PURE__ */ e("path", {
|
|
899
|
+
d: "M12 6.5c3.79 0 7.17 2.13 8.82 5.5-1.65 3.37-5.02 5.5-8.82 5.5S4.83 15.37 3.18 12C4.83 8.63 8.21 6.5 12 6.5m0-2C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5m0 5c1.38 0 2.5 1.12 2.5 2.5s-1.12 2.5-2.5 2.5-2.5-1.12-2.5-2.5 1.12-2.5 2.5-2.5m0-2c-2.48 0-4.5 2.02-4.5 4.5s2.02 4.5 4.5 4.5 4.5-2.02 4.5-4.5-2.02-4.5-4.5-4.5"
|
|
900
|
+
}), "RemoveRedEyeOutlined"), ge = ({
|
|
901
|
+
currentStep: a,
|
|
902
|
+
totalSteps: s,
|
|
903
|
+
onPrevious: u,
|
|
904
|
+
onNext: C,
|
|
905
|
+
isNextDisabled: l = !1,
|
|
906
|
+
isLastStep: r = !1,
|
|
907
|
+
nextLabel: h = "NEXT",
|
|
908
|
+
onPreview: f
|
|
909
|
+
}) => /* @__PURE__ */ n(i, { className: t.wizardFooter, children: [
|
|
910
|
+
/* @__PURE__ */ e(
|
|
911
|
+
G,
|
|
912
|
+
{
|
|
913
|
+
variant: "outlined",
|
|
914
|
+
onClick: u,
|
|
915
|
+
startIcon: /* @__PURE__ */ e(Ue, { sx: { fontSize: 16 } }),
|
|
916
|
+
className: `${t.previousBtn} ${a === 1 ? t.disabled : ""}`,
|
|
917
|
+
children: "PREVIOUS"
|
|
918
|
+
}
|
|
919
|
+
),
|
|
920
|
+
/* @__PURE__ */ n(b, { variant: "body2", className: t.stepCounterText, children: [
|
|
921
|
+
"Step ",
|
|
922
|
+
a,
|
|
923
|
+
" of ",
|
|
924
|
+
s
|
|
925
|
+
] }),
|
|
926
|
+
r ? /* @__PURE__ */ n($, { direction: "row", spacing: 1.5, alignItems: "center", children: [
|
|
927
|
+
f && /* @__PURE__ */ e(
|
|
928
|
+
G,
|
|
929
|
+
{
|
|
930
|
+
variant: "outlined",
|
|
931
|
+
onClick: f,
|
|
932
|
+
startIcon: /* @__PURE__ */ e(ps, { sx: { fontSize: 18 } }),
|
|
933
|
+
className: t.previewSurveyBtn,
|
|
934
|
+
children: "SURVEY PREVIEW"
|
|
935
|
+
}
|
|
936
|
+
),
|
|
937
|
+
/* @__PURE__ */ e(
|
|
938
|
+
G,
|
|
939
|
+
{
|
|
940
|
+
variant: "contained",
|
|
941
|
+
onClick: C,
|
|
942
|
+
disabled: l,
|
|
943
|
+
className: t.publishBtn,
|
|
944
|
+
children: h || "PUBLISH"
|
|
945
|
+
}
|
|
946
|
+
)
|
|
947
|
+
] }) : /* @__PURE__ */ e(
|
|
948
|
+
G,
|
|
949
|
+
{
|
|
950
|
+
variant: "contained",
|
|
951
|
+
onClick: C,
|
|
952
|
+
disabled: l,
|
|
953
|
+
endIcon: /* @__PURE__ */ e(Ke, { sx: { fontSize: 16 } }),
|
|
954
|
+
className: t.nextBtn,
|
|
955
|
+
children: h
|
|
956
|
+
}
|
|
957
|
+
)
|
|
958
|
+
] }), gs = ({
|
|
959
|
+
categories: a,
|
|
960
|
+
selectedCategory: s,
|
|
961
|
+
templates: u,
|
|
962
|
+
selectedTemplateId: C,
|
|
963
|
+
currentStepNumber: l,
|
|
964
|
+
totalSteps: r,
|
|
965
|
+
onSelectCategory: h,
|
|
966
|
+
onSelectTemplate: f,
|
|
967
|
+
onCreateBlank: d,
|
|
968
|
+
onEditTemplate: S,
|
|
969
|
+
onPrevious: c,
|
|
970
|
+
onNext: _
|
|
971
|
+
}) => /* @__PURE__ */ n(i, { className: t.chooseTemplateCard, children: [
|
|
972
|
+
/* @__PURE__ */ n(i, { children: [
|
|
973
|
+
/* @__PURE__ */ e(b, { variant: "h4", className: t.headerTitle, children: "Choose a Template" }),
|
|
974
|
+
/* @__PURE__ */ e(b, { variant: "body1", className: t.headerSubtitle, children: "Start with a template or create from scratch" })
|
|
975
|
+
] }),
|
|
976
|
+
/* @__PURE__ */ e(ms, { onCreateBlank: d }),
|
|
977
|
+
/* @__PURE__ */ n($, { spacing: 1, children: [
|
|
978
|
+
/* @__PURE__ */ e(b, { variant: "h6", className: t.sectionTitle, children: "Survey Templates" }),
|
|
979
|
+
/* @__PURE__ */ e(
|
|
980
|
+
hs,
|
|
981
|
+
{
|
|
982
|
+
categories: a,
|
|
983
|
+
selectedCategory: s,
|
|
984
|
+
onSelectCategory: h
|
|
985
|
+
}
|
|
986
|
+
)
|
|
987
|
+
] }),
|
|
988
|
+
/* @__PURE__ */ e(Pe, { container: !0, spacing: 2.5, sx: { mt: 1 }, children: u.map((y) => /* @__PURE__ */ e(Pe, { item: !0, xs: 12, sm: 6, md: 4, children: /* @__PURE__ */ e(
|
|
989
|
+
fs,
|
|
990
|
+
{
|
|
991
|
+
template: y,
|
|
992
|
+
isSelected: C === y.id,
|
|
993
|
+
onSelect: f,
|
|
994
|
+
onEdit: S
|
|
995
|
+
}
|
|
996
|
+
) }, y.id)) }),
|
|
997
|
+
/* @__PURE__ */ e(
|
|
998
|
+
ge,
|
|
999
|
+
{
|
|
1000
|
+
currentStep: l,
|
|
1001
|
+
totalSteps: r,
|
|
1002
|
+
onPrevious: c,
|
|
1003
|
+
onNext: _
|
|
1004
|
+
}
|
|
1005
|
+
)
|
|
1006
|
+
] }), _s = Ae(/* @__PURE__ */ e("path", {
|
|
1007
|
+
d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"
|
|
1008
|
+
}), "DeleteOutlineOutlined"), Je = ({ type: a }) => {
|
|
1009
|
+
const s = (l) => {
|
|
1010
|
+
if (typeof l == "number" || !isNaN(Number(l)) && String(l).trim() !== "")
|
|
1011
|
+
switch (Number(l)) {
|
|
1012
|
+
case 0:
|
|
1013
|
+
return "TextInput";
|
|
1014
|
+
case 1:
|
|
1015
|
+
return "SingleChoice";
|
|
1016
|
+
case 2:
|
|
1017
|
+
return "MultipleChoice";
|
|
1018
|
+
case 3:
|
|
1019
|
+
case 7:
|
|
1020
|
+
return "TextInput";
|
|
1021
|
+
case 4:
|
|
1022
|
+
return "Slider";
|
|
1023
|
+
case 6:
|
|
1024
|
+
return "StarRating";
|
|
1025
|
+
case 8:
|
|
1026
|
+
return "Emotional";
|
|
1027
|
+
case 9:
|
|
1028
|
+
return "Summarize";
|
|
1029
|
+
case 10:
|
|
1030
|
+
return "Rating";
|
|
1031
|
+
case 12:
|
|
1032
|
+
return "DropDown";
|
|
1033
|
+
}
|
|
1034
|
+
const r = String(l || "").trim(), h = r.toLowerCase();
|
|
1035
|
+
return h === "text" || h === "openfield" || h === "default" || h === "textinputwithsuggestions" ? "TextInput" : h === "singlechoice" ? "SingleChoice" : h === "multiplechoice" ? "MultipleChoice" : h === "slider" ? "Slider" : h === "rating" ? "Rating" : h === "starrating" ? "StarRating" : h === "emotional" || h === "emotion" ? "Emotional" : h === "summarize" ? "Summarize" : h === "dropdown" ? "DropDown" : h === "yesno" ? "YesNo" : r;
|
|
1036
|
+
}, u = (l) => {
|
|
1037
|
+
switch (s(l)) {
|
|
1038
|
+
case "Rating":
|
|
1039
|
+
case "StarRating":
|
|
1040
|
+
case "Slider":
|
|
1041
|
+
return t.badgeRating;
|
|
1042
|
+
case "YesNo":
|
|
1043
|
+
case "SingleChoice":
|
|
1044
|
+
return t.badgeYesNo;
|
|
1045
|
+
case "MultipleChoice":
|
|
1046
|
+
return t.badgeRating;
|
|
1047
|
+
case "Emotional":
|
|
1048
|
+
return t.badgeYesNo;
|
|
1049
|
+
case "DropDown":
|
|
1050
|
+
return t.badgeText;
|
|
1051
|
+
case "Text":
|
|
1052
|
+
case "TextInput":
|
|
1053
|
+
case "OpenField":
|
|
1054
|
+
case "Summarize":
|
|
1055
|
+
return t.badgeText;
|
|
1056
|
+
default:
|
|
1057
|
+
return t.badgeText;
|
|
1058
|
+
}
|
|
1059
|
+
}, C = (l) => {
|
|
1060
|
+
const r = s(l);
|
|
1061
|
+
switch (r) {
|
|
1062
|
+
case "YesNo":
|
|
1063
|
+
return "Yes/No";
|
|
1064
|
+
case "SingleChoice":
|
|
1065
|
+
return "Single Choice";
|
|
1066
|
+
case "MultipleChoice":
|
|
1067
|
+
return "Multiple Choice";
|
|
1068
|
+
case "StarRating":
|
|
1069
|
+
case "Rating":
|
|
1070
|
+
return "Rating";
|
|
1071
|
+
case "Slider":
|
|
1072
|
+
return "Slider";
|
|
1073
|
+
case "TextInput":
|
|
1074
|
+
case "OpenField":
|
|
1075
|
+
case "Text":
|
|
1076
|
+
return "Text";
|
|
1077
|
+
case "Emotional":
|
|
1078
|
+
return "Emotional";
|
|
1079
|
+
case "DropDown":
|
|
1080
|
+
return "Dropdown";
|
|
1081
|
+
case "Summarize":
|
|
1082
|
+
return "Summarize";
|
|
1083
|
+
default:
|
|
1084
|
+
return r;
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1087
|
+
return /* @__PURE__ */ e(i, { className: `${t.questionTypeBadge} ${u(a)}`, children: /* @__PURE__ */ e(b, { variant: "caption", className: t.badgeTextLabel, children: C(a) }) });
|
|
1088
|
+
}, Ze = ({
|
|
1089
|
+
questions: a,
|
|
1090
|
+
onEditQuestion: s,
|
|
1091
|
+
onRemoveQuestion: u
|
|
1092
|
+
}) => {
|
|
1093
|
+
const [C, l] = M(null), [r, h] = M(!1), f = (c) => {
|
|
1094
|
+
l(c), h(!0);
|
|
1095
|
+
}, d = () => {
|
|
1096
|
+
C !== null && u(C), h(!1), l(null);
|
|
1097
|
+
}, S = () => {
|
|
1098
|
+
h(!1), l(null);
|
|
1099
|
+
};
|
|
1100
|
+
return /* @__PURE__ */ n(yt, { className: t.tableContainerWrapper, children: [
|
|
1101
|
+
/* @__PURE__ */ n(Te, { className: t.questionsTable, children: [
|
|
1102
|
+
/* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ n(j, { className: t.tableHeaderRow, children: [
|
|
1103
|
+
/* @__PURE__ */ e(B, { className: t.thNumber, children: "#" }),
|
|
1104
|
+
/* @__PURE__ */ e(B, { className: t.thQuestion, children: "Question" }),
|
|
1105
|
+
/* @__PURE__ */ e(B, { className: t.thType, children: "Type" }),
|
|
1106
|
+
/* @__PURE__ */ e(B, { className: t.thCategory, children: "Category" }),
|
|
1107
|
+
/* @__PURE__ */ e(B, { className: t.thActions, children: "Actions" })
|
|
1108
|
+
] }) }),
|
|
1109
|
+
/* @__PURE__ */ e(ve, { children: a.map((c, _) => /* @__PURE__ */ n(j, { className: t.tableBodyRow, children: [
|
|
1110
|
+
/* @__PURE__ */ n(B, { className: t.tdNumber, children: [
|
|
1111
|
+
_ + 1,
|
|
1112
|
+
"."
|
|
1113
|
+
] }),
|
|
1114
|
+
/* @__PURE__ */ e(B, { className: t.tdQuestion, children: /* @__PURE__ */ e(
|
|
1115
|
+
b,
|
|
1116
|
+
{
|
|
1117
|
+
variant: "body2",
|
|
1118
|
+
className: t.questionText,
|
|
1119
|
+
dangerouslySetInnerHTML: {
|
|
1120
|
+
__html: c.questionText || ""
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
) }),
|
|
1124
|
+
/* @__PURE__ */ e(B, { className: t.tdType, children: /* @__PURE__ */ e(Je, { type: c.type }) }),
|
|
1125
|
+
/* @__PURE__ */ e(B, { className: t.tdCategory, children: /* @__PURE__ */ e(b, { variant: "body2", className: t.categoryText, children: c.category }) }),
|
|
1126
|
+
/* @__PURE__ */ e(B, { className: t.tdActions, children: /* @__PURE__ */ n($, { direction: "row", spacing: 1.5, alignItems: "center", children: [
|
|
1127
|
+
/* @__PURE__ */ e(
|
|
1128
|
+
G,
|
|
1129
|
+
{
|
|
1130
|
+
onClick: () => s(c.id),
|
|
1131
|
+
startIcon: /* @__PURE__ */ e(fe, { fontSize: "small" }),
|
|
1132
|
+
className: t.tableEditBtn,
|
|
1133
|
+
children: "Edit"
|
|
1134
|
+
}
|
|
1135
|
+
),
|
|
1136
|
+
/* @__PURE__ */ e(
|
|
1137
|
+
G,
|
|
1138
|
+
{
|
|
1139
|
+
onClick: () => f(c.id),
|
|
1140
|
+
startIcon: /* @__PURE__ */ e(_s, { fontSize: "small" }),
|
|
1141
|
+
className: t.tableRemoveBtn,
|
|
1142
|
+
children: "Remove"
|
|
1143
|
+
}
|
|
1144
|
+
)
|
|
1145
|
+
] }) })
|
|
1146
|
+
] }, c.id)) })
|
|
1147
|
+
] }),
|
|
1148
|
+
/* @__PURE__ */ n(
|
|
1149
|
+
He,
|
|
1150
|
+
{
|
|
1151
|
+
open: r,
|
|
1152
|
+
onClose: S,
|
|
1153
|
+
"aria-labelledby": "confirm-delete-dialog-title",
|
|
1154
|
+
"aria-describedby": "confirm-delete-dialog-description",
|
|
1155
|
+
children: [
|
|
1156
|
+
/* @__PURE__ */ e(Qe, { id: "confirm-delete-dialog-title", sx: { fontWeight: "bold" }, children: "Confirm Remove" }),
|
|
1157
|
+
/* @__PURE__ */ e(Oe, { children: /* @__PURE__ */ e(bt, { id: "confirm-delete-dialog-description", children: "Are you sure you want to remove this question?" }) }),
|
|
1158
|
+
/* @__PURE__ */ n(St, { children: [
|
|
1159
|
+
/* @__PURE__ */ e(G, { onClick: S, color: "inherit", children: "Cancel" }),
|
|
1160
|
+
/* @__PURE__ */ e(G, { onClick: d, color: "error", autoFocus: !0, children: "Remove" })
|
|
1161
|
+
] })
|
|
1162
|
+
]
|
|
1163
|
+
}
|
|
1164
|
+
)
|
|
1165
|
+
] });
|
|
1166
|
+
}, Cs = ({
|
|
1167
|
+
formData: a,
|
|
1168
|
+
questionCategories: s,
|
|
1169
|
+
filteredQuestions: u,
|
|
1170
|
+
totalQuestionsCount: C,
|
|
1171
|
+
currentStepNumber: l,
|
|
1172
|
+
totalSteps: r,
|
|
1173
|
+
onTemplateNameChange: h,
|
|
1174
|
+
onDescriptionChange: f,
|
|
1175
|
+
onCategoryFilterChange: d,
|
|
1176
|
+
onEditQuestion: S,
|
|
1177
|
+
onRemoveQuestion: c,
|
|
1178
|
+
onAddQuestion: _,
|
|
1179
|
+
onPrevious: y,
|
|
1180
|
+
onNext: w
|
|
1181
|
+
}) => {
|
|
1182
|
+
const E = (k) => {
|
|
1183
|
+
d(k.target.value);
|
|
1184
|
+
};
|
|
1185
|
+
return /* @__PURE__ */ n(i, { className: t.chooseTemplateCard, children: [
|
|
1186
|
+
/* @__PURE__ */ n(i, { className: t.headerSection, children: [
|
|
1187
|
+
/* @__PURE__ */ e(b, { variant: "h5", className: t.headerTitle, children: "Check Details" }),
|
|
1188
|
+
/* @__PURE__ */ e(b, { variant: "body2", className: t.headerSubtitle, children: "Review and edit the details below." })
|
|
1189
|
+
] }),
|
|
1190
|
+
/* @__PURE__ */ n(i, { className: t.formFieldBlock, children: [
|
|
1191
|
+
/* @__PURE__ */ n(b, { variant: "subtitle2", className: t.formFieldLabel, children: [
|
|
1192
|
+
"Template Name ",
|
|
1193
|
+
/* @__PURE__ */ e("span", { className: t.requiredAsterisk, children: "*" })
|
|
1194
|
+
] }),
|
|
1195
|
+
/* @__PURE__ */ e(
|
|
1196
|
+
J,
|
|
1197
|
+
{
|
|
1198
|
+
fullWidth: !0,
|
|
1199
|
+
variant: "outlined",
|
|
1200
|
+
value: a.templateName,
|
|
1201
|
+
onChange: (k) => h(k.target.value),
|
|
1202
|
+
placeholder: "Enter template name",
|
|
1203
|
+
className: t.customTextField
|
|
1204
|
+
}
|
|
1205
|
+
)
|
|
1206
|
+
] }),
|
|
1207
|
+
/* @__PURE__ */ n(i, { className: t.formFieldBlock, children: [
|
|
1208
|
+
/* @__PURE__ */ e(b, { variant: "subtitle2", className: t.formFieldLabel, children: "Description and instructions of when to use" }),
|
|
1209
|
+
/* @__PURE__ */ e(
|
|
1210
|
+
J,
|
|
1211
|
+
{
|
|
1212
|
+
fullWidth: !0,
|
|
1213
|
+
multiline: !0,
|
|
1214
|
+
rows: 3,
|
|
1215
|
+
variant: "outlined",
|
|
1216
|
+
value: a.description,
|
|
1217
|
+
onChange: (k) => f(k.target.value),
|
|
1218
|
+
placeholder: "Enter description and instructions",
|
|
1219
|
+
className: t.customTextField
|
|
1220
|
+
}
|
|
1221
|
+
)
|
|
1222
|
+
] }),
|
|
1223
|
+
/* @__PURE__ */ n(i, { className: t.questionsHeaderSection, children: [
|
|
1224
|
+
/* @__PURE__ */ n($, { direction: "row", alignItems: "center", spacing: 0.75, sx: { mb: 1.5 }, children: [
|
|
1225
|
+
/* @__PURE__ */ e(b, { variant: "subtitle1", className: t.questionsTitle, children: "Questions" }),
|
|
1226
|
+
/* @__PURE__ */ e(b, { variant: "subtitle1", className: t.questionsCountNumber, children: C })
|
|
1227
|
+
] }),
|
|
1228
|
+
/* @__PURE__ */ n($, { direction: "row", alignItems: "center", spacing: 1.5, className: t.filterByRow, children: [
|
|
1229
|
+
/* @__PURE__ */ e(b, { variant: "body2", className: t.filterByLabel, children: "Filter by category" }),
|
|
1230
|
+
/* @__PURE__ */ e(we, { size: "small", className: t.categoryFilterFormControl, children: /* @__PURE__ */ e(
|
|
1231
|
+
xe,
|
|
1232
|
+
{
|
|
1233
|
+
value: a.selectedCategoryFilter,
|
|
1234
|
+
onChange: E,
|
|
1235
|
+
className: t.categorySelectInput,
|
|
1236
|
+
children: s.map((k) => /* @__PURE__ */ e(Fe, { value: k, children: k }, k))
|
|
1237
|
+
}
|
|
1238
|
+
) })
|
|
1239
|
+
] })
|
|
1240
|
+
] }),
|
|
1241
|
+
/* @__PURE__ */ e(
|
|
1242
|
+
Ze,
|
|
1243
|
+
{
|
|
1244
|
+
questions: u,
|
|
1245
|
+
onEditQuestion: S,
|
|
1246
|
+
onRemoveQuestion: c
|
|
1247
|
+
}
|
|
1248
|
+
),
|
|
1249
|
+
/* @__PURE__ */ e(i, { className: t.addQuestionWrapper, children: /* @__PURE__ */ e(
|
|
1250
|
+
G,
|
|
1251
|
+
{
|
|
1252
|
+
onClick: _,
|
|
1253
|
+
startIcon: /* @__PURE__ */ e(je, {}),
|
|
1254
|
+
className: t.addQuestionBtn,
|
|
1255
|
+
children: "ADD QUESTION"
|
|
1256
|
+
}
|
|
1257
|
+
) }),
|
|
1258
|
+
/* @__PURE__ */ e(
|
|
1259
|
+
ge,
|
|
1260
|
+
{
|
|
1261
|
+
currentStep: l,
|
|
1262
|
+
totalSteps: r,
|
|
1263
|
+
onPrevious: y,
|
|
1264
|
+
onNext: w,
|
|
1265
|
+
isNextDisabled: !a.templateName || a.templateName.trim() === ""
|
|
1266
|
+
}
|
|
1267
|
+
)
|
|
1268
|
+
] });
|
|
1269
|
+
}, ys = ({
|
|
1270
|
+
formData: a,
|
|
1271
|
+
currentStepNumber: s,
|
|
1272
|
+
totalSteps: u,
|
|
1273
|
+
onTitleChange: C,
|
|
1274
|
+
onDeadlineChange: l,
|
|
1275
|
+
onPrevious: r,
|
|
1276
|
+
onNext: h
|
|
1277
|
+
}) => /* @__PURE__ */ n(i, { className: t.chooseTemplateCard, children: [
|
|
1278
|
+
/* @__PURE__ */ n(i, { className: t.headerSection, children: [
|
|
1279
|
+
/* @__PURE__ */ e(b, { variant: "h5", className: t.headerTitle, children: "Create Survey" }),
|
|
1280
|
+
/* @__PURE__ */ e(b, { variant: "body2", className: t.headerSubtitle, children: "Set the title and deadline for your survey" })
|
|
1281
|
+
] }),
|
|
1282
|
+
/* @__PURE__ */ n(i, { className: t.formFieldBlock, children: [
|
|
1283
|
+
/* @__PURE__ */ n(b, { variant: "subtitle2", className: t.formFieldLabel, children: [
|
|
1284
|
+
"Title ",
|
|
1285
|
+
/* @__PURE__ */ e("span", { className: t.requiredAsterisk, children: "*" })
|
|
1286
|
+
] }),
|
|
1287
|
+
/* @__PURE__ */ e(
|
|
1288
|
+
J,
|
|
1289
|
+
{
|
|
1290
|
+
fullWidth: !0,
|
|
1291
|
+
variant: "outlined",
|
|
1292
|
+
value: a.title,
|
|
1293
|
+
onChange: (f) => C(f.target.value),
|
|
1294
|
+
placeholder: "Enter survey title",
|
|
1295
|
+
className: t.customTextField
|
|
1296
|
+
}
|
|
1297
|
+
)
|
|
1298
|
+
] }),
|
|
1299
|
+
/* @__PURE__ */ n(i, { className: t.formFieldBlock, children: [
|
|
1300
|
+
/* @__PURE__ */ n(b, { variant: "subtitle2", className: t.formFieldLabel, children: [
|
|
1301
|
+
"Deadline ",
|
|
1302
|
+
/* @__PURE__ */ e("span", { className: t.requiredAsterisk, children: "*" })
|
|
1303
|
+
] }),
|
|
1304
|
+
/* @__PURE__ */ e(kt, { dateAdapter: zt, children: /* @__PURE__ */ e(
|
|
1305
|
+
Pt,
|
|
1306
|
+
{
|
|
1307
|
+
value: a.deadline ? ke(a.deadline, "DD.MM.YYYY hh:mm A") : null,
|
|
1308
|
+
onChange: (f) => {
|
|
1309
|
+
l(f ? f.format("DD.MM.YYYY hh:mm A") : "");
|
|
1310
|
+
},
|
|
1311
|
+
format: "DD.MM.YYYY hh:mm A",
|
|
1312
|
+
slotProps: {
|
|
1313
|
+
textField: {
|
|
1314
|
+
fullWidth: !0,
|
|
1315
|
+
variant: "outlined",
|
|
1316
|
+
placeholder: "DD.MM.YYYY hh:mm A",
|
|
1317
|
+
className: t.customTextField
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
) }),
|
|
1322
|
+
/* @__PURE__ */ e(b, { variant: "caption", className: t.formFieldHelperText, children: "Select the date and time when the survey will close" })
|
|
1323
|
+
] }),
|
|
1324
|
+
/* @__PURE__ */ e(
|
|
1325
|
+
ge,
|
|
1326
|
+
{
|
|
1327
|
+
currentStep: s,
|
|
1328
|
+
totalSteps: u,
|
|
1329
|
+
onPrevious: r,
|
|
1330
|
+
onNext: h,
|
|
1331
|
+
isNextDisabled: !a.title || a.title.trim() === "" || !a.deadline
|
|
1332
|
+
}
|
|
1333
|
+
)
|
|
1334
|
+
] }), pe = ({ size: a = 32, color: s = "#C44140" }) => /* @__PURE__ */ e("svg", { width: a, height: a, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ e("path", { d: "M28.2409 -0.141754C25.4195 3.28575 25.0819 7.25702 25.2536 11.6181C25.4635 16.9475 26.3117 24.291 27.1324 29.5842C27.2535 30.3658 26.3405 30.8232 25.7942 30.2545C22.7477 27.0829 19.2078 23.33 16.0196 19.1775C13.2409 22.6735 11.0153 26.7226 8.60824 31.0487C8.37898 31.4608 7.83452 31.5433 7.47943 31.2194C7.07049 30.8465 6.80209 30.3374 6.72382 29.7869C5.03439 17.9028 4.08511 12.0405 3.95375 -0.206989L28.2409 -0.141754Z", fill: s }) }), L = {
|
|
1335
|
+
"flag-of-session": "_flag-of-session_izm26_530",
|
|
1336
|
+
"flag-of-session__title-red": "_flag-of-session__title-red_izm26_539",
|
|
1337
|
+
"flag-of-session__title-red--text": "_flag-of-session__title-red--text_izm26_544",
|
|
1338
|
+
"flag-of-session__title-yellow": "_flag-of-session__title-yellow_izm26_561",
|
|
1339
|
+
"flag-of-session__title-yellow--text": "_flag-of-session__title-yellow--text_izm26_566",
|
|
1340
|
+
"flag-of-session__content-green": "_flag-of-session__content-green_izm26_572",
|
|
1341
|
+
"flag-of-session__content-green--text": "_flag-of-session__content-green--text_izm26_579",
|
|
1342
|
+
"flag-of-session__item": "_flag-of-session__item_izm26_586",
|
|
1343
|
+
"flag-of-session__item--title": "_flag-of-session__item--title_izm26_594",
|
|
1344
|
+
"flag-of-session__item--content": "_flag-of-session__item--content_izm26_601",
|
|
1345
|
+
"flag-of-session__item-column": "_flag-of-session__item-column_izm26_608",
|
|
1346
|
+
"flag-of-session__item-column--no-bold": "_flag-of-session__item-column--no-bold_izm26_620",
|
|
1347
|
+
"flag-of-session__item-column--content": "_flag-of-session__item-column--content_izm26_627"
|
|
1348
|
+
}, qe = (a) => {
|
|
1349
|
+
switch (a) {
|
|
1350
|
+
case "Red Flag":
|
|
1351
|
+
return /* @__PURE__ */ n("div", { className: L["flag-of-session__title-red"], children: [
|
|
1352
|
+
/* @__PURE__ */ e(pe, { color: "#C44140", size: 32 }),
|
|
1353
|
+
/* @__PURE__ */ e("span", { className: L["flag-of-session__title-red--text"], children: "Red Flag" })
|
|
1354
|
+
] });
|
|
1355
|
+
case "Yellow Flag":
|
|
1356
|
+
return /* @__PURE__ */ n("div", { className: L["flag-of-session__title-yellow"], children: [
|
|
1357
|
+
/* @__PURE__ */ e(pe, { color: "#F5D500", size: 32 }),
|
|
1358
|
+
/* @__PURE__ */ e("span", { className: L["flag-of-session__title-yellow--text"], children: "Yellow Flag" })
|
|
1359
|
+
] });
|
|
1360
|
+
default:
|
|
1361
|
+
return null;
|
|
1362
|
+
}
|
|
1363
|
+
}, bs = ({
|
|
1364
|
+
flag: a,
|
|
1365
|
+
flagDetail: s,
|
|
1366
|
+
lastSafetyAnswer: u,
|
|
1367
|
+
lastStressAnswer: C,
|
|
1368
|
+
showResult: l,
|
|
1369
|
+
defaultStress: r,
|
|
1370
|
+
defaultSafety: h,
|
|
1371
|
+
defaultDecrease: f,
|
|
1372
|
+
isDetailView: d,
|
|
1373
|
+
hasReadyToLearn: S,
|
|
1374
|
+
inSession: c
|
|
1375
|
+
}) => l ? /* @__PURE__ */ n("div", { className: L["flag-of-session"], style: { gap: "6px" }, children: [
|
|
1376
|
+
(a === "Green Flag" || a === "Green") && /* @__PURE__ */ n("div", { className: L["flag-of-session__content-green"], children: [
|
|
1377
|
+
"Everything is ",
|
|
1378
|
+
/* @__PURE__ */ e("p", { className: L["flag-of-session__content-green--text"], children: "fine" })
|
|
1379
|
+
] }),
|
|
1380
|
+
d && a && qe(a || ""),
|
|
1381
|
+
s?.stress && (d ? /* @__PURE__ */ n("div", { className: L["flag-of-session__item"], children: [
|
|
1382
|
+
/* @__PURE__ */ e("p", { className: L["flag-of-session__item--title"], children: "Stress score:" }),
|
|
1383
|
+
/* @__PURE__ */ n("p", { className: L["flag-of-session__item--content"], children: [
|
|
1384
|
+
s?.stress?.score,
|
|
1385
|
+
"%"
|
|
1386
|
+
] })
|
|
1387
|
+
] }) : /* @__PURE__ */ n("div", { className: L["flag-of-session__item"], children: [
|
|
1388
|
+
/* @__PURE__ */ n(
|
|
1389
|
+
"span",
|
|
1390
|
+
{
|
|
1391
|
+
style: {
|
|
1392
|
+
fontWeight: 600,
|
|
1393
|
+
color: s?.stress?.flag === "Red Flag" ? "#C44140" : "#F5D500",
|
|
1394
|
+
fontSize: "12px"
|
|
1395
|
+
},
|
|
1396
|
+
children: [
|
|
1397
|
+
s?.stress?.score,
|
|
1398
|
+
"%"
|
|
1399
|
+
]
|
|
1400
|
+
}
|
|
1401
|
+
),
|
|
1402
|
+
"Stress vs Last check-in ",
|
|
1403
|
+
C,
|
|
1404
|
+
"%"
|
|
1405
|
+
] })),
|
|
1406
|
+
s?.safety && (d ? /* @__PURE__ */ n("div", { className: L["flag-of-session__item"], children: [
|
|
1407
|
+
/* @__PURE__ */ e("p", { className: L["flag-of-session__item--title"], children: "Safety score:" }),
|
|
1408
|
+
/* @__PURE__ */ n("p", { className: L["flag-of-session__item--content"], children: [
|
|
1409
|
+
s?.safety?.score,
|
|
1410
|
+
"%"
|
|
1411
|
+
] })
|
|
1412
|
+
] }) : /* @__PURE__ */ n("div", { className: L["flag-of-session__item"], children: [
|
|
1413
|
+
/* @__PURE__ */ n("span", { style: { fontWeight: 600, color: s?.safety?.flag === "Red Flag" ? "#C44140" : "#F5D500" }, children: [
|
|
1414
|
+
s?.safety?.score,
|
|
1415
|
+
"%"
|
|
1416
|
+
] }),
|
|
1417
|
+
" Safety vs Last check-in ",
|
|
1418
|
+
u,
|
|
1419
|
+
"%"
|
|
1420
|
+
] })),
|
|
1421
|
+
s?.decrease && s?.decrease?.length > 0 && (d ? /* @__PURE__ */ n("div", { children: [
|
|
1422
|
+
/* @__PURE__ */ n("p", { className: L["flag-of-session__item--content"], children: [
|
|
1423
|
+
/* @__PURE__ */ e("span", { className: L["flag-of-session__item--title"], children: "Sudden Drop: " }),
|
|
1424
|
+
/* @__PURE__ */ n("span", { className: L["flag-of-session__item--title"], children: [
|
|
1425
|
+
s.decrease.length,
|
|
1426
|
+
" "
|
|
1427
|
+
] }),
|
|
1428
|
+
"core well-being metric shows a decrease of ",
|
|
1429
|
+
f,
|
|
1430
|
+
"% comparing their average of the last four check-ins."
|
|
1431
|
+
] }),
|
|
1432
|
+
/* @__PURE__ */ e("ul", { className: L["flag-of-session__item-column--content"], children: s.decrease?.map((_, y) => /* @__PURE__ */ e("li", { style: { color: "#242424", marginLeft: "16px" }, children: /* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: /* @__PURE__ */ n("p", { style: { margin: 0 }, children: [
|
|
1433
|
+
_.questionText,
|
|
1434
|
+
": ",
|
|
1435
|
+
_.answer,
|
|
1436
|
+
"% ",
|
|
1437
|
+
_.averageOtherRatingsText ? "" : _.averageOtherRatings !== void 0 ? `vs avr ${_.averageOtherRatings}%` : "vs previous"
|
|
1438
|
+
] }) }) }, y)) })
|
|
1439
|
+
] }) : c ? /* @__PURE__ */ n("div", { className: L["flag-of-session__item-column"], children: [
|
|
1440
|
+
/* @__PURE__ */ n("p", { className: L["flag-of-session__item-column--no-bold"], children: [
|
|
1441
|
+
"Sudden Drop: ",
|
|
1442
|
+
s.decrease.length || 0,
|
|
1443
|
+
" core well-being metric shows a decrease compared to the average of the last four check-ins."
|
|
1444
|
+
] }),
|
|
1445
|
+
/* @__PURE__ */ e("ul", { className: L["flag-of-session__item-column--content"], children: s.decrease?.map((_, y) => {
|
|
1446
|
+
const E = a?.includes("Red") ? "#C44140" : "#F5D500";
|
|
1447
|
+
return /* @__PURE__ */ e("li", { style: { color: "#242424", marginLeft: "16px" }, children: /* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
1448
|
+
/* @__PURE__ */ n("p", { style: { margin: 0, fontSize: "12px" }, children: [
|
|
1449
|
+
_.questionText,
|
|
1450
|
+
":"
|
|
1451
|
+
] }),
|
|
1452
|
+
/* @__PURE__ */ n("p", { style: { margin: 0, color: E, fontSize: "12px" }, children: [
|
|
1453
|
+
_.answer,
|
|
1454
|
+
"%"
|
|
1455
|
+
] }),
|
|
1456
|
+
_.averageOtherRatingsText ? "" : _.averageOtherRatings !== void 0 && /* @__PURE__ */ n("p", { style: { margin: 0, fontSize: "12px", marginLeft: "4px" }, children: [
|
|
1457
|
+
"vs avr ",
|
|
1458
|
+
_.averageOtherRatings,
|
|
1459
|
+
"%"
|
|
1460
|
+
] })
|
|
1461
|
+
] }) }, y);
|
|
1462
|
+
}) })
|
|
1463
|
+
] }) : /* @__PURE__ */ n("div", { className: L["flag-of-session__item"], children: [
|
|
1464
|
+
"Sudden Drop: Any core well-being metric shows a percentage decrease of ",
|
|
1465
|
+
f || 20,
|
|
1466
|
+
"% comparing their average of the last four check-ins."
|
|
1467
|
+
] })),
|
|
1468
|
+
s?.readinessToLearn && (d ? /* @__PURE__ */ e("div", { children: /* @__PURE__ */ n("p", { className: L["flag-of-session__item--content"], children: [
|
|
1469
|
+
/* @__PURE__ */ e("span", { className: L["flag-of-session__item--title"], children: "Ready to learn: " }),
|
|
1470
|
+
s?.readinessToLearn
|
|
1471
|
+
] }) }) : /* @__PURE__ */ n("div", { className: L["flag-of-session__item"], children: [
|
|
1472
|
+
"Ready to learn: ",
|
|
1473
|
+
s?.readinessToLearn
|
|
1474
|
+
] }))
|
|
1475
|
+
] }) : /* @__PURE__ */ n("div", { className: L["flag-of-session"], children: [
|
|
1476
|
+
qe(a || ""),
|
|
1477
|
+
h && /* @__PURE__ */ n("div", { className: L["flag-of-session__item"], children: [
|
|
1478
|
+
/* @__PURE__ */ e("p", { className: L["flag-of-session__item--title"], children: "Safety score:" }),
|
|
1479
|
+
/* @__PURE__ */ n("p", { className: L["flag-of-session__item--content"], children: [
|
|
1480
|
+
"Under ",
|
|
1481
|
+
h,
|
|
1482
|
+
"%"
|
|
1483
|
+
] })
|
|
1484
|
+
] }),
|
|
1485
|
+
r && /* @__PURE__ */ n("div", { className: L["flag-of-session__item"], children: [
|
|
1486
|
+
/* @__PURE__ */ e("p", { className: L["flag-of-session__item--title"], children: "Stress level:" }),
|
|
1487
|
+
/* @__PURE__ */ n("p", { className: L["flag-of-session__item--content"], children: [
|
|
1488
|
+
"Higher than ",
|
|
1489
|
+
r,
|
|
1490
|
+
"%"
|
|
1491
|
+
] })
|
|
1492
|
+
] }),
|
|
1493
|
+
f && /* @__PURE__ */ e("div", { children: /* @__PURE__ */ n("p", { className: L["flag-of-session__item--content"], children: [
|
|
1494
|
+
/* @__PURE__ */ e("span", { className: L["flag-of-session__item--title"], children: "Sudden Drop: " }),
|
|
1495
|
+
"Any core well-being metric shows a percentage decrease of ",
|
|
1496
|
+
f,
|
|
1497
|
+
"% comparing their average of the last four check-ins."
|
|
1498
|
+
] }) }),
|
|
1499
|
+
S && /* @__PURE__ */ e("div", { children: /* @__PURE__ */ n("p", { className: L["flag-of-session__item--content"], children: [
|
|
1500
|
+
/* @__PURE__ */ e("span", { className: L["flag-of-session__item--title"], children: "Ready to learn: " }),
|
|
1501
|
+
"The student reported as not ready to learn in last check-in."
|
|
1502
|
+
] }) })
|
|
1503
|
+
] }), Ss = Dt(({ className: a, ...s }) => /* @__PURE__ */ e(Me, { ...s, classes: { popper: a } }))(({ theme: a }) => ({
|
|
1504
|
+
zIndex: 1e3,
|
|
1505
|
+
[`& .${Ie.tooltip}`]: {
|
|
1506
|
+
backgroundColor: "transparent !important",
|
|
1507
|
+
marginTop: "8px !important",
|
|
1508
|
+
fontFamily: "Poppins-Regular"
|
|
1509
|
+
},
|
|
1510
|
+
[`& .${Ie.arrow}`]: {
|
|
1511
|
+
color: a.palette.common.white,
|
|
1512
|
+
top: "4px !important"
|
|
1513
|
+
}
|
|
1514
|
+
})), Ts = (a) => {
|
|
1515
|
+
if (!a) return null;
|
|
1516
|
+
const s = a.toLowerCase();
|
|
1517
|
+
return s === "red" ? /* @__PURE__ */ e(pe, { size: 32, color: "#C44140" }) : s === "yellow" ? /* @__PURE__ */ e(pe, { size: 32, color: "#F5D500" }) : s === "green" ? /* @__PURE__ */ e(pe, { size: 32, color: "#10B981" }) : null;
|
|
1518
|
+
}, Ns = ({
|
|
1519
|
+
students: a,
|
|
1520
|
+
totalStudentsCount: s,
|
|
1521
|
+
totalSelectedCount: u,
|
|
1522
|
+
selectedStudentIds: C,
|
|
1523
|
+
filters: l,
|
|
1524
|
+
gradeOptions: r,
|
|
1525
|
+
flagOptions: h,
|
|
1526
|
+
teacherOptions: f,
|
|
1527
|
+
page: d,
|
|
1528
|
+
rowsPerPage: S,
|
|
1529
|
+
isAllSelected: c,
|
|
1530
|
+
isIndeterminate: _,
|
|
1531
|
+
sortBy: y,
|
|
1532
|
+
sortOrder: w,
|
|
1533
|
+
onSortChange: E,
|
|
1534
|
+
currentStepNumber: k,
|
|
1535
|
+
totalSteps: v,
|
|
1536
|
+
onSearchChange: D,
|
|
1537
|
+
onGradeChange: F,
|
|
1538
|
+
onFlagChange: g,
|
|
1539
|
+
onTeacherChange: R,
|
|
1540
|
+
onPageChange: W,
|
|
1541
|
+
onRowsPerPageChange: H,
|
|
1542
|
+
onToggleSelectAll: Z,
|
|
1543
|
+
onToggleStudent: V,
|
|
1544
|
+
onPrevious: ee,
|
|
1545
|
+
onNext: X
|
|
1546
|
+
}) => {
|
|
1547
|
+
const re = (o) => {
|
|
1548
|
+
F(o.target.value);
|
|
1549
|
+
}, T = (o) => {
|
|
1550
|
+
g(o.target.value);
|
|
1551
|
+
}, N = (o, x) => {
|
|
1552
|
+
R(x || "All Teachers");
|
|
1553
|
+
}, m = Y(() => !f || f.length === 0 ? ["All Teachers"] : f.includes("All Teachers") ? f : ["All Teachers", ...f], [f]), I = (o, x) => {
|
|
1554
|
+
const A = (x.inputValue || "").trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
1555
|
+
return A ? o.filter((Q) => Q.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").includes(A)) : o;
|
|
1556
|
+
};
|
|
1557
|
+
return /* @__PURE__ */ n(i, { className: t.chooseTemplateCard, children: [
|
|
1558
|
+
/* @__PURE__ */ n(i, { className: t.headerSection, children: [
|
|
1559
|
+
/* @__PURE__ */ e(b, { variant: "h5", className: t.headerTitle, children: "Select Students" }),
|
|
1560
|
+
/* @__PURE__ */ e(b, { variant: "body2", className: t.headerSubtitle, children: "Choose the students who should participate in this survey" })
|
|
1561
|
+
] }),
|
|
1562
|
+
/* @__PURE__ */ e(i, { className: t.selectedCountSection, children: /* @__PURE__ */ n(b, { variant: "subtitle1", className: t.selectedCountText, children: [
|
|
1563
|
+
"Selected students",
|
|
1564
|
+
" ",
|
|
1565
|
+
/* @__PURE__ */ e(i, { component: "span", className: t.selectedCountHighlight, children: u })
|
|
1566
|
+
] }) }),
|
|
1567
|
+
/* @__PURE__ */ n(i, { className: t.studentsToolbar, children: [
|
|
1568
|
+
/* @__PURE__ */ e(i, { className: t.searchBarContainer, children: /* @__PURE__ */ e(
|
|
1569
|
+
J,
|
|
1570
|
+
{
|
|
1571
|
+
fullWidth: !0,
|
|
1572
|
+
size: "small",
|
|
1573
|
+
placeholder: "Search students by name or email...",
|
|
1574
|
+
value: l.searchQuery,
|
|
1575
|
+
onChange: (o) => D(o.target.value),
|
|
1576
|
+
className: t.studentSearchInput,
|
|
1577
|
+
InputProps: {
|
|
1578
|
+
startAdornment: /* @__PURE__ */ e(Tt, { position: "start", children: /* @__PURE__ */ e(qt, { sx: { color: "#94a3b8", fontSize: 20 } }) })
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
) }),
|
|
1582
|
+
/* @__PURE__ */ e(i, { className: t.filterDropdownWrapper, children: /* @__PURE__ */ e(we, { size: "small", fullWidth: !0, children: /* @__PURE__ */ e(
|
|
1583
|
+
xe,
|
|
1584
|
+
{
|
|
1585
|
+
value: l.selectedGrade,
|
|
1586
|
+
onChange: re,
|
|
1587
|
+
displayEmpty: !0,
|
|
1588
|
+
className: t.filterSelectBox,
|
|
1589
|
+
children: r.map((o) => /* @__PURE__ */ e(Fe, { value: o, children: o }, o))
|
|
1590
|
+
}
|
|
1591
|
+
) }) }),
|
|
1592
|
+
/* @__PURE__ */ e(i, { className: t.filterDropdownWrapper, children: /* @__PURE__ */ e(we, { size: "small", fullWidth: !0, children: /* @__PURE__ */ e(
|
|
1593
|
+
xe,
|
|
1594
|
+
{
|
|
1595
|
+
value: l.selectedFlag,
|
|
1596
|
+
onChange: T,
|
|
1597
|
+
displayEmpty: !0,
|
|
1598
|
+
className: t.filterSelectBox,
|
|
1599
|
+
children: h.map((o) => /* @__PURE__ */ e(Fe, { value: o.value, children: o.label }, o.value))
|
|
1600
|
+
}
|
|
1601
|
+
) }) }),
|
|
1602
|
+
/* @__PURE__ */ e(i, { className: t.teacherFilterWrapper, children: /* @__PURE__ */ e(
|
|
1603
|
+
Nt,
|
|
1604
|
+
{
|
|
1605
|
+
size: "small",
|
|
1606
|
+
fullWidth: !0,
|
|
1607
|
+
options: m,
|
|
1608
|
+
value: l.selectedTeacher || "All Teachers",
|
|
1609
|
+
onChange: N,
|
|
1610
|
+
disableClearable: l.selectedTeacher === "All Teachers",
|
|
1611
|
+
clearOnBlur: !0,
|
|
1612
|
+
handleHomeEndKeys: !0,
|
|
1613
|
+
isOptionEqualToValue: (o, x) => !x || o === x || x === "All Teachers",
|
|
1614
|
+
filterOptions: I,
|
|
1615
|
+
noOptionsText: "No teachers found",
|
|
1616
|
+
className: t.teacherAutocomplete,
|
|
1617
|
+
classes: {
|
|
1618
|
+
paper: t.teacherAutocompletePaper,
|
|
1619
|
+
listbox: t.teacherAutocompleteListbox
|
|
1620
|
+
},
|
|
1621
|
+
componentsProps: {
|
|
1622
|
+
paper: {
|
|
1623
|
+
className: t.teacherAutocompletePaper,
|
|
1624
|
+
sx: {
|
|
1625
|
+
backgroundColor: "#ffffff !important",
|
|
1626
|
+
color: "#000000 !important"
|
|
1627
|
+
}
|
|
1628
|
+
},
|
|
1629
|
+
popper: {
|
|
1630
|
+
sx: {
|
|
1631
|
+
zIndex: 1300
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
},
|
|
1635
|
+
slotProps: {
|
|
1636
|
+
paper: {
|
|
1637
|
+
className: t.teacherAutocompletePaper,
|
|
1638
|
+
sx: {
|
|
1639
|
+
backgroundColor: "#ffffff !important",
|
|
1640
|
+
color: "#000000 !important"
|
|
1641
|
+
}
|
|
1642
|
+
},
|
|
1643
|
+
popper: {
|
|
1644
|
+
sx: {
|
|
1645
|
+
zIndex: 1300
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
},
|
|
1649
|
+
renderOption: (o, x, { selected: A }) => {
|
|
1650
|
+
const { key: Q, ...p } = o;
|
|
1651
|
+
return /* @__PURE__ */ e(
|
|
1652
|
+
"li",
|
|
1653
|
+
{
|
|
1654
|
+
...p,
|
|
1655
|
+
className: t.teacherOptionItem,
|
|
1656
|
+
style: {
|
|
1657
|
+
backgroundColor: A ? "#f1f5f9" : "#ffffff",
|
|
1658
|
+
color: "#000000",
|
|
1659
|
+
fontSize: "14px",
|
|
1660
|
+
fontWeight: A ? 600 : 500,
|
|
1661
|
+
padding: "9px 14px",
|
|
1662
|
+
cursor: "pointer"
|
|
1663
|
+
},
|
|
1664
|
+
children: x
|
|
1665
|
+
},
|
|
1666
|
+
Q || x
|
|
1667
|
+
);
|
|
1668
|
+
},
|
|
1669
|
+
renderInput: (o) => /* @__PURE__ */ e(
|
|
1670
|
+
J,
|
|
1671
|
+
{
|
|
1672
|
+
...o,
|
|
1673
|
+
placeholder: "All Teachers",
|
|
1674
|
+
size: "small",
|
|
1675
|
+
inputProps: {
|
|
1676
|
+
...o.inputProps,
|
|
1677
|
+
style: {
|
|
1678
|
+
color: "#000000",
|
|
1679
|
+
fontWeight: 500
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
)
|
|
1684
|
+
}
|
|
1685
|
+
) })
|
|
1686
|
+
] }),
|
|
1687
|
+
/* @__PURE__ */ n(i, { className: t.studentsTableContainer, children: [
|
|
1688
|
+
/* @__PURE__ */ n(Te, { className: t.studentsTable, children: [
|
|
1689
|
+
/* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ n(j, { className: t.studentsTableHeaderRow, children: [
|
|
1690
|
+
/* @__PURE__ */ e(B, { className: t.checkboxHeaderCell, children: /* @__PURE__ */ e(
|
|
1691
|
+
ze,
|
|
1692
|
+
{
|
|
1693
|
+
checked: c,
|
|
1694
|
+
indeterminate: _,
|
|
1695
|
+
onChange: Z,
|
|
1696
|
+
sx: {
|
|
1697
|
+
color: "#cbd5e1",
|
|
1698
|
+
"&.Mui-checked": { color: "#2563eb" },
|
|
1699
|
+
"&.MuiCheckbox-indeterminate": { color: "#2563eb" }
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
) }),
|
|
1703
|
+
/* @__PURE__ */ e(B, { className: t.tableHeaderCell, children: /* @__PURE__ */ e(
|
|
1704
|
+
me,
|
|
1705
|
+
{
|
|
1706
|
+
active: y === "name",
|
|
1707
|
+
direction: y === "name" ? w : "asc",
|
|
1708
|
+
onClick: () => E("name"),
|
|
1709
|
+
children: "Student Name"
|
|
1710
|
+
}
|
|
1711
|
+
) }),
|
|
1712
|
+
/* @__PURE__ */ e(B, { className: t.tableHeaderCell, children: /* @__PURE__ */ e(
|
|
1713
|
+
me,
|
|
1714
|
+
{
|
|
1715
|
+
active: y === "flag",
|
|
1716
|
+
direction: y === "flag" ? w : "asc",
|
|
1717
|
+
onClick: () => E("flag"),
|
|
1718
|
+
children: "Flag"
|
|
1719
|
+
}
|
|
1720
|
+
) }),
|
|
1721
|
+
/* @__PURE__ */ e(B, { className: t.tableHeaderCell, children: /* @__PURE__ */ e(
|
|
1722
|
+
me,
|
|
1723
|
+
{
|
|
1724
|
+
active: y === "grade",
|
|
1725
|
+
direction: y === "grade" ? w : "asc",
|
|
1726
|
+
onClick: () => E("grade"),
|
|
1727
|
+
children: "Grade"
|
|
1728
|
+
}
|
|
1729
|
+
) }),
|
|
1730
|
+
/* @__PURE__ */ e(B, { className: t.tableHeaderCell, children: /* @__PURE__ */ e(
|
|
1731
|
+
me,
|
|
1732
|
+
{
|
|
1733
|
+
active: y === "email",
|
|
1734
|
+
direction: y === "email" ? w : "asc",
|
|
1735
|
+
onClick: () => E("email"),
|
|
1736
|
+
children: "Email"
|
|
1737
|
+
}
|
|
1738
|
+
) }),
|
|
1739
|
+
/* @__PURE__ */ e(B, { className: t.tableHeaderCell, children: /* @__PURE__ */ e(
|
|
1740
|
+
me,
|
|
1741
|
+
{
|
|
1742
|
+
active: y === "teacher",
|
|
1743
|
+
direction: y === "teacher" ? w : "asc",
|
|
1744
|
+
onClick: () => E("teacher"),
|
|
1745
|
+
children: "Teacher"
|
|
1746
|
+
}
|
|
1747
|
+
) })
|
|
1748
|
+
] }) }),
|
|
1749
|
+
/* @__PURE__ */ e(ve, { children: a.length === 0 ? /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(B, { colSpan: 5, align: "center", sx: { py: 4, color: "#94a3b8" }, children: "No students found matching current filters." }) }) : a.map((o) => {
|
|
1750
|
+
const x = C.includes(o.id);
|
|
1751
|
+
return /* @__PURE__ */ n(
|
|
1752
|
+
j,
|
|
1753
|
+
{
|
|
1754
|
+
className: `${t.studentTableRow} ${x ? t.selectedRow : ""}`,
|
|
1755
|
+
onClick: () => V(o.id),
|
|
1756
|
+
children: [
|
|
1757
|
+
/* @__PURE__ */ e(
|
|
1758
|
+
B,
|
|
1759
|
+
{
|
|
1760
|
+
className: t.checkboxBodyCell,
|
|
1761
|
+
onClick: (A) => A.stopPropagation(),
|
|
1762
|
+
children: /* @__PURE__ */ e(
|
|
1763
|
+
ze,
|
|
1764
|
+
{
|
|
1765
|
+
checked: x,
|
|
1766
|
+
onChange: () => V(o.id),
|
|
1767
|
+
sx: {
|
|
1768
|
+
color: "#cbd5e1",
|
|
1769
|
+
"&.Mui-checked": { color: "#2563eb" }
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
)
|
|
1773
|
+
}
|
|
1774
|
+
),
|
|
1775
|
+
/* @__PURE__ */ e(B, { className: t.studentNameCell, children: /* @__PURE__ */ n($, { direction: "row", alignItems: "center", spacing: 1.75, children: [
|
|
1776
|
+
/* @__PURE__ */ e(
|
|
1777
|
+
"img",
|
|
1778
|
+
{
|
|
1779
|
+
src: o.avatarUrl,
|
|
1780
|
+
alt: o.name,
|
|
1781
|
+
style: { width: 44, height: 44, borderRadius: "50%", objectFit: "cover" }
|
|
1782
|
+
}
|
|
1783
|
+
),
|
|
1784
|
+
/* @__PURE__ */ e(b, { variant: "body2", className: t.studentNameText, children: o.name })
|
|
1785
|
+
] }) }),
|
|
1786
|
+
/* @__PURE__ */ e(B, { className: t.flagCell, children: /* @__PURE__ */ e(
|
|
1787
|
+
Ss,
|
|
1788
|
+
{
|
|
1789
|
+
arrow: !0,
|
|
1790
|
+
placement: "bottom",
|
|
1791
|
+
title: o?.flag && o.flag !== "none" ? /* @__PURE__ */ e(
|
|
1792
|
+
bs,
|
|
1793
|
+
{
|
|
1794
|
+
flag: o.flag === "red" ? "Red Flag" : o.flag === "yellow" ? "Yellow Flag" : "Green Flag",
|
|
1795
|
+
flagDetail: o.flagDetail,
|
|
1796
|
+
lastSafetyAnswer: o.lastSafetyAnswer,
|
|
1797
|
+
lastStressAnswer: o.lastStressAnswer,
|
|
1798
|
+
showResult: !0
|
|
1799
|
+
}
|
|
1800
|
+
) : "",
|
|
1801
|
+
children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "center", cursor: "pointer" }, children: Ts(o.flag) }) })
|
|
1802
|
+
}
|
|
1803
|
+
) }),
|
|
1804
|
+
/* @__PURE__ */ e(B, { className: t.gradeCell, children: /* @__PURE__ */ e(b, { variant: "body2", className: t.gradeText, children: o.grade }) }),
|
|
1805
|
+
/* @__PURE__ */ e(B, { className: t.emailCell, children: /* @__PURE__ */ e(b, { variant: "body2", className: t.emailText, children: o.email }) }),
|
|
1806
|
+
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(b, { variant: "body2", sx: { color: "#475569" }, children: o.listTeachers && o.listTeachers.length > 0 ? o.listTeachers.map((A) => A.name).filter(Boolean).join(", ") : "-" }) })
|
|
1807
|
+
]
|
|
1808
|
+
},
|
|
1809
|
+
o.id
|
|
1810
|
+
);
|
|
1811
|
+
}) })
|
|
1812
|
+
] }),
|
|
1813
|
+
s > 0 && /* @__PURE__ */ e(
|
|
1814
|
+
vt,
|
|
1815
|
+
{
|
|
1816
|
+
rowsPerPageOptions: [5, 10, 25, 50],
|
|
1817
|
+
component: "div",
|
|
1818
|
+
count: s,
|
|
1819
|
+
rowsPerPage: S,
|
|
1820
|
+
page: d,
|
|
1821
|
+
onPageChange: W,
|
|
1822
|
+
onRowsPerPageChange: H,
|
|
1823
|
+
className: t.studentsPagination
|
|
1824
|
+
}
|
|
1825
|
+
)
|
|
1826
|
+
] }),
|
|
1827
|
+
/* @__PURE__ */ e(
|
|
1828
|
+
ge,
|
|
1829
|
+
{
|
|
1830
|
+
currentStep: k,
|
|
1831
|
+
totalSteps: v,
|
|
1832
|
+
onPrevious: ee,
|
|
1833
|
+
onNext: X
|
|
1834
|
+
}
|
|
1835
|
+
)
|
|
1836
|
+
] });
|
|
1837
|
+
}, vs = ({ size: a = 32, color: s = "#C44140" }) => /* @__PURE__ */ e("svg", { width: a, height: a, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ e("path", { d: "M28.2409 -0.141754C25.4195 3.28575 25.0819 7.25702 25.2536 11.6181C25.4635 16.9475 26.3117 24.291 27.1324 29.5842C27.2535 30.3658 26.3405 30.8232 25.7942 30.2545C22.7477 27.0829 19.2078 23.33 16.0196 19.1775C13.2409 22.6735 11.0153 26.7226 8.60824 31.0487C8.37898 31.4608 7.83452 31.5433 7.47943 31.2194C7.07049 30.8465 6.80209 30.3374 6.72382 29.7869C5.03439 17.9028 4.08511 12.0405 3.95375 -0.206989L28.2409 -0.141754Z", fill: s }) }), ws = wt(({ className: a, ...s }) => /* @__PURE__ */ e(Me, { ...s, classes: { popper: a } }))(() => ({
|
|
1838
|
+
[`& .${Ie.tooltip}`]: {
|
|
1839
|
+
backgroundColor: "#ffffff",
|
|
1840
|
+
color: "#1e293b",
|
|
1841
|
+
maxWidth: 220,
|
|
1842
|
+
fontSize: "0.75rem",
|
|
1843
|
+
border: "1px solid #e2e8f0",
|
|
1844
|
+
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
|
|
1845
|
+
borderRadius: "8px",
|
|
1846
|
+
padding: "8px 12px"
|
|
1847
|
+
},
|
|
1848
|
+
[`& .${Ie.arrow}`]: {
|
|
1849
|
+
color: "#ffffff",
|
|
1850
|
+
"&:before": {
|
|
1851
|
+
border: "1px solid #e2e8f0"
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
})), xs = ({ flag: a, tooltip: s }) => {
|
|
1855
|
+
if (a === "none") return null;
|
|
1856
|
+
let u = "#10B981";
|
|
1857
|
+
return a === "red" ? u = "#D10530" : a === "yellow" ? u = "#F5D500" : a === "green" && (u = "#0F9655"), /* @__PURE__ */ e(ws, { title: s ? /* @__PURE__ */ e(i, { sx: { lineHeight: 1.4 }, children: s }) : /* @__PURE__ */ e(i, { sx: { lineHeight: 1.4 }, children: a === "red" ? /* @__PURE__ */ n(Re, { children: [
|
|
1858
|
+
/* @__PURE__ */ e(i, { component: "span", sx: { color: "#D10530", fontWeight: 700 }, children: "High" }),
|
|
1859
|
+
" Risk,",
|
|
1860
|
+
/* @__PURE__ */ e("br", {}),
|
|
1861
|
+
/* @__PURE__ */ e(i, { component: "span", sx: { color: "#D10530", fontWeight: 700 }, children: "Negative" }),
|
|
1862
|
+
" readiness to learn"
|
|
1863
|
+
] }) : a === "yellow" ? /* @__PURE__ */ n(Re, { children: [
|
|
1864
|
+
/* @__PURE__ */ e(i, { component: "span", sx: { color: "#F5D500", fontWeight: 700 }, children: "Moderate" }),
|
|
1865
|
+
" Risk,",
|
|
1866
|
+
/* @__PURE__ */ e("br", {}),
|
|
1867
|
+
/* @__PURE__ */ e(i, { component: "span", sx: { color: "#F5D500", fontWeight: 700 }, children: "Caution" }),
|
|
1868
|
+
" readiness to learn"
|
|
1869
|
+
] }) : /* @__PURE__ */ n(Re, { children: [
|
|
1870
|
+
/* @__PURE__ */ e(i, { component: "span", sx: { color: "#0F9655", fontWeight: 700 }, children: "Low" }),
|
|
1871
|
+
" Risk,",
|
|
1872
|
+
/* @__PURE__ */ e("br", {}),
|
|
1873
|
+
/* @__PURE__ */ e(i, { component: "span", sx: { color: "#0F9655", fontWeight: 700 }, children: "Positive" }),
|
|
1874
|
+
" readiness to learn"
|
|
1875
|
+
] }) }), arrow: !0, placement: "top", children: /* @__PURE__ */ e(
|
|
1876
|
+
i,
|
|
1877
|
+
{
|
|
1878
|
+
component: "span",
|
|
1879
|
+
sx: {
|
|
1880
|
+
display: "inline-flex",
|
|
1881
|
+
alignItems: "center",
|
|
1882
|
+
cursor: "pointer",
|
|
1883
|
+
transition: "transform 0.15s ease",
|
|
1884
|
+
"&:hover": {
|
|
1885
|
+
transform: "scale(1.15)"
|
|
1886
|
+
}
|
|
1887
|
+
},
|
|
1888
|
+
children: /* @__PURE__ */ e(vs, { color: u, size: 28 })
|
|
1889
|
+
}
|
|
1890
|
+
) });
|
|
1891
|
+
}, Fs = Ae(/* @__PURE__ */ e("path", {
|
|
1892
|
+
d: "M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 16H5V10h14zm0-12H5V6h14zM9 14H7v-2h2zm4 0h-2v-2h2zm4 0h-2v-2h2zm-8 4H7v-2h2zm4 0h-2v-2h2zm4 0h-2v-2h2z"
|
|
1893
|
+
}), "CalendarMonthOutlined"), Is = ({
|
|
1894
|
+
open: a,
|
|
1895
|
+
title: s,
|
|
1896
|
+
description: u,
|
|
1897
|
+
deadline: C,
|
|
1898
|
+
questions: l,
|
|
1899
|
+
onClose: r
|
|
1900
|
+
}) => {
|
|
1901
|
+
const h = (d) => {
|
|
1902
|
+
if (typeof d == "number" || !isNaN(Number(d)) && String(d).trim() !== "")
|
|
1903
|
+
switch (Number(d)) {
|
|
1904
|
+
case 0:
|
|
1905
|
+
return "TextInput";
|
|
1906
|
+
case 1:
|
|
1907
|
+
return "SingleChoice";
|
|
1908
|
+
case 2:
|
|
1909
|
+
return "MultipleChoice";
|
|
1910
|
+
case 3:
|
|
1911
|
+
case 7:
|
|
1912
|
+
return "TextInput";
|
|
1913
|
+
case 4:
|
|
1914
|
+
return "Slider";
|
|
1915
|
+
case 6:
|
|
1916
|
+
return "StarRating";
|
|
1917
|
+
case 8:
|
|
1918
|
+
return "Emotional";
|
|
1919
|
+
case 9:
|
|
1920
|
+
return "Summarize";
|
|
1921
|
+
case 10:
|
|
1922
|
+
return "Rating";
|
|
1923
|
+
case 12:
|
|
1924
|
+
return "DropDown";
|
|
1925
|
+
}
|
|
1926
|
+
const S = String(d || "").trim(), c = S.toLowerCase();
|
|
1927
|
+
return c === "text" || c === "openfield" || c === "default" || c === "textinputwithsuggestions" ? "TextInput" : c === "singlechoice" ? "SingleChoice" : c === "multiplechoice" ? "MultipleChoice" : c === "slider" ? "Slider" : c === "rating" ? "Rating" : c === "starrating" ? "StarRating" : c === "emotional" || c === "emotion" ? "Emotional" : c === "summarize" ? "Summarize" : c === "dropdown" ? "DropDown" : c === "yesno" ? "YesNo" : S;
|
|
1928
|
+
}, f = (d) => {
|
|
1929
|
+
try {
|
|
1930
|
+
const S = document.createElement("textarea");
|
|
1931
|
+
return S.innerHTML = d, S.value;
|
|
1932
|
+
} catch {
|
|
1933
|
+
return d;
|
|
1934
|
+
}
|
|
1935
|
+
};
|
|
1936
|
+
return /* @__PURE__ */ n(
|
|
1937
|
+
He,
|
|
1938
|
+
{
|
|
1939
|
+
open: a,
|
|
1940
|
+
onClose: r,
|
|
1941
|
+
maxWidth: "md",
|
|
1942
|
+
fullWidth: !0,
|
|
1943
|
+
PaperProps: {
|
|
1944
|
+
sx: {
|
|
1945
|
+
borderRadius: "16px",
|
|
1946
|
+
p: 1,
|
|
1947
|
+
maxHeight: "90vh"
|
|
1948
|
+
}
|
|
1949
|
+
},
|
|
1950
|
+
children: [
|
|
1951
|
+
/* @__PURE__ */ n(
|
|
1952
|
+
Qe,
|
|
1953
|
+
{
|
|
1954
|
+
sx: {
|
|
1955
|
+
display: "flex",
|
|
1956
|
+
justifyContent: "space-between",
|
|
1957
|
+
alignItems: "center",
|
|
1958
|
+
pb: 1,
|
|
1959
|
+
fontWeight: 700,
|
|
1960
|
+
fontSize: "1.1rem",
|
|
1961
|
+
color: "#0f172a"
|
|
1962
|
+
},
|
|
1963
|
+
children: [
|
|
1964
|
+
"Survey preview",
|
|
1965
|
+
/* @__PURE__ */ e(xt, { onClick: r, size: "small", sx: { color: "#64748b" }, children: /* @__PURE__ */ e(Wt, { fontSize: "small" }) })
|
|
1966
|
+
]
|
|
1967
|
+
}
|
|
1968
|
+
),
|
|
1969
|
+
/* @__PURE__ */ n(Oe, { dividers: !0, sx: { p: 3 }, children: [
|
|
1970
|
+
/* @__PURE__ */ e(b, { variant: "h6", sx: { fontWeight: 800, color: "#0f172a", mb: 0.5 }, children: s || "Student Well Being" }),
|
|
1971
|
+
/* @__PURE__ */ e(b, { variant: "body2", sx: { color: "#64748b", mb: 2 }, children: u || "General assessment of student wellness and quality of life" }),
|
|
1972
|
+
C && /* @__PURE__ */ n($, { direction: "row", spacing: 1, alignItems: "center", sx: { color: "#64748b", mb: 3 }, children: [
|
|
1973
|
+
/* @__PURE__ */ e(Fs, { sx: { fontSize: 16, color: "#2563eb" } }),
|
|
1974
|
+
/* @__PURE__ */ n(b, { variant: "caption", sx: { fontWeight: 600 }, children: [
|
|
1975
|
+
"Due: ",
|
|
1976
|
+
C
|
|
1977
|
+
] })
|
|
1978
|
+
] }),
|
|
1979
|
+
/* @__PURE__ */ e($, { spacing: 3, children: l.map((d, S) => {
|
|
1980
|
+
const c = h(d.type), y = (d.options && d.options.length > 0 ? d.options : d.answers && Array.isArray(d.answers) ? d.answers : []).map((w) => typeof w == "string" ? w : w?.text ?? w?.answerText ?? w?.name ?? String(w || "")).filter((w) => !!(w && w.trim()));
|
|
1981
|
+
return /* @__PURE__ */ n(i, { sx: { pb: 1 }, children: [
|
|
1982
|
+
/* @__PURE__ */ n(i, { sx: { display: "flex", gap: "4px", fontWeight: 600, color: "#1e293b", mb: 1.5, fontSize: "0.875rem" }, children: [
|
|
1983
|
+
/* @__PURE__ */ n(i, { children: [
|
|
1984
|
+
S + 1,
|
|
1985
|
+
"."
|
|
1986
|
+
] }),
|
|
1987
|
+
/* @__PURE__ */ e(i, { sx: { "& p": { m: 0, display: "inline" }, "& span": { display: "inline" } }, dangerouslySetInnerHTML: { __html: f(d.questionText || "") } })
|
|
1988
|
+
] }),
|
|
1989
|
+
(c === "Rating" || c === "StarRating" || c === "Slider") && /* @__PURE__ */ e(i, { sx: { px: 2, py: 1 }, children: /* @__PURE__ */ e(
|
|
1990
|
+
Ht,
|
|
1991
|
+
{
|
|
1992
|
+
questionId: Number(d.id) || 0,
|
|
1993
|
+
valueText: "50",
|
|
1994
|
+
minText: d.fromLabel || "",
|
|
1995
|
+
maxText: d.toLabel || "",
|
|
1996
|
+
isBeforeSession: !1,
|
|
1997
|
+
isPageResult: !1
|
|
1998
|
+
}
|
|
1999
|
+
) }),
|
|
2000
|
+
c === "MultipleChoice" && /* @__PURE__ */ e(i, { sx: { px: 2 }, children: /* @__PURE__ */ e(
|
|
2001
|
+
Qt,
|
|
2002
|
+
{
|
|
2003
|
+
questionId: Number(d.id) || 0,
|
|
2004
|
+
valueText: "",
|
|
2005
|
+
isUserChangeSession: !0,
|
|
2006
|
+
questionAnswer: y,
|
|
2007
|
+
isPageResult: !1
|
|
2008
|
+
}
|
|
2009
|
+
) }),
|
|
2010
|
+
(c === "YesNo" || c === "SingleChoice") && /* @__PURE__ */ e(i, { sx: { px: 2 }, children: /* @__PURE__ */ e(
|
|
2011
|
+
Ot,
|
|
2012
|
+
{
|
|
2013
|
+
questionId: Number(d.id) || 0,
|
|
2014
|
+
valueText: "",
|
|
2015
|
+
isUserChangeSession: !0,
|
|
2016
|
+
questionAnswer: y.length > 0 ? y : c === "YesNo" ? ["Yes", "No"] : [],
|
|
2017
|
+
isPageResult: !1
|
|
2018
|
+
}
|
|
2019
|
+
) }),
|
|
2020
|
+
c === "Emotional" && /* @__PURE__ */ e(i, { sx: { px: 2, py: 1 }, children: /* @__PURE__ */ e(
|
|
2021
|
+
Mt,
|
|
2022
|
+
{
|
|
2023
|
+
questionId: Number(d.id) || 0,
|
|
2024
|
+
emotionTypeList: y.length > 0 ? y.map((w, E) => ({
|
|
2025
|
+
id: E,
|
|
2026
|
+
text: w,
|
|
2027
|
+
emotionalText: w
|
|
2028
|
+
})) : [
|
|
2029
|
+
{ id: 0, text: "Very sad", emotionalText: "Very sad" },
|
|
2030
|
+
{ id: 1, text: "Sad", emotionalText: "Sad" },
|
|
2031
|
+
{ id: 2, text: "Normal", emotionalText: "Normal" },
|
|
2032
|
+
{ id: 3, text: "Happy", emotionalText: "Happy" },
|
|
2033
|
+
{ id: 4, text: "Very happy", emotionalText: "Very happy" }
|
|
2034
|
+
],
|
|
2035
|
+
isPreviewPage: !0
|
|
2036
|
+
}
|
|
2037
|
+
) }),
|
|
2038
|
+
c === "TextInput" && /* @__PURE__ */ e(i, { sx: { px: 2 }, children: /* @__PURE__ */ e(
|
|
2039
|
+
J,
|
|
2040
|
+
{
|
|
2041
|
+
fullWidth: !0,
|
|
2042
|
+
multiline: !0,
|
|
2043
|
+
rows: 2,
|
|
2044
|
+
placeholder: "Your answer...",
|
|
2045
|
+
size: "small",
|
|
2046
|
+
sx: {
|
|
2047
|
+
"& .MuiOutlinedInput-root": {
|
|
2048
|
+
borderRadius: "8px",
|
|
2049
|
+
backgroundColor: "#ffffff"
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
) }),
|
|
2054
|
+
c === "DropDown" && /* @__PURE__ */ e(i, { sx: { px: 2 }, children: /* @__PURE__ */ e(
|
|
2055
|
+
Yt,
|
|
2056
|
+
{
|
|
2057
|
+
questionItemName: "",
|
|
2058
|
+
questionId: Number(d.id) || 0,
|
|
2059
|
+
valueText: "",
|
|
2060
|
+
isUserChangeSession: !0,
|
|
2061
|
+
questionAnswer: y.map((w, E) => ({ id: E, text: w }))
|
|
2062
|
+
}
|
|
2063
|
+
) }),
|
|
2064
|
+
c === "Summarize" && /* @__PURE__ */ e(i, { sx: { px: 2 }, children: /* @__PURE__ */ e(
|
|
2065
|
+
J,
|
|
2066
|
+
{
|
|
2067
|
+
fullWidth: !0,
|
|
2068
|
+
multiline: !0,
|
|
2069
|
+
rows: 4,
|
|
2070
|
+
placeholder: "Summarize your thoughts...",
|
|
2071
|
+
size: "small",
|
|
2072
|
+
sx: {
|
|
2073
|
+
"& .MuiOutlinedInput-root": {
|
|
2074
|
+
borderRadius: "8px",
|
|
2075
|
+
backgroundColor: "#ffffff"
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
) }),
|
|
2080
|
+
![
|
|
2081
|
+
"Rating",
|
|
2082
|
+
"StarRating",
|
|
2083
|
+
"Slider",
|
|
2084
|
+
"MultipleChoice",
|
|
2085
|
+
"YesNo",
|
|
2086
|
+
"SingleChoice",
|
|
2087
|
+
"Emotional",
|
|
2088
|
+
"TextInput",
|
|
2089
|
+
"DropDown",
|
|
2090
|
+
"Summarize"
|
|
2091
|
+
].includes(c) && /* @__PURE__ */ e(i, { sx: { px: 2 }, children: /* @__PURE__ */ e(
|
|
2092
|
+
J,
|
|
2093
|
+
{
|
|
2094
|
+
fullWidth: !0,
|
|
2095
|
+
multiline: !0,
|
|
2096
|
+
rows: 2,
|
|
2097
|
+
placeholder: "Your answer...",
|
|
2098
|
+
size: "small",
|
|
2099
|
+
sx: {
|
|
2100
|
+
"& .MuiOutlinedInput-root": {
|
|
2101
|
+
borderRadius: "8px",
|
|
2102
|
+
backgroundColor: "#ffffff"
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
) })
|
|
2107
|
+
] }, d.id);
|
|
2108
|
+
}) })
|
|
2109
|
+
] })
|
|
2110
|
+
]
|
|
2111
|
+
}
|
|
2112
|
+
);
|
|
2113
|
+
}, As = ({
|
|
2114
|
+
templateFormData: a,
|
|
2115
|
+
surveyFormData: s,
|
|
2116
|
+
selectedStudents: u,
|
|
2117
|
+
currentStepNumber: C,
|
|
2118
|
+
totalSteps: l,
|
|
2119
|
+
onEditTemplateDetails: r,
|
|
2120
|
+
onEditSurveyDetails: h,
|
|
2121
|
+
onEditSelectedStudents: f,
|
|
2122
|
+
onPrevious: d,
|
|
2123
|
+
onPublish: S
|
|
2124
|
+
}) => {
|
|
2125
|
+
const [c, _] = M(!1);
|
|
2126
|
+
return /* @__PURE__ */ n(i, { className: t.chooseTemplateCard, children: [
|
|
2127
|
+
/* @__PURE__ */ n(i, { className: t.reviewSectionBlock, children: [
|
|
2128
|
+
/* @__PURE__ */ n(i, { className: t.reviewSectionHeader, children: [
|
|
2129
|
+
/* @__PURE__ */ e(b, { variant: "h6", className: t.reviewSectionTitle, children: "Template Details" }),
|
|
2130
|
+
/* @__PURE__ */ e(
|
|
2131
|
+
G,
|
|
2132
|
+
{
|
|
2133
|
+
variant: "text",
|
|
2134
|
+
onClick: r,
|
|
2135
|
+
startIcon: /* @__PURE__ */ e(fe, { sx: { fontSize: 16 } }),
|
|
2136
|
+
className: t.reviewEditSectionBtn,
|
|
2137
|
+
children: "EDIT"
|
|
2138
|
+
}
|
|
2139
|
+
)
|
|
2140
|
+
] }),
|
|
2141
|
+
/* @__PURE__ */ n(i, { className: t.reviewFieldGroup, children: [
|
|
2142
|
+
/* @__PURE__ */ e(b, { variant: "caption", className: t.reviewFieldLabel, children: "Template Name" }),
|
|
2143
|
+
/* @__PURE__ */ e(b, { variant: "body2", className: t.reviewFieldValue, children: a.templateName || "Well-being" })
|
|
2144
|
+
] }),
|
|
2145
|
+
/* @__PURE__ */ n(i, { className: t.reviewFieldGroup, children: [
|
|
2146
|
+
/* @__PURE__ */ e(b, { variant: "caption", className: t.reviewFieldLabel, children: "Description and instructions of when to use" }),
|
|
2147
|
+
/* @__PURE__ */ e(b, { variant: "body2", className: t.reviewFieldValue, children: a.description || "General assessment of student wellness and quality of life" })
|
|
2148
|
+
] }),
|
|
2149
|
+
/* @__PURE__ */ n(i, { className: t.reviewFieldGroup, sx: { mt: 3 }, children: [
|
|
2150
|
+
/* @__PURE__ */ e(b, { variant: "caption", className: t.reviewFieldLabel, children: "Questions" }),
|
|
2151
|
+
/* @__PURE__ */ e(b, { variant: "h6", className: t.questionsHeadingText, sx: { mb: 1.5 }, children: /* @__PURE__ */ e("span", { className: t.questionCountBadge, children: a.questions.length }) }),
|
|
2152
|
+
/* @__PURE__ */ e(i, { className: t.reviewQuestionsTableContainer, children: /* @__PURE__ */ n(Te, { className: t.questionsTable, children: [
|
|
2153
|
+
/* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ n(j, { className: t.tableHeaderRow, children: [
|
|
2154
|
+
/* @__PURE__ */ e(B, { className: t.thNumber, children: "#" }),
|
|
2155
|
+
/* @__PURE__ */ e(B, { className: t.thQuestion, children: "Question" }),
|
|
2156
|
+
/* @__PURE__ */ e(B, { className: t.thType, children: "Type" }),
|
|
2157
|
+
/* @__PURE__ */ e(B, { className: t.thCategory, children: "Category" })
|
|
2158
|
+
] }) }),
|
|
2159
|
+
/* @__PURE__ */ e(ve, { children: a.questions.map((y, w) => /* @__PURE__ */ n(j, { className: t.tableBodyRow, children: [
|
|
2160
|
+
/* @__PURE__ */ n(B, { className: t.tdNumber, children: [
|
|
2161
|
+
w + 1,
|
|
2162
|
+
"."
|
|
2163
|
+
] }),
|
|
2164
|
+
/* @__PURE__ */ e(B, { className: t.tdQuestion, children: /* @__PURE__ */ e(
|
|
2165
|
+
b,
|
|
2166
|
+
{
|
|
2167
|
+
variant: "body2",
|
|
2168
|
+
className: t.questionText,
|
|
2169
|
+
dangerouslySetInnerHTML: {
|
|
2170
|
+
__html: y.questionText || ""
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
) }),
|
|
2174
|
+
/* @__PURE__ */ e(B, { className: t.tdType, children: /* @__PURE__ */ e(Je, { type: y.type }) }),
|
|
2175
|
+
/* @__PURE__ */ e(B, { className: t.tdCategory, children: /* @__PURE__ */ e(b, { variant: "body2", className: t.categoryText, children: y.category }) })
|
|
2176
|
+
] }, y.id)) })
|
|
2177
|
+
] }) })
|
|
2178
|
+
] })
|
|
2179
|
+
] }),
|
|
2180
|
+
/* @__PURE__ */ n(i, { className: t.reviewSectionBlock, children: [
|
|
2181
|
+
/* @__PURE__ */ n(i, { className: t.reviewSectionHeader, children: [
|
|
2182
|
+
/* @__PURE__ */ e(b, { variant: "h6", className: t.reviewSectionTitle, children: "Survey Details" }),
|
|
2183
|
+
/* @__PURE__ */ e(
|
|
2184
|
+
G,
|
|
2185
|
+
{
|
|
2186
|
+
variant: "text",
|
|
2187
|
+
onClick: h,
|
|
2188
|
+
startIcon: /* @__PURE__ */ e(fe, { sx: { fontSize: 16 } }),
|
|
2189
|
+
className: t.reviewEditSectionBtn,
|
|
2190
|
+
children: "EDIT"
|
|
2191
|
+
}
|
|
2192
|
+
)
|
|
2193
|
+
] }),
|
|
2194
|
+
/* @__PURE__ */ n(i, { className: t.reviewFieldGroup, children: [
|
|
2195
|
+
/* @__PURE__ */ e(b, { variant: "caption", className: t.reviewFieldLabel, children: "Title" }),
|
|
2196
|
+
/* @__PURE__ */ e(b, { variant: "body2", className: t.reviewFieldValue, children: s.title || "Student Well Being" })
|
|
2197
|
+
] }),
|
|
2198
|
+
/* @__PURE__ */ n(i, { className: t.reviewFieldGroup, children: [
|
|
2199
|
+
/* @__PURE__ */ e(b, { variant: "caption", className: t.reviewFieldLabel, children: "Deadline" }),
|
|
2200
|
+
/* @__PURE__ */ e(b, { variant: "body2", className: t.reviewFieldValue, children: s.deadline || "15th January 2026, 12:00 PM" })
|
|
2201
|
+
] })
|
|
2202
|
+
] }),
|
|
2203
|
+
/* @__PURE__ */ n(i, { className: t.reviewSectionBlock, children: [
|
|
2204
|
+
/* @__PURE__ */ n(i, { className: t.reviewSectionHeader, children: [
|
|
2205
|
+
/* @__PURE__ */ n(b, { variant: "h6", className: t.reviewSectionTitle, children: [
|
|
2206
|
+
"Selected Students",
|
|
2207
|
+
" ",
|
|
2208
|
+
/* @__PURE__ */ e(i, { component: "span", sx: { color: "#2563eb", fontWeight: 700 }, children: u.length })
|
|
2209
|
+
] }),
|
|
2210
|
+
/* @__PURE__ */ e(
|
|
2211
|
+
G,
|
|
2212
|
+
{
|
|
2213
|
+
variant: "text",
|
|
2214
|
+
onClick: f,
|
|
2215
|
+
startIcon: /* @__PURE__ */ e(fe, { sx: { fontSize: 16 } }),
|
|
2216
|
+
className: t.reviewEditSectionBtn,
|
|
2217
|
+
children: "EDIT"
|
|
2218
|
+
}
|
|
2219
|
+
)
|
|
2220
|
+
] }),
|
|
2221
|
+
/* @__PURE__ */ e(i, { className: t.studentsTableContainer, children: /* @__PURE__ */ n(Te, { className: t.studentsTable, children: [
|
|
2222
|
+
/* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ n(j, { className: t.tableHeaderRow, children: [
|
|
2223
|
+
/* @__PURE__ */ e(B, { className: t.tableHeaderCell, children: "Student Name" }),
|
|
2224
|
+
/* @__PURE__ */ e(B, { className: t.tableHeaderCell, children: "Flag" }),
|
|
2225
|
+
/* @__PURE__ */ e(B, { className: t.tableHeaderCell, children: "Grade" }),
|
|
2226
|
+
/* @__PURE__ */ e(B, { className: t.tableHeaderCell, children: "Email" })
|
|
2227
|
+
] }) }),
|
|
2228
|
+
/* @__PURE__ */ e(ve, { children: u.length === 0 ? /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(B, { colSpan: 4, align: "center", sx: { py: 3, color: "#94a3b8" }, children: "No students selected." }) }) : u.map((y) => /* @__PURE__ */ n(j, { className: t.studentTableRow, children: [
|
|
2229
|
+
/* @__PURE__ */ e(B, { className: t.studentNameCell, children: /* @__PURE__ */ n($, { direction: "row", alignItems: "center", spacing: 1.5, children: [
|
|
2230
|
+
/* @__PURE__ */ e(
|
|
2231
|
+
Ft,
|
|
2232
|
+
{
|
|
2233
|
+
src: y.avatarUrl,
|
|
2234
|
+
alt: y.name,
|
|
2235
|
+
sx: {
|
|
2236
|
+
width: 28,
|
|
2237
|
+
height: 28,
|
|
2238
|
+
fontSize: "0.75rem",
|
|
2239
|
+
bgcolor: "#e0e7ff",
|
|
2240
|
+
color: "#3730a3"
|
|
2241
|
+
},
|
|
2242
|
+
children: y.name.charAt(0)
|
|
2243
|
+
}
|
|
2244
|
+
),
|
|
2245
|
+
/* @__PURE__ */ e(b, { variant: "body2", className: t.studentNameText, children: y.name })
|
|
2246
|
+
] }) }),
|
|
2247
|
+
/* @__PURE__ */ e(B, { className: t.flagCell, children: /* @__PURE__ */ e(
|
|
2248
|
+
xs,
|
|
2249
|
+
{
|
|
2250
|
+
flag: y.flag,
|
|
2251
|
+
tooltip: y.flagTooltip
|
|
2252
|
+
}
|
|
2253
|
+
) }),
|
|
2254
|
+
/* @__PURE__ */ e(B, { className: t.gradeCell, children: /* @__PURE__ */ e(b, { variant: "body2", className: t.gradeText, children: y.grade }) }),
|
|
2255
|
+
/* @__PURE__ */ e(B, { className: t.emailCell, children: /* @__PURE__ */ e(b, { variant: "body2", className: t.emailText, children: y.email }) })
|
|
2256
|
+
] }, y.id)) })
|
|
2257
|
+
] }) })
|
|
2258
|
+
] }),
|
|
2259
|
+
/* @__PURE__ */ e(
|
|
2260
|
+
ge,
|
|
2261
|
+
{
|
|
2262
|
+
currentStep: C,
|
|
2263
|
+
totalSteps: l,
|
|
2264
|
+
isLastStep: !0,
|
|
2265
|
+
nextLabel: "PUBLISH",
|
|
2266
|
+
onPreview: () => _(!0),
|
|
2267
|
+
onPrevious: d,
|
|
2268
|
+
onNext: S
|
|
2269
|
+
}
|
|
2270
|
+
),
|
|
2271
|
+
/* @__PURE__ */ e(
|
|
2272
|
+
Is,
|
|
2273
|
+
{
|
|
2274
|
+
open: c,
|
|
2275
|
+
title: s.title || a.templateName,
|
|
2276
|
+
description: a.description,
|
|
2277
|
+
deadline: s.deadline,
|
|
2278
|
+
questions: a.questions,
|
|
2279
|
+
onClose: () => _(!1)
|
|
2280
|
+
}
|
|
2281
|
+
)
|
|
2282
|
+
] });
|
|
2283
|
+
}, Bs = [
|
|
2284
|
+
{
|
|
2285
|
+
id: "q-1",
|
|
2286
|
+
orderNumber: 1,
|
|
2287
|
+
questionText: "How would you rate your overall well-being?",
|
|
2288
|
+
type: "Rating",
|
|
2289
|
+
category: "Overall Well-being"
|
|
2290
|
+
},
|
|
2291
|
+
{
|
|
2292
|
+
id: "q-2",
|
|
2293
|
+
orderNumber: 2,
|
|
2294
|
+
questionText: "Do you feel balanced in your daily life?",
|
|
2295
|
+
type: "YesNo",
|
|
2296
|
+
category: "Life Balance"
|
|
2297
|
+
},
|
|
2298
|
+
{
|
|
2299
|
+
id: "q-3",
|
|
2300
|
+
orderNumber: 3,
|
|
2301
|
+
questionText: "What contributes most to your well-being?",
|
|
2302
|
+
type: "Text",
|
|
2303
|
+
category: "Well-being Factors"
|
|
2304
|
+
}
|
|
2305
|
+
], Ls = ({
|
|
2306
|
+
template: a,
|
|
2307
|
+
initialDraftData: s,
|
|
2308
|
+
onSave: u,
|
|
2309
|
+
onCancel: C,
|
|
2310
|
+
onAddQuestionRedirect: l,
|
|
2311
|
+
onEditQuestionRedirect: r
|
|
2312
|
+
}) => {
|
|
2313
|
+
const h = Y(() => a.rawTemplate ? Se(a.rawTemplate.questionTemplates, a.category || "Well-being") : Bs, [a]), [f, d] = M(() => s || {
|
|
2314
|
+
id: a.id,
|
|
2315
|
+
templateName: a.title,
|
|
2316
|
+
description: a.description || "",
|
|
2317
|
+
showLandingPageFlag: !1,
|
|
2318
|
+
selectedCategoryFilter: "All",
|
|
2319
|
+
questions: h
|
|
2320
|
+
}), S = Y(() => {
|
|
2321
|
+
const F = /* @__PURE__ */ new Set();
|
|
2322
|
+
f.questions.forEach((R) => {
|
|
2323
|
+
const W = R.category?.trim();
|
|
2324
|
+
W && F.add(W);
|
|
2325
|
+
});
|
|
2326
|
+
const g = Array.from(F);
|
|
2327
|
+
return g.length > 0 ? ["All", ...g] : ["All"];
|
|
2328
|
+
}, [f.questions]), c = Y(() => f.selectedCategoryFilter === "All" ? f.questions : f.questions.filter(
|
|
2329
|
+
(F) => F.category === f.selectedCategoryFilter
|
|
2330
|
+
), [f.questions, f.selectedCategoryFilter]), _ = (F) => {
|
|
2331
|
+
d((g) => ({ ...g, templateName: F }));
|
|
2332
|
+
}, y = (F) => {
|
|
2333
|
+
d((g) => ({ ...g, description: F }));
|
|
2334
|
+
}, w = (F) => {
|
|
2335
|
+
d((g) => ({ ...g, selectedCategoryFilter: F }));
|
|
2336
|
+
}, E = (F) => {
|
|
2337
|
+
r && r(F, f);
|
|
2338
|
+
}, k = (F) => {
|
|
2339
|
+
d((g) => ({
|
|
2340
|
+
...g,
|
|
2341
|
+
questions: g.questions.filter((R) => R.id !== F).map((R, W) => ({ ...R, orderNumber: W + 1 }))
|
|
2342
|
+
}));
|
|
2343
|
+
}, v = () => {
|
|
2344
|
+
l && l(f);
|
|
2345
|
+
}, D = () => {
|
|
2346
|
+
const F = {
|
|
2347
|
+
...a,
|
|
2348
|
+
title: f.templateName,
|
|
2349
|
+
description: f.description,
|
|
2350
|
+
questionCount: f.questions.length,
|
|
2351
|
+
rawTemplate: {
|
|
2352
|
+
...a.rawTemplate,
|
|
2353
|
+
questionTemplates: f.questions.map((g, R) => ({
|
|
2354
|
+
...g,
|
|
2355
|
+
questionId: typeof g.id == "number" || String(g.id).startsWith("q-") ? g.id : parseInt(String(g.id)),
|
|
2356
|
+
questionText: g.questionText,
|
|
2357
|
+
type: g.type,
|
|
2358
|
+
category: g.category,
|
|
2359
|
+
fromLabel: g.fromLabel,
|
|
2360
|
+
toLabel: g.toLabel,
|
|
2361
|
+
numberOfStars: g.numberOfStars,
|
|
2362
|
+
orderDefaultQuestionTemplate: g.orderNumber ?? R + 1,
|
|
2363
|
+
options: g.options || [],
|
|
2364
|
+
answers: g.options && Array.isArray(g.options) && g.options.length > 0 ? g.options.map((W, H) => ({
|
|
2365
|
+
id: 0,
|
|
2366
|
+
text: typeof W == "string" ? W : W?.text || "",
|
|
2367
|
+
order: H
|
|
2368
|
+
})) : g.answers || []
|
|
2369
|
+
}))
|
|
2370
|
+
}
|
|
2371
|
+
};
|
|
2372
|
+
u(F);
|
|
2373
|
+
};
|
|
2374
|
+
return {
|
|
2375
|
+
formData: f,
|
|
2376
|
+
categoryOptions: S,
|
|
2377
|
+
filteredQuestions: c,
|
|
2378
|
+
totalQuestionsCount: f.questions.length,
|
|
2379
|
+
handleTemplateNameChange: _,
|
|
2380
|
+
handleDescriptionChange: y,
|
|
2381
|
+
handleCategoryFilterChange: w,
|
|
2382
|
+
handleEditQuestion: E,
|
|
2383
|
+
handleRemoveQuestion: k,
|
|
2384
|
+
handleAddQuestion: v,
|
|
2385
|
+
handleSave: D,
|
|
2386
|
+
handleCancel: C
|
|
2387
|
+
};
|
|
2388
|
+
}, Rs = ({
|
|
2389
|
+
template: a,
|
|
2390
|
+
initialDraftData: s,
|
|
2391
|
+
onSave: u,
|
|
2392
|
+
onCancel: C,
|
|
2393
|
+
onAddQuestionRedirect: l,
|
|
2394
|
+
onEditQuestionRedirect: r
|
|
2395
|
+
}) => {
|
|
2396
|
+
const {
|
|
2397
|
+
formData: h,
|
|
2398
|
+
categoryOptions: f,
|
|
2399
|
+
filteredQuestions: d,
|
|
2400
|
+
totalQuestionsCount: S,
|
|
2401
|
+
handleTemplateNameChange: c,
|
|
2402
|
+
handleDescriptionChange: _,
|
|
2403
|
+
handleCategoryFilterChange: y,
|
|
2404
|
+
handleEditQuestion: w,
|
|
2405
|
+
handleRemoveQuestion: E,
|
|
2406
|
+
handleAddQuestion: k,
|
|
2407
|
+
handleSave: v,
|
|
2408
|
+
handleCancel: D
|
|
2409
|
+
} = Ls({
|
|
2410
|
+
template: a,
|
|
2411
|
+
initialDraftData: s,
|
|
2412
|
+
onSave: u,
|
|
2413
|
+
onCancel: C,
|
|
2414
|
+
onAddQuestionRedirect: l,
|
|
2415
|
+
onEditQuestionRedirect: r
|
|
2416
|
+
});
|
|
2417
|
+
se(() => {
|
|
2418
|
+
window.scrollTo({ top: 0, behavior: "instant" });
|
|
2419
|
+
const g = document.querySelector("main");
|
|
2420
|
+
g && g.scrollTo({ top: 0, behavior: "instant" });
|
|
2421
|
+
const R = document.documentElement || document.body;
|
|
2422
|
+
R && (R.scrollTop = 0);
|
|
2423
|
+
}, []);
|
|
2424
|
+
const F = (g) => {
|
|
2425
|
+
y(g.target.value);
|
|
2426
|
+
};
|
|
2427
|
+
return /* @__PURE__ */ n(i, { className: t.chooseTemplateCard, children: [
|
|
2428
|
+
/* @__PURE__ */ n(i, { className: t.editTemplateHeaderSection, children: [
|
|
2429
|
+
/* @__PURE__ */ e(b, { variant: "h5", className: t.headerTitle, children: "Edit Template" }),
|
|
2430
|
+
/* @__PURE__ */ n($, { direction: "row", alignItems: "center", spacing: 2, children: [
|
|
2431
|
+
/* @__PURE__ */ e(
|
|
2432
|
+
G,
|
|
2433
|
+
{
|
|
2434
|
+
onClick: D,
|
|
2435
|
+
className: t.editTemplateCancelBtn,
|
|
2436
|
+
children: "CANCEL"
|
|
2437
|
+
}
|
|
2438
|
+
),
|
|
2439
|
+
/* @__PURE__ */ e(
|
|
2440
|
+
G,
|
|
2441
|
+
{
|
|
2442
|
+
variant: "contained",
|
|
2443
|
+
onClick: v,
|
|
2444
|
+
startIcon: /* @__PURE__ */ e(Ve, {}),
|
|
2445
|
+
className: t.editTemplateSaveBtn,
|
|
2446
|
+
disabled: !h.templateName || h.templateName.trim() === "",
|
|
2447
|
+
children: "SAVE CHANGES"
|
|
2448
|
+
}
|
|
2449
|
+
)
|
|
2450
|
+
] })
|
|
2451
|
+
] }),
|
|
2452
|
+
/* @__PURE__ */ n(i, { className: t.formFieldBlock, children: [
|
|
2453
|
+
/* @__PURE__ */ n(b, { variant: "subtitle2", className: t.formFieldLabel, children: [
|
|
2454
|
+
"Template Name ",
|
|
2455
|
+
/* @__PURE__ */ e("span", { className: t.requiredAsterisk, children: "*" })
|
|
2456
|
+
] }),
|
|
2457
|
+
/* @__PURE__ */ e(
|
|
2458
|
+
J,
|
|
2459
|
+
{
|
|
2460
|
+
fullWidth: !0,
|
|
2461
|
+
variant: "outlined",
|
|
2462
|
+
value: h.templateName,
|
|
2463
|
+
onChange: (g) => c(g.target.value),
|
|
2464
|
+
placeholder: "Enter template name",
|
|
2465
|
+
className: t.customTextField
|
|
2466
|
+
}
|
|
2467
|
+
)
|
|
2468
|
+
] }),
|
|
2469
|
+
/* @__PURE__ */ n(i, { className: t.formFieldBlock, children: [
|
|
2470
|
+
/* @__PURE__ */ e(b, { variant: "subtitle2", className: t.formFieldLabel, children: "Description and instructions of when to use" }),
|
|
2471
|
+
/* @__PURE__ */ e(
|
|
2472
|
+
J,
|
|
2473
|
+
{
|
|
2474
|
+
fullWidth: !0,
|
|
2475
|
+
multiline: !0,
|
|
2476
|
+
rows: 3,
|
|
2477
|
+
variant: "outlined",
|
|
2478
|
+
value: h.description,
|
|
2479
|
+
onChange: (g) => _(g.target.value),
|
|
2480
|
+
placeholder: "Enter description and instructions",
|
|
2481
|
+
className: t.customTextField
|
|
2482
|
+
}
|
|
2483
|
+
)
|
|
2484
|
+
] }),
|
|
2485
|
+
/* @__PURE__ */ n(i, { className: t.questionsHeaderSection, children: [
|
|
2486
|
+
/* @__PURE__ */ n($, { direction: "row", alignItems: "center", spacing: 0.75, sx: { mb: 1.5 }, children: [
|
|
2487
|
+
/* @__PURE__ */ e(b, { variant: "subtitle1", className: t.questionsTitle, children: "Questions" }),
|
|
2488
|
+
/* @__PURE__ */ e(b, { variant: "subtitle1", className: t.questionsCountNumber, children: S })
|
|
2489
|
+
] }),
|
|
2490
|
+
/* @__PURE__ */ n($, { direction: "row", alignItems: "center", spacing: 1.5, className: t.filterByRow, children: [
|
|
2491
|
+
/* @__PURE__ */ e(b, { variant: "body2", className: t.filterByLabel, children: "Filter by category" }),
|
|
2492
|
+
/* @__PURE__ */ e(we, { size: "small", className: t.categoryFilterFormControl, children: /* @__PURE__ */ e(
|
|
2493
|
+
xe,
|
|
2494
|
+
{
|
|
2495
|
+
value: h.selectedCategoryFilter,
|
|
2496
|
+
onChange: F,
|
|
2497
|
+
className: t.categorySelectInput,
|
|
2498
|
+
children: f.map((g) => /* @__PURE__ */ e(Fe, { value: g, children: g }, g))
|
|
2499
|
+
}
|
|
2500
|
+
) })
|
|
2501
|
+
] })
|
|
2502
|
+
] }),
|
|
2503
|
+
/* @__PURE__ */ e(
|
|
2504
|
+
Ze,
|
|
2505
|
+
{
|
|
2506
|
+
questions: d,
|
|
2507
|
+
onEditQuestion: w,
|
|
2508
|
+
onRemoveQuestion: E
|
|
2509
|
+
}
|
|
2510
|
+
),
|
|
2511
|
+
/* @__PURE__ */ e(i, { className: t.addQuestionWrapper, children: /* @__PURE__ */ e(
|
|
2512
|
+
G,
|
|
2513
|
+
{
|
|
2514
|
+
onClick: k,
|
|
2515
|
+
startIcon: /* @__PURE__ */ e(je, {}),
|
|
2516
|
+
className: t.addQuestionBtn,
|
|
2517
|
+
children: "ADD QUESTION"
|
|
2518
|
+
}
|
|
2519
|
+
) })
|
|
2520
|
+
] });
|
|
2521
|
+
}, Zs = () => {
|
|
2522
|
+
const a = Ye(), s = Ge((z) => z?.common?.user?.roles), u = $e(), C = Y(() => {
|
|
2523
|
+
if (localStorage.getItem("is_returning_from_question") === "true") {
|
|
2524
|
+
const U = localStorage.getItem("create_survey_draft");
|
|
2525
|
+
if (U)
|
|
2526
|
+
try {
|
|
2527
|
+
return JSON.parse(U);
|
|
2528
|
+
} catch {
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
return null;
|
|
2532
|
+
}, []);
|
|
2533
|
+
se(() => {
|
|
2534
|
+
const z = setTimeout(() => {
|
|
2535
|
+
localStorage.getItem("is_returning_from_question") === "true" ? localStorage.removeItem("is_returning_from_question") : localStorage.removeItem("create_survey_draft");
|
|
2536
|
+
}, 500);
|
|
2537
|
+
return () => clearTimeout(z);
|
|
2538
|
+
}, []);
|
|
2539
|
+
const {
|
|
2540
|
+
steps: l,
|
|
2541
|
+
activeStep: r,
|
|
2542
|
+
categories: h,
|
|
2543
|
+
selectedCategory: f,
|
|
2544
|
+
selectedTemplateId: d,
|
|
2545
|
+
templates: S,
|
|
2546
|
+
editingTemplate: c,
|
|
2547
|
+
handleSelectCategory: _,
|
|
2548
|
+
handleSelectTemplate: y,
|
|
2549
|
+
handleCreateBlankSurvey: w,
|
|
2550
|
+
handleEditTemplate: E,
|
|
2551
|
+
handleCloseEditTemplate: k,
|
|
2552
|
+
handleSaveEditTemplate: v,
|
|
2553
|
+
handleGoBackToDashboard: D,
|
|
2554
|
+
handlePreviousStep: F,
|
|
2555
|
+
handleNextStep: g,
|
|
2556
|
+
handleGoToStep: R
|
|
2557
|
+
} = Ut(C), W = Y(() => {
|
|
2558
|
+
if (d === "BLANK") return null;
|
|
2559
|
+
if (d) {
|
|
2560
|
+
const z = S.find((U) => U.id === d);
|
|
2561
|
+
return z || null;
|
|
2562
|
+
}
|
|
2563
|
+
return S.length > 0 ? S[0] : null;
|
|
2564
|
+
}, [S, d]), {
|
|
2565
|
+
formData: H,
|
|
2566
|
+
questionCategories: Z,
|
|
2567
|
+
filteredQuestions: V,
|
|
2568
|
+
totalQuestionsCount: ee,
|
|
2569
|
+
handleTemplateNameChange: X,
|
|
2570
|
+
handleDescriptionChange: re,
|
|
2571
|
+
handleCategoryFilterChange: T,
|
|
2572
|
+
handleRemoveQuestion: N,
|
|
2573
|
+
resetFormDataWithTemplate: m
|
|
2574
|
+
} = Vt(d, W, C), {
|
|
2575
|
+
formData: I,
|
|
2576
|
+
handleTitleChange: o,
|
|
2577
|
+
handleDeadlineChange: x
|
|
2578
|
+
} = Kt(C), {
|
|
2579
|
+
students: A,
|
|
2580
|
+
allFilteredStudents: Q,
|
|
2581
|
+
allStudents: p,
|
|
2582
|
+
totalStudentsCount: P,
|
|
2583
|
+
totalSelectedCount: K,
|
|
2584
|
+
selectedStudentIds: te,
|
|
2585
|
+
filters: ne,
|
|
2586
|
+
gradeOptions: _e,
|
|
2587
|
+
flagOptions: ie,
|
|
2588
|
+
teacherOptions: Be,
|
|
2589
|
+
isAllSelected: Le,
|
|
2590
|
+
isIndeterminate: oe,
|
|
2591
|
+
handleSortChange: Xe,
|
|
2592
|
+
handleSearchChange: et,
|
|
2593
|
+
handleGradeFilterChange: tt,
|
|
2594
|
+
handleFlagFilterChange: nt,
|
|
2595
|
+
handleTeacherFilterChange: at,
|
|
2596
|
+
handlePageChange: st,
|
|
2597
|
+
handleRowsPerPageChange: rt,
|
|
2598
|
+
handleToggleSelectAll: lt,
|
|
2599
|
+
handleToggleStudent: it
|
|
2600
|
+
} = Zt(C), Ce = (z) => {
|
|
2601
|
+
const U = {
|
|
2602
|
+
activeStep: r,
|
|
2603
|
+
selectedCategory: f,
|
|
2604
|
+
selectedTemplateId: d,
|
|
2605
|
+
step2FormData: H,
|
|
2606
|
+
step3FormData: I,
|
|
2607
|
+
selectedStudentIds: te,
|
|
2608
|
+
editingTemplate: c,
|
|
2609
|
+
...z
|
|
2610
|
+
};
|
|
2611
|
+
localStorage.setItem("create_survey_draft", JSON.stringify(U));
|
|
2612
|
+
}, ot = () => {
|
|
2613
|
+
Ce(), u("/admin/create-survey-question?type=0&from=create-survey");
|
|
2614
|
+
}, ct = (z) => {
|
|
2615
|
+
Ce(), u(`/admin/survey-question-detail/${z}?type=0&from=create-survey`);
|
|
2616
|
+
}, dt = Y(() => (p && p.length > 0 ? p : Q || A).filter((U) => te.includes(U.id)), [p, Q, A, te]), ut = async () => {
|
|
2617
|
+
const z = /* @__PURE__ */ new Map();
|
|
2618
|
+
(p && p.length > 0 ? p : Q || A || []).forEach((q) => z.set(q.id, q));
|
|
2619
|
+
const ce = [], de = [], ye = [];
|
|
2620
|
+
te.forEach((q) => {
|
|
2621
|
+
const O = z.get(q);
|
|
2622
|
+
if (O)
|
|
2623
|
+
O.schoolLevel === "ES" && O.userId ? (de.push(O.userId), ye.push({
|
|
2624
|
+
userId: O.userId,
|
|
2625
|
+
name: O.name,
|
|
2626
|
+
firstName: O.name?.split(" ")?.[0] || "",
|
|
2627
|
+
email: O.email,
|
|
2628
|
+
studentId: O.studentId
|
|
2629
|
+
})) : O.studentId !== void 0 ? ce.push(O.studentId) : typeof q == "number" ? ce.push(q) : O.userId && (de.push(O.userId), ye.push({
|
|
2630
|
+
userId: O.userId,
|
|
2631
|
+
name: O.name,
|
|
2632
|
+
firstName: O.name?.split(" ")?.[0] || "",
|
|
2633
|
+
email: O.email,
|
|
2634
|
+
studentId: O.studentId
|
|
2635
|
+
}));
|
|
2636
|
+
else if (typeof q == "number" || !isNaN(Number(q)) && !String(q).includes("-"))
|
|
2637
|
+
ce.push(Number(q));
|
|
2638
|
+
else {
|
|
2639
|
+
const ue = String(q);
|
|
2640
|
+
de.push(ue), ye.push({
|
|
2641
|
+
userId: ue,
|
|
2642
|
+
name: `Student ${ue}`,
|
|
2643
|
+
firstName: "Student",
|
|
2644
|
+
email: ""
|
|
2645
|
+
});
|
|
2646
|
+
}
|
|
2647
|
+
});
|
|
2648
|
+
const pt = [
|
|
2649
|
+
{
|
|
2650
|
+
id: d,
|
|
2651
|
+
name: H.templateName,
|
|
2652
|
+
title: H.templateName,
|
|
2653
|
+
description: H.description,
|
|
2654
|
+
numberQuestion: H.questions.length,
|
|
2655
|
+
orderDefaultSurvey: 1,
|
|
2656
|
+
questionTemplates: H.questions.map((q, O) => ({
|
|
2657
|
+
questionId: typeof q.id == "string" && q.id.startsWith("q-") ? 0 : Number(q.id),
|
|
2658
|
+
questionText: q.questionText,
|
|
2659
|
+
type: q.type || "MultipleChoice",
|
|
2660
|
+
orderDefaultQuestionTemplate: q.orderNumber ?? O,
|
|
2661
|
+
answers: q.options && Array.isArray(q.options) ? q.options.map((ue, Ct) => ({
|
|
2662
|
+
id: 0,
|
|
2663
|
+
text: ue,
|
|
2664
|
+
order: Ct
|
|
2665
|
+
})) : q.answers || []
|
|
2666
|
+
}))
|
|
2667
|
+
}
|
|
2668
|
+
], gt = I.deadline ? ke(I.deadline, "DD.MM.YYYY hh:mm A").valueOf() : null, _t = {
|
|
2669
|
+
title: I.title,
|
|
2670
|
+
deadline: gt,
|
|
2671
|
+
studentIds: ce,
|
|
2672
|
+
esStudentUserIds: de,
|
|
2673
|
+
studentUserIds: de,
|
|
2674
|
+
esStudents: ye,
|
|
2675
|
+
additionalQuestions: [],
|
|
2676
|
+
staffIds: [],
|
|
2677
|
+
summarizeQuestions: [],
|
|
2678
|
+
isAdmin: !0,
|
|
2679
|
+
isDraft: !1,
|
|
2680
|
+
role: Array.isArray(s) ? s.join(",") : s ? String(s) : "Admin",
|
|
2681
|
+
templateQuestions: pt
|
|
2682
|
+
};
|
|
2683
|
+
try {
|
|
2684
|
+
a(le(!0)), await Rt(_t), a(
|
|
2685
|
+
he({
|
|
2686
|
+
type: "success",
|
|
2687
|
+
message: "Publish survey success"
|
|
2688
|
+
})
|
|
2689
|
+
), D();
|
|
2690
|
+
} catch (q) {
|
|
2691
|
+
console.error("Error publishing survey:", q), a(
|
|
2692
|
+
he({
|
|
2693
|
+
type: "danger",
|
|
2694
|
+
message: q?.response?.data?.title || q?.message || "Failed to publish survey"
|
|
2695
|
+
})
|
|
2696
|
+
);
|
|
2697
|
+
} finally {
|
|
2698
|
+
a(le(!1));
|
|
2699
|
+
}
|
|
2700
|
+
};
|
|
2701
|
+
se(() => {
|
|
2702
|
+
window.scrollTo({ top: 0, behavior: "instant" });
|
|
2703
|
+
const z = document.querySelector("main");
|
|
2704
|
+
z && z.scrollTo({ top: 0, behavior: "instant" });
|
|
2705
|
+
const U = document.documentElement || document.body;
|
|
2706
|
+
U && (U.scrollTop = 0);
|
|
2707
|
+
}, [r, c]);
|
|
2708
|
+
const mt = (z) => {
|
|
2709
|
+
Ce({ editingTemplateFormData: z }), u("/admin/create-survey-question?type=0&from=edit-template");
|
|
2710
|
+
}, ht = (z, U) => {
|
|
2711
|
+
Ce({ editingTemplateFormData: U }), u(`/admin/survey-question-detail/${z}?type=0&from=edit-template`);
|
|
2712
|
+
}, ft = async (z) => {
|
|
2713
|
+
await v(z), (d === z.id || !d) && m(z);
|
|
2714
|
+
};
|
|
2715
|
+
return c ? /* @__PURE__ */ e(i, { className: t.createSurveyPage, children: /* @__PURE__ */ e(i, { className: t.contentBody, children: /* @__PURE__ */ e(
|
|
2716
|
+
Rs,
|
|
2717
|
+
{
|
|
2718
|
+
template: c,
|
|
2719
|
+
initialDraftData: C?.editingTemplateFormData,
|
|
2720
|
+
onSave: ft,
|
|
2721
|
+
onCancel: k,
|
|
2722
|
+
onAddQuestionRedirect: mt,
|
|
2723
|
+
onEditQuestionRedirect: ht
|
|
2724
|
+
}
|
|
2725
|
+
) }) }) : /* @__PURE__ */ n(i, { className: t.createSurveyPage, children: [
|
|
2726
|
+
/* @__PURE__ */ e(i, { className: t.headerTopBar, children: /* @__PURE__ */ e(
|
|
2727
|
+
us,
|
|
2728
|
+
{
|
|
2729
|
+
steps: l,
|
|
2730
|
+
activeStep: r,
|
|
2731
|
+
onBack: D
|
|
2732
|
+
}
|
|
2733
|
+
) }),
|
|
2734
|
+
/* @__PURE__ */ n(i, { className: t.contentBody, children: [
|
|
2735
|
+
r === 0 && /* @__PURE__ */ e(
|
|
2736
|
+
gs,
|
|
2737
|
+
{
|
|
2738
|
+
categories: h,
|
|
2739
|
+
selectedCategory: f,
|
|
2740
|
+
templates: S,
|
|
2741
|
+
selectedTemplateId: d,
|
|
2742
|
+
currentStepNumber: r + 1,
|
|
2743
|
+
totalSteps: l.length,
|
|
2744
|
+
onSelectCategory: _,
|
|
2745
|
+
onSelectTemplate: y,
|
|
2746
|
+
onCreateBlank: w,
|
|
2747
|
+
onEditTemplate: E,
|
|
2748
|
+
onPrevious: F,
|
|
2749
|
+
onNext: g
|
|
2750
|
+
}
|
|
2751
|
+
),
|
|
2752
|
+
r === 1 && /* @__PURE__ */ e(
|
|
2753
|
+
Cs,
|
|
2754
|
+
{
|
|
2755
|
+
formData: H,
|
|
2756
|
+
questionCategories: Z,
|
|
2757
|
+
filteredQuestions: V,
|
|
2758
|
+
totalQuestionsCount: ee,
|
|
2759
|
+
currentStepNumber: r + 1,
|
|
2760
|
+
totalSteps: l.length,
|
|
2761
|
+
onTemplateNameChange: X,
|
|
2762
|
+
onDescriptionChange: re,
|
|
2763
|
+
onCategoryFilterChange: T,
|
|
2764
|
+
onEditQuestion: ct,
|
|
2765
|
+
onRemoveQuestion: N,
|
|
2766
|
+
onAddQuestion: ot,
|
|
2767
|
+
onPrevious: F,
|
|
2768
|
+
onNext: g
|
|
2769
|
+
}
|
|
2770
|
+
),
|
|
2771
|
+
r === 2 && /* @__PURE__ */ e(
|
|
2772
|
+
ys,
|
|
2773
|
+
{
|
|
2774
|
+
formData: I,
|
|
2775
|
+
currentStepNumber: r + 1,
|
|
2776
|
+
totalSteps: l.length,
|
|
2777
|
+
onTitleChange: o,
|
|
2778
|
+
onDeadlineChange: x,
|
|
2779
|
+
onPrevious: F,
|
|
2780
|
+
onNext: g
|
|
2781
|
+
}
|
|
2782
|
+
),
|
|
2783
|
+
r === 3 && /* @__PURE__ */ e(
|
|
2784
|
+
Ns,
|
|
2785
|
+
{
|
|
2786
|
+
students: A,
|
|
2787
|
+
totalStudentsCount: P,
|
|
2788
|
+
totalSelectedCount: K,
|
|
2789
|
+
selectedStudentIds: te,
|
|
2790
|
+
filters: ne,
|
|
2791
|
+
gradeOptions: _e,
|
|
2792
|
+
flagOptions: ie,
|
|
2793
|
+
teacherOptions: Be,
|
|
2794
|
+
page: ne.page,
|
|
2795
|
+
rowsPerPage: ne.rowsPerPage,
|
|
2796
|
+
isAllSelected: Le,
|
|
2797
|
+
isIndeterminate: oe,
|
|
2798
|
+
sortBy: ne.sortBy,
|
|
2799
|
+
sortOrder: ne.sortOrder,
|
|
2800
|
+
onSortChange: Xe,
|
|
2801
|
+
currentStepNumber: r + 1,
|
|
2802
|
+
totalSteps: l.length,
|
|
2803
|
+
onSearchChange: et,
|
|
2804
|
+
onGradeChange: tt,
|
|
2805
|
+
onFlagChange: nt,
|
|
2806
|
+
onTeacherChange: at,
|
|
2807
|
+
onPageChange: st,
|
|
2808
|
+
onRowsPerPageChange: rt,
|
|
2809
|
+
onToggleSelectAll: lt,
|
|
2810
|
+
onToggleStudent: it,
|
|
2811
|
+
onPrevious: F,
|
|
2812
|
+
onNext: g
|
|
2813
|
+
}
|
|
2814
|
+
),
|
|
2815
|
+
r === 4 && /* @__PURE__ */ e(
|
|
2816
|
+
As,
|
|
2817
|
+
{
|
|
2818
|
+
templateFormData: H,
|
|
2819
|
+
surveyFormData: I,
|
|
2820
|
+
selectedStudents: dt,
|
|
2821
|
+
currentStepNumber: r + 1,
|
|
2822
|
+
totalSteps: l.length,
|
|
2823
|
+
onEditTemplateDetails: () => R(1),
|
|
2824
|
+
onEditSurveyDetails: () => R(2),
|
|
2825
|
+
onEditSelectedStudents: () => R(3),
|
|
2826
|
+
onPrevious: F,
|
|
2827
|
+
onPublish: ut
|
|
2828
|
+
}
|
|
2829
|
+
)
|
|
2830
|
+
] })
|
|
2831
|
+
] });
|
|
2832
|
+
};
|
|
2833
|
+
export {
|
|
2834
|
+
Zs as default
|
|
2835
|
+
};
|