Add webinar calendar integration and consulting slot blocking
- Fix webinar duration field reference in Calendar (duration_minutes) - Calculate and display webinar end times in calendar view - Fetch webinars for selected date in consulting booking - Block consulting slots that overlap with webinar times - Show warning when webinars are scheduled on selected date - Properly handle webinar time range conflicts This prevents booking conflicts when users try to schedule consulting sessions during webinar times. Example: Webinar 20:15-22:15 blocks consulting slots 20:00-22:30 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -46,7 +46,7 @@ export default function Calendar() {
|
||||
// Fetch webinar events
|
||||
const { data: webinars } = await supabase
|
||||
.from('products')
|
||||
.select('id, title, event_start, duration')
|
||||
.select('id, title, event_start, duration_minutes')
|
||||
.eq('type', 'webinar')
|
||||
.eq('is_active', true)
|
||||
.gte('event_start', start)
|
||||
@@ -76,12 +76,16 @@ export default function Calendar() {
|
||||
webinars?.forEach(w => {
|
||||
if (w.event_start) {
|
||||
const eventDate = new Date(w.event_start);
|
||||
const durationMs = (w.duration_minutes || 60) * 60 * 1000;
|
||||
const endDate = new Date(eventDate.getTime() + durationMs);
|
||||
|
||||
allEvents.push({
|
||||
id: w.id,
|
||||
title: w.title,
|
||||
type: 'webinar',
|
||||
date: format(eventDate, 'yyyy-MM-dd'),
|
||||
start_time: format(eventDate, 'HH:mm'),
|
||||
end_time: format(endDate, 'HH:mm'),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user