feat(paiement): track payment manager (gestionnaire) in history
This commit is contained in:
@@ -26,6 +26,9 @@ public class Paiement {
|
||||
@JoinColumn(name = "mode_paiement_id", nullable = false)
|
||||
private ModePaiement modePaiement;
|
||||
|
||||
@Column(name = "gestionnaire")
|
||||
private String gestionnaire;
|
||||
|
||||
// Getters and Setters
|
||||
|
||||
public Long getId() { return id; }
|
||||
@@ -42,4 +45,7 @@ public class Paiement {
|
||||
|
||||
public ModePaiement getModePaiement() { return modePaiement; }
|
||||
public void setModePaiement(ModePaiement modePaiement) { this.modePaiement = modePaiement; }
|
||||
|
||||
public String getGestionnaire() { return gestionnaire; }
|
||||
public void setGestionnaire(String gestionnaire) { this.gestionnaire = gestionnaire; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE paiement ADD COLUMN gestionnaire VARCHAR(255);
|
||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import java.security.Principal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
@@ -34,7 +35,8 @@ public class PaiementController {
|
||||
@RequestParam Long adherentId,
|
||||
@RequestParam BigDecimal montant,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate datePaiement,
|
||||
@RequestParam Long modePaiementId) {
|
||||
@RequestParam Long modePaiementId,
|
||||
Principal principal) {
|
||||
|
||||
Licence licence = licenceRepository.findById(id)
|
||||
.orElseThrow(() -> new IllegalArgumentException("Invalid Licence ID"));
|
||||
@@ -52,6 +54,9 @@ public class PaiementController {
|
||||
paiement.setModePaiement(mode);
|
||||
paiement.setMontant(montant);
|
||||
paiement.setDatePaiement(datePaiement);
|
||||
if (principal != null) {
|
||||
paiement.setGestionnaire(principal.getName());
|
||||
}
|
||||
paiementRepository.save(paiement);
|
||||
}
|
||||
|
||||
@@ -64,7 +69,8 @@ public class PaiementController {
|
||||
@RequestParam BigDecimal montant,
|
||||
@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate datePaiement,
|
||||
@RequestParam Long modePaiementId,
|
||||
@RequestParam(required = false) String redirect) {
|
||||
@RequestParam(required = false) String redirect,
|
||||
Principal principal) {
|
||||
|
||||
Paiement paiement = paiementRepository.findById(id)
|
||||
.orElseThrow(() -> new IllegalArgumentException("Invalid Paiement ID"));
|
||||
@@ -84,6 +90,9 @@ public class PaiementController {
|
||||
paiement.setModePaiement(mode);
|
||||
paiement.setMontant(montant);
|
||||
paiement.setDatePaiement(datePaiement);
|
||||
if (principal != null) {
|
||||
paiement.setGestionnaire(principal.getName());
|
||||
}
|
||||
paiementRepository.save(paiement);
|
||||
}
|
||||
|
||||
|
||||
@@ -228,6 +228,7 @@
|
||||
<tr class="bg-gray-50 text-gray-500 uppercase font-medium">
|
||||
<th class="py-2 px-3 text-left">Date</th>
|
||||
<th class="py-2 px-3 text-left">Mode</th>
|
||||
<th class="py-2 px-3 text-left">Géré par</th>
|
||||
<th class="py-2 px-3 text-right font-medium">Montant</th>
|
||||
<th class="py-2 px-3 text-right font-medium pr-4">Actions</th>
|
||||
</tr>
|
||||
@@ -238,6 +239,7 @@
|
||||
<td class="py-2 px-3 text-gray-600">
|
||||
<span class="px-2 py-0.5 rounded bg-gray-100 text-gray-700 font-mono text-[10px]" th:text="${paiement.modePaiement.nom}">Chèque</span>
|
||||
</td>
|
||||
<td class="py-2 px-3 text-gray-500 text-xs italic" th:text="${paiement.gestionnaire != null ? paiement.gestionnaire : '-'}">-</td>
|
||||
<td class="py-2 px-3 text-right font-semibold text-green-600" th:text="${paiement.montant + ' €'}">50.00 €</td>
|
||||
<td class="py-2 px-3 text-right pr-4">
|
||||
<div class="flex justify-end items-center space-x-2">
|
||||
|
||||
Reference in New Issue
Block a user