<?php $__env->startSection('title', 'Add note'); ?>
<?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="https://cdnjs.cloudflare.com/ajax/libs/AlertifyJS/1.13.1/css/alertify.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', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    <div class="main-body">
        <div class="page-wrapper">
            <div class="page-body">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="card">
                            <div class="card-header mb-0 pb-0">
                                <div class="d-flex justify-content-between pb-0">
                                    <h4>Edit Moyenne - <strong style="font-size: 19px"><?php echo e(ucfirst($class->libelle)); ?></strong></h4>
                                    <span class="form-control-variant" style="font-size: 17px">
                                        <strong class="mr-2"><?php echo e(ucfirst($decoup->cutting->libelle.' [ '.($matter->matter->abbreviated ?? $matter->matter->libelle).' ]')); ?></strong>
                                    </span>
                                    <span>
                                        <a href="<?php echo e(route('moyenne.return',$class->id.'_'.$decoup->id)); ?>" class="btn btn-inverse btn-outline-inverse  btn-sm py-1 mx-1"><i class="fas fa-reply mx-0"></i></a>
                                    </span>
                                </div>
                            </div>
                            <hr class="mx-3 mt-0">
                            <form action="<?php echo e(route('moyenne.update',$matter->id)); ?>" method="post" id="myForm">
                                <?php echo csrf_field(); ?>
                                <?php echo method_field('get'); ?>
                                <div class="card-block">
                                    <div class="dt-responsive table-responsive px-lg-3">
                                        <table class="table table-striped table-bordered nowrap" id="myTable">
                                            <thead>
                                                <tr>
                                                    <th class="text-center" style="width: 6%"></th>
                                                    <th class="text-uppercase text-center" style="width: 15%">Matricule</th>
                                                    <th class="text-uppercase text-center" style="width: 15%">Nom</th>
                                                    <th class="text-uppercase text-center" style="width: 25%">Prénoms</th>
                                                    <th class="text-uppercase text-center" style="width: 15%">Sexe</th>
                                                    <th class="text-center text-uppercase" style="width: 15%">Moyenne</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php $i = 1; ?>
                                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $datas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoop($loop->index); ?><?php endif; ?>
                                                <tr class="my-2">
                                                    <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="py-0 text-center"><div class="pt-3"><?php echo e($item['matricule']); ?></div></td>
                                                    <td class="py-0"><div class="pt-3"><?php echo e($item['first_name']); ?></div></td>
                                                    <td class="py-0"><div class="pt-3"><?php echo e($item['last_name']); ?></div></td>
                                                    <td class="py-0 text-center"><div class="pt-3"><?php echo e(ucfirst($item['sexe'] == 'F' ? 'Feminin':'Masculin')); ?></div></td>
                                                    <td class="text-center py-0">
                                                        <span class="d-flex m-0 pt-2">
                                                            <input type="hidden" name="student[]" id="student_<?php echo e($i-1); ?>" value="<?php echo e($item['id'].'_'.$item['sexe']); ?>">
                                                            <input type="text" name="moyen[]" id="moyen_<?php echo e($i-1); ?>" class="form-control m-0 text-center myInput" value="<?php echo e($item['moyen']['moyenne'] ?? 'nc'); ?>" maxlength="5" style="width: 50%; font-weight: 900; border: 1px #000 dashed">
                                                            <strong class="mx-0 mt-2" style="font-size: 17px; font-weight: 700;">/ 20</strong>
                                                        </span>
                                                    </td>
                                                </tr>
                                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="text-center mb-0">
                                        <hr class="mx-3">
                                        <input type="hidden" name="cutting" value="<?php echo e($decoup->id); ?>">
                                        <input type="hidden" name="classe" value="<?php echo e($class->id); ?>">
                                        <button id="btn" class="btn btn-inverse btn-outline-inverse w-25" title="Corform Form">
                                            Valider
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- Modal Delete Evaluation-->
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="modalTitle" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class="modal-header bg-dark py-2">
                <h5 class="modal-title" id="modalLongTitle">Confirmed</h5>
                <h5 style="font-style: 17px"><?php echo e(ucfirst($decoup->cutting->libelle)); ?></h5>
            </div>
            <div class="modal-body py-3 text-center">
                <strong style="font-size: 16px">Modification de moyenne </br> <?php echo e($matter->matter->libelle); ?></strong>
                <p class="text-center">Voulez-vous vraiment Valider ?</p>
            </div>
            <div class="modal-footer mt-1">
                <button class="btn btn-inverse btn-outline-inverse btn-sm py-1 mx-2" data-dismiss="modal">Annuler</button>
                <button type="submit" id="submit1" class="btn btn-inverse btn-outline-inverse btn-sm py-1 mx-2">Valider</button>
            </div>
        </div>
    </div>
</div>
<?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>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/AlertifyJS/1.13.1/alertify.min.js"></script>
    <!-- Custom js -->
    <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
        });

            $('#myTable').on('keyup', '.myInput', function() {
                if($(this).val() > 20){
                    $(this).val(null);
                }
            });

            $('#myTable').on('keypress', '.myInput', function(e) {
                var key = e.which || e.keyCode;
                if ((key >= 48 && key <= 57) || key === 8 || key === 46 || key === 127) {
                    return true;
                } else {
                    e.preventDefault();
                }
            });


            $('#btn').on('click', function(e) {
                e.preventDefault(); // Empêche l'envoi par défaut
                const getModal = new bootstrap.Modal(document.getElementById('modal'));
                getModal.show();
            });


            $('#submit1').click(function(){
                table.rows().every(function(rowIdx, tableLoop, rowLoop) {
                    var row = this.node();
                    if (!$(row).is(':visible')) {
                        $(row).find('input, select, textarea').each(function() {
                            var name = $(this).attr('name');
                            var value = $(this).val();
                            $('<input>').attr({
                                type: 'hidden',
                                name: name,
                                value: value
                            }).appendTo('#myForm');
                        });
                    }
                });
                $('#myForm').submit();
            })

        })
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\EDUCAS\Desktop\App\V4_001\resources\views\pages\moyenne\edit.blade.php ENDPATH**/ ?>