feat(adherents): ajouter le récapitulatif des équipements et le filtre par statut dans la liste des adhérents
This commit is contained in:
@@ -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 ->
|
||||
|
||||
Reference in New Issue
Block a user