Checkpoint: Ajout validation frontend temps réel + backend pour dates séquences (date fin > date début). Indicateur visuel (bordure rouge + message erreur) dans formulaires création/édition. Validation backend dans procédures create/update. Correction structure table logsrappels. Amélioration système test rappels (badge compteur, désactivation visuelle, boîte dialogue avec email + progression).
This commit is contained in:
@@ -291,6 +291,16 @@ export default function AdminSequences() {
|
||||
const updateDate = (index: number, field: "dateDebut" | "dateFin", value: string) => {
|
||||
const newDates = [...formData.dates];
|
||||
newDates[index][field] = value;
|
||||
|
||||
// Validation en temps réel : vérifier que la date de fin est après la date de début
|
||||
if (newDates[index].dateDebut && newDates[index].dateFin) {
|
||||
const debut = new Date(newDates[index].dateDebut);
|
||||
const fin = new Date(newDates[index].dateFin);
|
||||
if (fin <= debut) {
|
||||
toast.error(`Date ${index + 1}: La date de fin doit être après la date de début`);
|
||||
}
|
||||
}
|
||||
|
||||
setFormData({ ...formData, dates: newDates });
|
||||
};
|
||||
|
||||
@@ -626,7 +636,16 @@ export default function AdminSequences() {
|
||||
value={date.dateFin}
|
||||
onChange={(e) => updateDate(index, "dateFin", e.target.value)}
|
||||
required
|
||||
className={(
|
||||
date.dateDebut && date.dateFin &&
|
||||
new Date(date.dateFin) <= new Date(date.dateDebut)
|
||||
) ? "border-red-500 focus:border-red-500" : ""}
|
||||
/>
|
||||
{date.dateDebut && date.dateFin && new Date(date.dateFin) <= new Date(date.dateDebut) && (
|
||||
<p className="text-xs text-red-500 mt-1">
|
||||
La date de fin doit être après la date de début
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
@@ -1093,7 +1112,16 @@ export default function AdminSequences() {
|
||||
value={date.dateFin}
|
||||
onChange={(e) => updateDate(index, "dateFin", e.target.value)}
|
||||
required
|
||||
className={(
|
||||
date.dateDebut && date.dateFin &&
|
||||
new Date(date.dateFin) <= new Date(date.dateDebut)
|
||||
) ? "border-red-500 focus:border-red-500" : ""}
|
||||
/>
|
||||
{date.dateDebut && date.dateFin && new Date(date.dateFin) <= new Date(date.dateDebut) && (
|
||||
<p className="text-xs text-red-500 mt-1">
|
||||
La date de fin doit être après la date de début
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
1
todo.md
1
todo.md
@@ -1197,3 +1197,4 @@
|
||||
- [x] Corriger l'erreur 'Unexpected token' lors de la mutation API sur /admin/sequences
|
||||
- [ ] Corriger l'erreur dans le fichier ICS qui empêche l'importation dans Outlook
|
||||
- [ ] Ajouter validation date fin > date début dans la boîte de dialogue de modification des séquences
|
||||
- [x] Ajouter une validation frontend en temps réel dans les champs de date pour afficher un message d'erreur immédiat
|
||||
|
||||
Reference in New Issue
Block a user