package ru.mcs.diary.dashboard;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import ru.mcs.diary.auth.CurrentUser;
import ru.mcs.diary.auth.CustomUserDetails;
import ru.mcs.diary.parent.ParentRepository;
import ru.mcs.diary.student.StudentRepository;
@Controller
@RequestMapping("/teacher")
@RequiredArgsConstructor
public class DashboardController {
private final StudentRepository studentRepository;
private final ParentRepository parentRepository;
// Позже добавим GroupRepository и LessonRepository
@GetMapping("/dashboard")
public String dashboard(@CurrentUser CustomUserDetails user, Model model) {
Long teacherId = user.getTeacherId();
model.addAttribute("user", user);
model.addAttribute("activeMenu", "dashboard");
model.addAttribute("pageTitle", "Главная");
// Статистика
model.addAttribute("studentCount", studentRepository.countByTeacherId(teacherId));
model.addAttribute("parentCount", parentRepository.countByTeacherId(teacherId));
model.addAttribute("groupCount", 0); // TODO: добавить после создания групп
model.addAttribute("todayLessonsCount", 0); // TODO: добавить после создания расписания
// Занятия на сегодня (пока пустой список)
model.addAttribute("todayLessons", java.util.Collections.emptyList());
return "dashboard/index";
}
}