Added Budget Page
This commit is contained in:
@@ -35,6 +35,11 @@ export const AVAILABLE_PAGES = [
|
||||
label: 'Participation financière',
|
||||
description: 'Documents de participation financière',
|
||||
},
|
||||
{
|
||||
route: '/dashboard/budget',
|
||||
label: 'Budget',
|
||||
description: 'Budget des prescripteurs',
|
||||
},
|
||||
{
|
||||
route: '/dashboard/archives',
|
||||
label: 'Archives',
|
||||
|
||||
@@ -21,19 +21,37 @@ export async function createParticipationForTrajet(trajetId: string): Promise<bo
|
||||
});
|
||||
if (existing) return true;
|
||||
|
||||
// Destinataire: univers pro si lié, sinon adhérent
|
||||
// Destinataire selon facturation de l'adhérent
|
||||
// Si facturation = "Adhérent" (ou vide) → email adhérent
|
||||
// Sinon → rechercher un Univers Pro dont nomEntreprise correspond à la facturation
|
||||
let destinataireEmail: string;
|
||||
let destinataireNom: string;
|
||||
let destinataireType: 'adherent' | 'univers_pro';
|
||||
|
||||
if (trajet.universProId && trajet.universPro) {
|
||||
const facturation = (trajet.adherent.facturation || '').trim();
|
||||
const isAdherent = !facturation || /^adh[eé]rent$/i.test(facturation);
|
||||
|
||||
if (isAdherent) {
|
||||
destinataireEmail = trajet.adherent.email;
|
||||
destinataireNom = `${trajet.adherent.prenom} ${trajet.adherent.nom}`;
|
||||
destinataireType = 'adherent';
|
||||
} else if (trajet.universProId && trajet.universPro) {
|
||||
destinataireEmail = trajet.universPro.email;
|
||||
destinataireNom = `${trajet.universPro.prenom} ${trajet.universPro.nom} - ${trajet.universPro.nomEntreprise}`;
|
||||
destinataireType = 'univers_pro';
|
||||
} else {
|
||||
destinataireEmail = trajet.adherent.email;
|
||||
destinataireNom = `${trajet.adherent.prenom} ${trajet.adherent.nom}`;
|
||||
destinataireType = 'adherent';
|
||||
const universPro = await prisma.universPro.findFirst({
|
||||
where: { nomEntreprise: facturation },
|
||||
});
|
||||
if (universPro) {
|
||||
destinataireEmail = universPro.email;
|
||||
destinataireNom = `${universPro.prenom} ${universPro.nom} - ${universPro.nomEntreprise}`;
|
||||
destinataireType = 'univers_pro';
|
||||
} else {
|
||||
destinataireEmail = trajet.adherent.email;
|
||||
destinataireNom = `${trajet.adherent.prenom} ${trajet.adherent.nom}`;
|
||||
destinataireType = 'adherent';
|
||||
}
|
||||
}
|
||||
|
||||
const participation = await prisma.participationFinanciere.create({
|
||||
|
||||
Reference in New Issue
Block a user