





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


<section class="content-header">
    <h1>Users Management</h1>
    <ol class="breadcrumb">
        <li><a href="/home"><i class="fa fa-dashboard"></i>Home</a></li>
        <li><a href="#">Management</a></li>
        <li class="active">Users</li>

    </ol>
</section>
<hr style="border: 3px groove #3c8dbc;">



<div class="row">

    <div class="col-lg-12 margin-tb">
          <div class="pull-right">

            

        </div>

    </div>

</div>





<?php if($message = Session::get('success')): ?>

<div class="alert alert-success">

  <p><?php echo e($message); ?></p>

</div>

<?php endif; ?>


<section class="content">
  <div class="row">
    <div class="col-xs-12">
      <div class="box box-info">
        <div class="box-header">
          <a class="btn btn-primary" href="<?php echo e(route('home')); ?>"> Back</a>
            <div class="pull-right">
              <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('user-create')): ?>
                <a class="btn btn-success" href="<?php echo e(route('users.create')); ?>"> Create New User</a>
              <?php endif; ?>
            </div>
        </div>
        <div class="box-body">
          
          <table class="dataTables_wrapper form-inline dt-bootstrap" id="users">
            <thead>
              <tr>
                <th>No</th>
                <th>Name</th>
                <th>Email</th>
                <th>Roles</th>
                <th width="280px">Action</th>
              </tr>
            </thead>
            <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <tr>
                <td><?php echo e(++$i); ?></td>
                <td><?php echo e(ucfirst($user->name)); ?></td>
                <td><?php echo e($user->email); ?></td>
                <td>
                  <?php if(!empty($user->getRoleNames())): ?>
                    <?php $__currentLoopData = $user->getRoleNames(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $v): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                      <label class="badge badge-success"><?php echo e($v); ?></label>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  <?php endif; ?>
                </td>
                <td>
                  <a href="<?php echo e(route('users.show',$user->id)); ?>"><i class="fa  fa-eye" style="font-size:24px;color:green;"></i></a>
                  <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('user-edit')): ?>
                    <a href="<?php echo e(route('users.edit',$user->id)); ?>"><i class="fa  fa-pencil-square-o" style="font-size:24px;"></i></a>
                  <?php endif; ?>
                  <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('user-delete')): ?>
					<form method="POST" action="<?php echo e(route('users.destroy', $user->id)); ?>" style="display:inline">
						<?php echo csrf_field(); ?>
						<?php echo method_field('DELETE'); ?>

                    <?php if(\Auth::user()->email !=$user->email){?>
                    <button type="submit" class="btn btn-danger btn-sm">
							Delete
						</button>
					</form>
                    <?php } ?>
                  <?php endif; ?>
                  </td>
              </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          </table>
          <?php echo $data->render(); ?>

        </div>
      </div>
    </div>
  </div>
</section>



<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.main', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp_8.2\htdocs\cpq8.2\resources\views/users/index.blade.php ENDPATH**/ ?>