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