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