
<?php $__env->startSection('title'); ?>
Admin :: User Management
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<div class="page-inner mt-5 pt-5">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">Admin Manage</h4>
                </div>
                <div class="card-body">
                    <button class="btn btn-black btn-sm mb-2" title="Go Back" onclick="history.back();">
                        <span class="btn-label">
                            <i class="fas fa-reply"></i>
                        </span>
                        Go Back
                    </button>
                    <a href="<?php echo e(route('dashboard')); ?>" class="btn btn-success btn-sm mb-2" title="Dashboard">
                        <span class="btn-label">
                            <i class="fas fa-undo"></i>
                        </span>
                        Go Dashboard
                    </a>
                    <div class="table-responsive">
                        <table id="basic-datatables" class="display table table-striped table-hover">
                            <thead>
                                <tr>
                                    <th>SL</th>
                                    <th>Name</th>
                                    <th>Email</th>
                                    <th>Role</th>
                                    <th class="text-center">Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e($loop->iteration); ?></td>
                                                 <td><?php echo e($user->first_name); ?> <?php echo e($user->last_name); ?></td>
                                    <td><?php echo e($user->email); ?></td>
                                    <td>
                                        <?php if($user->role == 2): ?>
                                        <div class="mt-sm-1 d-block">
                                            <span class="badge badge-primary">Admin</span>
                                        </div>
                                        <?php else: ?>
                                        <div class="mt-sm-1 d-block">
                                            <span class="badge badge-warning">User</span>
                                        </div>
                                        <?php endif; ?>
                                    </td>
                                    <td>
                                        <div class="btn-list d-flex justify-content-center gap-1">
                                            <?php if($user->role == 0): ?>
                                            <a class="btn btn-sm btn-danger" href="<?php echo e(route('admin.role', ['id' => $user->id, 'newRole' => 2])); ?>" title="Make Admin">
                                                <span class="btn-label">
                                                    <i class="fas fa-user-shield"></i>
                                                </span> 
                                                Admin
                                            </a>
                                            <?php else: ?>
                                            <a class="btn btn-black btn-sm" href="<?php echo e(route('admin.role', ['id' => $user->id, 'newRole' => 0])); ?>" title="Remove Admin">
                                                <span class="btn-label">
                                                    <i class="fas fa-user-times"></i>
                                                </span>
                                                Admin
                                            </a>
                                            <?php endif; ?>
                                            <a class="btn btn-sm btn-secondary" href="<?php echo e(route('admin.edit_admin', $user->id)); ?>" title="Edit Admin">
                                                <span class="btn-label">
                                                    <i class="fas fa-user-edit"></i>
                                                </span> 
                                                User
                                            </a>
                                            <form action="<?php echo e(route('admin.delete_admin', ['id' => $user->id])); ?>" method="post">
                                                <button class="btn btn-danger btn-sm delete_unique" type="submit" title="Delete User"> 
                                                    <span class="btn-label">
                                                        <i class="fas fa-user-minus"></i>
                                                    </span> 
                                                    User
                                                </button>
                                                <?php echo csrf_field(); ?>
                                                <?php echo method_field('delete'); ?>
                                            </form>
                                        </div>
                                    </td>
                                </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('backend.master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\xampp\htdocs\e-visa update\resources\views/backend/admin/index.blade.php ENDPATH**/ ?>