fix parent, teacher and admin pages

This commit is contained in:
root
2026-04-25 00:00:23 -04:00
parent 4cd98f1d30
commit eafe4eb134
30 changed files with 1566 additions and 105 deletions
@@ -41,6 +41,7 @@ class TeacherDashboardService
'students' => [],
'studentsBySection' => [],
'active_class_section_id' => null,
'class_section_name' => null,
'assignedNames' => [],
];
}
@@ -118,12 +119,24 @@ class TeacherDashboardService
$teacher = User::query()->find($userId)?->toArray();
$classSectionName = null;
if ($activeClassSectionId !== null && (int) $activeClassSectionId > 0) {
foreach ($classes as $row) {
if ((int) ($row['class_section_id'] ?? 0) === (int) $activeClassSectionId) {
$n = trim((string) ($row['class_section_name'] ?? ''));
$classSectionName = $n !== '' ? $n : null;
break;
}
}
}
return [
'teacher' => $teacher,
'classes' => $classes,
'students' => $activeClassSectionId ? ($studentsBySection[$activeClassSectionId] ?? []) : [],
'studentsBySection' => $studentsBySection,
'active_class_section_id' => $activeClassSectionId,
'class_section_name' => $classSectionName,
'assignedNames' => $assignedNames,
];
}