Healthy Work Habit Advisor
Select Focus Areas
Choose the areas where you'd like advice on forming healthier work habits. Relevant tips will be displayed below.
Create Your Action Plan
Based on the advice, choose 1-3 habits you want to focus on implementing. This will be included in your PDF summary.
Summary of Advice for Selected Areas (Review)
Select focus areas on the 'Get Habit Advice' tab and click "Show Advice" to see relevant tips here too.
Advice for Your Selected Focus Areas:
`; hwhaSelectedFocusAreas.forEach(areaId => { const areaConfig = HWHA_FOCUS_AREAS.find(a => a.id === areaId); const adviceTips = HWHA_ADVICE_DATA[areaId]; if (areaConfig && adviceTips && adviceTips.length > 0) { pdfHTML += `${areaConfig.name}
- `;
adviceTips.forEach(tip => {
pdfHTML += `
- ${tip} `; }); pdfHTML += `
Selected Focus Areas:
No specific focus areas were selected for detailed advice in this plan.
`; } pdfHTML += `My Chosen Habits to Implement:
`; let actionPlanExists = false; if (action1) { pdfHTML += `1. ${action1}
`; actionPlanExists = true; } if (action2) { pdfHTML += `2. ${action2}
`; actionPlanExists = true; } if (action3) { pdfHTML += `3. ${action3}
`; actionPlanExists = true; } if (!actionPlanExists) { pdfHTML += `No specific habits chosen for the action plan yet.
`; } const pdfContainer = document.getElementById('hwha-report-content-for-pdf'); pdfContainer.innerHTML = pdfHTML; // Apply styles for PDF pdfContainer.querySelectorAll('.hwha-advice-category').forEach(el => { el.style.backgroundColor = getComputedStyle(document.documentElement).getPropertyValue('--light-color'); el.style.borderLeftColor = getComputedStyle(document.documentElement).getPropertyValue('--primary-color'); }); pdfContainer.querySelectorAll('h4').forEach(el => { el.style.color = getComputedStyle(document.documentElement).getPropertyValue('--dark-color'); }); const opt = { margin: [0.6, 0.5, 0.6, 0.5], filename: 'My_Healthy_Work_Habit_Plan.pdf', image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2, useCORS: true, logging: false }, jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }, pagebreak: { mode: ['avoid-all', 'css', 'legacy'] } }; html2pdf().from(pdfContainer).set(opt).save().then(() => { pdfContainer.innerHTML = ''; }).catch(err => { console.error("Error generating PDF:", err); pdfContainer.innerHTML = ''; alert("An error occurred while generating the PDF. Check console for details."); }); }