<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="description" content="Educas est une application de gestion d'ecole dans son ensemble">
    <meta name="author" content="Jean-Marius Yao">
    <title>Liste des notes {{($matter->matter->abbreviated ?? $matter->matter->libelle)}} {{$class->libelle}}</title>
</head>
<style>
    @page {
        margin: 20px 10px 20px 10px; /* Supprime toutes les marges */
    }

    body {
        margin: 0cm;
        padding: 0cm;
        font-size: .875em;
        overflow-x: hidden;
        color: #353c4e;
        font-family: sans-serif;
    }

    /* applies border to the table */
    table th,td {
        text-align: center
    }

    th, td {
        white-space: nowrap;
    }

    #header {
        /* position: fixed; */
        border-bottom: 2px solid gray;
        left: 0;
        right: 0;
        top: -20px;
        text-align: center;
        font-size: 12px;
        color: #555;
    }

    #footer {
        position: fixed;
        bottom: -50px;
        border-top: 2px solid gray;
        left: 0;
        right: 0;
        height: 50px;
        text-align: center;
        font-size: 12px;
        color: #555;
    }
</style>
<body>
    <header id="header">
        <table style="width: 100%; margin: 0px auto; padding:0%">
            <tbody>
                <tr>
                <td style="width: 50%">
                    <table style="width: 100%">
                    <tbody>
                        <tr>
                        <td>
                            <div style="text-align: center; font-size: 12px">Ministère de l'Education Nationale, de l'Enseignement <br> Technique et de la   Formation Professionnelle</div>
                        </td>
                        </tr>
                        <tr>
                        <td>
                            <div style="text-align: center;">
                            <b style="font-size: 15px;">{{mb_strtoupper($school->school->name_school)}}</b><br>
                            </div>
                        </td>
                        </tr>
                    </tbody>
                    </table>
                </td>
                <td style="width: 50%">
                    <table style="width: 100%">
                    <tbody>
                        <tr>
                        <td>
                            <div style="text-align: center; font-size: 12px;">
                            <b >REPUBLIQUEDE COTE D'IVOIRE</b><br>
                            <i>Union - Discipline - Travail</i>
                            </div>
                        </td>
                        </tr>
                        <tr>
                        <td>
                            <div style="text-align: center;">
                            <b style="font-size: 15px;">Année Scolaire : <b>{{$class->schoolYear->school_year}}</b>
                            </div>
                        </td>
                        </tr>
                    </tbody>
                    </table>
                </td>
                </tr>
            </tbody>
        </table>
    </header>
    {{-- <hr> --}}
    <section style="margin: 5px auto;">
        <div style="margin-top: 20px">
            <div style="margin-top: 35px; text-align: center; font-size:21px; text-decoration: underline;">
                <b>LISTE NOTES {{strtoupper($decoup->cutting->libelle)}} {{strtoupper($matter->matter->abbreviated ?? $matter->matter->libelle)}} {{$class->libelle}}</b>
            </div>
            <div style="margin-top: 5%">
                <table border="2" cellpadding="10" cellspacing="0" style="border-collapse: collapse; width: 100%; margin: 0px auto; border: 1px solid #2c2d2e;">
                    <thead>
                        <tr>
                            <th style="width: 3%">N°</th>
                            <th style="width: 20%">Nom et prénoms</th>
                            <th style="width: 5%">Genre</th>
                            <th style="width: 13%">Matricule</th>
                            <th style="width: 13%">CF</th>
                            <th style="width: 13%">OG</th>
                            <th style="width: 13%">EO</th>
                            <th style="width: 7%">Moyenne</th>
                            <th style="width: 7%">Rang</th>
                        </tr>
                    </thead>
                    <tbody>
                        @php $i = 1 @endphp
                        @foreach ($datas as $item)
                        <tr>
                            <th>
                                <div class="mt-2">{{$i <= 9 ? '0'.$i++:$i++}}</div>
                            </th>
                            <td style="text-align:left">
                                <div class="mt-2">{{$item['name']}}</div>
                            </td>
                            <td class="py-2"><div class="mt-2">{{ucfirst($item['sexe'] == 'F' ? 'F':'M')}}</div></td>
                            <td class="py-2" style="text-align:left"><div class="mt-2">{{$item['matricule']}}</div></td>
                            <td class="p-0" style="padding: 0%">
                                <table class="table" style="margin: 0%; padding:0%">
                                    <tr style="margin: 0%; padding:0%">
                                        @foreach ($item['notes']['CF']['notes'] as $item1)
                                        <td class="text-center m-0 py-1" style="margin: 0%; padding: 5px 0px">{{$item1['note']}}</td>
                                        @endforeach
                                    </tr>
                                    <tr style="margin: 0%; padding:0%">
                                        <td colspan="5" style="padding-top:0%; padding-bottom:0%; text-align: center">{{$item['notes']['CF']['moyenne']}}</td>
                                    </tr>
                                </table>
                            </td>
                            <td class="p-0" style="padding: 0%">
                                <table class="table p-0 m-0">
                                    <tr style="margin: 0%; padding:0%">
                                        @foreach ($item['notes']['OG']['notes'] as $item3)
                                        <td class="text-center m-0 py-1" style="margin: 0%; padding: 5px 0px">{{$item3['note']}}</td>
                                        @endforeach
                                    </tr>
                                    <tr style="margin: 0%; padding:0%">
                                        <td colspan="5" style="padding-top:0%; padding-bottom:0%; text-align: center">{{$item['notes']['OG']['moyenne']}}</td>
                                    </tr>
                                </table>
                            </td>
                            <td class="p-0" style="padding: 0%">
                                <table class="table p-0 m-0">
                                    <tr style="margin: 0%; padding:0%">
                                        @foreach ($item['notes']['EO']['notes'] as $item2)
                                        <td class="text-center m-0 py-1" style="margin: 0%; padding: 5px 0px">{{$item2['note']}}</td>
                                        @endforeach
                                    </tr>
                                    <tr style="margin: 0%; padding:0%">
                                        <td colspan="5" style="padding-top:0%; padding-bottom:0%; text-align: center">{{$item['notes']['EO']['moyenne']}}</td>
                                    </tr>
                                </table>
                            </td>
                            <th class="py-2 text-center">
                                <div class="mt-2">{{$item['moyen'] ? $item['moyen']['moyenne']:'--'}}</div>
                            </th>
                            <td class="py-2 text-center">
                                <div class="mt-2">{{$item['moyen'] ? $item['moyen']['rang']:'--'}}</div>
                            </td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </section>
    <footer id="footer">
        <table style="width: 100%">
        <tbody>
            <tr>
            <td style="width: 50%">
                <i style="text-align: left; font-size: 12px; margin:0%">{{ $school->address_email }} / {{ $school->phon_school }}</i>
            </td>
            <td style="width: 25%">
                <i style="text-align: center; font-size: 12px; margin:0%">{{ strtoupper($class->libelle).' -- '.random_int(1000, 5000).' - 0'.$school->school_id }}</i>
            </td>
            <td style="width: 25%">
                <i style="text-align: right; float:right; font-size: 12px; margin:0%">Imprimé le {{date('Y-m-d H:i:s')}}</i>
            </td>
            </tr>
        </tbody>
        </table>
    </footer>
</body>
</html>