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