diff --git a/public/index.html b/public/index.html index 57cdc3e..ea6bf33 100644 --- a/public/index.html +++ b/public/index.html @@ -83,6 +83,7 @@ body.modal-open { overflow: hidden; } +
@@ -493,6 +494,16 @@ function closeAiModal(){ document.body.classList.remove('modal-open'); } +function downloadPdf(){ + const printWin = window.open('', '_blank'); + if (!printWin) return; + const cardsHtml = app.innerHTML; + const css = [...document.querySelectorAll('style')].map(s=>s.textContent||'').join('\n'); + printWin.document.write(`Coachingcards PDF
${cardsHtml}
`); + printWin.document.close(); + printWin.onload = () => setTimeout(() => printWin.print(), 200); +} + async function syncActiveJob(){ const r = await fetch('/api/generate/active'); const j = await r.json(); @@ -620,6 +631,7 @@ document.getElementById('saveAll').onclick=async()=>{ document.getElementById('menuToggle').onclick=()=>sidebar.classList.toggle('open'); document.getElementById('openReorder').onclick=()=>{ sidebar.classList.remove('open'); openReorderModal(); }; document.getElementById('openAi').onclick=async()=>{ sidebar.classList.remove('open'); await openAiModal(); }; +document.getElementById('downloadPdf').onclick=()=>{ sidebar.classList.remove('open'); downloadPdf(); }; document.getElementById('cancelReorder').onclick=closeReorderModal; document.getElementById('closeReorderX').onclick=closeReorderModal; document.getElementById('saveReorder').onclick=async()=>{