Personal Data Protection Compliance Tracker

Personal Data Protection Compliance Tracker

Evaluate your organization's data protection posture with this checklist.

Step 1 of 5

${q}

`; }); html += `
`; container.innerHTML = html; } } } // --- UI & STATE UPDATE LOGIC --- function updateUI() { tabButtons.forEach((btn) => { btn.classList.toggle('active', btn.dataset.tab === tabs[currentTabIndex]); }); tabPanels.forEach(panel => panel.classList.add('hidden')); document.getElementById(`tab-panel-${tabs[currentTabIndex]}`).classList.remove('hidden'); prevBtn.disabled = currentTabIndex === 0; prevBtn.classList.toggle('opacity-50', prevBtn.disabled); nextBtn.disabled = currentTabIndex === tabs.length - 1; nextBtn.classList.toggle('opacity-50', nextBtn.disabled); prevBtn.style.visibility = (currentTabIndex === 0) ? 'hidden' : 'visible'; tabIndicator.textContent = `Step ${currentTabIndex + 1} of ${tabs.length}`; } // --- REPORTING & PDF --- function generateReportSummary() { const formData = new FormData(form); const results = {}; let totalAnswered = 0; let totalQuestions = 0; for (const [key, category] of Object.entries(checklistData)) { results[key] = { title: category.title, score: 0, maxScore: 0, nonCompliantItems: [] }; category.questions.forEach((q, index) => { totalQuestions++; const value = formData.get(`${key}-${index}`); if (value !== null) { totalAnswered++; const score = parseInt(value); if (score > 0) { // Yes (2) or N/A (1) contribute to score results[key].score += score; } if (score === 0) { // 'No' is non-compliant results[key].nonCompliantItems.push(q); } if(score !== 1) { // N/A doesn't count towards max score potential results[key].maxScore += 2; } } }); } const allAnswered = totalAnswered === totalQuestions; if (!allAnswered) { document.getElementById('report-prompt').classList.remove('hidden'); document.getElementById('report-results').classList.add('hidden'); downloadPdfBtn.disabled = true; return; } document.getElementById('report-prompt').classList.add('hidden'); document.getElementById('report-results').classList.remove('hidden'); downloadPdfBtn.disabled = false; const summaryContainer = document.getElementById('summary-container'); let summaryHtml = ''; let overallScore = 0; let overallMaxScore = 0; for (const [key, data] of Object.entries(results)) { const percentage = data.maxScore > 0 ? Math.round((data.score / data.maxScore) * 100) : 100; overallScore += data.score; overallMaxScore += data.maxScore; let color = 'bg-green-500'; if (percentage < 75) color = 'bg-yellow-500'; if (percentage < 50) color = 'bg-red-500'; summaryHtml += `

${data.title}

${percentage}%
${data.nonCompliantItems.length > 0 ? `

Action Required:

    ${data.nonCompliantItems.map(item => `
  • ${item}
  • `).join('')}
` : ''}
`; } const overallPercentage = overallMaxScore > 0 ? Math.round((overallScore / overallMaxScore) * 100) : 100; let overallColor = 'bg-green-500'; if (overallPercentage < 75) overallColor = 'bg-yellow-500'; if (overallPercentage < 50) overallColor = 'bg-red-500'; const overallHtml = `

Overall Compliance Score

${overallPercentage}%
`; summaryContainer.innerHTML = overallHtml + summaryHtml; } async function generatePdf() { const { jsPDF } = window.jspdf; const reportContent = document.getElementById('pdf-content'); if (!reportContent || document.getElementById('report-results').classList.contains('hidden')) { alert("Please complete the checklist before downloading the report."); return; } try { reportContent.style.fontFamily = 'Arial, sans-serif'; const canvas = await html2canvas(reportContent, { scale: 2 }); reportContent.style.fontFamily = ''; const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); pdf.setFontSize(22); pdf.text("Data Protection Compliance Report", 40, 60); pdf.setFontSize(12); pdf.text(`Report generated on: ${new Date().toLocaleDateString()}`, 40, 80); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const imgProps = pdf.getImageProperties(imgData); const imgWidth = pdfWidth - 80; const imgHeight = (imgProps.height * imgWidth) / imgProps.width; let heightLeft = imgHeight; let position = 110; pdf.addImage(imgData, 'PNG', 40, position, imgWidth, imgHeight); heightLeft -= (pdfHeight - 120); while (heightLeft > 0) { position = heightLeft - imgHeight -10; pdf.addPage(); pdf.addImage(imgData, 'PNG', 40, position, imgWidth, imgHeight); heightLeft -= pdfHeight; } pdf.save('Data_Protection_Compliance_Report.pdf'); } catch (error) { console.error('Error generating PDF:', error); alert('An error occurred while generating the PDF.'); } } // --- START THE APP --- initializeTool(); });
Scroll to Top