fix : ne fait plus de pesée si une pesée existe + fix save des granulé + fix de la génération du pdf

This commit is contained in:
tristan
2026-02-02 17:12:23 +01:00
parent 086279f962
commit 149bced1c5
3 changed files with 50 additions and 23 deletions
+9 -12
View File
@@ -5,7 +5,7 @@ export const usePdfPrinter = () => {
const receptionStore = useReceptionStore()
const currentReception = receptionStore.current
const printPdf = async (url: string, previewWindow?: Window | null): Promise<void> => {
const printPdf = async (url: string): Promise<void> => {
const blob = await api.getBlob(url);
const pdfBlob = blob.type === 'application/pdf'
@@ -16,17 +16,14 @@ export const usePdfPrinter = () => {
const filename = `${currentReception.identificationNumber}_${currentReception.supplier.name}_${currentReception.licensePlate}.pdf`;
if (previewWindow) {
previewWindow.location.replace(blobUrl)
}
const a = document.createElement('a')
a.href = blobUrl
a.download = filename
a.style.display = 'none'
document.body.appendChild(a)
a.click()
a.remove()
const a = document.createElement('a');
a.href = blobUrl;
a.download = filename;
a.style.display = 'none';
document.body.appendChild(a);
a.click();
a.remove();
// L'ouverture dans un nouvel onglet déclenche un 2e PDF sans le nom personnalisé.
setTimeout(() => URL.revokeObjectURL(blobUrl), 60_000);
}