style: display total due, paid, and remaining balance in adherents list
This commit is contained in:
@@ -83,6 +83,16 @@ public class Licence {
|
|||||||
return reste.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : reste;
|
return reste.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : reste;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
public BigDecimal getSommePayee() {
|
||||||
|
if (paiements == null || paiements.isEmpty()) {
|
||||||
|
return BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
return paiements.stream()
|
||||||
|
.map(Paiement::getMontant)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
}
|
||||||
|
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
|
|
||||||
public Long getId() { return id; }
|
public Long getId() { return id; }
|
||||||
|
|||||||
@@ -120,10 +120,35 @@
|
|||||||
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>
|
||||||
<td class="py-4 px-6 text-gray-600" th:text="${adherent.email}">jean@example.com</td>
|
<td class="py-4 px-6 text-gray-600" th:text="${adherent.email}">jean@example.com</td>
|
||||||
<td class="py-4 px-6 text-gray-600" th:text="${adherent.telephone}">0600000000</td>
|
<td class="py-4 px-6 text-gray-600" th:text="${adherent.telephone}">0600000000</td>
|
||||||
<td class="py-4 px-6 text-center">
|
<td class="py-3 px-4">
|
||||||
<span class="px-2 py-1 text-xs font-semibold rounded-full"
|
<!-- Aucune licence -->
|
||||||
th:classappend="${adherent.getStatutPaiement() == 'À jour' ? 'bg-green-100 text-green-800' : (adherent.getStatutPaiement() == 'Aucune licence' ? 'bg-gray-100 text-gray-800' : 'bg-red-100 text-red-800')}"
|
<div th:if="${adherent.getLicenceActuelle() == null}" class="text-center text-gray-400 text-xs italic">
|
||||||
th:text="${adherent.getStatutPaiement()}">À jour</span>
|
Aucune licence
|
||||||
|
</div>
|
||||||
|
<!-- Détails financiers -->
|
||||||
|
<div th:if="${adherent.getLicenceActuelle() != null}" class="flex flex-col items-center space-y-1">
|
||||||
|
<!-- Badge Statut -->
|
||||||
|
<span class="px-2 py-0.5 text-[9px] font-bold rounded-full uppercase tracking-wider"
|
||||||
|
th:classappend="${adherent.getLicenceActuelle().getResteAPayer().compareTo(T(java.math.BigDecimal).ZERO) == 0 ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'}"
|
||||||
|
th:text="${adherent.getLicenceActuelle().getResteAPayer().compareTo(T(java.math.BigDecimal).ZERO) == 0 ? 'À jour' : 'Reste à payer'}">
|
||||||
|
À jour
|
||||||
|
</span>
|
||||||
|
<!-- Tableau/Liste miniature des montants -->
|
||||||
|
<div class="text-[11px] font-mono text-gray-600 bg-gray-50 p-1.5 rounded-lg border border-gray-100 w-28 space-y-0.5 shadow-2xs mx-auto">
|
||||||
|
<div class="flex justify-between">
|
||||||
|
<span class="text-gray-400">Dû:</span>
|
||||||
|
<span class="font-semibold text-gray-800" th:text="|${adherent.getLicenceActuelle().getPrixTotal()} €|">150 €</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-between">
|
||||||
|
<span class="text-gray-400">Payé:</span>
|
||||||
|
<span class="font-semibold text-green-600" th:text="|${adherent.getLicenceActuelle().getSommePayee()} €|">100 €</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-between border-t border-gray-200 pt-0.5 mt-0.5">
|
||||||
|
<span class="text-gray-500 font-medium">Reste:</span>
|
||||||
|
<span class="font-bold" th:classappend="${adherent.getLicenceActuelle().getResteAPayer().compareTo(T(java.math.BigDecimal).ZERO) == 0 ? 'text-gray-800' : 'text-red-600'}" th:text="|${adherent.getLicenceActuelle().getResteAPayer()} €|">50 €</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="py-4 px-6 text-right flex justify-end space-x-3 items-center">
|
<td class="py-4 px-6 text-right flex justify-end space-x-3 items-center">
|
||||||
<a th:href="@{/adherents/{id}/edit(id=${adherent.id})}" class="text-indigo-600 hover:text-indigo-900 font-medium bg-indigo-50 px-3 py-1 rounded-lg">Voir / Modifier</a>
|
<a th:href="@{/adherents/{id}/edit(id=${adherent.id})}" class="text-indigo-600 hover:text-indigo-900 font-medium bg-indigo-50 px-3 py-1 rounded-lg">Voir / Modifier</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user