function initTaskManagement() { const taskContainer = document.getElementById('task-items-container'); const quickAddInput = document.getElementById('task-quick-add-input'); const taskSummaryCount = document.getElementById('task-summary-count'); // State initialization if (typeof window.calendarView === 'undefined') { window.calendarView = 'month'; } if (typeof window.calendarCurrentDate === 'undefined') { window.calendarCurrentDate = new Date(); } // Ensure no mock tasks are loaded in local storage let tasks = JSON.parse(localStorage.getItem('prospectiq-tasks') || '[]'); if (tasks.length > 0 && tasks.some(t => t.title === 'Upload primary contact data sheets' || t.title === 'Read the learning playbook on MapleMPSS')) { tasks = []; localStorage.setItem('prospectiq-tasks', JSON.stringify(tasks)); } // Install Sourcing Duty Calendar Modal if not present let calendarModal = document.getElementById('calendar-task-modal'); if (!calendarModal) { calendarModal = document.createElement('div'); calendarModal.id = 'calendar-task-modal'; calendarModal.className = 'modal fade'; calendarModal.tabIndex = -1; calendarModal.setAttribute('aria-hidden', 'true'); calendarModal.innerHTML = `
No tasks left. Write above to create one.
'; } else { taskContainer.innerHTML = currentTasks.map(task => `