<?php
    $isAdmin = auth()->user()->isAdmin();
    $isSuperAdmin = auth()->user()->isSuperAdmin();
?>

<aside class="fixed inset-y-0 left-0 z-50 w-64 bg-gradient-to-b from-transtev-700 to-transtev-900 text-white transform transition-transform duration-200 lg:translate-x-0 -translate-x-full lg:translate-x-0" id="sidebar">
    <div class="flex flex-col h-full">
        <div class="px-5 py-6 border-b border-white/10">
            <img src="<?php echo e(asset('images/transfleet_logo_white.png')); ?>" alt="Groupe TRANSTEV" class="h-16 w-auto">
            <p class="mt-2 text-xs text-blue-200/80">
                <?php if($isSuperAdmin): ?>
                    Espace Super administrateur
                <?php elseif($isAdmin): ?>
                    Espace Administrateur
                <?php else: ?>
                    <?php echo e(auth()->user()->filiale?->name); ?>

                <?php endif; ?>
            </p>
        </div>

        <nav class="flex-1 px-3 py-6 space-y-1 overflow-y-auto">
            <?php if($isAdmin): ?>
                <a href="<?php echo e(route('admin.dashboard')); ?>" class="<?php echo e(request()->routeIs('admin.dashboard') ? 'sidebar-link-active' : 'sidebar-link-inactive'); ?>">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"/></svg>
                    Tableau de bord
                </a>
                <a href="<?php echo e(route('admin.filiales.index')); ?>" class="<?php echo e(request()->routeIs('admin.filiales.*') && ! request()->routeIs('admin.filiales.submissions') ? 'sidebar-link-active' : 'sidebar-link-inactive'); ?>">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"/></svg>
                    Filiales
                </a>
                <a href="<?php echo e(route('admin.forms.index')); ?>" class="<?php echo e(request()->routeIs('admin.forms.*') ? 'sidebar-link-active' : 'sidebar-link-inactive'); ?>">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
                    Formulaires
                    <?php if (! ($isSuperAdmin)): ?>
                        <span class="ml-auto text-xs bg-white/20 px-2 py-0.5 rounded-full">Échéances</span>
                    <?php endif; ?>
                </a>
                <a href="<?php echo e(route('admin.submissions.overview')); ?>" class="<?php echo e(request()->routeIs('admin.submissions.*') || request()->routeIs('admin.filiales.submissions') ? 'sidebar-link-active' : 'sidebar-link-inactive'); ?>">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"/></svg>
                    Soumissions
                </a>
                <a href="<?php echo e(route('admin.notifications')); ?>" class="<?php echo e(request()->routeIs('admin.notifications*') ? 'sidebar-link-active' : 'sidebar-link-inactive'); ?>">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"/></svg>
                    Notifications
                    <?php $unread = auth()->user()->unreadNotifications->count(); ?>
                    <?php if($unread > 0): ?>
                        <span class="ml-auto bg-transtev-accent text-white text-xs font-bold px-2 py-0.5 rounded-full"><?php echo e($unread); ?></span>
                    <?php endif; ?>
                </a>
                <a href="<?php echo e(route('admin.activity.index')); ?>" class="<?php echo e(request()->routeIs('admin.activity.*') ? 'sidebar-link-active' : 'sidebar-link-inactive'); ?>">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"/></svg>
                    Journal d'audit
                </a>
                <?php if($isSuperAdmin): ?>
                    <a href="<?php echo e(route('admin.admins.index')); ?>" class="<?php echo e(request()->routeIs('admin.admins.*') ? 'sidebar-link-active' : 'sidebar-link-inactive'); ?>">
                        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"/></svg>
                        Administrateurs
                    </a>
                <?php endif; ?>
            <?php else: ?>
                <a href="<?php echo e(route('filiale.dashboard')); ?>" class="<?php echo e(request()->routeIs('filiale.dashboard') ? 'sidebar-link-active' : 'sidebar-link-inactive'); ?>">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"/></svg>
                    Tableau de bord
                </a>
                <a href="<?php echo e(route('filiale.notifications')); ?>" class="<?php echo e(request()->routeIs('filiale.notifications') ? 'sidebar-link-active' : 'sidebar-link-inactive'); ?>">
                    <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"/></svg>
                    Notifications
                    <?php $unread = auth()->user()->unreadNotifications->count(); ?>
                    <?php if($unread > 0): ?>
                        <span class="ml-auto bg-transtev-accent text-white text-xs font-bold px-2 py-0.5 rounded-full"><?php echo e($unread); ?></span>
                    <?php endif; ?>
                </a>
            <?php endif; ?>
        </nav>

        <div class="p-4 border-t border-white/10">
            <div class="flex items-center gap-3 px-2">
                <div class="w-9 h-9 rounded-full bg-transtev-accent flex items-center justify-center text-sm font-bold">
                    <?php echo e(strtoupper(substr(auth()->user()->name, 0, 1))); ?>

                </div>
                <div class="min-w-0 flex-1">
                    <p class="text-sm font-medium truncate"><?php echo e(auth()->user()->name); ?></p>
                    <p class="text-xs text-blue-200 truncate"><?php echo e(auth()->user()->email); ?></p>
                </div>
            </div>
        </div>
    </div>
</aside>
<?php /**PATH C:\xampp\htdocs\teyssir\resources\views/layouts/sidebar.blade.php ENDPATH**/ ?>