added next

This commit is contained in:
Jottyfan
2024-07-30 10:43:25 +02:00
parent aadfdfa9b5
commit e3ebc387bb
12 changed files with 436 additions and 139 deletions

View File

@@ -0,0 +1,38 @@
package de.jottyfan.bico.modules.next;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import de.jottyfan.bico.modules.CommonController;
/**
*
* @author jotty
*
*/
@Controller
public class NextController extends CommonController {
@Autowired
private NextService service;
@GetMapping("/next")
public String getNext(Model model) {
model.addAttribute("list", service.getNext(LocalDate.now()));
return "/next";
}
@GetMapping("/next/{date}")
public String getNextForDate(@PathVariable("date") String dateStr, Model model) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate date = LocalDate.parse(dateStr, formatter);
model.addAttribute("list", service.getNext(date));
return "/next";
}
}