feat(membre): add certificat make date

This commit is contained in:
2025-01-17 10:56:46 +01:00
parent f637300e87
commit 8623275854
3 changed files with 66 additions and 20 deletions

View File

@@ -41,6 +41,7 @@ import org.hibernate.reactive.mutiny.Mutiny;
import java.io.*;
import java.nio.file.Files;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Objects;
@@ -438,11 +439,27 @@ public class MembreService {
photoCell.setBorder(PdfPCell.NO_BORDER);
memberTable.addCell(photoCell);
String[] cert;
if (licence.getCertificate() != null && !licence.getCertificate().isBlank()) {
cert = licence.getCertificate().split("¤");
if (cert.length <= 1){
cert = new String[]{licence.getCertificate(), "--"};
}else{
try {
cert[1] = sdf.format(new SimpleDateFormat("yyyy-MM-dd").parse(cert[1]));
} catch (ParseException e) {
cert[1] = "--";
}
}
} else {
cert = new String[]{"--", "--"};
}
// Adding member details
memberTable.addCell(new Phrase("NOM : " + m.getLname().toUpperCase(), bodyFont));
memberTable.addCell(new Phrase("Prénom : " + m.getFname(), bodyFont));
memberTable.addCell(new Phrase("Licence n° : " + m.getLicence(), bodyFont));
memberTable.addCell(new Phrase("Certificat médical par Dr " + licence.getCertificate(), bodyFont));
memberTable.addCell(new Phrase("Certificat médical par " + cert[0] + ", le " + cert[1], bodyFont));
memberTable.addCell(new Phrase("")); // Empty cell for spacing
document.add(memberTable);