<?php $__env->startSection('title', 'Gestion des resultats'); ?>
<?php $__env->startSection('link'); ?>
<!-- Data Table Css -->
<link rel="stylesheet" href="<?php echo e(asset('bower_components/datatables.net-bs4/css/dataTables.bootstrap4.min.css')); ?>">
<link rel="stylesheet" href="<?php echo e(asset('assets/pages/data-table/css/buttons.dataTables.min.css')); ?>">
<link rel="stylesheet" href="<?php echo e(asset('bower_components/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css')); ?>">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/alertify.min.css"/>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/default.min.css"/>
<style>
    .dataTables_length label{
        display: none;
    }
</style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<div class="pcoded-inner-content">
    <?php echo $__env->make('includes._alert', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <div class="main-body">
        <div class="page-wrapper">
            <div class="page-body">
                <div class="row">
                    <div class="col-sm-12">
                        <form action="<?php echo e(route('resultat.pdf')); ?>" id="myForm" method="get"  target="_blank">
                            <input type="hidden" name="classe" id="classe" value="<?php echo e($classe->id); ?>">
                            <input type="hidden" name="cutting" id="cutting" value="<?php echo e($cutting->id); ?>">
                            <div class="card">
                                <div class="card-header mb-0 pb-0">
                                    <div class="d-flex justify-content-between mb-0 pb-0">
                                        <h4 class="mb-0 pb-0">Resultat <?php echo e(ucfirst($cutting->cutting->libelle)); ?></h4>
                                        <span class="form-control-variant" style="font-size: 15px">
                                            <strong class="mr-2"><?php echo e($classe['libelle']); ?></strong>[<?php echo e($prof ? ($prof->user->sexe == 'F' ? 'Mme '.strtoupper($prof->user->first_name).' '.ucwords($prof->user->last_name):'M. '.strtoupper($prof->user->first_name).' '.ucwords($prof->user->last_name)):'Non defini'); ?>]
                                        </span>
                                        <span>
                                            <button type="button" id="btn" class="btn btn-sm py-2" title="pdf"><img src="<?php echo e(asset('assets/images/imprimer.png')); ?>" alt="" srcset=""></button>
                                            <a href="<?php echo e(route('resultat.return',$classe->id.'_'.$cutting->id)); ?>" class="btn btn-inverse btn-outline-inverse  btn-sm py-1 ml-1"><i class="fas fa-reply mx-0"></i></a>
                                        </span>
                                    </div>
                                </div>
                                <hr class="mx-3 mt-0">
                                <div class="card-block">
                                    <div class="dt-responsive table-responsive">
                                        <div class="tab-content card-block">
                                            <table id="myTable" class="table table-striped table-bordered nowrap">
                                                <thead>
                                                    <tr>
                                                        <th class="text-center" style="width: 5%"></th>
                                                        <th class="text-center">Matricule</th>
                                                        <th class="text-center">Nom</th>
                                                        <th class="text-center">Prénoms</th>
                                                        <th class="text-center">Sexe</th>
                                                        <th class="text-center">Moyenne</th>
                                                        <th class="text-center">Rang</th>
                                                        <th class="text-center" style="width: 10%">
                                                            <input type="checkbox" id="checkAll">
                                                        </th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <?php $i = 1; ?>
                                                    <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <tr>
                                                        <th class="text-center py-1">
                                                            <img src="<?php echo e(asset($item['sexe'] == 'F' ? 'assets/images/stdt1_woman.png':'assets/images/stdt1_man.png')); ?>" class="img-radius m-0 p-0" alt="Photo Stuedent" style="height: 40px; width: 40px; border: 1px solid grey">
                                                            <?php $i++ ?>
                                                        </th>
                                                        <td class="text-center"><?php echo e($item['matricule']); ?></td>
                                                        <td class="ml-2"><?php echo e(strtoupper($item['first_name'])); ?></td>
                                                        <td class="ml-2"><?php echo e(ucwords($item['last_name'])); ?></td>
                                                        <td class="text-center"><?php echo e($item['sexe'] == 'F' ? 'Feminin':'Masculin'); ?></td>
                                                        <td class="text-center"><?php echo e($item['moyenne']); ?></td>
                                                        <td class="text-center"><?php echo e($item['rang']); ?></td>
                                                        <td class="text-center">
                                                            <input type="checkbox" name="tags[]" value="<?php echo e($item['inscription_id']); ?>" class="<?php echo e($item['moyenne'] != 'nc' ? 'item':null); ?>" <?php echo e($item['moyenne'] == 'nc' ? 'disabled':null); ?>>
                                                        </td>
                                                    </tr>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </tbody>
                                                
                                            </table>
                                        </div> 
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<form action="<?php echo e(route('resultat.show')); ?>" method="post" style="display: none">
    <?php echo csrf_field(); ?>
    <?php echo method_field('get'); ?>
    <input type="hidden" name="class" value="<?php echo e($classe->id); ?>">
    <input type="hidden" name="select" value="<?php echo e($cutting->id); ?>">
    <button type="submit" id="divBtn">button</button>
</form>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
    <!-- data-table js -->
    <script src="<?php echo e(asset('bower_components/datatables.net/js/jquery.dataTables.min.js')); ?>"></script>
    <script src="<?php echo e(asset('bower_components/datatables.net-buttons/js/dataTables.buttons.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/pages/data-table/extensions/autofill/js/dataTables.autoFill.min.js')); ?>"></script>
    <script src="<?php echo e(asset('bower_components/datatables.net-buttons/js/buttons.print.min.js')); ?>"></script>
    <script src="<?php echo e(asset('bower_components/datatables.net-buttons/js/buttons.html5.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/pages/data-table/js/dataTables.bootstrap4.min.js')); ?>"></script>
    <script src="<?php echo e(asset('bower_components/datatables.net-responsive/js/dataTables.responsive.min.js')); ?>"></script>
    <script src="<?php echo e(asset('bower_components/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js')); ?>"></script>
    <!-- Custom js -->
    <script src="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/alertify.min.js"></script>
    <script src="<?php echo e(asset('assets/pages/data-table/extensions/colreorder/js/colreorder-custom.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/js/pcoded.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/js/vartical-layout.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/js/jquery.mCustomScrollbar.concat.min.js')); ?>"></script>
    <script>
        $(document).ready(function(){
            let table = $('#myTable').DataTable({
                ordering: false
            });

            $("#checkAll").on("change", function(){
                // let table = $('#myTable').DataTable();
                var checked = this.checked;
                table.rows({ page: 'current' }).every(function () {
                    $(this.node()).find('.item').prop('checked', checked);
                });
            });
            

            $('#btn').on('click', function(e){
                e.preventDefault();
                let tags = [];
                $('input[name="tags[]"]:checked').each(function() {
                    tags.push($(this).val());
                });

                if(tags.length){
                   $('#myForm').submit(); // e.target refers to the form element
                }
                else{
                    alertify.error('Une erreur est survenue.');
                }
            });


            table.on('page.dt', function () {
                $('#checkAll').prop('checked', false);
            });
            
        })
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/educasnsa/public_html/neuroschool/resources/views/pages/resultats/list_classe.blade.php ENDPATH**/ ?>