Checkpoint: Corrections multiples : template reset_password, bugs UI templates d'email, schémas DB, et table logsRappels
**Ajouts :**
- Template "Réinitialisation de mot de passe" (reset_password) ajouté à l'enum et au système
**Corrections de bugs :**
- Bug de mise à jour du type de template (ajout de key={selectedType} pour forcer remontage)
- Erreur SQL configuration SMTP (correction schéma emailConfig avec champs active, domainVerified, apiKey)
- Erreur de type formateurId (conversion string → number dans AdminSequences.tsx)
- Date de blocage non sauvegardée (ajout champ dateBlocage au schéma sequences)
- Table logsRappels incohérente (suppression colonnes obsolètes, correction enum statut)
**Schémas Drizzle mis à jour :**
- emailTemplates : ajout reset_password à l'enum type
- emailConfig : ajout active, domainVerified, correction apiKey
- sequences : ajout dateBlocage (datetime)
- logsRappels : structure nettoyée et conforme
**Déploiement VPS :**
- Toutes les migrations SQL exécutées avec succès
- Application redémarrée et fonctionnelle
- Historique des rappels prêt à fonctionner (table logsRappels corrigée)
This commit is contained in:
@@ -64,7 +64,7 @@ export default function AdminEmailTemplates() {
|
||||
],
|
||||
content: formData.bodyContent,
|
||||
onUpdate: ({ editor }) => {
|
||||
setFormData({ ...formData, bodyContent: editor.getHTML() });
|
||||
setFormData((prev) => ({ ...prev, bodyContent: editor.getHTML() }));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -101,11 +101,18 @@ export default function AdminEmailTemplates() {
|
||||
};
|
||||
setFormData(newData);
|
||||
// Mettre à jour le contenu de l'éditeur
|
||||
if (editor) {
|
||||
if (editor && !editor.isDestroyed) {
|
||||
editor.commands.setContent(newData.bodyContent);
|
||||
}
|
||||
}
|
||||
}, [currentTemplate, editor]);
|
||||
}, [currentTemplate]);
|
||||
|
||||
// Synchroniser l'éditeur avec formData.bodyContent quand l'éditeur est prêt
|
||||
useEffect(() => {
|
||||
if (editor && !editor.isDestroyed && formData.bodyContent !== editor.getHTML()) {
|
||||
editor.commands.setContent(formData.bodyContent);
|
||||
}
|
||||
}, [editor]);
|
||||
|
||||
const handleSave = () => {
|
||||
upsertMutation.mutate({
|
||||
@@ -273,7 +280,7 @@ export default function AdminEmailTemplates() {
|
||||
</Card>
|
||||
|
||||
{/* Formulaire d'édition */}
|
||||
<Card className="lg:col-span-2">
|
||||
<Card key={selectedType} className="lg:col-span-2">
|
||||
<CardHeader>
|
||||
<CardTitle>Éditer le template</CardTitle>
|
||||
<CardDescription>
|
||||
|
||||
@@ -162,7 +162,7 @@ export default function AdminSequences() {
|
||||
|
||||
// Convertir une date locale (datetime-local) en ISO UTC
|
||||
const convertLocalToUTC = (localDateStr: string): string => {
|
||||
if (!localDateStr) return localDateStr;
|
||||
if (!localDateStr || localDateStr.trim() === '') return '';
|
||||
// datetime-local retourne "YYYY-MM-DDTHH:mm"
|
||||
// On doit le traiter comme heure locale et le convertir en UTC
|
||||
const localDate = new Date(localDateStr);
|
||||
@@ -185,7 +185,7 @@ export default function AdminSequences() {
|
||||
capaciteMax: parseInt(formData.capaciteMax),
|
||||
dateBlocage: convertLocalToUTC(formData.dateBlocage),
|
||||
statut: formData.statut,
|
||||
formateurId: formData.formateur,
|
||||
formateurId: formData.formateur ? parseInt(formData.formateur) : null,
|
||||
dates: formData.dates.map(d => ({
|
||||
...d,
|
||||
dateDebut: convertLocalToUTC(d.dateDebut),
|
||||
|
||||
Reference in New Issue
Block a user