<?php $__env->startSection('content'); ?>
<div class="container-fluid px-4">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h1 class="h3 text-gray-800">Manage Admins</h1>
        <a href="<?php echo e(route('super-admin.create-admin')); ?>" class="btn btn-primary">
            <i class="fas fa-plus"></i> Create New Admin
        </a>
    </div>

    <?php if(session('success')): ?>
        <div class="alert alert-success alert-dismissible fade show" role="alert">
            <?php echo e(session('success')); ?>

            <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
        </div>
    <?php endif; ?>

    <?php if(session('error')): ?>
        <div class="alert alert-danger alert-dismissible fade show" role="alert">
            <?php echo e(session('error')); ?>

            <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
        </div>
    <?php endif; ?>

    <div class="card shadow">
        <div class="card-header py-3">
            <h6 class="m-0 font-weight-bold text-primary">All Admins</h6>
        </div>
        <div class="card-body">
            <?php if($admins->count() > 0): ?>
                <div class="table-responsive">
                    <table class="table table-striped table-hover">
                        <thead class="table-dark">
                            <tr>
                                <th>ID</th>
                                <th>Name</th>
                                <th>Email</th>
                                <th>Permissions Assigned</th>
                                <th>Created Date</th>
                                <th>Actions</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $admins; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $admin): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e($admin->id); ?></td>
                                    <td><strong><?php echo e($admin->name); ?></strong></td>
                                    <td><?php echo e($admin->email); ?></td>
                                    <td>
                                        <span class="badge bg-success">
                                            <?php echo e($admin->permissions->count()); ?> permissions
                                        </span>
                                    </td>
                                    <td><?php echo e($admin->created_at->format('M d, Y')); ?></td>
                                    <td>
                                        <a href="<?php echo e(route('super-admin.edit-permissions', $admin->id)); ?>"
                                           class="btn btn-sm btn-info" title="Edit Permissions">
                                            <i class="fas fa-key"></i> Permissions
                                        </a>
                                        <form action="<?php echo e(route('super-admin.delete-admin', $admin->id)); ?>"
                                              method="POST" class="d-inline">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button type="submit" class="btn btn-sm btn-danger"
                                                    onclick="return confirm('Delete this admin? This action cannot be undone.')">
                                                <i class="fas fa-trash"></i> Delete
                                            </button>
                                        </form>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>

                <!-- Pagination -->
                <div class="d-flex justify-content-center mt-4">
                    <?php echo e($admins->links()); ?>

                </div>
            <?php else: ?>
                <div class="alert alert-info text-center">
                    <i class="fas fa-info-circle"></i> No admins found.
                    <a href="<?php echo e(route('super-admin.create-admin')); ?>">Create the first admin</a>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\startup sabbir\Desktop\jannat\sarvice-accounts\accounting-system\resources\views/super-admin/manage-admins.blade.php ENDPATH**/ ?>