{% extends 'EspaceEnseignant/base_enseignant.html' %}
{% block page_title %} Importer les notes {% endblock page_title %}
{% block content %}

{% include "EspaceEnseignant/infos.html" %}

<div>
    <div class="container w-25 my-5 py-3 border">
        <form method="POST" enctype="multipart/form-data">
            {% csrf_token %}
            <div>
                <label>Type evaluation</label>
                <select name="typeEvaluationId" class="form-control">
                    {% for typeEvaluation in typeEvaluations %}
                        <option value="{{typeEvaluation.id}}">{{typeEvaluation.libelle}}</option>
                    {% endfor %}    
                </select>
            </div>
            <div class="my-2">
                <label>Session</label>
                <select name="sessionId" class="form-control">
                    {% for session in sessions %}
                        <option value="{{session.id}}">{{session.libelle}}</option>
                    {% endfor %}    
                </select>
            </div>
            <div class=" my-2">
                <label>Evaluation</label>
                <input type="text" class="form-control" placeholder="libelle evaluation" aria-label="libelle evaluation" name="evaluation" required>
            </div>
            <div class="my-2">
                <label>Fichier</label>
                <div class="custom-file">
                    <input type="file" class="custom-file-input" id="customFile" name="fichier" required>
                    <label class="custom-file-label" for="customFile">Choisir fichier</label>
                </div>
            </div>
            <button class="btn btn-primary w-100 mt-5" type="submit">Valider</button>
        </form>
    </div>

    <div class="container w-1/4">
        <table class="table">
            <thead>
                <tr>
                    <th scope="col">#</th>
                    <th scope="col">NCE</th>
                    <th scope="col">NOM</th>
                    <th scope="col">PRENOMS</th>
                    <th scope="col">Notes</th>
                </tr>
            </thead>
            <tbody>
                {% for note in  notes %}
                    <tr>
                        <th scope="row">{{ forloop.counter }}</th>
                        <td>{{note.etudiant.nce}}</td>
                        <td>{{note.etudiant.nom}}</td>
                        <td>{{note.etudiant.prenoms}}</td>
                        <td>{{note.note}}</td>
                    </tr>

                {% empty %}
                    <tr>
                        <td colspan="5">Pas de notes....</td>
                    </tr>
                {% endfor %}
                
            </tbody>
        </table>
        <div class="d-flex justify-content-end">
            <a class="btn btn-primary text-white" href="{% url 'EspaceEnseignant:notes' ecueId %}">Retour</a>
        </div>
    </div>


</div>
{% endblock content %}

{% block custom_js %}
{% endblock custom_js %}