<?php $__env->startSection('content'); ?>
  <div class="card card-table rounded-20">
    <div class="card-body">
      <div class="pd-30">
        <div class="row">
          <div class="col-md-4">
            <form action="">
              <select class="select2" name="hak_akses" style="width:100%" onchange="javascript:submit()">
                <?php $__currentLoopData = $data['hak_akses']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <option value="<?php echo e($value->id); ?>" <?php echo e(($hak_akses==$value->id ? 'selected' : '')); ?> ><?php echo e($value->hak_akses); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
              </select>
            </form>
          </div>
        </div>
      </div>
      <form action="<?php echo e(route('proses_otoritas_modul')); ?>" method="POST">
        <table class="table">
          <thead>
            <tr>
              <th width="30px">No</th>
              <th colspan="2">Nama Modul</th>
              <th style="width:80px;text-align:center;line-height:25px">View<br><input type="checkbox" id="check_all_view"></th>
              <th style="width:80px;text-align:center;line-height:25px">Insert<br><input type="checkbox" id="check_all_insert"></th>
              <th style="width:80px;text-align:center;line-height:25px">Update<br><input type="checkbox" id="check_all_update"></th>
              <th style="width:80px;text-align:center;line-height:25px">Delete<br><input type="checkbox" id="check_all_delete"></th>
            </tr>
          </thead>
          <tbody>
            <?php $__currentLoopData = $data['modul']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <?php ($otoritas=$value->otoritas); ?>
              <tr style="background:whitesmoke">
                <td style="text-align:left"><?php echo e($key+1); ?></td>
                <td style="text-align:left" colspan="2"><?php echo e($value->nama_modul); ?><input type="hidden" name="id[]" value="<?php echo e($value->id); ?>" ></td>
                <td style="text-align:center"><input type="checkbox" <?php if($otoritas['view'] == 'Y'): ?> checked <?php endif; ?> class="checkbox_view" name="view[<?php echo e($value->id); ?>]" value="Y" ></td>
                <td style="text-align:center"><input type="checkbox" <?php if($otoritas['insert'] == 'Y'): ?> checked <?php endif; ?> class="checkbox_insert" name="insert[<?php echo e($value->id); ?>]" value="Y" ></td>
                <td style="text-align:center"><input type="checkbox" <?php if($otoritas['update'] == 'Y'): ?> checked <?php endif; ?> class="checkbox_update" name="update[<?php echo e($value->id); ?>]" value="Y" ></td>
                <td style="text-align:center"><input type="checkbox" <?php if($otoritas['delete'] == 'Y'): ?> checked <?php endif; ?> class="checkbox_delete" name="delete[<?php echo e($value->id); ?>]" value="Y" ></td>
              </tr>
              <?php $__currentLoopData = $value->submodul; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key2 => $value2): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php ($otoritas=$value2->otoritas); ?>
                <tr>
                  <td style="text-align:left"><?php echo e($key+1); ?>.<?php echo e($key2+1); ?></td>
                  <td style="text-align:left" colspan="2"><?php echo e($value2->nama_modul); ?><input type="hidden" name="id[]" value="<?php echo e($value2->id); ?>" ></td>
                  <td style="text-align:center"><input type="checkbox" <?php if($otoritas['view'] == 'Y'): ?> checked <?php endif; ?> class="checkbox_view" name="view[<?php echo e($value2->id); ?>]" value="Y" ></td>
                  <td style="text-align:center"><input type="checkbox" <?php if($otoritas['insert'] == 'Y'): ?> checked <?php endif; ?> class="checkbox_insert" name="insert[<?php echo e($value2->id); ?>]" value="Y" ></td>
                  <td style="text-align:center"><input type="checkbox" <?php if($otoritas['update'] == 'Y'): ?> checked <?php endif; ?> class="checkbox_update" name="update[<?php echo e($value2->id); ?>]" value="Y" ></td>
                  <td style="text-align:center"><input type="checkbox" <?php if($otoritas['delete'] == 'Y'): ?> checked <?php endif; ?> class="checkbox_delete" name="delete[<?php echo e($value2->id); ?>]" value="Y" ></td>
                </tr>
              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          </tbody>
        </table>
        <div style="padding:20px">
          <?php echo e(csrf_field()); ?>

          <input type="hidden" name="hak_akses" value="<?php echo e($hak_akses); ?>">
    			<button type="submit" class="btn btn-block btn-primary" >SIMPAN</button>
        </div>
		  </form>
    </div>
  </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
<script>
$("#check_all_view").click(function(){
  $('.checkbox_view').not(this).prop('checked', this.checked);
});
$("#check_all_insert").click(function(){
  $('.checkbox_insert').not(this).prop('checked', this.checked);
});
$("#check_all_update").click(function(){
  $('.checkbox_update').not(this).prop('checked', this.checked);
});
$("#check_all_delete").click(function(){
  $('.checkbox_delete').not(this).prop('checked', this.checked);
});
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/rantai_pasok/code/resources/views/manajemen_user/otoritas_modul.blade.php ENDPATH**/ ?>