

<?php $__env->startSection('content'); ?>
<section class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                <h1>User Management</h1>
            </div>
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item"><a href="#">Home</a></li>
                    <li class="breadcrumb-item active">User List</li>
                </ol>
            </div>
        </div>
    </div>
</section>

<section class="content">
    <div class="container-fluid">
        <div class="card">
        <div class="card-header">
    <h3 class="card-title">List of Users</h3>
    <div class="float-right">
    <?php if(auth()->user()->role->name == 'Superadmin'): ?>
        <a href="<?php echo e(route('users.create')); ?>" class="btn btn-success">Create New User</a>
    <?php elseif(auth()->user()->role->name == 'Manager'): ?>
        <a href="<?php echo e(route('staff.create')); ?>" class="btn btn-success">Create New Staff</a>
    <?php endif; ?>
</div>

</div>

            <div class="card-body">
                <table class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th>No</th>
                            <th>Username</th>
                            <th>Full Name</th>
                            <th>Created By</th>
                            <th>IC</th>
                            <th>Email</th>
                            <th>Role</th>
                            <th>Actions</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->username); ?></td>
                                <td><?php echo e($user->user_detail->fullname ??'-'); ?></td>
                                <td><?php echo e($user->user_detail->created_by ?? '-'); ?></td>
                                <td><?php echo e($user->user_detail->ic ?? '-'); ?></td>
                                <td><?php echo e($user->user_detail->email ?? '-'); ?></td>
                                <td><?php echo e($user->role->name?? '-'); ?></td>
                                <td>
                                    <a href="<?php echo e(route('users.edit', $user->id)); ?>" class="btn btn-primary btn-sm">Edit</a>
                                    <form action="<?php echo e(route('users.destroy', $user->id)); ?>" method="POST" style="display:inline-block;">
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('DELETE'); ?>
                                        <button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete this user?')">Delete</button>
                                    </form>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
            <div class="card-footer">
                
            </div>
        </div>
    </div>
</section>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\laragon\www\VPS_changes\resources\views/users/user-index.blade.php ENDPATH**/ ?>