Personalized Work Efficiency Booster

Personalized Work Efficiency Booster

Session Goal & Duration

Choose Your Efficiency Strategy

Active Session

Session Goal(s):

    Chosen Strategy:

    Quick Distraction Log

    Distractions Logged: 0

      Session Review

      Goal Completion:

        Strategy Effectiveness

        Strategy Used:

        Personal Metrics & Reflections

        Distractions Logged: 0

        Efficiency Booster Insights

        • Complete the review to see insights.
        ${pwebSession.strategyConfig.distraction1 ? `

        1. ${pwebSession.strategyConfig.distraction1}

        `:''} ${pwebSession.strategyConfig.distraction2 ? `

        2. ${pwebSession.strategyConfig.distraction2}

        `:''}`; break; case 'custom': strategyDetailsEl.innerHTML = `

        Your Focus: ${pwebSession.strategyConfig.description}

        `; break; default: strategyNameEl.textContent = "None / Custom (if not specified)"; break; } document.getElementById('pweb-distraction-count').textContent = pwebSession.distractions.length; document.getElementById('pweb-distraction-log-list').innerHTML = '
      • No distractions logged yet for this session.
      • '; } function pwebToggleActiveGoal(goalId) { const goal = pwebSession.goals.find(g => g.id === goalId); if (goal) { const checkbox = document.getElementById(`active-check-${goal.id}`); if(checkbox) goal.completed = checkbox.checked; const label = checkbox ? checkbox.nextElementSibling : null; if (label) { label.style.textDecoration = goal.completed ? 'line-through' : 'none'; label.style.color = goal.completed ? 'var(--secondary-color)' : 'var(--text-color)'; } } } function pwebLogDistraction() { const note = document.getElementById('pweb-distraction-note').value.trim(); pwebSession.distractions.push({ time: new Date(), note: note }); document.getElementById('pweb-distraction-count').textContent = pwebSession.distractions.length; const logListEl = document.getElementById('pweb-distraction-log-list'); if (pwebSession.distractions.length === 1 && logListEl.firstChild.textContent.includes("No distractions")) { logListEl.innerHTML = ''; } const li = document.createElement('li'); const timeStr = new Date().toLocaleTimeString([], {hour:'2-digit', minute:'2-digit'}); li.textContent = `[${timeStr}] ${note || "Distraction logged"}`; logListEl.appendChild(li); document.getElementById('pweb-distraction-note').value = ''; } // Pomodoro Timer Logic function pwebUpdateTimerDisplay() { const minutes = Math.floor(pwebTimerSecondsRemaining / 60); const seconds = pwebTimerSecondsRemaining % 60; const timerDisplay = document.getElementById('pweb-active-timer-display'); if (timerDisplay) timerDisplay.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; } function pwebSetTimer(seconds) { pwebTimerSecondsRemaining = seconds; pwebUpdateTimerDisplay(); } function pwebToggleTimer() { const button = document.getElementById('pweb-timer-startpause'); if (!button) return; if (pwebTimerInterval) { clearInterval(pwebTimerInterval); pwebTimerInterval = null; button.textContent = "Resume"; } else { if (pwebTimerSecondsRemaining <=0) { pwebIsPomodoroWorkTime ? pwebSetTimer(pwebSession.strategyConfig.work * 60) : pwebSetTimer(pwebSession.strategyConfig.breakVal * 60); } pwebTimerInterval = setInterval(() => { pwebTimerSecondsRemaining--; pwebUpdateTimerDisplay(); if (pwebTimerSecondsRemaining < 0) { // Check for < 0 to ensure it triggers after 00:00 pwebClearTimer(); button.textContent = "Start Next"; if(document.getElementById('pweb-active-timer-display')) document.getElementById('pweb-active-timer-display').textContent = "00:00 - Block Ended!"; } }, 1000); button.textContent = "Pause"; } } function pwebClearTimer() { clearInterval(pwebTimerInterval); pwebTimerInterval = null; } function pwebResetCurrentBlock() { pwebClearTimer(); const duration = pwebIsPomodoroWorkTime ? pwebSession.strategyConfig.work : pwebSession.strategyConfig.breakVal; pwebSetTimer(duration * 60); const timerButton = document.getElementById('pweb-timer-startpause'); if (timerButton) timerButton.textContent = "Start"; } function pwebSkipToNext() { pwebClearTimer(); pwebIsPomodoroWorkTime = !pwebIsPomodoroWorkTime; if(pwebIsPomodoroWorkTime) pwebPomodoroCycleCount++; const intervalType = pwebIsPomodoroWorkTime ? "Work" : "Break"; const duration = pwebIsPomodoroWorkTime ? pwebSession.strategyConfig.work : pwebSession.strategyConfig.breakVal; const intervalDisplay = document.getElementById('pweb-active-current-interval'); if (intervalDisplay) intervalDisplay.textContent = `Current Interval: ${intervalType} ${pwebIsPomodoroWorkTime ? `(Cycle ${pwebPomodoroCycleCount + 1})` : ''}`; pwebSetTimer(duration * 60); const timerButton = document.getElementById('pweb-timer-startpause'); if(timerButton) timerButton.textContent = "Start"; } // Session Review (Tab 3) function pwebEndSession() { pwebClearTimer(); pwebPrepareReviewTab(); pwebOpenTab(null, 'pweb-review'); } function pwebPrepareReviewTab() { const reviewInfoEl = document.getElementById('pweb-review-session-info'); const reviewGoalListEl = document.getElementById('pweb-review-goal-list'); const reviewStrategyUsedEl = document.getElementById('pweb-review-strategy-used'); const reviewDistractionCountEl = document.getElementById('pweb-review-distraction-count'); if (!pwebSession.date) { if(reviewInfoEl) reviewInfoEl.textContent = "No active session data. Please plan and start a session first."; if(reviewGoalListEl) reviewGoalListEl.innerHTML = '
      • No goals to review.
      • '; if(reviewDistractionCountEl) reviewDistractionCountEl.textContent = '0'; document.getElementById('pweb-booster-insights-list').innerHTML = '
      • No session data to analyze.
      • '; pwebSession.review.generated = false; // Mark as not properly prepared return; } pwebSession.review.generated = true; if(reviewInfoEl) reviewInfoEl.textContent = `Reviewing session from ${new Date(pwebSession.date+"T00:00:00").toLocaleDateString()} (Planned Duration: ${pwebSession.duration} min).`; if(reviewGoalListEl){ reviewGoalListEl.innerHTML = ''; if (pwebSession.goals.length === 0) { reviewGoalListEl.innerHTML = '
      • No goals were set for this session.
      • '; } else { pwebSession.goals.forEach(goal => { const li = document.createElement('li'); // Checkboxes are disabled here, just showing status li.innerHTML = `${goal.text} - ${goal.completed ? 'Completed':'Not Completed'}`; reviewGoalListEl.appendChild(li); }); } } const strategySelectEl = document.getElementById('pweb-strategy-select'); if(reviewStrategyUsedEl && strategySelectEl) reviewStrategyUsedEl.textContent = strategySelectEl.selectedOptions[0].text; if(reviewDistractionCountEl) reviewDistractionCountEl.textContent = pwebSession.distractions.length; document.getElementById('pweb-review-strategy-rating').value = pwebSession.review.strategyRating || '3'; document.getElementById('pweb-review-strategy-worked').value = pwebSession.review.strategyWorked || ''; document.getElementById('pweb-review-strategy-challenging').value = pwebSession.review.strategyChallenging || ''; document.getElementById('pweb-review-focus').value = pwebSession.review.focusRating || '3'; document.getElementById('pweb-review-efficiency').value = pwebSession.review.efficiencyRating || '3'; pwebGenerateBoosterInsights(); } function pwebGenerateBoosterInsights() { if (!pwebSession.review || !pwebSession.review.generated) return; // Don't run if review tab not ready pwebSession.review.strategyRating = parseInt(document.getElementById('pweb-review-strategy-rating').value); pwebSession.review.strategyWorked = document.getElementById('pweb-review-strategy-worked').value.trim(); pwebSession.review.strategyChallenging = document.getElementById('pweb-review-strategy-challenging').value.trim(); pwebSession.review.focusRating = parseInt(document.getElementById('pweb-review-focus').value); pwebSession.review.efficiencyRating = parseInt(document.getElementById('pweb-review-efficiency').value); let insights = []; const goalsCompletedCount = pwebSession.goals.filter(g => g.completed).length; const totalGoals = pwebSession.goals.length; const strategyName = document.getElementById('pweb-strategy-select').selectedOptions[0].text; if(pwebSession.review.strategyRating >= 4 && pwebSession.review.focusRating >=4){ insights.push(`The chosen strategy ('${strategyName}') combined with your high focus (${pwebSession.review.focusRating}/5) seems very effective for you!`); } else if (pwebSession.review.strategyRating <= 2) { insights.push(`The strategy ('${strategyName}') was rated ${pwebSession.review.strategyRating}/5. Reflect on your notes about challenges and consider if a different strategy or adjustments are needed.`); } if(pwebSession.distractions.length >= 5 && pwebSession.review.focusRating <=2){ // Threshold for "many" distractions insights.push(`With ${pwebSession.distractions.length} distractions logged, focus was low. For future remote sessions, consider a more robust 'Distraction Management Plan'.`); } else if (pwebSession.distractions.length <= 1 && pwebSession.review.focusRating >= 4) { insights.push("Excellent work minimizing distractions and maintaining high focus!"); } if(totalGoals > 0 && goalsCompletedCount === totalGoals && pwebSession.review.efficiencyRating >=4){ insights.push("Fantastic! You completed all session goals with high perceived efficiency."); } else if (totalGoals > 0 && goalsCompletedCount < (totalGoals > 1 ? totalGoals / 2 : 1) ) { // If more than 1 goal, less than half. If 1 goal, and not completed. insights.push("Fewer than half of the session goals were marked complete. Consider if goals were too large for the session duration, if the chosen strategy was a good fit, or if distractions played a major role."); } if (pwebSession.strategy === 'eat_the_frog' && pwebSession.strategyConfig.frogTask) { const frogGoalText = pwebSession.strategyConfig.frogTask.toLowerCase(); const frogGoalObject = pwebSession.goals.find(g => g.text.toLowerCase().includes(frogGoalText)); // Simple check if (frogGoalObject && frogGoalObject.completed) { insights.push("You successfully 'ate the frog'! This often boosts momentum for other tasks."); } else if (frogGoalObject && !frogGoalObject.completed){ insights.push("The 'frog' task seems to have remained. It might need to be broken down, or be the primary focus of a dedicated session with minimal other goals."); } } if (pwebSession.review.efficiencyRating <=2) { insights.push("Your perceived efficiency was low. Reflect on what consumed more time or energy than expected. Were there unexpected challenges or underestimations in your plan?"); } if (insights.length === 0) { insights.push("This session provides a good baseline. Continue tracking and reflecting to identify patterns and strategies that consistently boost your efficiency."); } const insightsListEl = document.getElementById('pweb-booster-insights-list'); insightsListEl.innerHTML = ''; insights.forEach(insight => { const li = document.createElement('li'); li.textContent = insight; insightsListEl.appendChild(li); }); pwebSession.review.insightsGenerated = insights; } // Attach listeners to review form elements if they exist ['pweb-review-strategy-rating', 'pweb-review-strategy-worked', 'pweb-review-strategy-challenging', 'pweb-review-focus', 'pweb-review-efficiency'].forEach(id => { const el = document.getElementById(id); if(el) { const eventType = (el.tagName === 'TEXTAREA' || el.tagName === 'INPUT') ? 'input' : 'change'; el.addEventListener(eventType, pwebGenerateBoosterInsights); } }); // PDF Download function pwebDownloadPDFReport() { if (!pwebSession.date || !pwebSession.review || !pwebSession.review.generated) { alert("Please complete a session and its review before downloading a report."); return; } pwebGenerateBoosterInsights(); // Ensure insights are current let pdfHTML = `

        Work Efficiency Session Report

        `; pdfHTML += `

        Date: ${new Date(pwebSession.date+"T00:00:00").toLocaleDateString()} | Planned Duration: ${pwebSession.duration} min

        `; pdfHTML += `

        1. Session Plan

        `; pdfHTML += `

        Goal(s):

          `; if(pwebSession.goals.length > 0) pwebSession.goals.forEach(g => pdfHTML += `
        • ${g.text}
        • `); else pdfHTML += `
        • No specific goals listed for the plan.
        • `; pdfHTML += `
        `; const strategySelectEl = document.getElementById('pweb-strategy-select'); const strategyName = strategySelectEl ? strategySelectEl.selectedOptions[0].text : pwebSession.strategy; pdfHTML += `

        Chosen Strategy: ${strategyName}

        `; let strategyConfigText = 'N/A'; switch(pwebSession.strategy) { case 'pomodoro': strategyConfigText = `Work: ${pwebSession.strategyConfig.work} min, Break: ${pwebSession.strategyConfig.breakVal} min`; break; case 'eat_the_frog': strategyConfigText = `Frog Task: ${pwebSession.strategyConfig.frogTask || "Not specified"}`; break; case 'distraction_management': strategyConfigText = `Key Distractions & Mitigations:
          `; if(pwebSession.strategyConfig.distraction1) strategyConfigText += `
        • ${pwebSession.strategyConfig.distraction1}
        • `; if(pwebSession.strategyConfig.distraction2) strategyConfigText += `
        • ${pwebSession.strategyConfig.distraction2}
        • `; if(!pwebSession.strategyConfig.distraction1 && !pwebSession.strategyConfig.distraction2) strategyConfigText += `
        • None specified.
        • `; strategyConfigText += `
        `; break; case 'custom': strategyConfigText = `Focus: ${pwebSession.strategyConfig.description || "Not specified"}`; break; } if(strategyConfigText !== 'N/A') pdfHTML += `

        Strategy Configuration: ${strategyConfigText}

        `; pdfHTML += `

        2. Session Execution & Review

        `; pdfHTML += `

        Goal Completion:

          `; if(pwebSession.goals.length > 0) { pwebSession.goals.forEach(g => pdfHTML += `
        • ${g.text} - ${g.completed ? 'Completed' : 'Not Completed'}
        • `); } else { pdfHTML += `
        • No goals were set to track completion.
        • `} pdfHTML += `
        `; pdfHTML += `

        Distractions Logged: ${pwebSession.distractions.length}

        `; if(pwebSession.distractions.length > 0) { pdfHTML += `
          `; pwebSession.distractions.forEach(d => pdfHTML += `
        • [${new Date(d.time).toLocaleTimeString([],{hour:'2-digit', minute:'2-digit'})}] ${d.note || 'Distraction'}
        • `); pdfHTML += `
        `; } pdfHTML += `

        Strategy Effectiveness Rating: ${pwebSession.review.strategyRating}/5

        `; pdfHTML += `

        What worked well with strategy:
        ${pwebSession.review.strategyWorked.replace(/\n/g, '
        ') || "N/A"}

        `; pdfHTML += `

        What was challenging with strategy:
        ${pwebSession.review.strategyChallenging.replace(/\n/g, '
        ') || "N/A"}

        `; pdfHTML += `

        Personal Focus Rating: ${pwebSession.review.focusRating}/5

        `; pdfHTML += `

        Perceived Efficiency Rating: ${pwebSession.review.efficiencyRating}/5

        `; pdfHTML += `

        3. Efficiency Booster Insights

          `; if (pwebSession.review.insightsGenerated && pwebSession.review.insightsGenerated.length > 0) { pwebSession.review.insightsGenerated.forEach(insight => pdfHTML += `
        • ${insight}
        • `); } else { pdfHTML += `
        • No specific automated insights generated. Refer to your reflections.
        • `; } pdfHTML += `
        `; const pdfContainer = document.getElementById('pweb-report-content-for-pdf'); if(!pdfContainer) { console.error("PDF container not found"); return; } pdfContainer.innerHTML = pdfHTML; const opt = { margin: [0.6, 0.5, 0.6, 0.5], filename: `Efficiency_Report_${pwebSession.date}.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