|
|
|
@ -8,6 +8,8 @@ import { IoMdReturnRight } from 'react-icons/io' |
|
|
|
import jsPDF from 'jspdf' |
|
|
|
import autoTable from 'jspdf-autotable' |
|
|
|
import { FaDownload } from 'react-icons/fa' |
|
|
|
import logoRelerev1 from '../assets/logorelever.png' |
|
|
|
import logoRelerev2 from '../assets/logorelever2.png' |
|
|
|
|
|
|
|
const Resultat = () => { |
|
|
|
const { niveau, scolaire } = useParams() |
|
|
|
@ -59,22 +61,32 @@ const Resultat = () => { |
|
|
|
format: 'a4' |
|
|
|
}) |
|
|
|
|
|
|
|
pdf.addImage(logoRelerev1, 'PNG', 10, 5, 40, 20) |
|
|
|
pdf.addImage(logoRelerev2, 'PNG', 175, 5, 30, 30) |
|
|
|
|
|
|
|
// Ajouter le texte entre les logos |
|
|
|
pdf.setFontSize(10) |
|
|
|
pdf.text('REPOBLIKAN\'I MADAGASIKARA', 105, 10, { align: 'center' }) |
|
|
|
pdf.text('Fitiavana-Tanindrazana-Fandrosoana', 105, 14, { align: 'center' }) |
|
|
|
pdf.text('********************', 105, 18, { align: 'center' }) |
|
|
|
pdf.text('MINISTÈRE DE L\'ENSEIGNEMENT SUPÉRIEUR', 105, 22, { align: 'center' }) |
|
|
|
pdf.text('ET DE LA RECHERCHE SCIENTIFIQUE', 105, 26, { align: 'center' }) |
|
|
|
pdf.text('********************', 105, 30, { align: 'center' }) |
|
|
|
pdf.text('UNIVERSITÉ DE TOAMASINA', 105, 34, { align: 'center' }) |
|
|
|
pdf.text('ÉCOLE SUPÉRIEURE POLYTECHNIQUE', 105, 38, { align: 'center' }) |
|
|
|
|
|
|
|
// Select the table |
|
|
|
autoTable(pdf, { |
|
|
|
html: '#myTable2', // ID de la table |
|
|
|
startY: 20, |
|
|
|
html: '#myTable2', |
|
|
|
startY: 50, // décalé vers le bas pour laisser la place aux logos et texte |
|
|
|
theme: 'grid', |
|
|
|
headStyles: { |
|
|
|
fillColor: 'gray', |
|
|
|
halign: 'center', |
|
|
|
fontStyle: 'bold', |
|
|
|
textColor: 'black' |
|
|
|
}, // Supprimer la couleur et centrer |
|
|
|
margin: { top: 10 }, |
|
|
|
styles: { fontSize: 8, cellPadding: 2, halign: 'center' }, // Centrer le texte des cellules |
|
|
|
didDrawPage: (data) => { |
|
|
|
pdf.text('', 14, 10) |
|
|
|
} |
|
|
|
}, |
|
|
|
styles: { fontSize: 8, cellPadding: 2, halign: 'center' } |
|
|
|
}) |
|
|
|
|
|
|
|
pdf.save(`Resultat-${niveau}-${scolaire}.pdf`) |
|
|
|
@ -175,36 +187,83 @@ const Resultat = () => { |
|
|
|
<div className={classeHome.boxEtudiantsCard}> |
|
|
|
<Paper |
|
|
|
sx={{ |
|
|
|
height: 'auto', // Auto height to make the grid responsive |
|
|
|
height: 'auto', |
|
|
|
width: '100%', |
|
|
|
// minHeight: 500, // Ensures a minimum height |
|
|
|
display: 'flex', |
|
|
|
flexDirection: 'column', |
|
|
|
padding: '2%' |
|
|
|
}} |
|
|
|
> |
|
|
|
<table className="table table-bordered table-striped text-center shadow-sm" id="myTable2"> |
|
|
|
{/* En-tête avec logos et texte */} |
|
|
|
<div |
|
|
|
style={{ |
|
|
|
display: 'flex', |
|
|
|
alignItems: 'flex-start', |
|
|
|
justifyContent: 'space-between', |
|
|
|
marginBottom: '20px', |
|
|
|
position: 'relative' |
|
|
|
}} |
|
|
|
> |
|
|
|
<img src={logoRelerev1} alt="Logo gauche" width={70} /> |
|
|
|
|
|
|
|
{/* Texte centré entre les logos */} |
|
|
|
<div |
|
|
|
style={{ |
|
|
|
position: 'absolute', |
|
|
|
left: '50%', |
|
|
|
transform: 'translateX(-50%)', |
|
|
|
textAlign: 'center', |
|
|
|
fontSize: '10px', |
|
|
|
lineHeight: '1.2' |
|
|
|
}} |
|
|
|
> |
|
|
|
<div style={{ fontWeight: 'bold' }}>REPOBLIKAN'I MADAGASIKARA</div> |
|
|
|
<div style={{ fontStyle: 'italic' }}>Fitiavana-Tanindrazana-Fandrosoana</div> |
|
|
|
<div>********************</div> |
|
|
|
<div style={{ fontWeight: 'bold' }}>MINISTÈRE DE L'ENSEIGNEMENT SUPÉRIEUR</div> |
|
|
|
<div style={{ fontWeight: 'bold' }}>ET DE LA RECHERCHE SCIENTIFIQUE</div> |
|
|
|
<div>********************</div> |
|
|
|
<div style={{ fontWeight: 'bold' }}>UNIVERSITÉ DE TOAMASINA</div> |
|
|
|
<div style={{ fontWeight: 'bold' }}>ÉCOLE SUPÉRIEURE POLYTECHNIQUE</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<img src={logoRelerev2} alt="Logo droite" width={90} height={90} /> |
|
|
|
</div> |
|
|
|
|
|
|
|
{/* Informations du parcours */} |
|
|
|
<div style={{ marginBottom: '15px', fontSize: '12px' }}> |
|
|
|
<div><strong>Parcours :</strong> GC</div> |
|
|
|
<div><strong>Niveau :</strong> {niveau}</div> |
|
|
|
<div><strong>Année Universitaire :</strong> {scolaire}</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<table |
|
|
|
className="table table-bordered table-striped text-center shadow-sm" |
|
|
|
id="myTable2" |
|
|
|
style={{ fontSize: '12px' }} |
|
|
|
> |
|
|
|
<thead className="table-secondary"> |
|
|
|
<tr> |
|
|
|
<td colSpan={4} className="py-3"> |
|
|
|
<h6> |
|
|
|
Niveau {niveau} | Année Scolaire {scolaire} |
|
|
|
<td colSpan={4} className="py-3" style={{ backgroundColor: '#f8f9fa' }}> |
|
|
|
<h6 style={{ margin: 0, fontWeight: 'bold' }}> |
|
|
|
Résultat de la Deuxième Session : {niveau} admis en L3 par ordre de mérite |
|
|
|
</h6> |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<th>Nom</th> |
|
|
|
<th>Prenom</th> |
|
|
|
<th>Mention</th> |
|
|
|
<th>Moyenne</th> |
|
|
|
<tr style={{ backgroundColor: '#e9ecef' }}> |
|
|
|
<th style={{ width: '10%', fontWeight: 'bold' }}>RANG</th> |
|
|
|
<th style={{ width: '30%', fontWeight: 'bold' }}>NOMS</th> |
|
|
|
<th style={{ width: '40%', fontWeight: 'bold' }}>PRÉNOMS</th> |
|
|
|
<th style={{ width: '20%', fontWeight: 'bold' }}>Moyenne</th> |
|
|
|
</tr> |
|
|
|
</thead> |
|
|
|
<tbody> |
|
|
|
{sortedStudents.map((sorted) => ( |
|
|
|
{sortedStudents.map((sorted, index) => ( |
|
|
|
<tr key={sorted.id}> |
|
|
|
<td>{sorted.nom}</td> |
|
|
|
<td>{sorted.prenom}</td> |
|
|
|
<td>{returnmention(sorted.mention)}</td> |
|
|
|
<td className="fw-bold">{sorted.moyenne}</td> |
|
|
|
<td style={{ fontWeight: 'bold' }}>{index + 1}.</td> |
|
|
|
<td style={{ textAlign: 'left', paddingLeft: '10px', fontWeight: 'bold' }}>{sorted.nom}</td> |
|
|
|
<td style={{ textAlign: 'left', paddingLeft: '10px' }}>{sorted.prenom}</td> |
|
|
|
<td style={{ fontWeight: 'bold' }}>{sorted.moyenne}</td> |
|
|
|
</tr> |
|
|
|
))} |
|
|
|
</tbody> |
|
|
|
|