`;
}
};
const createViolationCard = (violation) => {
const card = document.createElement('div');
card.className = 'violation-card bg-red-50 p-5 rounded-r-lg';
card.innerHTML = `
${violation.title}
${violation.description}
Relevant Statute/Rule: ${violation.law}
`;
return card;
};
const downloadPdf = () => {
const { jsPDF } = window.jspdf;
const doc = new jsPDF();
doc.setFont('helvetica', 'bold');
doc.setFontSize(18);
doc.text('Federal Tax Law Violation Check Results', 105, 20, { align: 'center' });
doc.setFontSize(11);
doc.setFont('helvetica', 'normal');
doc.text(`Report Generated: ${new Date().toLocaleDateString()}`, 105, 27, { align: 'center' });
if (violations.length > 0) {
let yPos = 40;
violations.forEach(v => {
if (yPos > 250) { doc.addPage(); yPos = 20; }
doc.setFont('helvetica', 'bold');
doc.setFontSize(14);
doc.text(v.title, 14, yPos);
yPos += 7;
doc.setFont('helvetica', 'normal');
doc.setFontSize(10);
const desc = doc.splitTextToSize(v.description, 180);
doc.text(desc, 14, yPos);
yPos += (desc.length * 5) + 3;
doc.setFont('helvetica', 'italic');
doc.text(`Relevant Law: ${v.law}`, 14, yPos);
yPos += 10;
});
} else {
doc.setFont('helvetica', 'bold');
doc.setFontSize(14);
doc.text("No Potential Violations Flagged", 14, 40);
doc.setFont('helvetica', 'normal');
doc.setFontSize(10);
const text = doc.splitTextToSize("Based on the answers provided, no common federal tax law violations were identified. This does not constitute legal advice. It is recommended to continue practicing good record-keeping and to consult a qualified tax professional for advice tailored to your specific situation.", 180);
doc.text(text, 14, 48);
}
doc.save('Tax_Violation_Check_Results.pdf');
};
tabs.forEach(tab => tab.addEventListener('click', () => { currentTab = parseInt(tab.dataset.tab); updateTabs(); }));
prevBtn.addEventListener('click', () => { if (currentTab > 1) { currentTab--; updateTabs(); } });
nextBtn.addEventListener('click', () => { if (currentTab < totalTabs) { currentTab++; updateTabs(); } });
document.getElementById('download-pdf-btn').addEventListener('click', downloadPdf);
updateTabs();
});