Workload Adjustment Recommender

Workload Adjustment Recommender

Analysis Period (Optional for immediate load assessment)

Current Tasks/Projects

    Your Capacity & Well-being

    Input your workload and capacity details on the first tab, then click "Get Adjustment Recommendations".

    Your Action Plan Notes:

      `; warReportData.contributingFactors.forEach(f => pdfHTML += `
    • ${f}
    • `); pdfHTML += `
    `; } // Use the already generated HTML for analysis and recommendations from the display // Need to extract the specific parts from warReportData.recommendationsHTML or re-generate for PDF context const workloadSnapshotHTML = reportDisplayElement.querySelector('.war-report-section:first-of-type') ? reportDisplayElement.querySelector('.war-report-section:first-of-type').innerHTML : ''; const recommendationsHTMLSection = Array.from(reportDisplayElement.querySelectorAll('.war-report-section')).find(el => el.textContent.includes("Recommended Adjustments")); const recommendationsContent = recommendationsHTMLSection ? recommendationsHTMLSection.innerHTML : '

    No recommendations generated.

    '; pdfHTML += `
    ${workloadSnapshotHTML.replace('

    Workload Snapshot

    ', '

    3. Workload Analysis

    ')}`; pdfHTML += `
    ${recommendationsContent.replace('

    Recommended Adjustments & Strategies

    ', '

    4. Recommended Adjustments & Strategies

    ')}`; const actionPlanNotes = document.getElementById('war-action-plan-notes').value.trim(); if (actionPlanNotes) { pdfHTML += `

    5. Your Action Plan Notes

    `; pdfHTML += `

    ${actionPlanNotes.replace(/\n/g, '
    ')}

    `; } const pdfContainer = document.getElementById('war-report-content-for-pdf'); pdfContainer.innerHTML = pdfHTML; // Apply critical styles that might be lost by html2pdf pdfContainer.querySelectorAll('.workload-comparison').forEach(el => { if (el.classList.contains('workload-high')) { el.style.backgroundColor = getComputedStyle(document.documentElement).getPropertyValue('--danger-color'); el.style.color = 'white';} else if (el.classList.contains('workload-balanced')) { el.style.backgroundColor = getComputedStyle(document.documentElement).getPropertyValue('--success-color'); el.style.color = 'white';} else if (el.classList.contains('workload-low')) { el.style.backgroundColor = getComputedStyle(document.documentElement).getPropertyValue('--warning-color'); el.style.color = getComputedStyle(document.documentElement).getPropertyValue('--text-color');} }); const opt = { margin: [0.6, 0.5, 0.6, 0.5], filename: 'Workload_Adjustment_Report.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