11package de .kaleidox .workbench .controller ;
22
33import de .kaleidox .workbench .model .jpa .timetable .TimetableEntry ;
4+ import de .kaleidox .workbench .repo .CustomerRepository ;
45import de .kaleidox .workbench .repo .TimetableEntryRepository ;
56import de .kaleidox .workbench .repo .UserRepository ;
67import org .jetbrains .annotations .Nullable ;
910import org .springframework .stereotype .Controller ;
1011import org .springframework .ui .Model ;
1112import org .springframework .web .bind .annotation .GetMapping ;
13+ import org .springframework .web .bind .annotation .ModelAttribute ;
1214import org .springframework .web .bind .annotation .RequestMapping ;
1315import org .springframework .web .bind .annotation .RequestParam ;
1416
1921@ RequestMapping ("/timetable" )
2022public class TimetableController {
2123 @ Autowired UserRepository users ;
24+ @ Autowired CustomerRepository customers ;
2225 @ Autowired TimetableEntryRepository entries ;
2326
27+ @ ModelAttribute ("users" )
28+ public UserRepository users () {
29+ return users ;
30+ }
31+
32+ @ ModelAttribute ("customers" )
33+ public CustomerRepository customers () {
34+ return customers ;
35+ }
36+
2437 @ GetMapping
2538 public String index (
2639 Model model , Authentication auth , @ RequestParam (required = false ) @ Nullable Short year ,
@@ -44,7 +57,6 @@ public String index(
4457 display = entries .findThisWeekByUser (user .getUsername ());
4558 }
4659
47- model .addAttribute ("user" , user );
4860 model .addAttribute ("entries" , display );
4961 model .addAttribute ("displayInfoText" , displayInfoText );
5062
0 commit comments