Correction PDF

This commit is contained in:
2025-09-16 22:20:21 +02:00
parent d9fca86145
commit 41bd8254e7
17 changed files with 591 additions and 110 deletions

View File

@@ -55,6 +55,22 @@
})(jQuery); // End of use strict
async function openRecipePdfById(id, initialUrl) {
let pdfUrl = initialUrl || '';
if (!pdfUrl) {
try {
const res = await fetch(`/HelloFresh/GetRecipesDetails?ids=${encodeURIComponent(id)}`);
if (res.ok) {
const arr = await res.json();
pdfUrl = (arr?.[0]?.pdf || arr?.[0]?.Pdf || '');
}
} catch { /* ignore */ }
}
if (!pdfUrl) { alert("Aucun PDF pour cette recette."); return; }
const proxied = `/HelloFresh/ProxyPdf?url=${encodeURIComponent(pdfUrl)}`;
showPdfModal(proxied);
}
/**
* 💶 Formate un nombre en chaîne de caractères au format français avec division par 1000.
* Exemples :