feat: gestion des dotations equipements et historique des paiements

This commit is contained in:
2026-05-19 22:15:33 +02:00
parent ee85d38c43
commit 5e0b9ab02a
15 changed files with 435 additions and 7 deletions
@@ -0,0 +1,38 @@
package com.astalange.web.controller;
import com.astalange.core.entity.Dotation;
import com.astalange.core.repository.DotationRepository;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class DotationController {
private final DotationRepository dotationRepository;
public DotationController(DotationRepository dotationRepository) {
this.dotationRepository = dotationRepository;
}
@PostMapping("/dotations/{id}")
public String updateDotation(
@PathVariable Long id,
@RequestParam Long adherentId,
@RequestParam(required = false, defaultValue = "") String taille,
@RequestParam(required = false, defaultValue = "") String flocage,
@RequestParam(required = false) Boolean fourni) {
Dotation dotation = dotationRepository.findById(id)
.orElseThrow(() -> new IllegalArgumentException("Invalid Dotation ID: " + id));
dotation.setTaille(taille);
dotation.setFlocage(flocage);
dotation.setFourni(fourni != null && fourni);
dotationRepository.save(dotation);
return "redirect:/adherents/" + adherentId + "/edit";
}
}