fix(equipements): ne calculer et n'afficher que les equipements choisis sur la grille adherents
This commit is contained in:
@@ -97,8 +97,14 @@ public class AdherentController {
|
||||
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();
|
||||
List<com.astalange.core.entity.Dotation> choisis = lic.getDotations().stream()
|
||||
.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)) {
|
||||
return fournis == total;
|
||||
} else if ("PARTIEL".equalsIgnoreCase(eqFilter)) {
|
||||
|
||||
@@ -199,27 +199,29 @@
|
||||
th:text="${adherent.getLicenceActuelle() != null ? adherent.getLicenceActuelle().getCategorie().getNom() + (adherent.getLicenceActuelle().getEquipe() != null ? ' (' + adherent.getLicenceActuelle().getEquipe().getNom() + ')' : '') : '-'}">-</td>
|
||||
<!-- Équipements Column -->
|
||||
<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">
|
||||
<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)},
|
||||
fournis=${#lists.size(adherent.getLicenceActuelle().dotations.?[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:text="${fournis == total ? '🟢 Complet (' + fournis + '/' + total + ')' : (fournis > 0 ? '🟠 Partiel (' + fournis + '/' + total + ')' : '🔴 Non fourni (0/' + total + ')')}"
|
||||
>
|
||||
Complet (3/3)
|
||||
</span>
|
||||
<div class="flex flex-wrap justify-center gap-1 max-w-[190px]">
|
||||
<span th:each="dot : ${adherent.getLicenceActuelle().dotations}"
|
||||
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:title="${(dot.equipement != null ? dot.equipement.nom : '') + (dot.taille != null and !dot.taille.isEmpty() ? ' (' + dot.taille + ')' : '') + ' : ' + (dot.fourni ? 'Fourni' : 'Non fourni')}">
|
||||
<span class="mr-0.5" th:text="${dot.fourni ? '✓' : '✗'}">✓</span>
|
||||
<span th:text="${dot.equipement != null ? dot.equipement.nom : 'Équipement'}">Maillot</span>
|
||||
<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"
|
||||
th:with="total=${#lists.size(choisis)},
|
||||
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:text="${fournis == total ? '🟢 Complet (' + fournis + '/' + total + ')' : (fournis > 0 ? '🟠 Partiel (' + fournis + '/' + total + ')' : '🔴 Non fourni (0/' + total + ')')}"
|
||||
>
|
||||
Complet (3/3)
|
||||
</span>
|
||||
<div class="flex flex-wrap justify-center gap-1 max-w-[190px]">
|
||||
<span th:each="dot : ${choisis}"
|
||||
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:title="${(dot.equipement != null ? dot.equipement.nom : '') + (dot.taille != null and !dot.taille.isEmpty() ? ' (' + dot.taille + ')' : '') + ' : ' + (dot.fourni ? 'Fourni' : 'Non fourni')}">
|
||||
<span class="mr-0.5" th:text="${dot.fourni ? '✓' : '✗'}">✓</span>
|
||||
<span th:text="${dot.equipement != null ? dot.equipement.nom : 'Équipement'}">Maillot</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div th:if="${choisis == null or #lists.isEmpty(choisis)}" class="text-xs text-gray-400 italic">
|
||||
-
|
||||
</div>
|
||||
</div>
|
||||
<div th:if="${adherent.getLicenceActuelle() == null or #lists.isEmpty(adherent.getLicenceActuelle().dotations)}" class="text-xs text-gray-400 italic">
|
||||
-
|
||||
</div>
|
||||
</td>
|
||||
<td class="py-4 px-6 text-center text-gray-600 font-mono text-xs"
|
||||
|
||||
Reference in New Issue
Block a user