Work-Life Balance Evaluator

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".

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."); }); }
Scroll to Top