Overlapping Task Detector

Overlapping Task Detector

Add or Edit Task

Task List

Task NameStart DateTimeEnd DateTimeActions

Overlap Detection

No task overlaps detected. Well planned!

"; } else { overlaps.forEach(ov => { const itemDiv = document.createElement('div'); itemDiv.className = 'otd-overlap-item'; itemDiv.innerHTML = `

Task A: ${ov.taskA_name}

Task B: ${ov.taskB_name}

Overlap Period: From ${otd_formatDateTimeForDisplay(ov.overlapStartDateTime)} To ${otd_formatDateTimeForDisplay(ov.overlapEndDateTime)}

`; overlapListDiv.appendChild(itemDiv); }); } resultsDiv.style.display = 'block'; document.getElementById('otd_pdfButton').style.display = 'inline-block'; } function otd_downloadPDF() { if (typeof jsPDF === 'undefined' || typeof jsPDF.API === 'undefined' || typeof jsPDF.API.autoTable === 'undefined') { alert("PDF generation library is not loaded."); console.error("jsPDF or jsPDF-AutoTable is not loaded."); return; } const doc = new jsPDF(); const primaryColorPDF = getComputedStyle(document.documentElement).getPropertyValue('--primary-color').trim(); const textColorPDF = getComputedStyle(document.documentElement).getPropertyValue('--text-color').trim(); const whiteColorPDF = '#FFFFFF'; doc.setFontSize(20); doc.setTextColor(primaryColorPDF); doc.text("Task Overlap Report", 14, 22); doc.setFontSize(11); doc.setTextColor(textColorPDF); doc.text(`Generated On: ${OTD_GENERATED_ON_DATE}`, 14, 30); let currentY = 40; // Section 1: All Tasks doc.setFontSize(14); doc.setTextColor(primaryColorPDF); doc.text("Summary of All Tasks Entered:", 14, currentY); currentY += 8; if (otd_tasks.length > 0) { const taskTableColumns = ["Task Name", "Start DateTime", "End DateTime"]; const taskTableRows = otd_tasks.map(t => [ t.name, otd_formatDateTimeForDisplay(t.startDateTime), otd_formatDateTimeForDisplay(t.endDateTime) ]); doc.autoTable({ head: [taskTableColumns], body: taskTableRows, startY: currentY, theme: 'grid', headStyles: { fillColor: primaryColorPDF, textColor: whiteColorPDF }, styles: { fontSize: 9, cellPadding: 2, textColor: textColorPDF }, alternateRowStyles: { fillColor: [245, 245, 245] } }); currentY = doc.lastAutoTable.finalY + 10; } else { doc.setFontSize(10); doc.setTextColor(textColorPDF); doc.text("No tasks were entered for analysis.", 16, currentY); currentY += 10; } // Section 2: Detected Overlaps doc.setFontSize(14); doc.setTextColor(primaryColorPDF); if (currentY > 250) { doc.addPage(); currentY = 20; } // Check for page break doc.text("Detected Overlaps Analysis:", 14, currentY); currentY += 8; const overlaps = otd_detectOverlaps(); if (overlaps.length > 0) { const overlapTableColumns = ["Task A", "Task B", "Overlap Start", "Overlap End"]; const overlapTableRows = overlaps.map(ov => [ ov.taskA_name, ov.taskB_name, otd_formatDateTimeForDisplay(ov.overlapStartDateTime), otd_formatDateTimeForDisplay(ov.overlapEndDateTime) ]); doc.autoTable({ head: [overlapTableColumns], body: overlapTableRows, startY: currentY, theme: 'grid', headStyles: { fillColor: primaryColorPDF, textColor: whiteColorPDF }, styles: { fontSize: 9, cellPadding: 2, textColor: textColorPDF }, alternateRowStyles: { fillColor: [245, 245, 245] }, columnStyles: { // Example to make columns wider if needed 0: { cellWidth: 'auto' }, 1: { cellWidth: 'auto' }, 2: { cellWidth: 40 }, 3: { cellWidth: 40 } } }); currentY = doc.lastAutoTable.finalY + 10; } else { doc.setFontSize(10); doc.setTextColor(textColorPDF); doc.text(otd_tasks.length < 2 ? "Not enough tasks to detect overlaps." : "No task overlaps detected.", 16, currentY); currentY += 10; } doc.save('Task_Overlap_Report.pdf'); }
Scroll to Top