<?php $__env->startSection('page-title'); ?> Autorisations <?php $__env->stopSection(); ?>

<?php $__env->startSection('tag-title'); ?> Autorisations <?php $__env->stopSection(); ?>

<?php $__env->startSection('page-sub-title'); ?>

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

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

    ?>
    <div class="row">
        <div class="col-xl-12">
            <div class="card">
                <div class="card-body">
                    <form method="POST" autocomplete="off" action="" enctype="multipart/form-data" class="form-horizontal form-label-left input_mask form-step">
                        <?php echo e(csrf_field()); ?>

                        <input type="hidden" value="<?php if($model->id!=0): ?><?php echo e($model->id); ?><?php else: ?><?php echo e(0); ?><?php endif; ?>" id="_id" name="_id">

                        <div class="col-sm-12">
                            <div class="form-group">
                                <label for="name" class="control-label">Role</label>
                                <input  class="form-control" value="<?php echo e($model->nom); ?>" name="name" id="name"  type="text" >
                            </div>
                        </div>

                        <?php
                        $menu_check_ids = $model->menus->pluck('id')->toArray();
                        $menus = \App\Models\Menu::select('*')->whereNull('menus.menu_id')->orderBy('sequence','asc')->get();
                        ?>

                        <style>
                            .checkbox{
                                margin-bottom: 0;
                                margin-top: 0;
                            }
                        </style>

                        <div class="col-sm-12">
                            <table class="table m-0  table-bordered-custom">
                                <thead>
                                <tr>
                                    <th>Menus</th>
                                    <th style="text-align: center">Attribution d'accès</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php $__currentLoopData = $menus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td class="libelle">
                                            <?php echo e($p->nom); ?>

                                            <?php if($p->menus->count()!=0): ?>
                                                <div class="ml-15 pt-10" style="border-left: 1px solid #a6a6a6">
                                                    <?php $__currentLoopData = $p->menus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sm): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <div class="ml-5"><?php echo e($sm->name); ?></div>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </div>
                                            <?php endif; ?>
                                        </td>
                                        <td  align="center" valign="top">
                                            <div class="checkbox checkbox-primary">
                                                <input name="aut_<?php echo e($p->id); ?>" id="checkbox-signup" <?php if(in_array($p->id, $menu_check_ids)): ?> checked <?php endif; ?> type="checkbox" >
                                                <label for="checkbox-signup"></label>
                                            </div>
                                            <?php if($p->menus->count()!=0): ?>
                                                <div class="mt-10">
                                                    <?php $__currentLoopData = $p->menus; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sm): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <div class="checkbox checkbox-custom">
                                                            <input name="aut_<?php echo e($sm->id); ?>" id="checkbox-signup" <?php if(in_array($sm->id, $menu_check_ids)): ?> checked <?php endif; ?> type="checkbox" >
                                                            <label for="checkbox-signup"></label>
                                                        </div>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </div>
                                            <?php endif; ?>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                        </div>

                        <div class="col-sm-12 mt-3">
                            <button type="submit"  class="btn btn-success action-btn  float-right btn-submit-step">Enregistrer</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <style>
        label{
            font-weight: bold;
        }

        .table th, .table td{
            padding: 5px 10px;
        }

    </style>

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


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

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

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

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

<?php echo $__env->make('template', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Users\UTILISATEUR\Desktop\Fidelisations\loyalty-system\loyalty-app\resources\views/roles/add.blade.php ENDPATH**/ ?>