<?php if (isset($component)) { $__componentOriginal91fdd17964e43374ae18c674f95cdaa3 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal91fdd17964e43374ae18c674f95cdaa3 = $attributes; } ?>
<?php $component = App\View\Components\AdminLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AdminLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('header', null, []); ?> 
        <!-- Header slot -->
     <?php $__env->endSlot(); ?>

    <!-- Main Outer Container -->
    <div class="p-0 font-sans bg-slate-50 min-h-screen">

        <?php if(session('success')): ?>
            <div x-data="{ show: true }" x-init="setTimeout(() => show = false, 3000)" x-show="show"
                class="mx-4 mb-6 bg-emerald-50 p-3 rounded-lg shadow-sm relative md:mx-0" role="alert">
                <div class="flex">
                    <span class="font-semibold"><?php echo e(session('success')); ?></span>
                </div>
            </div>
        <?php endif; ?>

        <!-- SINGLE WHITE CARD CONTAINER -->
        <div class="bg-white border-none shadow-none md:rounded-none p-4 md:p-6 relative min-h-screen">

            <!-- Header Section (Inside Card) -->
            <div class="mb-6 flex items-center justify-between">
                <h5 class="text-[14px] font-bold text-gray-700 uppercase tracking-wide">
                    Gestion des Comptes
                </h5>
            </div>

            <!-- Filter Section -->
            <div class="mb-6 p-4 bg-gray-50/50 border border-gray-200 rounded-sm">
                <form method="GET" action="<?php echo e(route('admin.accounts.index')); ?>"
                    class="flex flex-wrap items-center gap-4">
                    <!-- Search Field -->
                    <div class="flex-1 min-w-[200px]">
                        <div class="relative">
                            <span class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                                <svg class="h-4 h-4 text-gray-400" fill="none" stroke="currentColor"
                                    viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                        d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
                                </svg>
                            </span>
                            <input type="text" name="search" value="<?php echo e(request('search')); ?>"
                                placeholder="Rechercher par nom, banque..."
                                class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-sm text-[13px] font-semibold text-gray-700 placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 bg-white transition-all h-[38px]">
                        </div>
                    </div>

                    <!-- Buttons -->
                    <div class="flex items-center gap-2">
                        <button type="submit"
                            class="inline-flex items-center px-4 py-2 border border-emerald-600 text-white text-[13px] font-bold rounded-sm hover:opacity-90 h-[38px] transition-all group"
                            style="background-color: #10b981 !important;">
                            <svg class="w-4 h-4 mr-2 text-white" fill="none"
                                stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                    d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" />
                            </svg>
                            Filtrer
                        </button>
                        <a href="<?php echo e(route('admin.accounts.index')); ?>"
                            class="inline-flex items-center px-4 py-2 border border-red-600 text-white text-[13px] font-bold rounded-sm hover:opacity-90 h-[38px] transition-all group"
                            style="background-color: #e01e22 !important; text-decoration: none;">
                            <svg class="w-4 h-4 mr-2 text-white" fill="none"
                                stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                    d="M6 18L18 6M6 6l12 12" />
                            </svg>
                            Effacer
                        </a>
                    </div>
                </form>
            </div>

            <!-- Controls Row -->
            <div class="flex flex-col lg:flex-row lg:items-center justify-between mb-6 gap-4">
                <div class="flex items-center gap-3">
                    <button
                        class="inline-flex items-center justify-center px-4 py-2 border border-amber-400 shadow-sm text-[13px] font-bold text-black rounded-sm hover:opacity-90 h-[38px] transition-all"
                        style="background-color: #fbbf24 !important;">
                        Liste des comptes
                    </button>
                </div>

                <?php if(auth()->user()->canManage()): ?>
                <a href="<?php echo e(route('admin.accounts.create')); ?>"
                    class="inline-flex items-center justify-center px-4 py-2 text-white text-[13px] font-bold rounded-sm shadow-sm h-[38px] leading-none lg:w-auto hover:opacity-90"
                    style="background-color: #5867dd !important;">
                    <svg class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20">
                        <path d="M10 5a1 1 0 011!1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z" />
                    </svg>
                    Nouveau compte
                </a>
                <?php endif; ?>
            </div>

            <!-- Table -->
            <div class="overflow-x-auto border border-gray-200 rounded-sm shadow-sm">
                <style>
                    .custom-v-lines th, .custom-v-lines td { border-right: 1px solid #d1d5db !important; }
                    .custom-v-lines th:last-child, .custom-v-lines td:last-child { border-right: none !important; }
                </style>
                <table class="min-w-full divide-y divide-gray-200 custom-v-lines">
                    <thead>
                        <tr class="bg-gray-50/80">
                            <th class="px-4 py-3.5 text-left text-[13px] font-bold text-slate-900 uppercase tracking-widest border-b border-gray-200">Compte</th>
                            <th class="px-4 py-3.5 text-left text-[13px] font-bold text-slate-900 uppercase tracking-widest border-b border-gray-200">Nom</th>
                            <th class="px-4 py-3.5 text-left text-[13px] font-bold text-slate-900 uppercase tracking-widest border-b border-gray-200">RIB</th>
                            <th class="px-4 py-3.5 text-right text-[13px] font-bold text-slate-900 uppercase tracking-widest border-b border-gray-200">Solde</th>
                            <th class="px-4 py-3.5 text-center text-[13px] font-bold text-slate-900 uppercase tracking-widest border-b border-gray-200">Statut</th>
                            <?php if(auth()->user()->canManage()): ?>
                            <th class="px-4 py-3.5 text-center text-[13px] font-bold text-slate-900 uppercase tracking-widest border-b border-gray-200">Actions</th>
                            <?php endif; ?>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-gray-200 bg-white">
                        <?php $__empty_1 = true; $__currentLoopData = $accounts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $account): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <tr class="hover:bg-gray-50/50 transition-colors">
                                <td class="px-4 py-3.5">
                                    <div class="flex flex-col">
                                        <span class="text-[13px] text-slate-900 font-bold uppercase tracking-tight"><?php echo e($account->name); ?></span>
                                        <?php if($account->description): ?>
                                            <span class="text-[11px] text-slate-400 line-clamp-1"><?php echo e($account->description); ?></span>
                                        <?php endif; ?>
                                    </div>
                                </td>
                                <td class="px-4 py-3.5">
                                    <span class="text-[13px] text-slate-900 font-bold"><?php echo e($account->bank_name ?: 'N/A'); ?></span>
                                </td>
                                <td class="px-4 py-3.5">
                                    <span class="text-[13px] text-slate-900 font-bold"><?php echo e($account->account_number ?: 'N/A'); ?></span>
                                </td>
                                <td class="px-4 py-3.5 text-right whitespace-nowrap">
                                    <span class="text-[13px] text-slate-900 font-bold whitespace-nowrap">
                                        <?php echo e(\App\Models\Setting::format($account->balance)); ?>

                                    </span>
                                </td>
                                <td class="px-4 py-3.5 text-center">
                                    <?php if($account->is_active): ?>
                                        <span class="inline-flex items-center px-3 py-1 rounded-full bg-emerald-100 text-emerald-800 border border-emerald-600 text-[10px] font-black uppercase tracking-widest">Actif</span>
                                    <?php else: ?>
                                        <span class="inline-flex items-center px-3 py-1 rounded-full bg-rose-100 text-rose-800 border border-rose-600 text-[10px] font-black uppercase tracking-widest">Inactif</span>
                                    <?php endif; ?>
                                </td>
                                <?php if(auth()->user()->canManage()): ?>
                                <td class="px-4 py-3.5 text-center">
                                    <div class="flex items-center justify-center space-x-2">
                                        <a href="<?php echo e(route('admin.accounts.edit', $account)); ?>"
                                            class="flex items-center justify-center w-8 h-8 rounded bg-indigo-50 text-indigo-600 border border-indigo-100 hover:bg-indigo-600 hover:text-white">
                                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
                                            </svg>
                                        </a>

                                        <form id="delete-account-<?php echo e($account->id); ?>" method="POST" action="<?php echo e(route('admin.accounts.destroy', $account)); ?>" class="inline">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button type="button"
                                                data-action="delete-account"
                                                data-form-id="delete-account-<?php echo e($account->id); ?>"
                                                data-confirm-message="Êtes-vous sûr de vouloir supprimer ce compte ?"
                                                class="flex items-center justify-center w-8 h-8 rounded bg-red-50 text-red-600 border border-red-100 hover:bg-red-600 hover:text-white">
                                                <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
                                                </svg>
                                            </button>
                                        </form>
                                    </div>
                                </td>
                                <?php endif; ?>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="<?php echo e(auth()->user()->canManage() ? 6 : 5); ?>" class="px-6 py-12 text-center text-gray-400 text-sm italic">Aucun compte trouvé.</td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>

            <!-- Pagination -->
            <div class="px-4 md:px-6 py-4 border-t border-gray-200 flex items-center justify-end bg-gray-50/10">
                <?php echo e($accounts->links()); ?>

            </div>
        </div>
    </div>

    <?php echo $__env->make('partials.form-submit-script', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal91fdd17964e43374ae18c674f95cdaa3)): ?>
<?php $attributes = $__attributesOriginal91fdd17964e43374ae18c674f95cdaa3; ?>
<?php unset($__attributesOriginal91fdd17964e43374ae18c674f95cdaa3); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal91fdd17964e43374ae18c674f95cdaa3)): ?>
<?php $component = $__componentOriginal91fdd17964e43374ae18c674f95cdaa3; ?>
<?php unset($__componentOriginal91fdd17964e43374ae18c674f95cdaa3); ?>
<?php endif; ?>
<?php /**PATH /home/fonix-sa/Bureau/Fonix projects/GASOS/resources/views/admin/accounts/index.blade.php ENDPATH**/ ?>