diff --git a/client/src/pages/Invoices.tsx b/client/src/pages/Invoices.tsx index 8e75ea9..df599f1 100644 --- a/client/src/pages/Invoices.tsx +++ b/client/src/pages/Invoices.tsx @@ -61,12 +61,12 @@ export default function Invoices() { onSuccess: (data) => { toast.success(`${data.invoices.length} facture(s) exportée(s) avec succès`); - // Download PDFs - data.invoices.forEach(inv => { - const link = document.createElement('a'); - link.href = inv.fileUrl; - link.download = `${inv.supplierName || 'facture'}_${inv.invoiceNumber || 'unknown'}.pdf`; - link.click(); + // Open PDFs in new tabs + data.invoices.forEach((inv, index) => { + // Add a small delay between each window to avoid popup blocking + setTimeout(() => { + window.open(inv.fileUrl, '_blank'); + }, index * 100); }); setSelectedIds([]); diff --git a/todo.md b/todo.md index 368984f..7755fc1 100644 --- a/todo.md +++ b/todo.md @@ -96,3 +96,9 @@ - [x] Recalculer le score de qualité après édition manuelle - [x] Ajouter bouton "Export Excel" dans la page Factures - [x] Générer fichier Excel avec toutes les métadonnées + +## Correction export PDF +- [x] Diagnostiquer le problème d'export PDF (URLs non accessibles) +- [x] Corriger la route exportToPdf pour retourner les bonnes URLs +- [x] Modifier le code client pour ouvrir les PDFs dans de nouveaux onglets +- [x] Ajouter un délai entre chaque ouverture pour éviter le blocage des popups