/** * Calendar Agent Specific Functions */ class CalendarAgent { constructor() { this.totalActions = 0; this.init(); } init() { Utils.time.updateLastUpdated('lastSync'); this.initializeEventListeners(); } initializeEventListeners() { Utils.events.onEnterKey('calendarCommand', () => this.executeCalendarCommand()); } setCalendarCommand(command) { Utils.form.setInputValue('calendarCommand', command); this.executeCalendarCommand(); } async executeCalendarCommand() { const command = Utils.form.getInputValue('calendarCommand'); if (!command) { Utils.toast.warning('Please enter a command'); return; } Utils.button.setLoading('calendarAiBtn', 'Processing...', 'fa-spinner fa-spin'); try { // Simulate AI processing await new Promise(resolve => setTimeout(resolve, 1500)); const response = this.generateCalendarAIResponse(command); Utils.modal.showAI(response); this.updateCalendarStats(); Utils.time.updateLastUpdated('lastSync'); } catch (error) { Utils.toast.error('Error processing command: ' + error.message); } finally { Utils.button.restore('calendarAiBtn', 'Execute', 'fa-robot'); Utils.form.clearInput('calendarCommand'); } } generateCalendarAIResponse(command) { const lowerCommand = command.toLowerCase(); if (lowerCommand.includes('schedule') && lowerCommand.includes('meeting')) { return `
Best time for all attendees: Tomorrow 3:30 PM - 4:30 PM
Title: Team Strategy Discussion
Duration: 1 hour
Attendees: Sarah, John, Mike, Lisa, David
Agenda: Q1 planning and resource allocation
Processing your request: "${command}"
I can help you with: