diff --git a/as-talange-web/src/main/java/com/astalange/web/controller/AdherentController.java b/as-talange-web/src/main/java/com/astalange/web/controller/AdherentController.java index a7e67b5..7a99baa 100644 --- a/as-talange-web/src/main/java/com/astalange/web/controller/AdherentController.java +++ b/as-talange-web/src/main/java/com/astalange/web/controller/AdherentController.java @@ -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 -> diff --git a/as-talange-web/src/main/resources/templates/adherents/list.html b/as-talange-web/src/main/resources/templates/adherents/list.html index c740961..3b6a51b 100644 --- a/as-talange-web/src/main/resources/templates/adherents/list.html +++ b/as-talange-web/src/main/resources/templates/adherents/list.html @@ -74,7 +74,7 @@
| @@ -107,6 +107,7 @@ | +Équipements |
N° Licence
@@ -147,6 +148,14 @@
+
+
+ |
|
@@ -174,7 +183,7 @@
| ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Aucun adhérent enregistré. | +Aucun adhérent enregistré. | |||||||||||||||
| @@ -188,6 +197,31 @@ | Jean | - | + +
+
+
+ Complet (3/3)
+
+
+
+
+ ✓
+ Maillot
+
+
+
+ -
+
+ |
- | jean@example.com | |||||||||||