Work-Life Balance Evaluator
Weekly Time Allocation (Actual - Hours per Week)
Estimate average hours spent per week in each category. Total hours in a week: 168.
Total Hours Entered: 0 / 168
Satisfaction Levels (1=Very Dissatisfied, 5=Very Satisfied)
Ideal Time Allocation (Optional - Hours per Week)
If you have an ideal in mind, enter it here. This helps identify gaps.
Input your time and satisfaction levels on the first tab, then click "Evaluate My Balance".
Total Actual Hours Reported: ${data.totalActualHours.toFixed(1)}
Visual Time Breakdown (Actual %)
`;
const totalValidHoursForChart = data.totalActualHours > 0 ? data.totalActualHours : 1; // Avoid division by zero
data.allocations.filter(a => a.actual > 0).sort((x,y) => y.actual - x.actual).forEach(alloc => {
const percentage = (alloc.actual / totalValidHoursForChart) * 100;
html += `
`;
});
html += `
${alloc.category}
${percentage.toFixed(0)}% (${alloc.actual.toFixed(1)}h)
Key Observations & Reflections
- `;
data.insights.forEach(insight => html += `
- ${insight} `); html += `
Prompts for Further Reflection
- Which single change this week could improve your satisfaction in your lowest-rated category?
- Are there any activities acting as 'time thieves' that you could reduce?
- How does this evaluation align with your long-term personal and professional goals?
Work-Life Balance Evaluation Report
`; pdfHTML += `Report generated on: ${new Date().toLocaleDateString()}
`; // Clone the report content, but style it for PDF explicitly const reportClone = reportDisplayElement.cloneNode(true); // Remove H3 from clone as we add custom one const h3InClone = reportClone.querySelector('h3'); if (h3InClone) h3InClone.remove(); pdfHTML += reportClone.innerHTML; const pdfContainer = document.getElementById('wlbe-report-content-for-pdf'); if(!pdfContainer) return; pdfContainer.innerHTML = pdfHTML; // Ensure colors for satisfaction and chart bars for PDF pdfContainer.querySelectorAll('.satisfaction-cell span').forEach(span => { const satClass = Array.from(span.classList).find(cls => cls.startsWith('wlbe-sat-')); if(satClass){ const satNum = satClass.split('-')[2]; span.style.backgroundColor = getComputedStyle(document.documentElement).getPropertyValue(`--sat-${satNum}-bg`).trim(); span.style.color = getComputedStyle(document.documentElement).getPropertyValue(`--sat-${satNum}-text`).trim(); } }); pdfContainer.querySelectorAll('.wlbe-chart-bar').forEach(bar => { bar.style.backgroundColor = getComputedStyle(document.documentElement).getPropertyValue('--accent-color').trim(); bar.style.color = getComputedStyle(document.documentElement).getPropertyValue('--dark-color').trim(); }); const opt = { margin: [0.6, 0.4, 0.6, 0.4], filename: 'WorkLifeBalance_Evaluation.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."); }); }