Workplace Safety Compliance Checker

Workplace Safety Compliance Checker

Assess your workplace against common U.S. safety standards. This is a general guide, not a substitute for a professional OSHA inspection.

Compliance Report

Compliance Score

0%

Identified Issues

0

Generate the report to see detailed findings and recommendations.

Compliance Score

${scoreEl}

Identified Issues

${issuesEl}

Detailed Findings & Recommendations

${[1, 2, 3, 4].map(tabNum => { const tabName = document.querySelector(`.tab-button[data-tab="${tabNum}"]`).textContent; return `

${tabName}

${reportData.filter(q => q.tab === tabNum).map(q => ` `).join('')}
QuestionStatus
${q.text} ${q.answer === 'no' ? `

Recommendation: ${q.recommendation}

` : ''}
${q.answer.toUpperCase()}
`; }).join('')} `; document.getElementById('pdf-content').innerHTML = contentHTML; const { jsPDF } = window.jspdf; const button = document.getElementById('downloadPdfBtn'); button.textContent = 'Generating...'; button.disabled = true; const pdfContainer = document.getElementById('pdf-container'); pdfContainer.classList.remove('invisible'); try { const canvas = await html2canvas(pdfContainer, { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgProps = pdf.getImageProperties(imgData); const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; let heightLeft = pdfHeight; let position = 0; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); heightLeft -= pdf.internal.pageSize.getHeight(); while (heightLeft > 0) { position -= pdf.internal.pageSize.getHeight(); pdf.addPage(); pdf.addImage(imgData, 'PNG', 0, position, pdfWidth, pdfHeight); heightLeft -= pdf.internal.pageSize.getHeight(); } pdf.save('Workplace_Safety_Report.pdf'); } catch (error) { console.error("PDF generation failed:", error); } finally { button.textContent = 'Download Report as PDF'; button.disabled = false; pdfContainer.classList.add('invisible'); } } // --- INITIALIZATION --- renderQuestions(); updateTabDisplay(); nextBtn.addEventListener('click', () => changeTab(currentTab + 1)); prevBtn.addEventListener('click', () => changeTab(currentTab - 1)); document.getElementById('downloadPdfBtn').addEventListener('click', handlePdfDownload); tabButtons.forEach(button => { button.addEventListener('click', (e) => { const targetTab = parseInt(e.target.dataset.tab); // Allow navigation to report tab only if form is valid or already on a tab >= report tab if (targetTab === totalTabs && currentTab < totalTabs && !form.checkValidity()) { form.reportValidity(); } else { changeTab(targetTab); } }); }); });
Scroll to Top