<?php $__env->startSection('title', '| Create Permission'); ?>

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

<?php $__env->startSection('content'); ?>
<div class="container">
    <div class="row container_layout justify-content-center">
       <div class='col-lg-7  new_card_style p35'>

    

    <h2><i class='fa fa-key'></i> Add Permission</h2>
    <hr>
    <?php echo e(Form::open(array('url' => 'user_management/permissions'))); ?>


    <div class="form-group">
        <?php echo e(Form::label('name', 'Name')); ?>

        <?php echo e(Form::text('name', '', array('class' => 'form-control'))); ?>

        <?php if($errors->has('name')): ?> <p class="help-block error"><?php echo e($errors->first('name')); ?></p> <?php endif; ?>
    </div>
    
    
    <div class="form-group <?php if($errors->has('module')): ?> has-error <?php endif; ?>">
        <?php echo Form::label('module', 'Module'); ?>

        <select class="form-control" id="module" name="module">
          <option value="">Select A Module</option>
          <?php $__currentLoopData = $modules; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $module): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> 
            <option value="<?php echo e($module->module_code); ?>"><?php echo e($module->module_name); ?></option>
          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
        <?php if($errors->has('module')): ?> <p class="help-block error"><?php echo e($errors->first('module')); ?></p> <?php endif; ?>
    </div>
    <br>
<!--    <?php echo e($modules); ?>-->
    <?php if(!$roles->isEmpty()): ?>

        <h4>Assign Permission to Roles</h4>

        <?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
          <?php if($role->name=="Admin"): ?>
            <?php echo e(Form::checkbox('roles[]',  $role->id,'checked' )); ?>

            <?php echo e(Form::label($role->name, ucfirst($role->name))); ?><br>
          <?php else: ?>
            <?php echo e(Form::checkbox('roles[]',  $role->id )); ?>

            <?php echo e(Form::label($role->name, ucfirst($role->name))); ?><br>
          <?php endif; ?>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

    <?php endif; ?>
    <hr>
    <?php echo e(Form::submit('Add', array('class' => 'btn btn-primary btn-sm'))); ?>

    <a href="<?php echo e(route('permissions.index')); ?>" class="btn btn-sm btn-default"> <i class="fa fa-arrow-left"></i> Back</a>
    <?php echo e(Form::close()); ?>


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

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app2', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>