<?php
    header('cache-Control: no-store, no-cache, must-revalidate');
    header('cache-Control: post-check=0, pre-check=0', false);
    header('Pragma: no-cache');
    header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
?>

<!DOCTYPE html>
<html id="html" lang="<?php echo e(app()->getLocale()); ?>">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">
    <link href="https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;600&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css"
        integrity="sha384-DyZ88mC6Up2uqS4h/KRgHuoeGwBcD4Ng9SiP4dIRy0EXTlnuz47vAwmeGwVChigm" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="/css/connexion.css">
    <link rel="stylesheet" href="/css/style.css">
    <title>UpSchool</title>
    <script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk="
        crossorigin="anonymous"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/cleave.js@1.6.0/dist/cleave.min.js"
        integrity="sha256-frGUwmSN4CLLjyk5m59ECdXsDMUxTW5O6hdceNHVCJo=" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/cleave.js@1.6.0/dist/addons/cleave-phone.sn.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.3/additional-methods.min.js"
        integrity="sha512-XZEy8UQ9rngkxQVugAdOuBRDmJ5N4vCuNXCh8KlniZgDKTvf7zl75QBtaVG1lEhMFe2a2DuA22nZYY+qsI2/xA=="
        crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
    <link rel="icon" href="/img/upschool-favicon.png">
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <style>
        h1 {
            font-family: 'New Century Schoolbook', 'TeX Gyre Schola', 'serif';
        }

        @media  print {
            @page  {
                size: A4;
                margin: 5mm;
            }

            body {
                zoom: 0.85;
                /* ajuste si besoin : 0.8 / 0.75 */
            }

            .page-break {
                page-break-after: always;
                break-after: page;
            }
        }


        * {
            -webkit-print-color-adjust: exact !important;
            /* Chrome, Safari, Edge */
            color-adjust: exact !important;
            /*Firefox*/
        }
    </style>
</head>

<body style="background-image: url('/img/bgbulletin.png'); background-size: contain;"
    class="has-background-white px-5 my-0 m-auto is-family-monospace" id="print">

    <div
        class="container columns is-centered is-multiline mx-0 mt-3 is-flex is-justify-content-center is-justify-content-space-around is-flex-wrap-wrap">
        <?php
            $counter = 0;
        ?>
        <?php $__currentLoopData = $eleves; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $eleve): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php if($counter % 4 == 0 && $counter != 0): ?>
                <div class="page-break"></div>
            <?php endif; ?>
            <div class="column is-half">
                <div class="has-text-centered">
                    <h1 class="title mb-0"><?php echo e(env('SCHOOL_NAME')); ?></h1>
                    <p><?php echo e(env('SCHOOL_ADDRESS')); ?></p>
                    <p><?php echo e(env('SCHOOL_AUT')); ?></p>
                    <p><?php echo e(env('SCHOOL_PHONE')); ?></p>

                    <?php
                        $reliquat = 0;
                        $toPay = $eleve->payements
                            ->where('paye', 0)
                            ->where('mois', $month)
                            ->where('promo', env('SCHOOL_YEAR'))
                            ->first();
                        $allToPay = $eleve->payements->where('paye', 0)->where('promo', env('SCHOOL_YEAR'));
                        $otherToPay = $eleve->payements
                            ->where('paye', 0)
                            ->where('promo', env('SCHOOL_YEAR'))
                            ->where('type', '!=', 'Inscription')
                            ->where('type', '!=', 'Mensualité');

                        if (isset($toPay)) {
                            foreach ($allToPay as $oneToPay) {
                                if ($oneToPay->mois != $toPay->mois && $oneToPay->id < $toPay->id) {
                                    $reliquat = $reliquat + $oneToPay->montant;
                                }
                            }
                        }
                    ?>

                    <h1 class="title is-4 my-3">Facture : <?php echo e($month); ?></h1>
                </div>

                <p>Nom : <?php echo e($eleve->nom); ?></p>
                <p>Prénom : <?php echo e($eleve->prenom); ?></p>
                <p>Classe : <?php echo e($classe->libelle); ?></p>
                <p>Mensualité : <?php echo e(number_format($eleve->mensualite, 0, ',', ' ')); ?> CFA</p>
                <p>Reliquat : <?php echo e(number_format($reliquat, 0, ',', ' ')); ?> CFA</p>

                <?php if($toPay != null): ?>
                    <h1 class="title is-5 mt-3">Net à payer :
                        <?php echo e(number_format($reliquat + $toPay->montant, 0, ',', ' ')); ?> CFA</h1>
                <?php else: ?>
                    <h1 class="title is-5 mt-3">Net à payer :
                        0 CFA</h1>
                <?php endif; ?>

                <?php if($otherToPay->count() > 0): ?>
                    <h2 class="subtitle is-6 mb-1 has-text-weight-semibold">Autres frais à régler :</h2>
                    <ul class="mb-1">
                        <?php $__currentLoopData = $otherToPay; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $other): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <li><?php echo e($other->type); ?> :
                                <?php echo e(number_format($other->montant, 0, ',', ' ')); ?> CFA
                            </li>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </ul>
                <?php endif; ?>


                <p class="mb-3">NB : Les parents doivent s'acquitter des frais de scolarité au plus tard le
                    <?php echo e($limit); ?> du mois. Passé cette date, les élèves ne seront reçus à l'école qu'après
                    réglement.</p>

                <p class="has-text-right">Merci de votre confiance<br>La Direction<br><?php echo e(date_format(now(), 'd/m/Y')); ?>

                </p>
            </div>
            <?php
                $counter++;
            ?>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </div>

</body>

</html>
<?php /**PATH /home/dide1435/luqman.upschool-sn.com/resources/views/factures.blade.php ENDPATH**/ ?>