<?php
use App\Models\Maladie;
use App\Models\ReportQuarter;
use App\Services\RepportService;
use Livewire\Component;
?>

<div>
    <div class="table-responsive">
        <table class="table table-bordered" style="width: 100%">
            <thead>
                <tr>
                    <th class="text-center" style="padding: 8px">N°</th>
                    <th style="padding: 8px">Matricule</th>
                    <th style="padding: 8px" >Nom et Prénons</th>
                    <th style="padding: 8px">Sexe</th>
                    <th style="padding: 8px">Age</th>
                    <th style="padding: 8px">Classe</th>
                    <th style="padding: 8px">Date dépot <br> du certificat médical</th>
                    <th style="padding: 8px">Type de maladie</th>
                    <th style="padding: 8px">Durée de la maladie</th>
                </tr>
            </thead>
            <tbody>
            @php $i = 1; @endphp
            @forelse ($data as $item)
                <tr>
                    <th class="text-center" style="padding: 8px">{{ $i < 10 ? '0'.$i++:$i++ }}</th>
                    <td class="text-center" style="padding: 8px">{{ $item->inscription->student->matricule }}</td>
                    <td style="padding: 8px">
                        {{ strtoupper($item->inscription->student->first_name).' '.ucwords($item->inscription->student->last_name) }}
                    </td>
                    <td class="text-center" style="padding: 8px">{{ $item->inscription->student->sexe }}</td>
                    <td class="text-center" style="padding: 8px">{{ $item->inscription->student->age.' ans' }}</td>
                    <td style="padding: 8px">{{ ucfirst($item->classe->libelle) }}</td>
                    <td style="padding: 8px">{{ date('d/m/Y', strtotime($item->date)) }}</td>
                    <td style="padding: 8px">{{ ucfirst($item->maladie) }}</td>
                    <td style="padding: 8px">{{ ucfirst($item->dure) }}</td>
                </tr> 
            @empty
                <tr>
                <td colspan="9" class="text-center" style="padding: 8px">Underdefined data</td>
                </tr>
            @endforelse
            </tbody>
        </table>
    </div>
</div>