Checkpoint: Améliorations du tableau des rappels : renommage de la colonne "Template" en "Template d'email" et ajout d'une colonne "Dates concernées" affichant les formations, séquences et dates spécifiques associées à chaque rappel. La fonction getRappels a été enrichie pour récupérer automatiquement les détails des dates de formation (formation, séquence, ordre). L'affichage groupé permet de voir en un coup d'œil si un rappel s'applique à toutes les dates ou seulement à des dates spécifiques.

This commit is contained in:
Manus
2026-01-08 09:08:27 -05:00
parent f331f9bb5f
commit 2b31900255
3 changed files with 78 additions and 3 deletions

View File

@@ -183,6 +183,40 @@ export default function AdminRappels() {
return TEMPLATE_TYPES.find(t => t.value === type)?.label || type;
};
const formatDatesInfo = (rappel: any) => {
if (!rappel.datesDetails || rappel.datesDetails.length === 0) {
return <span className="text-muted-foreground italic">Toutes les dates</span>;
}
// Grouper par formation et séquence
const grouped = rappel.datesDetails.reduce((acc: any, date: any) => {
const key = `${date.formationNom} - ${date.sequenceNom}`;
if (!acc[key]) {
acc[key] = [];
}
acc[key].push(date);
return acc;
}, {});
return (
<div className="text-sm space-y-1">
{Object.entries(grouped).map(([key, dates]: [string, any]) => (
<div key={key}>
<div className="font-medium">{key}</div>
<div className="text-muted-foreground">
{dates.map((d: any, idx: number) => (
<span key={d.dateFormationId}>
Date {d.ordre}
{idx < dates.length - 1 && ", "}
</span>
))}
</div>
</div>
))}
</div>
);
};
return (
<DashboardLayout>
<div className="space-y-6">
@@ -214,9 +248,10 @@ export default function AdminRappels() {
<TableHeader>
<TableRow>
<TableHead>Nom</TableHead>
<TableHead>Template</TableHead>
<TableHead>Template d'email</TableHead>
<TableHead>Délai</TableHead>
<TableHead>Heure</TableHead>
<TableHead>Dates concernées</TableHead>
<TableHead>Statut</TableHead>
<TableHead className="text-right">Actions</TableHead>
</TableRow>
@@ -231,6 +266,9 @@ export default function AdminRappels() {
{rappel.timing === "post_formation" ? `J+${rappel.joursAvant}` : `J-${rappel.joursAvant}`}
</TableCell>
<TableCell>{rappel.heureEnvoi}</TableCell>
<TableCell>
{formatDatesInfo(rappel)}
</TableCell>
<TableCell>
<button
onClick={() => handleToggleActif(rappel.id, rappel.actif)}
@@ -265,7 +303,7 @@ export default function AdminRappels() {
))
) : (
<TableRow>
<TableCell colSpan={6} className="text-center text-muted-foreground">
<TableCell colSpan={7} className="text-center text-muted-foreground">
Aucun rappel configuré
</TableCell>
</TableRow>