<?php if (isset($component)) { $__componentOriginal8e2ce59650f81721f93fef32250174d77c3531da = $component; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\AppLayout::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    <?php $__env->startSection('title'); ?>
       Roles Management
    <?php $__env->stopSection(); ?>

         <!-- Page Heading -->
         <h1 class="h3 mb-2 text-gray-800">

            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Role create')): ?>
            <a href="<?php echo e(route('admin.roles.create')); ?>" class="btn btn-primary"
              ><i class="fas fa-plus" aria-hidden="true"></i> Create Role
            </a>
            <?php endif; ?>
          </h1>
          <!-- DataTales Example -->
          <div class="card shadow mb-4">
            <div class="card-header py-3">
              <h6 class="m-0 font-weight-bold text-primary">
                Listing Role Table
              </h6>
            </div>
            <div class="card-body">
              <div class="table-responsive">
                <table
                  class="table table-bordered"
                  id="dataTable"
                  width="100%"
                  cellspacing="0"
                >
                  <thead>
                    <tr>
                        <th>No</th>
                        <th>Name</th>
                        <th>Roles</th>
                        <th>Created At</th>
                        <th>Updated At</th>
                        <th>Action</th>
                    </tr>
                  </thead>
                  <tbody>

                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Role access')): ?>
                    <?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td><?php echo e($loop->index + 1); ?></td>
                            <td><?php echo e($role->name); ?></td>
                            <td>
                                <?php $__currentLoopData = $role->permissions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $permission): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <span class="badge badge-info mr-1">
                                        <?php echo e($permission->name); ?>

                                    </span>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </td>
                            <td><?php echo e($role->created_at->diffForHumans()); ?></td>
                            <td><?php echo e($role->updated_at->diffForHumans()); ?></td>
                            <td class="d-flex">
                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Role edit')): ?>
                                <a href="<?php echo e(route('admin.roles.edit',$role->id)); ?>" class="btn btn-primary btn-sm mr-1">
                                    <i class="fas fa-edit"></i>
                                </a>
                                <?php endif; ?>

                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('Role delete')): ?>
                                    <a href="<?php echo e(route('admin.roles.destroy', $role->id)); ?>" class="btn btn-danger btn-sm" onclick="event.preventDefault();
                                        document.getElementById('role_delete').submit();"><i class="fas fa-trash"></i></a>
                                    <form action="<?php echo e(route('admin.roles.destroy', $role->id)); ?>" method="POST" class="d-none" id="role_delete">
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('delete'); ?>
                                        <button class="btn btn-block bg-gradient-danger ">Delete</button>
                                    </form>
                                <?php endif; ?>

                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <?php endif; ?>
                  </tbody>
                </table>
              </div>
            </div>
          </div>



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

<script>
    function confirmdelete(ev)
    {
        ev.preventDefault();
        var urlRedirect = ev.currentTarget.getAttribute('href');

        swal({

            title:"Are you Sure to delete this ",
            text:"You won't be able to revert this delete "
            icon:"warning",
            buttons: true,
            dangerMode: true,

        })

        .then((willCancel) => {

            if(willCancel)
            {
                window.location.href=urlRedirect;
            }
        })
    }
</script>
<?php $__env->stopSection(); ?>

 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8e2ce59650f81721f93fef32250174d77c3531da)): ?>
<?php $component = $__componentOriginal8e2ce59650f81721f93fef32250174d77c3531da; ?>
<?php unset($__componentOriginal8e2ce59650f81721f93fef32250174d77c3531da); ?>
<?php endif; ?>
<?php /**PATH /home/doptorbd/hotel.doptor.com.bd/resources/views/admin/setting/role/index.blade.php ENDPATH**/ ?>