package com.utopiaindustries.controller; import com.utopiaindustries.service.DashboardService; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.ui.Model; import java.time.LocalDate; @Controller @RequestMapping("/dashboard") public class DashboardController { private final DashboardService dashboardService; public DashboardController(DashboardService dashboardService) { this.dashboardService = dashboardService; } @GetMapping("/{lineNumber}") public String getDashboard(@PathVariable("lineNumber") String lineNumber, Model model) { model.addAttribute("refresh", true); model.addAttribute("phases", dashboardService.getPhasesProgressDayWise(lineNumber)); model.addAttribute("date", LocalDate.now()); model.addAttribute("day", LocalDate.now().getDayOfWeek()); model.addAttribute("detail", dashboardService.getLineDetails(lineNumber) ); return "dashboard"; } }