fix(equipements): ne calculer et n'afficher que les equipements choisis sur la grille adherents
AS Talange CI/CD Pipeline / Build & Run Unit Tests (push) Successful in 4m39s
AS Talange CI/CD Pipeline / Deploy to Test Environment (push) Successful in 6m50s

This commit is contained in:
2026-08-07 15:22:19 +02:00
parent 2bd623b719
commit 3612206e57
2 changed files with 29 additions and 21 deletions
@@ -97,8 +97,14 @@ public class AdherentController {
if (lic == null || lic.getDotations() == null || lic.getDotations().isEmpty()) { if (lic == null || lic.getDotations() == null || lic.getDotations().isEmpty()) {
return false; return false;
} }
long total = lic.getDotations().size(); List<com.astalange.core.entity.Dotation> choisis = lic.getDotations().stream()
long fournis = lic.getDotations().stream().filter(d -> Boolean.TRUE.equals(d.getFourni())).count(); .filter(d -> Boolean.TRUE.equals(d.getChoisi()))
.collect(java.util.stream.Collectors.toList());
if (choisis.isEmpty()) {
return false;
}
long total = choisis.size();
long fournis = choisis.stream().filter(d -> Boolean.TRUE.equals(d.getFourni())).count();
if ("TOUT_FOURNI".equalsIgnoreCase(eqFilter)) { if ("TOUT_FOURNI".equalsIgnoreCase(eqFilter)) {
return fournis == total; return fournis == total;
} else if ("PARTIEL".equalsIgnoreCase(eqFilter)) { } else if ("PARTIEL".equalsIgnoreCase(eqFilter)) {
@@ -199,17 +199,18 @@
th:text="${adherent.getLicenceActuelle() != null ? adherent.getLicenceActuelle().getCategorie().getNom() + (adherent.getLicenceActuelle().getEquipe() != null ? ' (' + adherent.getLicenceActuelle().getEquipe().getNom() + ')' : '') : '-'}">-</td> th:text="${adherent.getLicenceActuelle() != null ? adherent.getLicenceActuelle().getCategorie().getNom() + (adherent.getLicenceActuelle().getEquipe() != null ? ' (' + adherent.getLicenceActuelle().getEquipe().getNom() + ')' : '') : '-'}">-</td>
<!-- Équipements Column --> <!-- Équipements Column -->
<td class="py-3 px-4 text-center"> <td class="py-3 px-4 text-center">
<div th:if="${adherent.getLicenceActuelle() != null and !#lists.isEmpty(adherent.getLicenceActuelle().dotations)}" class="flex flex-col items-center space-y-1"> <div th:with="choisis=${adherent.getLicenceActuelle() != null ? adherent.getLicenceActuelle().dotations.?[choisi == true] : null}">
<div th:if="${choisis != null and !#lists.isEmpty(choisis)}" class="flex flex-col items-center space-y-1">
<span class="px-2 py-0.5 text-[9px] font-bold rounded-full border uppercase tracking-wider" <span class="px-2 py-0.5 text-[9px] font-bold rounded-full border uppercase tracking-wider"
th:with="total=${#lists.size(adherent.getLicenceActuelle().dotations)}, th:with="total=${#lists.size(choisis)},
fournis=${#lists.size(adherent.getLicenceActuelle().dotations.?[fourni == true])}" fournis=${#lists.size(choisis.?[fourni == true])}"
th:classappend="${fournis == total ? 'bg-emerald-100 text-emerald-800 border-emerald-200' : (fournis > 0 ? 'bg-amber-100 text-amber-800 border-amber-200' : 'bg-rose-100 text-rose-800 border-rose-200')}" th:classappend="${fournis == total ? 'bg-emerald-100 text-emerald-800 border-emerald-200' : (fournis > 0 ? 'bg-amber-100 text-amber-800 border-amber-200' : 'bg-rose-100 text-rose-800 border-rose-200')}"
th:text="${fournis == total ? '🟢 Complet (' + fournis + '/' + total + ')' : (fournis > 0 ? '🟠 Partiel (' + fournis + '/' + total + ')' : '🔴 Non fourni (0/' + total + ')')}" th:text="${fournis == total ? '🟢 Complet (' + fournis + '/' + total + ')' : (fournis > 0 ? '🟠 Partiel (' + fournis + '/' + total + ')' : '🔴 Non fourni (0/' + total + ')')}"
> >
Complet (3/3) Complet (3/3)
</span> </span>
<div class="flex flex-wrap justify-center gap-1 max-w-[190px]"> <div class="flex flex-wrap justify-center gap-1 max-w-[190px]">
<span th:each="dot : ${adherent.getLicenceActuelle().dotations}" <span th:each="dot : ${choisis}"
class="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium border" class="inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium border"
th:classappend="${dot.fourni ? 'bg-green-50 text-green-700 border-green-200' : 'bg-gray-50 text-gray-500 border-gray-200'}" th:classappend="${dot.fourni ? 'bg-green-50 text-green-700 border-green-200' : 'bg-gray-50 text-gray-500 border-gray-200'}"
th:title="${(dot.equipement != null ? dot.equipement.nom : '') + (dot.taille != null and !dot.taille.isEmpty() ? ' (' + dot.taille + ')' : '') + ' : ' + (dot.fourni ? 'Fourni' : 'Non fourni')}"> th:title="${(dot.equipement != null ? dot.equipement.nom : '') + (dot.taille != null and !dot.taille.isEmpty() ? ' (' + dot.taille + ')' : '') + ' : ' + (dot.fourni ? 'Fourni' : 'Non fourni')}">
@@ -218,9 +219,10 @@
</span> </span>
</div> </div>
</div> </div>
<div th:if="${adherent.getLicenceActuelle() == null or #lists.isEmpty(adherent.getLicenceActuelle().dotations)}" class="text-xs text-gray-400 italic"> <div th:if="${choisis == null or #lists.isEmpty(choisis)}" class="text-xs text-gray-400 italic">
- -
</div> </div>
</div>
</td> </td>
<td class="py-4 px-6 text-center text-gray-600 font-mono text-xs" <td class="py-4 px-6 text-center text-gray-600 font-mono text-xs"
th:text="${adherent.getLicenceActuelle() != null and adherent.getLicenceActuelle().numeroLicence != null and !adherent.getLicenceActuelle().numeroLicence.isEmpty() ? adherent.getLicenceActuelle().numeroLicence : '-'}">-</td> th:text="${adherent.getLicenceActuelle() != null and adherent.getLicenceActuelle().numeroLicence != null and !adherent.getLicenceActuelle().numeroLicence.isEmpty() ? adherent.getLicenceActuelle().numeroLicence : '-'}">-</td>