Online Meeting Scheduling Conflict Resolver

Online Meeting Scheduling Conflict Resolver

Attendees

Availability Window

No common time slots found for all attendees within the specified window and business hours (9 AM - 5 PM local time).

`; pdfDownloadContainer.classList.add('hidden'); return; } const attendeesHeader = attendees.map(a => `${a.name}'s Time`).join(''); const slotRows = slots.map(utcSlot => { const attendeeCells = attendees.map(attendee => { const localTime = new Date(utcSlot.getTime() + attendee.timezoneOffset * 3600 * 1000); return `${formatDate(localTime)}`; }).join(''); return `${attendeeCells}`; }).join(''); resultsOutput.innerHTML = `

${meetingTitle}

Suggested meeting times (${duration} minutes)

${attendeesHeader} ${slotRows}
`; pdfDownloadContainer.classList.remove('hidden'); }; /** * Formats a Date object into a readable string. */ const formatDate = (date) => { return date.toLocaleString('en-US', { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit', hour12: true, timeZone: 'UTC' // Important: treat the date object's values as UTC }); }; /** * Generates and triggers the download of a PDF report. */ const generatePdf = () => { const { jsPDF } = window.jspdf; const doc = new jsPDF(); const meetingTitle = document.getElementById('meeting-title').value || 'Meeting'; const duration = document.getElementById('meeting-duration').value; doc.setFontSize(18); doc.text(`Meeting Schedule: ${meetingTitle}`, 14, 22); doc.setFontSize(11); doc.setTextColor(100); doc.text(`Duration: ${duration} minutes`, 14, 30); const table = resultsOutput.querySelector('table'); if (table) { doc.autoTable({ html: table, startY: 35, theme: 'grid', headStyles: { fillColor: [243, 244, 246], textColor: [55, 65, 81], fontStyle: 'bold' }, styles: { cellPadding: 2.5, fontSize: 9 }, }); } else { doc.text("No results to display.", 14, 40); } doc.save(`${meetingTitle.replace(/\s+/g, '_')}_schedule.pdf`); }; // --- Event Listeners --- addAttendeeBtn.addEventListener('click', () => addAttendee()); downloadPdfBtn.addEventListener('click', generatePdf); findSlotsBtn.addEventListener('click', resolveConflicts); // Also linked via updateNavButtons logic // --- Initial Setup --- const today = new Date().toISOString().split('T')[0]; document.getElementById('start-date').value = today; const nextWeek = new Date(); nextWeek.setDate(nextWeek.getDate() + 7); document.getElementById('end-date').value = nextWeek.toISOString().split('T')[0]; addAttendee('Alice (USA)', 'alice@example.com', -7); // PST/MST addAttendee('Bob (USA)', 'bob@example.com', -5); // EST addAttendee('Charlie (International)', 'charlie@example.com', 1); // CET updateNavButtons(); });
Scroll to Top