<?php $__env->startSection('title', 'Gestion des appels'); ?>
<?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')); ?>">
<style>
    .btn.btn-icons {
        border-radius: 50%;
        width: 25px;
        line-height: 15px;
        height: 25px;
        padding: 2px;
        text-align: center;
    }
    .btn.btn-icons i{
        font-size: 11px;
        margin: 0px auto
    }
    .dataTables_length label{
        display: none;
    }
    .form-control:focus {
        box-shadow: none !important;
        border-color: #ccc !important; /* ou une couleur de ton choix */
    }
</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 mb-0 pb-0">
                                    <div style="font-size: 18px">Appels du <?php echo e($cutting->cutting->libelle); ?></div>
                                    <div class="text-center text-muted" style="font-size: 17px"><?php echo e(strtoupper($inscris->student->first_name).' '.ucwords(limitCaracts($inscris->student->last_name,25))); ?> - <?php echo e($inscris->classe->libelle); ?></div>
                                    <span>
                                        <a href="<?php echo e(route('appel.return', $matter->matter_id.'_'.$inscris->classe->id)); ?>" class="btn btn-inverse btn-outline-inverse  btn-sm py-1" title="Return Back"><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">
                                    <table class="table table-striped table-bordered nowrap" id="myTable">
                                        <thead>
                                            <tr>
                                                <th class="text-center" style="width: 5%">N°</th>
                                                <th class="text-center" style="width: 35%">Date d'absence</th>
                                                <th class="text-center" style="width: 20%">Heure</th>
                                                <th class="text-center" style="width: 20%">statut</th>
                                                <th class="text-center" style="width: 20%">Actions</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 = $data; $__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 $val1 = $item['period'] == 1 ? 'time_morning':'time_after'; $val2 = $item['period'] == 1 ? 'morning_time':'after_noon_time';?>
                                            <tr>
                                                <th class="text-center"><?php echo e($i <= 9 ? '0'.$i++:$i++); ?></th>
                                                <td class="text-center"><?php echo e(date('d-m-Y', strtotime($item['dateAbsence']))); ?></td>
                                                <td class="text-center"><?php echo e($item->$val1->$val2->debut.' à '.$item->$val1->$val2->fin); ?></td>
                                                <td class="text-center" title="">
                                                    <label class="label label-<?php echo e($item['justified'] ? 'success':'danger'); ?>" <?php echo e($item['justified'] ? '':''); ?> data-toggle="tooltip" title="" data-original-title="<?php echo e($item['motifs'] ? 'Motif : '.$item['motifs']:''); ?>"><?php echo e($item['justified'] ? 'Justifié':'Non justifié'); ?></label>
                                                </td>
                                                <td style="width: 15%" class="text-center">
                                                    <span class="card-block remove-label m-0 text-center">
                                                        <button class="editAbs btn btn-inverse btn-outline-inverse btn-icons pb-2" data-id="<?php echo e($item['id']); ?>" data-just="<?php echo e($item['justified']); ?>" title="Edition" data-toggle="modal" data-target="#editAppelModal" <?php echo e($cutting->status == 2 ? 'disabled':''); ?>><i class="fas fa-edit m-0"></i></button>
                                                    </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>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- Modal Add New Appel -->
<div class="modal fade" id="editAppelModal" tabindex="-1" role="dialog" aria-labelledby="editAppelModalTitle" 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="editAppelModalLongTitle">Justificatif d'absence</h5>
        </div>
        <form action="<?php echo e(route('appel.update')); ?>" method="post">
            <?php echo csrf_field(); ?>
            <?php echo method_field('put'); ?>
            <input type="hidden" name="absId" id="absenceId" value="">
            <input type="hidden" name="string" value="<?php echo e($matter->matter_id.'_'.$inscris->classe->id); ?>">
            <input type="hidden" name="typeEnseig" value="<?php echo e($inscris->classe->type); ?>">
            <div class="modal-body">
                <div class="m-b-30 mt-3">
                    <span class="mx-3" id="divAutre">
                        <input type="radio" name="type" class="type" id="autre" value="1">
                        <label for="autre">Autre</label>
                    </span>
                    <span class="mx-3">
                        <input type="radio" name="type" class="type" id="annule" value="2">
                        <label for="annule">Annulé l'absence</label>
                    </span>
                </div>
                <div class="mt-3" id="divMotif">
                    <label for="motif">Motif de justificatif<span class="text-danger">*</span> : </label>
                    <textarea name="motif" class="form-control" id="motif" rows="3" style="resize: none;" required></textarea>
                </div>
                <div class="mt-1 text-center" id="testJust" style="display: none">
                    Absence justifiée.
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-inverse btn-outline-inverse btn-sm py-1 mx-2" data-dismiss="modal">Annuler</button>
                <button type="submit" class="btn btn-inverse btn-outline-inverse btn-sm py-1 mx-2">Valider</button>
            </div>
        </form>
      </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>
    <!-- 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(){

            $('#myTable').DataTable({
                ordering: false
            });

            $(document).on('click', '.editAbs', function() {
                $('#absenceId').val($(this).data('id'));
                $(this).data('just') == 1 ? $('#divAutre').slideUp():$('#divAutre').slideDown();
                $(this).data('just') == 1 ? $('#divMotif').slideUp():$('#divMotif').slideDown();
                $(this).data('just') == 1 ? $('#autre').attr('checked', false):$('#autre').attr('checked', true);
                $(this).data('just') == 1 ? $('#annule').attr('checked', true):$('#annule').attr('checked', false);
                $(this).data('just') == 1 ? $('#testJust').slideDown():$('#testJust').slideUp();
            });


            $(document).on('click', '.type', function() {
                $(this).val() == 2 ? $('#divMotif').slideUp():$('#divMotif').slideDown();
                $(this).val() == 2 ? $('#motif').prop('required', false):$('#motif').prop('required', true);
            });

        })
    </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\appels\edit.blade.php ENDPATH**/ ?>