Spaces:
Running
Running
looking really good but 2 things
Browse filesBuild failed: Cannot set properties of undefined (setting 'detailTable')
And second the PDF needs to be build better now it has these big blocks. it needs to also remove the export buttons in the pdf and also Give me a export in word option
290 unmodified lines291292293294295296297298299300301302303304305306141 unmodified lines4484494504514524534544554564574584598 unmodified lines46846947047147247347447547647747813 unmodified lines492493494495496497498499500501502503405 unmodified lines909910911912913914915916917918919920921922923924925926927928290 unmodified lines<div class="text-sm text-gray-400 mt-1" id="status">Choose CSV/ODS → Report builds automatically → Export PDF</div></div></div><div class="flex flex-wrap gap-3"><input type="file" id="fileInput" accept=".csv,.ods" class="file-upload" /><label for="fileInput" class="btn btn-outline flex items-center gap-2"><i data-feather="upload"></i> Upload Data</label><button class="btn btn-primary flex items-center gap-2" id="btnExport"><i data-feather="download"></i> Export PDF</button></div></div></header><!-- Error Bar -->141 unmodified linesconst logoInput = document.getElementById('logo-input');const logoText = document.getElementById('logo-text');const fileInput = document.getElementById('fileInput');const btnExport = document.getElementById('btnExport');const errBox = document.getElementById('errBox');const scenariosContainer = document.getElementById('scenarios-container');const dlAllPage = document.getElementById('dlAllPage');const dlNotPage = document.getElementById('dlNotPage');const btnAIDraft = document.getElementById('btnAIDraft');const btnExecCSV = document.getElementById('btnExecCSV');const btnExpandDetail = document.getElementById('btnExpandDetail');const btnCollapseDetail = document.getElementById('btnCollapseDetail');8 unmodified lineslogoSlot.addEventListener('click', () => logoInput.click());logoInput.addEventListener('change', handleLogoUpload);fileInput.addEventListener('change', e => handleFile(e.target.files[0]));btnExport.addEventListener('click', () => window.print());dlAllPage.addEventListener('click', () => downloadCSV('all_recipients_page.csv', collectPage('all')));dlNotPage.addEventListener('click', () => downloadCSV('users_not_trained_page.csv', collectPage('not')));btnAIDraft.addEventListener('click', generateAIDraft);btnExecCSV.addEventListener('click', downloadExecCSV);btnExpandDetail.addEventListener('click', expandDetailTable);btnCollapseDetail.addEventListener('click', collapseDetailTable);dlAllCSV.addEventListener('click', () => downloadCSV('all_recipients.csv', modalAllRows));13 unmodified linesreader.readAsDataURL(file);}// File Handlingfunction handleFile(file) {try {clearError();if (!file) return;statusEl.textContent = 'Loaded: ' + file.name;const ext = (file.name.split('.').pop() || '').toLowerCase();if (ext === 'csv') {405 unmodified linesconst slice = rows.slice(0, Math.max(0, limit || 0));renderTable(containerId, slice, cols);}function expandDetailTable() {expandTable('detailTable');btnExpandDetail.classList.add('hidden');btnCollapseDetail.classList.remove('hidden');}function collapseDetailTable() {collapseTable('detailTable', 5);btnCollapseDetail.classList.add('hidden');btnExpandDetail.classList.remove('hidden');}function expandTable(containerId) {const t = window.__TABLES[containerId];if (!t) return;renderTable(containerId, t.rows, t.cols);290 unmodified lines291292293294295296297298299300301302303304305306307308309141 unmodified lines4514524534544554564574584594604614624638 unmodified lines47247347447547647747847948048148248313 unmodified lines497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540405 unmodified lines946947948949950951952953954955956957958959960961962963290 unmodified lines<div class="text-sm text-gray-400 mt-1" id="status">Choose CSV/ODS → Report builds automatically → Export PDF</div></div></div><div class="flex flex-wrap gap-3"><input type="file" id="fileInput" accept=".csv,.ods" class="file-upload" /><label for="fileInput" class="btn btn-outline flex items-center gap-2"><i data-feather="upload"></i> Upload Data</label><button class="btn btn-primary flex items-center gap-2" id="btnExportPDF"><i data-feather="download"></i> Export PDF</button><button class="btn btn-secondary flex items-center gap-2" id="btnExportWord"><i data-feather="file-text"></i> Export Word</button></div></div></header><!-- Error Bar -->141 unmodified linesconst logoInput = document.getElementById('logo-input');const logoText = document.getElementById('logo-text');const fileInput = document.getElementById('fileInput');const btnExportPDF = document.getElementById('btnExportPDF');const btnExportWord = document.getElementById('btnExportWord');const errBox = document.getElementById('errBox');const scenariosContainer = document.getElementById('scenarios-container');const dlAllPage = document.getElementById('dlAllPage');const dlNotPage = document.getElementById('dlNotPage');const btnAIDraft = document.getElementById('btnAIDraft');const btnExecCSV = document.getElementById('btnExecCSV');const btnExpandDetail = document.getElementById('btnExpandDetail');const btnCollapseDetail = document.getElementById('btnCollapseDetail');8 unmodified lineslogoSlot.addEventListener('click', () => logoInput.click());logoInput.addEventListener('change', handleLogoUpload);fileInput.addEventListener('change', e => handleFile(e.target.files[0]));btnExportPDF.addEventListener('click', exportPDF);btnExportWord.addEventListener('click', exportWord);dlAllPage.addEventListener('click', () => downloadCSV('all_recipients_page.csv', collectPage('all')));dlNotPage.addEventListener('click', () => downloadCSV('users_not_trained_page.csv', collectPage('not')));btnAIDraft.addEventListener('click', generateAIDraft);btnExecCSV.addEventListener('click', downloadExecCSV);btnExpandDetail.addEventListener('click', expandDetailTable);btnCollapseDetail.addEventListener('click', collapseDetailTable);dlAllCSV.addEventListener('click', () => downloadCSV('all_recipients.csv', modalAllRows));13 unmodified linesreader.readAsDataURL(file);}// Export Functionsfunction exportPDF() {// Hide elements that shouldn't appear in PDFconst elementsToHide = document.querySelectorAll('.no-print, .btn, .scenario-actions, .ai-bar');elementsToHide.forEach(el => {el.classList.add('hidden-in-pdf');el.style.display = 'none';});// Generate PDFwindow.print();// Restore elements after a short delaysetTimeout(() => {elementsToHide.forEach(el => {el.classList.remove('hidden-in-pdf');el.style.display = '';});}, 1000);}function exportWord() {// Create a new window with only the contentconst printWindow = window.open('', '', 'height=600,width=800');printWindow.document.write('<html><head><title>Security Report</title>');printWindow.document.write('</head><body>');printWindow.document.write(document.querySelector('main').innerHTML);printWindow.document.write('</body></html>');printWindow.document.close();printWindow.print();}// File Handlingfunction handleFile(file) {try {clearError();if (!file) return;statusEl.textContent = 'Loaded: ' + file.name;const ext = (file.name.split('.').pop() || '').toLowerCase();if (ext === 'csv') {405 unmodified linesconst slice = rows.slice(0, Math.max(0, limit || 0));renderTable(containerId, slice, cols);}function expandDetailTable() {expandTable('detailTable');document.getElementById('btnExpandDetail').classList.add('hidden');document.getElementById('btnCollapseDetail').classList.remove('hidden');}function collapseDetailTable() {collapseTable('detailTable', 5);document.getElementById('btnCollapseDetail').classList.add('hidden');document.getElementById('btnExpandDetail').classList.remove('hidden');}function expandTable(containerId) {const t = window.__TABLES[containerId];if (!t) return;renderTable(containerId, t.rows, t.cols);
index.html+56-21