Compliance Training Course Creator

Compliance Training Course Creator

Build a custom training course module by module.

${courseData.description || 'No description provided.'}

`; courseData.modules.forEach(module => { html += `

${module.title}

`; const points = module.content.split('\n').filter(p => p.trim() !== ''); html += '
    '; points.forEach(point => { html += `
  • ${point.replace(//g, ">").replace(/^•\s*/, '')}
  • `; }); html += '
'; }); courseReviewContent.innerHTML = html; }; const downloadPDF = () => { const { jsPDF } = window.jspdf; const contentArea = document.getElementById('pdf-content-area'); html2canvas(contentArea, { scale: 2, useCORS: true, backgroundColor: '#ffffff' }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const imgProps= pdf.getImageProperties(imgData); const imgHeight = (imgProps.height * pdfWidth) / imgProps.width; let heightLeft = imgHeight; let position = 0; pdf.addImage(imgData, 'PNG', 0, position, pdfWidth, imgHeight); heightLeft -= pdfHeight; while (heightLeft >= 0) { position = heightLeft - imgHeight; pdf.addPage(); pdf.addImage(imgData, 'PNG', 0, position, pdfWidth, imgHeight); heightLeft -= pdfHeight; } pdf.save(`${courseData.title.replace(/\s+/g, '_') || 'Compliance_Course'}.pdf`); }); }; // Event Listeners prevBtn.addEventListener('click', () => navigateTabs(-1)); nextBtn.addEventListener('click', () => navigateTabs(1)); addModuleBtn.addEventListener('click', addModule); downloadPdfBtn.addEventListener('click', downloadPDF); courseTitleInput.addEventListener('input', (e) => courseData.title = e.target.value); courseDescriptionInput.addEventListener('input', (e) => courseData.description = e.target.value); modulesContainer.addEventListener('input', handleModuleUpdate); modulesContainer.addEventListener('click', handleModuleRemove); tabButtons.forEach(button => { button.addEventListener('click', () => { const tabIndex = parseInt(button.dataset.tab, 10); if (tabIndex === totalTabs - 1) { renderReview(); } showTab(tabIndex); }); }); // Initial Setup courseTitleInput.value = courseData.title; courseDescriptionInput.value = courseData.description; addModule(); // Start with one module showTab(0); });
Scroll to Top