feat(adherents): ajouter le récapitulatif des équipements et le filtre par statut dans la liste des adhérents

This commit is contained in:
2026-08-07 14:45:43 +02:00
parent 14730e667f
commit 2bd623b719
2 changed files with 57 additions and 2 deletions
@@ -47,6 +47,7 @@ public class AdherentController {
@org.springframework.web.bind.annotation.RequestParam(required = false) String nom,
@org.springframework.web.bind.annotation.RequestParam(required = false) String prenom,
@org.springframework.web.bind.annotation.RequestParam(required = false) String categorie,
@org.springframework.web.bind.annotation.RequestParam(required = false) String equipements,
@org.springframework.web.bind.annotation.RequestParam(required = false) String licence,
@org.springframework.web.bind.annotation.RequestParam(required = false) String email,
@org.springframework.web.bind.annotation.RequestParam(required = false) String paiement,
@@ -89,6 +90,26 @@ public class AdherentController {
).collect(java.util.stream.Collectors.toList());
model.addAttribute("categorieFilter", categorie.trim());
}
if (equipements != null && !equipements.trim().isEmpty()) {
String eqFilter = equipements.trim();
adherents = adherents.stream().filter(a -> {
Licence lic = a.getLicenceActuelle();
if (lic == null || lic.getDotations() == null || lic.getDotations().isEmpty()) {
return false;
}
long total = lic.getDotations().size();
long fournis = lic.getDotations().stream().filter(d -> Boolean.TRUE.equals(d.getFourni())).count();
if ("TOUT_FOURNI".equalsIgnoreCase(eqFilter)) {
return fournis == total;
} else if ("PARTIEL".equalsIgnoreCase(eqFilter)) {
return fournis > 0 && fournis < total;
} else if ("NON_FOURNI".equalsIgnoreCase(eqFilter)) {
return fournis == 0;
}
return true;
}).collect(java.util.stream.Collectors.toList());
model.addAttribute("equipementsFilter", eqFilter);
}
if (licence != null && !licence.trim().isEmpty()) {
String l = licence.trim().toLowerCase();
adherents = adherents.stream().filter(a ->