fix: Utiliser email_signature au lieu de email_contact dans le modal d'envoi groupé de signatures électroniques

This commit is contained in:
odentas 2025-11-19 12:21:24 +01:00
parent 813cbb998f
commit 3d9e1298d4

View file

@ -45,18 +45,24 @@ export default function BulkESignConfirmModal({
const orgIds = [...new Set(selectedContracts.map(c => c.org_id).filter(Boolean))];
const emails: Record<string, string> = {};
for (const orgId of orgIds) {
try {
const response = await fetch(`/api/informations?org_id=${orgId}`);
if (response.ok) {
const data = await response.json();
if (data.email) {
emails[orgId as string] = data.email;
try {
const response = await fetch('/api/staff/organizations/emails', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ org_ids: orgIds }),
});
if (response.ok) {
const data = await response.json();
// data est un array de { org_id, email_signature }
data.forEach((org: any) => {
if (org.org_id && org.email_signature) {
emails[org.org_id] = org.email_signature;
}
}
} catch (error) {
console.error(`Erreur lors de la récupération de l'email pour org ${orgId}:`, error);
});
}
} catch (error) {
console.error('Erreur lors de la récupération des emails de signature:', error);
}
setEmployerEmails(emails);
@ -128,10 +134,10 @@ export default function BulkESignConfirmModal({
{contract.contract_number && `[${contract.contract_number}]`} {contract.employee_name || contract.salaries?.salarie || '—'}
</p>
<p className="text-gray-600 mt-1">
👤 Salarié : <span className={employeeEmail ? "text-indigo-600 font-mono" : "text-orange-600"}>{employeeEmail || "Email non renseigné"}</span>
Salarié : <span className={employeeEmail ? "text-indigo-600 font-mono" : "text-orange-600"}>{employeeEmail || "Email non renseigné"}</span>
</p>
<p className="text-gray-600">
Employeur : <span className={employerEmail ? "text-indigo-600 font-mono" : "text-orange-600"}>{employerEmail || "Email non renseigné"}</span>
Employeur (signature) : <span className={employerEmail ? "text-indigo-600 font-mono" : "text-orange-600"}>{employerEmail || "Email signature non renseigné"}</span>
</p>
</div>
);