<div class="modal fade" id="editUserModal" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <form action="<?= base_url('admin/users/update') ?>" method="post">
      <input type="hidden" name="<?= $this->security->get_csrf_token_name(); ?>" 
             value="<?= $this->security->get_csrf_hash(); ?>" />
      <input type="hidden" name="id" id="edit-user-id">
      <div class="modal-content card-outline-info">
            <div class="card-header text-white text-center">Edit User Info</div>
        <div class="modal-body">
          <label class=" small">Full Name</label>
          <input type="text" name="name" id="edit-user-name" class="form-control" required>

          <label class="mt-2 small">Username</label>
          <input type="text" name="username" id="edit-user-username" class="form-control" required>

          <label class="mt-2 small">Email</label>
          <input type="email" name="email" id="edit-user-email" class="form-control" required>

          <label class="mt-2 small">Role</label>
          <select name="role" id="edit-user-role" class="form-control" required>
    <option value="">Select Role</option>
    <?php if (!empty($roles)): ?>
        <?php foreach ($roles as $role): ?>
            <option value="<?= $role->name ?>" 
                <?= (isset($user->role) && $user->role === $role->name) ? 'selected' : '' ?>>
                <?= $role->label ?>
            </option>
        <?php endforeach; ?>
    <?php endif; ?>
</select>        </div>
        <div class="modal-footer">
          <button type="submit" class="btn btn-success">Update</button>
          <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
        </div>
      </div>
    </form>
  </div>
</div>
