<?php
    $user = auth()->user();
    $bookingsOpen = request()->routeIs('bookings.*');
    $adminOpen = request()->routeIs('admin.*');
?>

<aside id="vemSidebar" class="vem-sidebar" aria-label="Main navigation">
    <div class="vem-sidebar-brand">
        <div class="vem-sidebar-brand-icon">
            <i class="bi bi-building" aria-hidden="true"></i>
        </div>
        <div class="vem-sidebar-brand-text">
            <strong><?php echo e(config('app.name', 'Venue Events Manager')); ?></strong>
            <small>Events &amp; Reservations</small>
        </div>
    </div>

    <nav class="vem-sidebar-nav" aria-label="Sidebar menu">
        <?php if($user?->hasPermission('dashboard.view')): ?>
            <a href="<?php echo e(route('dashboard')); ?>"
               class="vem-nav-link <?php echo e(request()->routeIs('dashboard') ? 'active' : ''); ?>"
               <?php if(request()->routeIs('dashboard')): ?> aria-current="page" <?php endif; ?>>
                <i class="bi bi-speedometer2" aria-hidden="true"></i>
                <span>Dashboard</span>
            </a>
        <?php endif; ?>

        <?php if($user?->hasPermission('customers.view')): ?>
            <a href="<?php echo e(Route::has('customers.index') ? route('customers.index') : '#'); ?>"
               class="vem-nav-link <?php echo e(request()->routeIs('customers.*') ? 'active' : ''); ?>">
                <i class="bi bi-people" aria-hidden="true"></i>
                <span>Customers</span>
            </a>
        <?php endif; ?>

        <?php if($user?->hasPermission('spaces.view')): ?>
            <a href="<?php echo e(Route::has('spaces.index') ? route('spaces.index') : '#'); ?>"
               class="vem-nav-link <?php echo e(request()->routeIs('spaces.*') ? 'active' : ''); ?>">
                <i class="bi bi-door-open" aria-hidden="true"></i>
                <span>Spaces</span>
            </a>
        <?php endif; ?>

        <?php if($user?->hasPermission('spaces.view')): ?>
            <a href="<?php echo e(Route::has('availability.index') ? route('availability.index') : '#'); ?>"
               class="vem-nav-link <?php echo e(request()->routeIs('availability.*') ? 'active' : ''); ?>">
                <i class="bi bi-calendar3" aria-hidden="true"></i>
                <span>Availability Calendar</span>
            </a>
        <?php endif; ?>

        <?php if($user?->hasPermission('products.view')): ?>
            <a href="<?php echo e(Route::has('products.index') ? route('products.index') : '#'); ?>"
               class="vem-nav-link <?php echo e(request()->routeIs('products.*') ? 'active' : ''); ?>">
                <i class="bi bi-box-seam" aria-hidden="true"></i>
                <span>Products &amp; Services</span>
            </a>
        <?php endif; ?>

        <?php if($user?->hasPermission('packages.view')): ?>
            <a href="<?php echo e(Route::has('packages.index') ? route('packages.index') : '#'); ?>"
               class="vem-nav-link <?php echo e(request()->routeIs('packages.*') ? 'active' : ''); ?>">
                <i class="bi bi-collection" aria-hidden="true"></i>
                <span>Packages</span>
            </a>
        <?php endif; ?>

        <?php if($user?->hasPermission('bookings.view')): ?>
            <button class="vem-nav-link vem-nav-toggle <?php echo e($bookingsOpen ? 'active' : ''); ?>"
                    type="button"
                    data-bs-toggle="collapse"
                    data-bs-target="#navBookings"
                    aria-expanded="<?php echo e($bookingsOpen ? 'true' : 'false'); ?>"
                    aria-controls="navBookings">
                <i class="bi bi-calendar-event" aria-hidden="true"></i>
                <span>Bookings &amp; Reservations</span>
                <i class="bi bi-chevron-down" aria-hidden="true"></i>
            </button>
            <div class="collapse vem-nav-children <?php echo e($bookingsOpen ? 'show' : ''); ?>" id="navBookings" data-nav-collapse="bookings">
                <?php
                    $bookingLinks = [
                        ['label' => 'All', 'route' => 'bookings.index', 'params' => []],
                        ['label' => 'Upcoming', 'route' => 'bookings.index', 'params' => ['view' => 'upcoming']],
                        ['label' => 'Today', 'route' => 'bookings.index', 'params' => ['view' => 'today']],
                        ['label' => 'Past', 'route' => 'bookings.index', 'params' => ['view' => 'past']],
                        ['label' => 'Provisional', 'route' => 'bookings.index', 'params' => ['status' => 'provisional']],
                        ['label' => 'Confirmed', 'route' => 'bookings.index', 'params' => ['status' => 'confirmed']],
                        ['label' => 'Cancelled', 'route' => 'bookings.index', 'params' => ['status' => 'cancelled']],
                    ];
                ?>
                <?php $__currentLoopData = $bookingLinks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $link): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php
                        $href = Route::has($link['route'])
                            ? route($link['route'], $link['params'])
                            : '#';
                        $isActive = request()->routeIs('bookings.*')
                            && request('view', request('filter', '')) === ($link['params']['view'] ?? $link['params']['filter'] ?? '')
                            && request('status', '') === ($link['params']['status'] ?? '');
                    ?>
                    <a href="<?php echo e($href); ?>" class="vem-nav-link <?php echo e($isActive ? 'active' : ''); ?>">
                        <?php echo e($link['label']); ?>

                    </a>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
        <?php endif; ?>

        <?php if($user?->hasPermission('quotations.view')): ?>
            <a href="<?php echo e(Route::has('quotations.index') ? route('quotations.index') : '#'); ?>"
               class="vem-nav-link <?php echo e(request()->routeIs('quotations.*') ? 'active' : ''); ?>">
                <i class="bi bi-file-earmark-text" aria-hidden="true"></i>
                <span>Quotations</span>
            </a>
        <?php endif; ?>

        <?php if($user?->hasPermission('invoices.view')): ?>
            <a href="<?php echo e(Route::has('invoices.index') ? route('invoices.index') : '#'); ?>"
               class="vem-nav-link <?php echo e(request()->routeIs('invoices.*') ? 'active' : ''); ?>">
                <i class="bi bi-receipt" aria-hidden="true"></i>
                <span>Invoices</span>
            </a>
        <?php endif; ?>

        <?php if($user?->hasPermission('payments.view')): ?>
            <a href="<?php echo e(Route::has('payments.index') ? route('payments.index') : '#'); ?>"
               class="vem-nav-link <?php echo e(request()->routeIs('payments.*') ? 'active' : ''); ?>">
                <i class="bi bi-credit-card" aria-hidden="true"></i>
                <span>Payments</span>
            </a>
        <?php endif; ?>

        <?php if($user?->hasPermission('reports.view')): ?>
            <a href="<?php echo e(Route::has('reports.index') ? route('reports.index') : '#'); ?>"
               class="vem-nav-link <?php echo e(request()->routeIs('reports.*') ? 'active' : ''); ?>">
                <i class="bi bi-bar-chart-line" aria-hidden="true"></i>
                <span>Reports</span>
            </a>
        <?php endif; ?>

        <?php
            $canAdmin = $user?->hasPermission('users.manage')
                || $user?->hasPermission('roles.manage')
                || $user?->hasPermission('settings.manage')
                || $user?->hasPermission('audit.view');
        ?>

        <?php if($canAdmin): ?>
            <div class="vem-nav-section">Administration</div>

            <button class="vem-nav-link vem-nav-toggle <?php echo e($adminOpen ? 'active' : ''); ?>"
                    type="button"
                    data-bs-toggle="collapse"
                    data-bs-target="#navAdmin"
                    aria-expanded="<?php echo e($adminOpen ? 'true' : 'false'); ?>"
                    aria-controls="navAdmin">
                <i class="bi bi-gear" aria-hidden="true"></i>
                <span>Administration</span>
                <i class="bi bi-chevron-down" aria-hidden="true"></i>
            </button>
            <div class="collapse vem-nav-children <?php echo e($adminOpen ? 'show' : ''); ?>" id="navAdmin" data-nav-collapse="admin">
                <?php if($user?->hasPermission('users.manage')): ?>
                    <a href="<?php echo e(route('admin.users.index')); ?>"
                       class="vem-nav-link <?php echo e(request()->routeIs('admin.users.*') ? 'active' : ''); ?>">
                        Users
                    </a>
                <?php endif; ?>
                <?php if($user?->hasPermission('roles.manage')): ?>
                    <a href="<?php echo e(route('admin.roles.index')); ?>"
                       class="vem-nav-link <?php echo e(request()->routeIs('admin.roles.*') ? 'active' : ''); ?>">
                        Roles
                    </a>
                <?php endif; ?>
                <?php if($user?->hasPermission('settings.manage')): ?>
                    <a href="<?php echo e(route('admin.settings.edit')); ?>"
                       class="vem-nav-link <?php echo e(request()->routeIs('admin.settings.*') ? 'active' : ''); ?>">
                        Settings
                    </a>
                <?php endif; ?>
                <?php if($user?->hasPermission('audit.view')): ?>
                    <a href="<?php echo e(route('admin.audit-logs.index')); ?>"
                       class="vem-nav-link <?php echo e(request()->routeIs('admin.audit-logs.*') ? 'active' : ''); ?>">
                        Audit Logs
                    </a>
                <?php endif; ?>
            </div>
        <?php endif; ?>
    </nav>
</aside>

<div id="vemSidebarBackdrop" class="vem-sidebar-backdrop d-none" onclick="vemCloseSidebar()" aria-hidden="true"></div>
<?php /**PATH C:\xampp\htdocs\hotelplus\consol\resources\views/layouts/partials/sidebar.blade.php ENDPATH**/ ?>