Hazardous Material Class to Packaging Type

Quantity Category: ${quantity.options[quantity.selectedIndex].text}

`; // Show regulatory references regulatoryReferences.innerHTML = ''; regulations[selectedClass].forEach(ref => { const li = document.createElement('li'); li.textContent = ref; regulatoryReferences.appendChild(li); }); // Show hazard symbols requiredSymbols.innerHTML = ''; const symbol = hazardSymbols[selectedClass]; const symbolDiv = document.createElement('div'); symbolDiv.className = 'hazard-symbol'; symbolDiv.style.backgroundColor = symbol.color; symbolDiv.textContent = symbol.text; requiredSymbols.appendChild(symbolDiv); // Show result section resultSection.style.display = 'block'; }); // Generate PDF guide pdfBtn.addEventListener('click', function() { if (!resultSection.style.display || resultSection.style.display === 'none') { alert('Please find packaging requirements first'); return; } const selectedClass = hazmatClass.value; const selectedDivision = division.value; const selectedPG = packagingGroup.value; const selectedQty = quantity.value; const requirements = packagingDB[selectedClass][selectedPG][selectedQty]; const symbol = hazardSymbols[selectedClass]; const doc = new jsPDF(); // Title doc.setFontSize(18); doc.setTextColor(44, 62, 80); doc.text('Hazardous Materials Packaging Guide', 105, 20, { align: 'center' }); // Class info doc.setFontSize(14); doc.text(`Hazard Class: ${hazmatClass.options[hazmatClass.selectedIndex].text}`, 20, 40); if (selectedDivision !== "N/A") { doc.text(`Division: ${selectedDivision}`, 20, 50); } doc.text(`Packaging Group: ${selectedPG}`, 20, 60); doc.text(`Quantity: ${quantity.options[quantity.selectedIndex].text}`, 20, 70); // Requirements doc.setFontSize(12); doc.text('Packaging Requirements:', 20, 90); doc.text(requirements, 20, 100, { maxWidth: 170 }); // Regulatory references doc.setFontSize(12); doc.text('Regulatory References:', 20, 130); let yPos = 140; regulations[selectedClass].forEach(ref => { doc.text(ref, 20, yPos); yPos += 10; }); // Hazard symbol doc.setFillColor(symbol.color); doc.circle(160, 50, 15, 'F'); doc.setTextColor(255, 255, 255); doc.setFontSize(8); doc.text(symbol.text, 160, 50, { align: 'center' }); // Footer doc.setTextColor(100); doc.setFontSize(10); doc.text(`Generated on: ${new Date().toLocaleString()}`, 20, 180); doc.save('Hazmat_Packaging_Guide.pdf'); }); });
Scroll to Top