Checkpoint: Tableau de bord personnalisé pour formateurs avec statistiques (total séquences, séquences à venir, total apprenants) et liste des prochaines interventions avec détails (dates, lieu, capacité). Redirection automatique des formateurs vers /formateur au lieu de /admin. Notifications automatiques par email pour les formateurs lors de nouvelles inscriptions, annulations, capacité maximale atteinte et places disponibles. Menus Configuration, Traçabilité et Analyses masqués pour les formateurs.
This commit is contained in:
@@ -891,3 +891,90 @@ export async function sendNotificationAnnulationListeAttente(params: {
|
||||
html: await getEmailTemplate(content, 'notification_annulation'),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoie une notification au formateur quand la capacité maximale est atteinte
|
||||
*/
|
||||
export async function sendNotificationFormateurCapaciteAtteinte(params: {
|
||||
formateurEmail: string;
|
||||
formateurNom: string;
|
||||
formationNom: string;
|
||||
sequenceNom: string;
|
||||
capaciteMax: number;
|
||||
nbInscrits: number;
|
||||
dates: Array<{ dateDebut: Date; dateFin: Date; ordre: number }>;
|
||||
}): Promise<boolean> {
|
||||
const datesHTML = params.dates.map(date => `
|
||||
<li>Date ${date.ordre} : ${date.dateDebut.toLocaleDateString('fr-FR', {
|
||||
weekday: 'long',
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric'
|
||||
})}</li>
|
||||
`).join('');
|
||||
|
||||
const content = `
|
||||
<h2>⚠️ Capacité maximale atteinte</h2>
|
||||
<p>Bonjour ${params.formateurNom},</p>
|
||||
|
||||
<p>La capacité maximale de votre formation a été atteinte.</p>
|
||||
|
||||
<div class="info-box" style="background-color: #fee2e2; border-left-color: #ef4444;">
|
||||
<h3>Détails de la séquence</h3>
|
||||
<p><strong>Formation :</strong> ${params.formationNom}</p>
|
||||
<p><strong>Séquence :</strong> ${params.sequenceNom}</p>
|
||||
<p><strong>Capacité :</strong> ${params.nbInscrits} / ${params.capaciteMax}</p>
|
||||
</div>
|
||||
|
||||
<h4>Dates de la formation :</h4>
|
||||
<ul>${datesHTML}</ul>
|
||||
|
||||
<p>Les nouvelles inscriptions seront automatiquement placées en liste d'attente.</p>
|
||||
|
||||
<p>Cordialement,<br/>L'équipe Formation</p>
|
||||
`;
|
||||
|
||||
return sendEmail({
|
||||
to: params.formateurEmail,
|
||||
subject: `⚠️ Capacité maximale atteinte - ${params.formationNom} (${params.sequenceNom})`,
|
||||
html: await getEmailTemplate(content, 'notification_formateur'),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoie une notification au formateur quand une place se libère
|
||||
*/
|
||||
export async function sendNotificationFormateurPlaceDisponible(params: {
|
||||
formateurEmail: string;
|
||||
formateurNom: string;
|
||||
formationNom: string;
|
||||
sequenceNom: string;
|
||||
capaciteMax: number;
|
||||
nbInscrits: number;
|
||||
placesDisponibles: number;
|
||||
}): Promise<boolean> {
|
||||
const content = `
|
||||
<h2>✅ Place disponible</h2>
|
||||
<p>Bonjour ${params.formateurNom},</p>
|
||||
|
||||
<p>Une place s'est libérée dans votre formation suite à une annulation.</p>
|
||||
|
||||
<div class="info-box" style="background-color: #d1fae5; border-left-color: #10b981;">
|
||||
<h3>Détails de la séquence</h3>
|
||||
<p><strong>Formation :</strong> ${params.formationNom}</p>
|
||||
<p><strong>Séquence :</strong> ${params.sequenceNom}</p>
|
||||
<p><strong>Places occupées :</strong> ${params.nbInscrits} / ${params.capaciteMax}</p>
|
||||
<p><strong>Places disponibles :</strong> ${params.placesDisponibles}</p>
|
||||
</div>
|
||||
|
||||
<p>De nouvelles inscriptions peuvent maintenant être acceptées.</p>
|
||||
|
||||
<p>Cordialement,<br/>L'équipe Formation</p>
|
||||
`;
|
||||
|
||||
return sendEmail({
|
||||
to: params.formateurEmail,
|
||||
subject: `✅ Place disponible - ${params.formationNom} (${params.sequenceNom})`,
|
||||
html: await getEmailTemplate(content, 'notification_formateur'),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user