Server Maintenance Checklist Generator
Your generated checklist will appear here. Go to the "Checklist Configuration" tab to select your tasks.
Daily Tasks
Weekly Tasks
Monthly Tasks
Quarterly Tasks
Error: Could not load PDF generation libraries. Please check console.
'; pdfBtnContainer.style.display = 'block'; } } // Element selection const tabs = document.querySelectorAll('.smc-tool-container .smc-tab-button'); const contents = document.querySelectorAll('.smc-tool-container .smc-tab-content'); const nextBtn = document.getElementById('smc-prev-tab'); const prevBtn = document.getElementById('smc-next-tab'); const generateBtn = document.getElementById('smc-generate-checklist'); const downloadPdfBtn = document.getElementById('smc-download-pdf'); const outputDiv = document.getElementById('smc-checklist-output'); const placeholder = document.getElementById('smc-dashboard-placeholder'); const pdfBtnContainer = document.getElementById('smc-pdf-btn-container'); const customTaskButtons = document.querySelectorAll('.smc-tool-container .smc-custom-task button'); let currentTabIndex = 0; // --- Tab Navigation Function --- function showSmcTab(tabIndex) { // Guard clause if (tabIndex < 0 || tabIndex >= tabs.length) { return; } currentTabIndex = tabIndex; // Update tab buttons tabs.forEach((tab, index) => { if (index === tabIndex) { tab.classList.add('active'); } else { tab.classList.remove('active'); } }); // Show/hide content contents.forEach((content, index) => { if (index === tabIndex) { content.classList.add('active'); } else { content.classList.remove('active'); } }); // Update Nav Buttons if (prevBtn) { prevBtn.disabled = currentTabIndex === 0; } if (nextBtn) { nextBtn.disabled = currentTabIndex === tabs.length - 1; } } // --- Add Custom Task Function --- function addSmcCustomTask(frequency) { const input = document.getElementById(`smc-custom-task-${frequency}`); const list = document.getElementById(`smc-task-list-${frequency}`); // Null checks if (!input || !list) { console.error('SMC Tool: Could not find custom task elements for', frequency); return; } const taskText = input.value.trim(); if (taskText === "") { alert('Please enter a task description.'); return; } const taskId = `smc-custom-${frequency}-${Date.now()}`; // Create new task item const taskItem = document.createElement('div'); taskItem.className = 'smc-task-item'; taskItem.innerHTML = ` `; list.appendChild(taskItem); input.value = ''; // Clear input } // --- Generate Checklist Function --- function generateSmcChecklist() { if (!outputDiv || !placeholder || !pdfBtnContainer) { console.error('SMC Tool: Output elements not found.'); return; } let html = ''; let taskCount = 0; const frequencies = [ { id: 'daily', title: 'Daily Tasks' }, { id: 'weekly', title: 'Weekly Tasks' }, { id: 'monthly', title: 'Monthly Tasks' }, { id: 'quarterly', title: 'Quarterly Tasks' } ]; frequencies.forEach(freq => { const listContainer = document.getElementById(`smc-task-list-${freq.id}`); if (!listContainer) return; const checkedTasks = listContainer.querySelectorAll('input[type="checkbox"]:checked'); if (checkedTasks.length > 0) { html += `${freq.title}
- `;
checkedTasks.forEach(task => {
// Get text from the associated label
let label = document.querySelector(`label[for="${task.id}"]`);
let taskText = label ? label.textContent : task.value; // Fallback to value
html += `
- ${taskText} `; taskCount++; }); html += `
