<?php if (isset($component)) { $__componentOriginala9a83a123d88acdd340fad74fb98f602 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginala9a83a123d88acdd340fad74fb98f602 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.layouts.tenant','data' => ['pageTitle' => 'Agenda']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('layouts.tenant'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['pageTitle' => 'Agenda']); ?>

    <?php $__env->startPush('head'); ?>
        <link href="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.11/index.global.min.css" rel="stylesheet">
        <style>
            .agenda-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; }
            .agenda-side { position: sticky; top: 88px; align-self: start; }
            .agenda-calendar-card { overflow: hidden; border: 1px solid #e2e8f0; border-radius: 24px; background: #fff; box-shadow: 0 18px 50px rgba(15, 23, 42, .06); }
            .agenda-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid #e2e8f0; background: linear-gradient(180deg, #fff, #f8fafc); }
            .agenda-title { font-size: 24px; line-height: 1.1; font-weight: 800; color: #0f172a; letter-spacing: 0; }
            .agenda-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
            .agenda-icon-btn, .agenda-view-btn, .agenda-today-btn { height: 38px; border: 1px solid #e2e8f0; background: #fff; color: #334155; border-radius: 999px; padding: 0 14px; font-size: 13px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: .15s ease; }
            .agenda-icon-btn { width: 38px; padding: 0; }
            .agenda-icon-btn:hover, .agenda-view-btn:hover, .agenda-today-btn:hover { border-color: #cbd5e1; background: #f8fafc; }
            .agenda-view-btn.is-active { background: #0f172a; border-color: #0f172a; color: #fff; }
            .agenda-calendar-wrap { padding: 12px 14px 18px; }
            .agenda-side-panel { border: 1px solid #e2e8f0; border-radius: 24px; background: #fff; box-shadow: 0 18px 50px rgba(15, 23, 42, .06); overflow: hidden; }
            .agenda-profile { display: flex; align-items: center; gap: 12px; padding: 18px; border-bottom: 1px solid #e2e8f0; background: #fff; }
            .agenda-avatar { width: 42px; height: 42px; border-radius: 999px; display: grid; place-items: center; color: #fff; font-weight: 900; background: linear-gradient(135deg, #4f46e5, #06b6d4); }
            .agenda-mini { padding: 16px 18px; border-bottom: 1px solid #e2e8f0; }
            .agenda-mini-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; margin-top: 12px; text-align: center; }
            .agenda-mini-grid span { height: 26px; display: grid; place-items: center; border-radius: 999px; font-size: 11px; font-weight: 700; color: #64748b; }
            .agenda-mini-grid .day-name { height: auto; color: #94a3b8; font-size: 10px; text-transform: uppercase; }
            .agenda-mini-grid .is-today { background: #111827; color: #fff; }
            .agenda-mini-grid .is-muted { color: #cbd5e1; }
            .agenda-list { padding: 16px 18px; border-bottom: 1px solid #e2e8f0; }
            .agenda-list-item { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px solid #f1f5f9; }
            .agenda-list-item:first-of-type { border-top: 0; }
            .agenda-time { font-size: 12px; font-weight: 900; color: #0f172a; }
            .agenda-breakdown { padding: 16px 18px 18px; }
            .agenda-bar { height: 6px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
            .agenda-bar > span { display: block; height: 100%; border-radius: inherit; }
            .fc { font-family: inherit; color: #0f172a; }
            .fc .fc-header-toolbar { display: none; }
            .fc-theme-standard .fc-scrollgrid { border: 0 !important; }
            .fc-theme-standard td, .fc-theme-standard th { border-color: #e2e8f0 !important; }
            .fc .fc-col-header-cell { background: #f8fafc; padding: 10px 0; }
            .fc .fc-col-header-cell-cushion { color: #334155; font-size: 12px; font-weight: 900; text-transform: uppercase; text-decoration: none; }
            .fc .fc-timegrid-axis-cushion, .fc .fc-timegrid-slot-label-cushion { color: #64748b; font-size: 11px; font-weight: 700; }
            .fc .fc-timegrid-slot { height: 54px; background: #fff; }
            .fc .fc-timegrid-col.fc-day-today, .fc .fc-daygrid-day.fc-day-today { background: #f5f7ff !important; }
            .fc .fc-timegrid-now-indicator-line { border-color: #7c3aed; border-width: 2px; }
            .fc .fc-timegrid-now-indicator-arrow { border-color: #7c3aed; border-top-color: transparent; border-bottom-color: transparent; }
            .fc .fc-event { border: 0 !important; border-radius: 14px !important; overflow: hidden; box-shadow: 0 8px 18px rgba(15, 23, 42, .10); cursor: pointer; }
            .fc .fc-event.fc-event-draggable { cursor: grab; }
            .fc .fc-event.fc-event-dragging { cursor: grabbing; opacity: .86; filter: saturate(1.08); box-shadow: 0 18px 36px rgba(15, 23, 42, .22); }
            .fc .fc-event.is-saving { opacity: .62; pointer-events: none; }
            .fc .fc-highlight { background: rgba(79, 70, 229, .12) !important; }
            .fc .fc-event-main { padding: 0 !important; }
            .agenda-event { min-height: 100%; padding: 8px 9px; color: #0f172a; border-left: 4px solid rgba(15, 23, 42, .16); }
            .agenda-event-time { font-size: 10px; font-weight: 900; opacity: .75; }
            .agenda-event-title { margin-top: 2px; font-size: 12px; line-height: 1.15; font-weight: 900; }
            .agenda-event-meta { margin-top: 5px; font-size: 10px; line-height: 1.1; font-weight: 700; opacity: .72; }
            .agenda-event-avatars { display: flex; margin-top: 8px; }
            .agenda-event-dot { width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; margin-right: -5px; border: 2px solid rgba(255,255,255,.75); color: #fff; font-size: 9px; font-weight: 900; background: #0f172a; }
            .fc .fc-daygrid-event { white-space: normal; }
            .fc .fc-daygrid-day-number { color: #334155; font-size: 12px; font-weight: 900; text-decoration: none; padding: 8px; }
            .agenda-save-status { min-height: 18px; margin-top: 5px; font-size: 12px; font-weight: 800; color: #64748b; }
            .agenda-save-status.is-ok { color: #047857; }
            .agenda-save-status.is-error { color: #be123c; }
            @media (max-width: 1180px) {
                .agenda-shell { grid-template-columns: 1fr; }
                .agenda-side { position: static; }
            }
            @media (max-width: 760px) {
                .agenda-topbar { align-items: stretch; flex-direction: column; }
                .agenda-controls { justify-content: flex-start; }
                .agenda-calendar-wrap { padding: 8px; overflow-x: auto; }
                #agenda-calendar { min-width: 760px; }
            }
        </style>
    <?php $__env->stopPush(); ?>

    <?php
        $company = auth()->user()->company;
        $today = now();
        $monthStart = $today->copy()->startOfMonth()->startOfWeek();
        $maxBreakdown = max(array_values($statusBreakdown)) ?: 1;
        $barColors = ['Confirmadas' => '#6366f1', 'Pendientes' => '#f59e0b', 'Atendidas' => '#10b981', 'Canceladas' => '#e11d48'];
    ?>

    <div class="agenda-shell">
        <aside class="agenda-side">
            <div class="agenda-side-panel">
                <div class="agenda-profile">
                    <div class="agenda-avatar"><?php echo e(strtoupper(substr($company?->name ?? 'R', 0, 1))); ?></div>
                    <div class="min-w-0">
                        <p class="text-sm font-black text-ink-900 truncate"><?php echo e($company?->name ?? 'AsignaPro'); ?></p>
                        <p class="text-xs text-ink-500">Agenda del equipo</p>
                    </div>
                </div>

                <div class="agenda-mini">
                    <div class="flex items-center justify-between gap-3">
                        <p class="text-sm font-black text-ink-900"><?php echo e(ucfirst($today->translatedFormat('F Y'))); ?></p>
                        <a href="<?php echo e(route('tenant.bookings.create')); ?>" class="agenda-icon-btn" title="Añadir reserva">+</a>
                    </div>
                    <div class="agenda-mini-grid">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = ['L', 'M', 'M', 'J', 'V', 'S', 'D']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dayName): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <span class="day-name"><?php echo e($dayName); ?></span>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php for($i = 0; $i < 35; $i++): ?>
                            <?php $day = $monthStart->copy()->addDays($i); ?>
                            <span class="<?php echo \Illuminate\Support\Arr::toCssClasses([
                                'is-today' => $day->isToday(),
                                'is-muted' => ! $day->isSameMonth($today),
                            ]); ?>"><?php echo e($day->day); ?></span>
                        <?php endfor; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                </div>

                <div class="agenda-list">
                    <div class="flex items-center justify-between gap-3 mb-2">
                        <div>
                            <p class="text-sm font-black text-ink-900">Citas de hoy</p>
                            <p class="text-xs text-ink-500"><?php echo e($todayBookings->count()); ?> próximas</p>
                        </div>
                        <a href="<?php echo e(route('tenant.bookings.index')); ?>" class="text-xs font-bold text-brand-600">Ver</a>
                    </div>

                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $todayBookings; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $booking): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <a href="<?php echo e(route('tenant.bookings.show', $booking)); ?>" class="agenda-list-item">
                            <div class="agenda-time"><?php echo e($booking->scheduled_at?->format('g:i A')); ?></div>
                            <div class="min-w-0">
                                <p class="text-sm font-black text-ink-900 truncate"><?php echo e($booking->service?->name ?? 'Reserva'); ?></p>
                                <p class="text-xs text-ink-500 truncate"><?php echo e($booking->customer?->first_name); ?> <?php echo e($booking->customer?->last_name); ?> con <?php echo e($booking->employee?->first_name); ?></p>
                            </div>
                        </a>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <div class="py-6 text-center">
                            <p class="text-sm font-bold text-ink-700">Sin citas hoy</p>
                            <p class="mt-1 text-xs text-ink-500">Tu día está libre.</p>
                        </div>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </div>

                <div class="agenda-breakdown">
                    <p class="text-sm font-black text-ink-900">Resumen semanal</p>
                    <div class="mt-4 space-y-3">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $statusBreakdown; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $label => $count): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div>
                                <div class="flex items-center justify-between text-xs font-bold mb-1.5">
                                    <span class="text-ink-600"><?php echo e($label); ?></span>
                                    <span class="text-ink-900"><?php echo e($count); ?></span>
                                </div>
                                <div class="agenda-bar"><span style="width: <?php echo e(($count / $maxBreakdown) * 100); ?>%; background: <?php echo e($barColors[$label]); ?>"></span></div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                </div>
            </div>
        </aside>

        <section class="agenda-calendar-card" x-data="{ open: false, evt: null }" @booking-clicked.window="evt = $event.detail; open = true">
            <div class="agenda-topbar">
                <div>
                    <p class="text-xs font-black uppercase tracking-wider text-brand-600">Calendario</p>
                    <h1 id="agenda-title" class="agenda-title">Agenda</h1>
                    <p id="agenda-save-status" class="agenda-save-status" aria-live="polite"></p>
                </div>
                <div class="agenda-controls">
                    <button type="button" class="agenda-icon-btn" data-calendar-action="prev" title="Anterior">‹</button>
                    <button type="button" class="agenda-today-btn" data-calendar-action="today">Hoy</button>
                    <button type="button" class="agenda-icon-btn" data-calendar-action="next" title="Siguiente">›</button>
                    <button type="button" class="agenda-view-btn" data-calendar-view="dayGridMonth">Mes</button>
                    <button type="button" class="agenda-view-btn is-active" data-calendar-view="timeGridWeek">Semana</button>
                    <button type="button" class="agenda-view-btn" data-calendar-view="timeGridDay">Día</button>
                    <a href="<?php echo e(route('tenant.bookings.create')); ?>" class="agenda-today-btn bg-ink-900 text-white border-ink-900 hover:bg-ink-800">Añadir</a>
                </div>
            </div>

            <div class="agenda-calendar-wrap">
                <div id="agenda-calendar"></div>
            </div>

            <div x-show="open" x-cloak class="fixed inset-0 z-50 flex items-center justify-center bg-ink-950/30 p-4" @click.self="open = false">
                <div class="w-full max-w-md rounded-3xl bg-white shadow-2xl border border-ink-100 overflow-hidden" @click.stop>
                    <div class="p-6">
                        <div class="flex items-start justify-between gap-4">
                            <div class="min-w-0">
                                <p class="text-xs font-mono font-bold text-ink-400" x-text="evt?.code"></p>
                                <h3 class="mt-1 text-2xl font-black text-ink-900 leading-tight" x-text="evt?.title"></h3>
                                <p class="mt-1 text-sm text-ink-500" x-text="evt?.customer"></p>
                            </div>
                            <button @click="open = false" class="agenda-icon-btn flex-shrink-0">×</button>
                        </div>

                        <dl class="mt-5 divide-y divide-ink-100 text-sm">
                            <div class="flex justify-between gap-4 py-3"><dt class="text-ink-500">Profesional</dt><dd class="font-bold text-ink-900 text-right" x-text="evt?.employee || 'Sin asignar'"></dd></div>
                            <div class="flex justify-between gap-4 py-3"><dt class="text-ink-500">Teléfono</dt><dd class="font-bold text-ink-900 text-right" x-text="evt?.phone || 'No registrado'"></dd></div>
                            <div class="flex justify-between gap-4 py-3"><dt class="text-ink-500">Duración</dt><dd class="font-bold text-ink-900 text-right"><span x-text="evt?.duration"></span> min</dd></div>
                            <div class="flex justify-between gap-4 py-3"><dt class="text-ink-500">Valor</dt><dd class="font-bold text-ink-900 text-right" x-text="evt?.amount"></dd></div>
                            <div class="flex justify-between gap-4 py-3"><dt class="text-ink-500">Estado</dt><dd class="font-black text-brand-700 text-right" x-text="evt?.statusLabel"></dd></div>
                        </dl>

                        <div class="mt-5 flex justify-end gap-2">
                            <button @click="open = false" class="agenda-today-btn">Cerrar</button>
                            <a :href="evt?.url" class="agenda-today-btn bg-ink-900 text-white border-ink-900 hover:bg-ink-800">Ver detalle</a>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>

    <?php $__env->startPush('scripts'); ?>
        <script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.11/index.global.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.11/locales/es.global.min.js"></script>
        <script>
            document.addEventListener('DOMContentLoaded', function () {
                const el = document.getElementById('agenda-calendar');
                if (!el) return;

                const settings = <?php echo json_encode($settings, 15, 512) ?>;
                const titleEl = document.getElementById('agenda-title');
                const statusEl = document.getElementById('agenda-save-status');
                const viewButtons = document.querySelectorAll('[data-calendar-view]');
                const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content || '';
                const moveUrlTemplate = <?php echo json_encode(route('tenant.bookings.move', ['booking' => '__BOOKING__']), 512) ?>;

                function hexToRgb(hex) {
                    const clean = (hex || '#4f46e5').replace('#', '');
                    const value = clean.length === 3 ? clean.split('').map((c) => c + c).join('') : clean;
                    const number = parseInt(value, 16);
                    return { r: (number >> 16) & 255, g: (number >> 8) & 255, b: number & 255 };
                }

                function rgba(hex, alpha) {
                    const { r, g, b } = hexToRgb(hex);
                    return `rgba(${r}, ${g}, ${b}, ${alpha})`;
                }

                function initials(name) {
                    return (name || 'R').split(' ').filter(Boolean).slice(0, 2).map((part) => part[0]).join('').toUpperCase();
                }

                function escapeHtml(value) {
                    const div = document.createElement('div');
                    div.textContent = value || '';
                    return div.innerHTML;
                }

                function slotDuration(minutes) {
                    const value = Number(minutes || 30);
                    const hours = Math.floor(value / 60);
                    const mins = value % 60;
                    return `${String(hours).padStart(2, '0')}:${String(mins).padStart(2, '0')}:00`;
                }

                function refreshTitle(calendar) {
                    if (titleEl) titleEl.textContent = calendar.view.title;
                    viewButtons.forEach((btn) => btn.classList.toggle('is-active', btn.dataset.calendarView === calendar.view.type));
                }

                function formatLocalDateTime(date) {
                    if (!date) return null;

                    const pad = (value) => String(value).padStart(2, '0');

                    return [
                        date.getFullYear(),
                        pad(date.getMonth() + 1),
                        pad(date.getDate()),
                    ].join('-') + ' ' + [
                        pad(date.getHours()),
                        pad(date.getMinutes()),
                        pad(date.getSeconds()),
                    ].join(':');
                }

                function setStatus(message, type = '') {
                    if (!statusEl) return;

                    statusEl.textContent = message || '';
                    statusEl.classList.toggle('is-ok', type === 'ok');
                    statusEl.classList.toggle('is-error', type === 'error');

                    if (message && type !== 'error') {
                        window.setTimeout(() => {
                            statusEl.textContent = '';
                            statusEl.classList.remove('is-ok', 'is-error');
                        }, 2400);
                    }
                }

                async function moveBooking(info) {
                    const event = info.event;
                    const moveUrl = moveUrlTemplate.replace('__BOOKING__', encodeURIComponent(event.id));
                    const resources = typeof event.getResources === 'function' ? event.getResources() : [];

                    event.setProp('classNames', [...new Set([...(event.classNames || []), 'is-saving'])]);
                    setStatus('Guardando nueva fecha y hora...');

                    try {
                        const response = await fetch(moveUrl, {
                            method: 'PATCH',
                            headers: {
                                'Accept': 'application/json',
                                'Content-Type': 'application/json',
                                'X-CSRF-TOKEN': csrfToken,
                            },
                            body: JSON.stringify({
                                scheduled_at: formatLocalDateTime(event.start),
                                end_at: formatLocalDateTime(event.end),
                                employee_id: resources[0]?.id || event.extendedProps.employee_id || null,
                            }),
                        });

                        const payload = await response.json().catch(() => ({}));

                        if (!response.ok) {
                            throw new Error(payload.message || 'No se pudo actualizar la reserva.');
                        }

                        setStatus(payload.message || 'Reserva actualizada correctamente.', 'ok');
                        calendar.refetchEvents();
                    } catch (error) {
                        info.revert();
                        setStatus(error.message || 'No se pudo actualizar la reserva.', 'error');
                    } finally {
                        event.setProp('classNames', (event.classNames || []).filter((name) => name !== 'is-saving'));
                    }
                }

                const calendar = new FullCalendar.Calendar(el, {
                    initialView: 'timeGridWeek',
                    locale: 'es',
                    timeZone: 'local',
                    height: 'auto',
                    expandRows: true,
                    firstDay: 1,
                    weekends: Boolean(settings.show_weekends),
                    nowIndicator: true,
                    slotMinTime: '07:00:00',
                    slotMaxTime: '22:00:00',
                    slotDuration: slotDuration(settings.slot_minutes),
                    allDaySlot: false,
                    dayMaxEvents: 3,
                    editable: true,
                    eventStartEditable: true,
                    eventDurationEditable: true,
                    dragScroll: true,
                    snapDuration: slotDuration(settings.slot_minutes),
                    longPressDelay: 250,
                    eventLongPressDelay: 250,
                    selectLongPressDelay: 250,
                    eventTimeFormat: { hour: 'numeric', minute: '2-digit', meridiem: false },
                    headerToolbar: false,
                    events: {
                        url: '<?php echo e(route('tenant.bookings.events')); ?>',
                        method: 'GET',
                    },
                    eventDidMount: function (info) {
                        const color = info.event.backgroundColor || info.event.extendedProps.color || '#4f46e5';
                        info.el.style.backgroundColor = rgba(color, .34);
                        info.el.style.color = '#0f172a';
                    },
                    eventContent: function (arg) {
                        const color = arg.event.backgroundColor || '#4f46e5';
                        const props = arg.event.extendedProps || {};
                        const employee = props.employee || '';
                        const customer = props.customer || '';
                        const timeText = arg.timeText || '';

                        return {
                            html: `
                                <div class="agenda-event" style="border-left-color:${color}; background:${rgba(color, .18)}">
                                    <div class="agenda-event-time">${escapeHtml(timeText)}</div>
                                    <div class="agenda-event-title">${escapeHtml(arg.event.title)}</div>
                                    <div class="agenda-event-meta">${escapeHtml(customer || employee)}</div>
                                    <div class="agenda-event-avatars">
                                        <span class="agenda-event-dot" style="background:${color}">${escapeHtml(initials(customer))}</span>
                                        <span class="agenda-event-dot">${escapeHtml(initials(employee))}</span>
                                    </div>
                                </div>
                            `,
                        };
                    },
                    eventClick: function (info) {
                        info.jsEvent.preventDefault();
                        window.dispatchEvent(new CustomEvent('booking-clicked', {
                            detail: {
                                url: info.event.url,
                                title: info.event.title,
                                start: info.event.start?.toLocaleString(),
                                ...info.event.extendedProps,
                            },
                        }));
                    },
                    eventDrop: moveBooking,
                    eventResize: moveBooking,
                    datesSet: function () {
                        refreshTitle(calendar);
                    },
                });

                calendar.render();
                refreshTitle(calendar);

                document.querySelectorAll('[data-calendar-action]').forEach((button) => {
                    button.addEventListener('click', () => {
                        calendar[button.dataset.calendarAction]();
                        refreshTitle(calendar);
                    });
                });

                viewButtons.forEach((button) => {
                    button.addEventListener('click', () => {
                        calendar.changeView(button.dataset.calendarView);
                        refreshTitle(calendar);
                    });
                });
            });
        </script>
    <?php $__env->stopPush(); ?>

 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginala9a83a123d88acdd340fad74fb98f602)): ?>
<?php $attributes = $__attributesOriginala9a83a123d88acdd340fad74fb98f602; ?>
<?php unset($__attributesOriginala9a83a123d88acdd340fad74fb98f602); ?>
<?php endif; ?>
<?php if (isset($__componentOriginala9a83a123d88acdd340fad74fb98f602)): ?>
<?php $component = $__componentOriginala9a83a123d88acdd340fad74fb98f602; ?>
<?php unset($__componentOriginala9a83a123d88acdd340fad74fb98f602); ?>
<?php endif; ?>
<?php /**PATH /Applications/XAMPP/xamppfiles/htdocs/CitasSoft/resources/views/tenant/bookings/agenda.blade.php ENDPATH**/ ?>