<?php $__env->startSection('title', 'Gestion des classes'); ?>
<?php $__env->startSection('link'); ?>
<!-- Data Table Css -->
<?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 mb-0">
                                    <h4 class="m-0">Emploi du temps</h4>
                                    <h4>
                                        <strong><?php echo e($class['libelle']); ?></strong>
                                    </h4>
                                    <div class="right">
                                        <span style="float: right">
                                            <button class="btn btn-inverse btn-outline-inverse btn-sm py-1 mx-2" id="enseignant" data-info="<?php echo e($class['id'].'_'.$class['libelle'].'_'.$string); ?>" title="List Teacher" data-toggle="modal" data-target="#enseignantModal"> <i class="fas fa-user-alt m-0"></i></button>
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($existe): ?>
                                            <a href="<?php echo e(route('time.pdf',$class->id)); ?>" target="_blank" class="btn btn-inverse btn-outline-inverse btn-sm py-1 mr-2" title="Download pdf"> <i class="fas fa-download m-0"></i></a>
                                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                            <a href="<?php echo e(route('time.classe',$string)); ?>" class="btn btn-inverse btn-outline-inverse  btn-sm py-1" title="Return Back"><i class="fas fa-reply m-0"></i></a>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <hr class="mt-0 mx-3">
                            <div class="card-block">
                                <div class="dt-responsive table-responsive">
                                    <table id="simpletable" class="table table-striped table-bordered nowrap">
                                        <thead>
                                            <tr style="background: rgb(237, 236, 236)">
                                                <th class="text-center" style="width: 100px">Horaires</th>
                                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $days; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $day): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoop($loop->index); ?><?php endif; ?>
                                                <th class="text-center" style="width: 100px"><?php echo e(ucfirst($day['day'])); ?></th>
                                                <?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; ?>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $morning; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $mrg): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoop($loop->index); ?><?php endif; ?>
                                            <tr>
                                                <td class="text-center"><?php echo e($mrg['debut']); ?> - <?php echo e($mrg['fin']); ?></td>
                                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php for($i = 0; $i < count($days); $i++): ?>
                                                <td class="text-center">
                                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $dtsMrg; $__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; ?>
                                                        <?php echo e($item['ligne'] == $i+1 ? ($item['morning_time_id'] == $mrg['id'] ? $item->matter['abbreviated'] ?? $item->matter['libelle']:null):null); ?>

                                                    <?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; ?>
                                                </td>
                                                <?php endfor; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                            </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; ?>
                                            <tr style="background: rgb(209, 217, 221); letter-spacing: 1rem; font-size: 15px">
                                                <th colspan="<?php echo e(count($days)+1); ?>" class="text-center py-2">APRES - MIDI</th>
                                            </tr>
                                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $after; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $atr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoop($loop->index); ?><?php endif; ?>
                                            <tr>
                                                <td class="text-center"><?php echo e($atr['debut']); ?> - <?php echo e($atr['fin']); ?></td>
                                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php for($i = 0; $i < count($days); $i++): ?>
                                                <td class="text-center">
                                                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $dtsAfter; $__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; ?>
                                                        <?php echo e($item['ligne'] == $i+1 ? ($item['after_noon_time_id'] == $atr['id'] ? $item->matter['abbreviated'] ?? $item->matter['libelle']:null):null); ?>

                                                    <?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; ?>
                                                </td>
                                                <?php endfor; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                            </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="row text-center">
                                    <div class="col-sm-12 invoice-btn-group text-center">
                                        <a href="<?php echo e(route('time.create',$class->id.'_'.$string)); ?>" class="btn btn-inverse btn-outline-inverse py-1"> <i class="fas fa-edit"></i> Edit emploi du temps</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- @Modal -->
<div class="modal fade" id="enseignantModal" tabindex="-1" role="dialog" aria-labelledby="enseignantModalTitle" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
      <div class="modal-content">
        <div class="modal-header bg-dark py-2">
          <h5 class="modal-title" id="enseignantModalTitle">Liste d'enseignant</h5>
          <span id="libelle" style="font-size: 18px"></span>
        </div>
        <div class="modal-body">
            <div class="dt-responsive table-responsive">
                <table id="modalEnseignant" class="table table-striped table-bordered nowrap">
                    <thead>
                        <tr>
                            <th class="text-center" style="width: 5%">N°</th>
                            <th class="text-center" style="width: 100px">Enseignant</th>
                            <th class="text-center" style="width: 70px">Discipline</th>
                        </tr>
                    </thead>
                    <tbody>
                        
                    </tbody>
                </table>
                <span class="my-0 py-0" style="font-size: 12px" style="display: none" id="ppDiv"><u>NB</u> : Professeur Principal <strong class="text-danger">*</strong></span>
            </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-inverse btn-outline-inverse btn-sm py-1 mx-2" data-dismiss="modal">Annuler</button>
          <a href="#" class="btn btn-inverse btn-outline-inverse btn-sm py-1 mx-2" id="formUrl">Editer</a>
        </div>
      </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('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(){

            var currentUrl = window.location.href;
            let debutUrl = currentUrl.split("classe");
           $('#enseignant').click(function() {
                $('#classe').remove();
                $('.addRow').remove();
                let val = $(this).data('info');
                $('#formUrl').attr('href', debutUrl[0]+'classe/add_teacher/'+(val.split('_'))[0]+'_'+(val.split('_'))[2]);
                $('#libelle').append('<strong id="classe">'+(val.split('_'))[1]+'</strong>');

                // Affichage des données
                $.ajax({
                    url: '<?php echo e(route('time.show_teacher')); ?>',
                    method: 'GET',
                    data: {
                        id: (val.split('_'))[0]
                    },
                    success: function(data){
                        console.log(data);
                        if(data.length){
                            $('#ppDiv').show();
                            $i = 0;
                            while($i < data.length){
                                $num = $i <= 9 ? '0'+($i+1):$i+1;
                                $pp = data[$i].pp == '1' ? ' <strong class="text-danger">*</strong>':'';
                                $('#modalEnseignant tbody').append('<tr class="addRow">'+
                                '<td class="text-center">'+$num+'</td>'+
                                '<td>'+data[$i].name+$pp+'</td>'+
                                '<td>'+data[$i].mat+'</td>'+
                                '</tr>');
                                $i++;
                            }
                        }
                        else{
                            $('#ppDiv').hide();
                            $('#modalEnseignant tbody').append('<tr class="addRow">'+
                                '<td class="text-center" colspan="5">Aucun enseignant disponible pour cette classe</td>'+
                            '</tr>');
                        }
                    }
                });

            });
        })
    </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\times\index.blade.php ENDPATH**/ ?>