Checkpoint: Implémentation des trois améliorations demandées : ajout de filtres par fonction sur les pages apprenants et inscrits, création d'un graphique circulaire de répartition par fonction sur le tableau de bord avec recharts, et personnalisation des templates d'emails (confirmation, teaser, rappel J-7) incluant la fonction de l'apprenant dans la salutation.
This commit is contained in:
@@ -94,6 +94,7 @@ export async function sendInscriptionConfirmation(params: {
|
||||
apprenantEmail: string;
|
||||
apprenantNom: string;
|
||||
apprenantPrenom: string;
|
||||
apprenantFonction: string;
|
||||
formationNom: string;
|
||||
sessionNom: string;
|
||||
dateDebut: Date;
|
||||
@@ -102,10 +103,12 @@ export async function sendInscriptionConfirmation(params: {
|
||||
statut: 'confirmee' | 'liste_attente';
|
||||
}): Promise<boolean> {
|
||||
const isConfirmed = params.statut === 'confirmee';
|
||||
const fonctionLabel = params.apprenantFonction === 'directeur' ? 'Directeur' :
|
||||
params.apprenantFonction === 'chef_service' ? 'Chef de service' : 'Autre';
|
||||
|
||||
const content = `
|
||||
<h2>Confirmation d'inscription</h2>
|
||||
<p>Bonjour ${params.apprenantPrenom} ${params.apprenantNom},</p>
|
||||
<p>Bonjour ${fonctionLabel} ${params.apprenantPrenom} ${params.apprenantNom},</p>
|
||||
|
||||
${isConfirmed
|
||||
? '<p><strong>Votre inscription a été confirmée !</strong></p>'
|
||||
@@ -175,13 +178,19 @@ export async function sendInscriptionConfirmation(params: {
|
||||
export async function sendTeaserEmail(params: {
|
||||
apprenantEmail: string;
|
||||
apprenantPrenom: string;
|
||||
apprenantNom: string;
|
||||
apprenantFonction: string;
|
||||
formationNom: string;
|
||||
sessionNom: string;
|
||||
dateDebut: Date;
|
||||
}): Promise<boolean> {
|
||||
const fonctionLabel = params.apprenantFonction === 'directeur' ? 'Directeur' :
|
||||
params.apprenantFonction === 'chef_service' ? 'Chef de service' : '';
|
||||
const salutation = fonctionLabel ? `${fonctionLabel} ${params.apprenantPrenom} ${params.apprenantNom}` : params.apprenantPrenom;
|
||||
|
||||
const content = `
|
||||
<h2>Votre formation approche !</h2>
|
||||
<p>Bonjour ${params.apprenantPrenom},</p>
|
||||
<p>Bonjour ${salutation},</p>
|
||||
|
||||
<p>Nous sommes ravis de vous accueillir prochainement pour la formation <strong>${params.formationNom}</strong>.</p>
|
||||
|
||||
@@ -213,14 +222,20 @@ export async function sendTeaserEmail(params: {
|
||||
export async function sendRappelJ7Email(params: {
|
||||
apprenantEmail: string;
|
||||
apprenantPrenom: string;
|
||||
apprenantNom: string;
|
||||
apprenantFonction: string;
|
||||
formationNom: string;
|
||||
sessionNom: string;
|
||||
dateDebut: Date;
|
||||
lieu: string;
|
||||
}): Promise<boolean> {
|
||||
const fonctionLabel = params.apprenantFonction === 'directeur' ? 'Directeur' :
|
||||
params.apprenantFonction === 'chef_service' ? 'Chef de service' : '';
|
||||
const salutation = fonctionLabel ? `${fonctionLabel} ${params.apprenantPrenom} ${params.apprenantNom}` : params.apprenantPrenom;
|
||||
|
||||
const content = `
|
||||
<h2>Rappel : Votre formation dans 7 jours</h2>
|
||||
<p>Bonjour ${params.apprenantPrenom},</p>
|
||||
<p>Bonjour ${salutation},</p>
|
||||
|
||||
<p>Nous vous rappelons que votre formation <strong>${params.formationNom}</strong> commence dans 7 jours.</p>
|
||||
|
||||
@@ -256,7 +271,7 @@ export async function sendRappelJ7Email(params: {
|
||||
* Envoie des emails groupés à tous les inscrits d'une session
|
||||
*/
|
||||
export async function sendGroupEmail(params: {
|
||||
recipients: Array<{ email: string; prenom: string }>;
|
||||
recipients: Array<{ email: string; prenom: string; nom: string; fonction: string }>;
|
||||
formationNom: string;
|
||||
sessionNom: string;
|
||||
type: 'teaser' | 'rappel';
|
||||
@@ -272,6 +287,8 @@ export async function sendGroupEmail(params: {
|
||||
await sendTeaserEmail({
|
||||
apprenantEmail: recipient.email,
|
||||
apprenantPrenom: recipient.prenom,
|
||||
apprenantNom: recipient.nom,
|
||||
apprenantFonction: recipient.fonction,
|
||||
formationNom: params.formationNom,
|
||||
sessionNom: params.sessionNom,
|
||||
dateDebut: params.dateDebut,
|
||||
@@ -280,6 +297,8 @@ export async function sendGroupEmail(params: {
|
||||
await sendRappelJ7Email({
|
||||
apprenantEmail: recipient.email,
|
||||
apprenantPrenom: recipient.prenom,
|
||||
apprenantNom: recipient.nom,
|
||||
apprenantFonction: recipient.fonction,
|
||||
formationNom: params.formationNom,
|
||||
sessionNom: params.sessionNom,
|
||||
dateDebut: params.dateDebut,
|
||||
|
||||
Reference in New Issue
Block a user