mario-education 2.0.183-staging → 2.0.185-staging

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