Posture Correction Exercise Planner

Posture Correction Exercise Planner

Identify Your Posture Concerns

Select the primary areas you'd like to improve. This will help us suggest the most effective exercises for you.

Recommended Exercises

Based on your assessment, here are some recommended exercises. Click to select the ones you want to add to your plan.

Your Personalized Posture Plan

Here is your selected exercise plan. We recommend performing these exercises 3-5 times per week.

Subject: Corrective Exercise Plan
Date:

No exercises selected. Go to the "Exercises" tab to add to your plan.

`; document.getElementById('download-pdf-btn').style.display = 'none'; return; } document.getElementById('download-pdf-btn').style.display = 'inline-block'; container.innerHTML = Array.from(userSelections.exercises).map(exId => { const ex = exerciseData[exId]; return `

${ex.name}

${ex.desc}

Recommendation: ${ex.sets}

`; }).join(''); } window.goToTab = function(index) { if (index > currentTabIndex && !validateCurrentTab()) return; saveCurrentTabData(); currentTabIndex = index; if (tabs[currentTabIndex] === 'exercises') updateRecommendedExercises(); if (tabs[currentTabIndex] === 'plan') renderPlanSummary(); updateUI(); }; function validateCurrentTab() { if (currentTabIndex === 0) { const checked = document.querySelector('input[name="concern"]:checked'); if (!checked) { alert("Please select at least one posture concern to proceed."); return false; } } return true; } function saveCurrentTabData() { if (tabs[currentTabIndex] === 'assessment') { userSelections.concerns.clear(); document.querySelectorAll('input[name="concern"]:checked').forEach(input => { userSelections.concerns.add(input.value); }); } } function updateUI() { Object.keys(tabButtons).forEach((key, index) => { tabButtons[key].classList.toggle('active', index === currentTabIndex); tabContents[key].classList.toggle('active', index === currentTabIndex); }); prevBtn.classList.toggle('invisible', currentTabIndex === 0); nextBtn.classList.toggle('invisible', currentTabIndex === tabs.length - 1); } function handleNav(direction) { const newIndex = currentTabIndex + (direction === 'next' ? 1 : -1); if (newIndex >= 0 && newIndex < tabs.length) { window.goToTab(newIndex); } } function generatePdf() { prepareReportData(); const reportContainer = document.getElementById('pdf-report-container'); reportContainer.style.display = 'block'; html2canvas(reportContainer, { scale: 2, useCORS: true }).then(canvas => { const { jsPDF } = window.jspdf; const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'px', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const ratio = canvas.width / canvas.height; const imgHeight = pdfWidth / ratio; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, imgHeight); pdf.save('Personalized-Posture-Plan.pdf'); reportContainer.style.display = 'none'; }); } function prepareReportData() { document.getElementById('report-date').textContent = new Date().toLocaleDateString('en-US'); const reportBody = document.getElementById('pdf-report-body'); let concernsHtml = `

Identified Concerns

`; userSelections.concerns.forEach(key => { concernsHtml += `

${postureData[key].label}

${postureData[key].description}

`; }); concernsHtml += `
`; let exercisesHtml = `

Your Exercise Plan

`; userSelections.exercises.forEach(exId => { const ex = exerciseData[exId]; exercisesHtml += `

${ex.name}

${ex.desc}

Recommendation: ${ex.sets}

`; }); exercisesHtml += `
`; reportBody.innerHTML = concernsHtml + exercisesHtml; } // --- Event Listeners --- nextBtn.addEventListener('click', () => handleNav('next')); prevBtn.addEventListener('click', () => handleNav('prev')); document.getElementById('download-pdf-btn').addEventListener('click', generatePdf); // --- Initial Setup --- renderAssessmentOptions(); updateUI(); });
Scroll to Top