`;
});
resultsSummaryEl.innerHTML = summaryHtml;
} else {
resultsSummaryEl.innerHTML = '
Based on your answers, there are no obvious signs of consumer rights violations.
'; } calculationResults = { score: finalScore, label: riskLabel, summary: summaryPoints }; } function generatePDF() { const { jsPDF } = window.jspdf; const doc = new jsPDF(); const res = calculationResults; doc.setFont('helvetica', 'bold'); doc.setFontSize(20); doc.text('Consumer Rights Violation Check Report', 105, 20, { align: 'center' }); doc.setFontSize(32); doc.text(`Risk Score: ${res.score}`, 105, 40, { align: 'center' }); doc.setFontSize(18); doc.text(`Risk Level: ${res.label}`, 105, 50, { align: 'center' }); if (res.summary.length > 0) { const body = res.summary.map(p => [p.text, p.issue]); doc.autoTable({ startY: 65, head: [['Area of Concern', 'Potential Issue']], body: body, theme: 'grid', headStyles: { fillColor: [59, 130, 246] }, }); } else { doc.setFontSize(12); doc.text('Based on the answers provided, no potential violations were flagged.', 14, 65); } const finalY = doc.lastAutoTable.finalY || 75; doc.setFontSize(10); doc.setTextColor(150); doc.text('Disclaimer: This report is for informational purposes only and does not constitute legal advice.', 14, finalY + 15); doc.save('Consumer-Rights-Check-Report.pdf'); } });