<div>
     <?php $__env->slot('header', null, []); ?> 
        <h2 class="text-xl font-semibold leading-tight text-gray-800">
            Roles
        </h2>
     <?php $__env->endSlot(); ?>

    <div class="py-6">
        <div class="mx-auto max-w-8xl sm:px-6 lg:px-8 mt-2">

            <!--[if BLOCK]><![endif]--><?php if(session()->has('success')): ?>
                <div class="mb-4 rounded bg-green-100 px-4 py-3 text-green-700">
                    <?php echo e(session('success')); ?>

                </div>
            <?php endif; ?><!--[if ENDBLOCK]><![endif]-->

            <?php if(session()->has('error')): ?>
                <div class="mb-4 rounded bg-red-100 px-4 py-3 text-red-700">
                    <?php echo e(session('error')); ?>

                </div>
            <?php endif; ?><!--[if ENDBLOCK]><![endif]-->

            <div class="rounded bg-white p-6 shadow">

                <div class="flex justify-between items-center mb-6">
                    <div class="w-1/3">
                        <input
                            type="text"
                            wire:model.live.debounce.300ms="search"
                            placeholder="Buscar rol..."
                            class="w-full rounded border px-3 py-2"
                        >
                    </div>

                    <a href="<?php echo e(route('roles.create')); ?>"
                       class="rounded bg-blue-600 px-4 py-2 text-white hover:bg-blue-700">
                        Crear rol
                    </a>
                </div>

                <div class="overflow-x-auto">
                    <table class="w-full text-left border-collapse">
                        <thead>
                        <tr class="border-b bg-gray-50 text-gray-700">
                            <th class="px-3 py-2">ID</th>
                            <th class="px-3 py-2">Alias</th>
                            <th class="px-3 py-2">Nombre</th>
                            <th class="px-3 py-2">Descripción</th>
                            <th class="px-3 py-2">Creación</th>
                            <th class="px-3 py-2">Actualización</th>
                            <th class="px-3 py-2 text-right">Acciones</th>
                        </tr>
                        </thead>

                        <tbody>
                        <!--[if BLOCK]><![endif]--><?php $__empty_1 = true; $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr class="border-b">
                                <td class="px-3 py-2"><?php echo e($role->id); ?></td>
                                <td class="px-3 py-2"><?php echo e($role->name); ?></td>
                                <td class="px-3 py-2"><?php echo e($role->fullname); ?></td>
                                <td class="px-3 py-2 text-gray-600">
                                    <?php echo e($role->description ?? '—'); ?>

                                </td>
                                <td class="px-3 py-2"><?php echo e($role->created_at->format('Y-m-d H:i')); ?></td>
                                <td class="px-3 py-2"><?php echo e($role->updated_at->format('Y-m-d H:i')); ?></td>

                                <td class="px-3 py-2 text-right flex justify-end space-x-3">
                                    <a href="<?php echo e(route('roles.edit', $role)); ?>"
                                       class="text-blue-600 hover:underline">
                                        Editar
                                    </a>

                                    <!--[if BLOCK]><![endif]--><?php if($role->name !== 'admin'): ?>
                                        <button wire:click="delete(<?php echo e($role->id); ?>)"
                                                wire:confirm="¿Seguro que deseas eliminar este rol?"
                                                class="text-red-600 hover:underline">
                                            Borrar
                                        </button>
                                    <?php endif; ?><!--[if ENDBLOCK]><![endif]-->
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="7" class="px-3 py-6 text-center text-gray-500">
                                    No hay roles.
                                </td>
                            </tr>
                        <?php endif; ?><!--[if ENDBLOCK]><![endif]-->
                        </tbody>
                    </table>
                </div>

                <div class="mt-4">
                    <?php echo e($roles->links()); ?>

                </div>

            </div>
        </div>
    </div>
</div><?php /**PATH /var/www/html/resources/views/livewire/roles/index.blade.php ENDPATH**/ ?>