feat : ajout de la partie reception des marchandises (étape 3) et modification du bon de réception

This commit is contained in:
2026-01-29 16:33:37 +01:00
parent cff80b5ab2
commit 07be7e8d14
26 changed files with 1141 additions and 107 deletions

View File

@@ -6,21 +6,26 @@ export const usePdfPrinter = () => {
const currentReception = receptionStore.current
const printPdf = async (url: string): Promise<void> => {
if (!import.meta.client) {
return
}
const blob = await api.getBlob(url);
const pdfBlob = blob.type === 'application/pdf'
? blob
: new Blob([blob], { type: 'application/pdf' });
const blobUrl = URL.createObjectURL(pdfBlob);
const filename = `${currentReception.identificationNumber}_${currentReception.supplier.name}_${currentReception.licensePlate}.pdf`;
const blob = await api.getBlob(url)
const blobUrl = URL.createObjectURL(blob)
const a = document.createElement('a');
a.href = url;
// nom du fichier à changer par les infos du store pinia
a.download = `${currentReception.identificationNumber}_${currentReception.supplier.name}_${currentReception.licensePlate}`;
a.href = blobUrl;
a.download = filename;
a.style.display = 'none';
document.body.appendChild(a);
a.click();
a.remove();
window.open(blobUrl, '_blank', 'noopener,noreferrer')
setTimeout(() => URL.revokeObjectURL(blobUrl), 60000)
window.open(blobUrl, '_blank', 'noopener,noreferrer');
setTimeout(() => URL.revokeObjectURL(blobUrl), 60_000);
}
return {