<?php $__env->startSection('content'); ?>
<div class="page-header">
    <div class="page-title">
        <h4>User List</h4>
        <h6>Manage your users</h6>
    </div>
    <div class="page-btn">
        <a href="<?php echo e(route('users.register')); ?>" class="btn btn-added">
            <img src="<?php echo e(asset('assets/img/icons/plus.svg')); ?>" alt="img" class="me-1"> Add Users
        </a>
    </div>
</div>

<div class="card">
    <div class="card-body">
        <div class="table-top">
            <div class="search-set">
                <div class="search-input">
                    <a class="btn btn-searchset">
                        <img src="<?php echo e(asset('assets/img/icons/search-white.svg')); ?>" alt="img">
                    </a>
                </div>
            </div>
        </div>
        <div class="table-responsive">
            <table class="table datanew dataTable no-footer table-striped">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>Employee Id</th>
                        <th>Action</th>
                        <th>Name</th>
                        <th>Email</th>
                        <?php if (\Illuminate\Support\Facades\Blade::check('role', 'Superadmin')): ?>
                        <th>Company</th>
                        <?php endif; ?>
                        <th>Branch</th>
                        <th>Department</th>
                        <th>Role</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php
                                            $employee = $user->employee;
                                            $company = $employee ? $employee->company : null;
                                            $branch = $employee ? $employee->branch : null;
                                            $department = $employee ? $employee->department : null;
                                        ?>

                                        <tr>
                                            <td><?php echo e($key + 1); ?></td>
                                            <td><a class="link-primary" href="<?php echo e(route('users.view', $user->id)); ?>"><?php echo e($user->employee->code ?? 'N/A'); ?></a></td>
                                            <td>
                                                <a class="me-3" href="<?php echo e(route('users.edit', $user->id)); ?>">
                                                    <img src="<?php echo e(asset('assets/img/icons/edit.svg')); ?>" alt="Edit">
                                                </a>
                                            </td>
                                            <td><?php echo e($user->name ?? 'N/A'); ?></td>
                                            <td><?php echo e($user->email ?? 'N/A'); ?></td>
                                            <?php if (\Illuminate\Support\Facades\Blade::check('role', 'Superadmin')): ?>
                                            <td><?php echo e($company ? $company->name : 'N/A'); ?></td>
                                            <?php endif; ?>
                                            <td><?php echo e($branch ? $branch->name : 'N/A'); ?></td>
                                            <td><?php echo e($department ? $department->name : 'N/A'); ?></td>
                                            <td>
                                                <?php $__currentLoopData = $user->roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if($role->name == "Admin"): ?>
                                                        <span class="badges bg-info mb-1">
                                                            <?php echo e($role->name); ?>

                                                        </span>
                                                    <?php endif; ?>
                                                    <?php if($role->name != "Admin"): ?>
                                                        <span class="badges bg-whitegreen mb-1">
                                                            <?php echo e($role->name); ?>

                                                        </span>
                                                    <?php endif; ?>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </td>
                                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/aligkrwp/public_html/resources/views/auth/index.blade.php ENDPATH**/ ?>