{% extends 'enseignant/base_profile.html' %}
{% load static %}
{% load custom_tag %}
{% load custom_tag_obj %}
{% block head %}{% endblock head %}
{% block page_title %}<!--({{ue.code}}) : {{ue.libelle}}--> {% endblock page_title %}
{% block content %}

<div class="row">
    <div class="col-md-12 not-lib" style="color:#179acf;font-size:26px;font-weight:bold;align:left;width:100%;margin-bottom:25px;margin-top:-35px;"
    ><br/>
        <!--<span style="margin-left:15px;">UE : {{ue.libelle}}</span><br/>-->
        <span style="margin-left:55px;">Matière : ({{ecue.code}}) {{ecue.libelle}}</span>
    </div><hr/>
    <div style="text-align:center;margin-left:55px;">
        <h4>ANNEE: <span style="color:red">{{annee}}</span> </h4>
    </div>
</div>
<div class="card">
    <div class="card-header text-white" style="background: #21618C"><h3 class="card-title">MENU</h3></div>
    <div class="card-body">

        {% if not etudiantUes %}
        <button class="btn btn-warning mx-1 btn-sm" disabled><i class="fa  fa-upload"></i> Exporter la liste (CSV)</button>
        {% else %}
        <a href="{% url 'EspaceEnseignant:dr_ufr_etudiant_ecue_export' ecue.id annee.id %}" target="_blank" class="btn btn-warning btn-sm" ><i class="fa fa-upload"></i> Exporter la liste (.csv)</a>
        {% endif %}
        <br/><br/>
    </div>
</div>
<div class="card card-primary">
    <div class="card-header text-white" style="background: #21618C"><h3 class="card-title">AJOUTER DES NOTES</h3></div>
</div>
<div class="table p-2">
    <form method="post" action="#">
        {% csrf_token %}

<div class="row">
    <div class="col-md-3">
        <label>Date du jour</label>
        <input type="date" class="form-control" name="date" required/>
    </div>
    <div class="col-md-3">
        <label>Heure de début</label>
        <input type="time" class="form-control" name="debut" required/>
    </div>
    <div class="col-md-3">
        <label>Heure de fin</label>
        <input type="time" class="form-control" name="fin" required/>
    </div>
    <div class="col-md-3">
        <label>Nombre d'heure</label>
        <input type="number" class="form-control" name="nbHeure" placeholder="0" required/>
    </div>
</div>
<br/>
<table class="table table-striped table-bordered">
    <tr>
        <th></th>
        <th>NCE</th>
        <th>Nom et Prénoms</th>
        <th>Présence</th>
    </tr>
    {% for etudiantUe in etudiantUes %}
        {% check_appel_ecue date ecue annee etudiantUe as checkedBox %}
        <tr class="antr">
            <td style="text-align:center;">{{forloop.counter}}</td>
            <td class="antd" style="width:100px;">{{etudiantUe.nce}}</td>
            <td>{{etudiantUe}}</td>
            <td width="300">
                <input type="checkbox" name="absent" value="{{etudiantUe.id}}" {% if checkedBox %}checked{% endif %}>
            </td>
        </tr>
    <tr>
    </tr>
    {% empty%}
        <tr>
            <td class="h4" colspan="5" >La liste est vide ....</td>
        </tr>
    {% endfor %}
    <tr>
        <td colspan="3">
        </td>
        <td>
            <button class="btn btn-success btn-sm" name="Enregistrer" type="submit"><i class="fa fa-save"></i> Enregistrer</button>
        </td>
    </tr>

</table>
    </form>
</div>


{% endblock content %}

{% block custom_js %}
<script src="{% static 'js/custom-js/save_note.js'%} "></script>
 <script src="{% static 'js/custom-js/note.js' %}"></script>
<script>
    var elements = rootElement.getElementsByClassName('delib')
    $('#sField').change(function(){
        $('#sForm1').submit()
    });
</script>
{% endblock custom_js %}