<?php

$page_name='UM_DASHBOARD';

?>



<?php $__env->startSection('title', 'Roles & Permissions'); ?>

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

<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
   <div class="container">
            <!-- Modal -->
            <div class="modal fade" id="roleModal" tabindex="-1" role="dialog" aria-labelledby="roleModalLabel">
                <div class="modal-dialog" role="document">
                    <?php echo Form::open(['method' => 'post']); ?>


                    <div class="modal-content">
                        <div class="modal-header">
                            <h4 class="modal-title w-100 font-weight-bold">Role</h4>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            <!-- name Form Input -->
                            <div class="form-group <?php if($errors->has('name')): ?> has-error <?php endif; ?>">
                                <?php echo Form::label('name', 'Name'); ?>

                                <?php echo Form::text('name', null, ['class' => 'form-control', 'placeholder' => 'Role Name']); ?>

                                <?php if($errors->has('name')): ?> <p class="help-block"><?php echo e($errors->first('name')); ?></p> <?php endif; ?>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

                            <!-- Submit Form Button -->
                            <?php echo Form::submit('Submit', ['class' => 'btn btn-primary']); ?>

                        </div>
                        <?php echo Form::close(); ?>

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



       <div class="row container_layout">
           
            <div class="col-md-12 mobile_view">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item">
                            <a href="<?php echo e(route('adminhome')); ?>">
                                <i class="material-icons">home</i>
                            </a>
                        </li>
                        <li class="breadcrumb-item"><a href="<?php echo e(route('usermanagement')); ?>">User Management</a></li>
                        <li class="breadcrumb-item active"><a href="<?php echo e(route('roles.index')); ?>">Roles&Permission</a></li>
                    </ol>
                </nav>
            </div>
           
           
           
            <div class="col-md-12 page-action text-right">
                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('add_roles')): ?>
                    <a href="#" class="btn btn-sm btn-success pull-right" data-toggle="modal" data-target="#roleModal">
                        <i class="fa fa-plus-square-o" aria-hidden="true"></i> New
                    </a>
                <?php endif; ?>
            </div>

            <div class="col-md-12">
              <div class="panel-group" id="accordion">
                <?php $flag=1; ?>
                <?php $__empty_1 = true; $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <?php echo Form::model($role, ['method' => 'PUT', 'route' => ['roles.update',  $role->id ], 'class' => 'm-b']); ?>

                    
                    <?php if($role->name === 'Admin'): ?>
                        <?php echo $__env->make('shared._permissions', [
                                      'title' => $role->name .' Permissions',
                                      'options' => ['disabled'],
                                      'role_name'=>$role->name ], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                    <?php else: ?>
                        <?php echo $__env->make('shared._permissions', [
                                      'title' => $role->name .' Permissions',
                                      'model' => $role,
                                      'role_name'=>$role->name,
                                      'closed'=>false], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

                    <?php endif; ?>

                    <?php echo Form::close(); ?> 
                  
                  <?php $flag +=1; ?>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <p>No Roles defined, please run <code>php artisan db:seed</code> to seed some dummy data.</p>    
                <?php endif; ?>
             </div>
           </div>
      </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app2', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>