Checkpoint: Ajout de la page de gestion des attestations de formation
Nouvelle fonctionnalité complète pour gérer les attestations : - Schéma de base de données : colonnes modeAttestation et modeEnvoi dans formations, colonnes documentUrl, documentS3Key, uploadedBy, uploadedAt dans attestations - Backend : fichier gestionAttestationsDb.ts, procédures tRPC, fonction sendAttestationEmail - Interface : page AdminGestionAttestations avec sélection de formation, configuration des modes, tableau des apprenants, boutons upload/prévisualisation/envoi/suppression - Navigation : lien dans menu Gestion, route /admin/gestion-attestations
This commit is contained in:
@@ -978,3 +978,46 @@ export async function sendNotificationFormateurPlaceDisponible(params: {
|
||||
html: await getEmailTemplate(content, 'notification_formateur'),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoie une attestation de formation par email
|
||||
*/
|
||||
export async function sendAttestationEmail(params: {
|
||||
to: string;
|
||||
apprenantNom: string;
|
||||
apprenantPrenom: string;
|
||||
formationNom: string;
|
||||
pdfUrl: string;
|
||||
}): Promise<boolean> {
|
||||
const content = `
|
||||
<h2>Votre attestation de formation</h2>
|
||||
|
||||
<p>Bonjour ${params.apprenantPrenom} ${params.apprenantNom},</p>
|
||||
|
||||
<p>Nous avons le plaisir de vous transmettre votre attestation de formation pour :</p>
|
||||
|
||||
<div class="info-box" style="background-color: #dbeafe; border-left-color: #3b82f6;">
|
||||
<h3>${params.formationNom}</h3>
|
||||
</div>
|
||||
|
||||
<p>Vous pouvez télécharger votre attestation en cliquant sur le lien ci-dessous :</p>
|
||||
|
||||
<div style="text-align: center; margin: 30px 0;">
|
||||
<a href="${params.pdfUrl}" style="display: inline-block; padding: 12px 30px; background-color: #3b82f6; color: white; text-decoration: none; border-radius: 5px; font-weight: bold;">
|
||||
📄 Télécharger mon attestation
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p>Cette attestation certifie votre participation à la formation et peut être utilisée pour votre dossier professionnel.</p>
|
||||
|
||||
<p>Nous vous remercions pour votre participation et vous souhaitons une excellente continuation.</p>
|
||||
|
||||
<p>Cordialement,<br/>L'équipe Formation</p>
|
||||
`;
|
||||
|
||||
return sendEmail({
|
||||
to: params.to,
|
||||
subject: `Votre attestation de formation - ${params.formationNom}`,
|
||||
html: await getEmailTemplate(content, 'attestation'),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user