Personalized Herbal Remedy
Recommender
What is your primary wellness goal?
Your Herbal Recommendations
Disclaimer: This tool provides information for educational purposes only and is not a substitute for professional medical advice. Consult with a healthcare provider before starting any new herbal supplement, especially if you are pregnant, nursing, or have a pre-existing medical condition.
No recommendations found for the selected goal.
`; } }; const updateUI = () => { prevBtn.style.visibility = currentStep > 0 ? 'visible' : 'hidden'; nextBtn.style.display = currentStep === steps.length - 1 ? 'none' : 'block'; }; const handlePdfDownload = () => { if (finalRecommendations.length === 0) return; const { jsPDF } = window.jspdf; const doc = new jsPDF(); const goal = userAnswers.goal; doc.setFillColor('#65a30d').rect(0, 0, 210, 30, 'F'); doc.setFont('helvetica', 'bold').setFontSize(20).setTextColor('#FFFFFF'); doc.text('Herbal Remedy Recommendations', 105, 18, { align: 'center' }); doc.setFontSize(16).setFont('helvetica', 'normal').setTextColor('#1f2937'); doc.text(`For Your Goal: ${goal}`, 14, 45); let yPos = 55; finalRecommendations.forEach(remedy => { if (yPos > 250) { // Add new page if content overflows doc.addPage(); yPos = 20; } doc.setFontSize(14).setFont('helvetica', 'bold').setTextColor('#4d7c0f'); doc.text(remedy.name, 14, yPos); yPos += 7; doc.setFontSize(10).setFont('helvetica', 'normal').setTextColor('#374151'); const descLines = doc.splitTextToSize(`Description: ${remedy.description}`, 180); doc.text(descLines, 14, yPos); yPos += (descLines.length * 4) + 4; const usageLines = doc.splitTextToSize(`Usage: ${remedy.usage}`, 180); doc.text(usageLines, 14, yPos); yPos += (usageLines.length * 4) + 4; const precLines = doc.splitTextToSize(`Precautions: ${remedy.precautions}`, 180); doc.text(precLines, 14, yPos); yPos += (precLines.length * 4) + 8; }); doc.save(`Herbal_Remedies_for_${goal.replace(/ /g, '_')}.pdf`); }; // --- EVENT LISTENERS --- nextBtn.addEventListener('click', () => navigate(1)); prevBtn.addEventListener('click', () => navigate(-1)); downloadPdfBtn.addEventListener('click', handlePdfDownload); // Initial UI setup updateUI(); });