@extends('layout')

@section('contenu')

    <section
        style="background-image: url('/img/bgclasse.png'); background-attachment: fixed; background-repeat: no-repeat; background-size: cover; min-height: 93.2vh"
        class="section mt-0 columns mx-0 mb-0 is-centered">
        <section class="section container column is-two-thirds">
            <section class="section is-link is-light p-0">
                <h1 class="title is-1 is-size-3-touch has-text-centered has-text-white">{{ $classe->libelle }}</h1>
                <h1 class="subtitle is-6 has-text-centered has-text-white">{{ $classe->type }}</h1>
            </section>
            <nav class="panel is-info has-background-light mt-2">
                <p class="panel-heading">
                    @foreach ($matieres as $matiere)
                        @if ($matiere->id == $evaluation->matiere_id)
                            Evaluation {{ $matiere->libelle }} du {{ date('d/m/Y', strtotime($evaluation->date)) }}
                        @endif
                    @endforeach
                    <br>
                    @if ($classe->type == 'Secondaire')
                        Trimestre/Semestre {{$evaluation->semestre}}
                    @else
                        Trimestre {{$evaluation->semestre}}
                    @endif
                </p>
                <div class="content">
                    @foreach ($eleves->sortBy('nom') as $eleve)
                        <div class="panel-block is-flex is-justify-content-space-between">
                            <div class="has-text-dark">
                                <span class="panel-icon mt-1">
                                    <i class="fas fa-user-graduate" aria-hidden="true"></i>
                                </span>
                                {{ $eleve->prenom }} {{ $eleve->nom }}
                            </div>
                            @foreach ($notes as $note)
                                @if ($note->eleve_id == $eleve->id)
                                    <div>
                                        <input id="{{ $eleve->id }}" min="0" max="20" type="number"
                                            class="input is-info is-rounded note_eleve" title="Entre 0 et 20"
                                            name="note{{ $eleve->id }}" placeholder="00" value="{{ $note->valeur }}"
                                            disabled required>
                                    </div>
                                @endif
                            @endforeach
                            <span hidden>{{ $existe = 0 }}</span>
                            @foreach ($notes as $note)
                                @if ($note->eleve_id == $eleve->id)
                                    <span hidden>{{ $existe++ }}</span>
                                @endif
                            @endforeach
                            @if ($existe == 0)
                                <div>
                                    <input id="{{ $eleve->id }}" min="0" max="20" type="number"
                                        class="input is-info is-rounded note_eleve" title="Entre 0 et 20"
                                        name="note{{ $eleve->id }}" placeholder="00" disabled required>
                                </div>
                            @endif
                        </div>
                    @endforeach
                </div>
            </nav>
        </section>
    </section>
    @include('/partials/evaluationJs')
@endsection
