 <?php $__env->startSection('content'); ?>

<div class="card mb-3">
  <div class="card-header">
    <div class="row flex-between-end">
      <div class="col-auto align-self-center">
        <form class="form-material" method="POST" action="<?php echo e(url ('/search_user')); ?>">
          <?php echo csrf_field(); ?>
          <input type="text" class="form-control" name="search" id="search">
          <br><button type="submit" class="btn btn-primary btn-sm" aria-placeholder="Search"><i class="fas fa-search"></i> Search</button>
          <br><br>
          <h5 class="mb-0" data-anchor="data-anchor">List of all users</h5>
        </form>
      </div>
    </div>
  </div>
  <div class="card-body pt-0">

    <div id="tableExample2" data-list='{"valueNames":["name","surname","role"],"page":10,"pagination":true}'>
      <div class="table-responsive scrollbar">
        <table id="basic-btn" class="table table-bordered table-striped fs--1 mb-0">
          <thead class="bg-200 text-900">
            <tr>
              <th>Action</th>
              <th>Name</th>
              <th>Surname</th>
              <th>Role</th>
              <th>Status</th>
            </tr>
          </thead>
          <tbody class="list">
            <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr>
              <td>
                <div class="dropdown">
                  <button class="btn btn-primary btn-sm dropdown-toggle" type="button" id="actionMenu<?php echo e($user->id); ?>" data-bs-toggle="dropdown" aria-expanded="false">
                    Actions
                  </button>
                  <ul class="dropdown-menu" aria-labelledby="actionMenu<?php echo e($user->id); ?>">

                    <!-- Profile -->
                    <li>
                      <a class="dropdown-item" href='<?php echo e(url("/agentprofile", $user->id)); ?>'>
                        <i class="fa fa-address-card"></i> Profile
                      </a>
                    </li>

                    <?php if(Auth::user()->role == 3): ?>
                    <!-- Edit -->
                    <li>
                      <a class="dropdown-item" href='<?php echo e(url("/user", $user->id)); ?>'>
                        <i class="fas fa-eye"></i> Edit
                      </a>
                    </li>

                    <!-- Delete -->
                    <li>
                      <a class="dropdown-item text-danger" href='<?php echo e(url("/delete_user", $user->id)); ?>'
                        onclick="return confirm('Are you sure you want to delete this user?');">
                        <i class="far fa-trash-alt"></i> Delete
                      </a>
                    </li>

                    <li>
                      <hr class="dropdown-divider">
                    </li>

                    <!-- Change Status -->
                    <li>
                      <?php if($user->status == 1): ?>
                      <a class="dropdown-item text-warning" href='<?php echo e(url("/user/status/$user->id/0")); ?>'>
                        <i class="fas fa-user-slash"></i> Deactivate
                      </a>
                      <?php else: ?>
                      <a class="dropdown-item text-success" href='<?php echo e(url("/user/status/$user->id/1")); ?>'>
                        <i class="fas fa-user-check"></i> Activate
                      </a>
                      <?php endif; ?>
                    </li>
                    <?php endif; ?>
                  </ul>
                </div>
              </td>

              <td class="name"><?php echo e($user->name); ?></td>
              <td class="surname"><?php echo e($user->surname); ?></td>
              <td class="role"><?php echo e($user->rrole->name); ?></td>
              <td>
                <?php if($user->status == 1): ?>
                <span class="badge bg-success">Active</span>
                <?php else: ?>
                <span class="badge bg-danger">Deactivated</span>
                <?php endif; ?>
              </td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          </tbody>
        </table>
      </div>

    </div>
  </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\WORK-STATION\MBBS\Insurance-Version Controls\03-01-2026\resources\views/users/allusers.blade.php ENDPATH**/ ?>