feat : ajout de la partie reception des marchandises (étape 3) et modification du bon de réception
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user