{% extends 'dg_ufr/base_ufr.html' %}
{% load static %}
{% load custom_tag %}
{% load custom_tag_obj %}
{% load widget_tweaks %}
{% block custom_css %}
{% endblock custom_css %}
{% block m-title %} {% endblock m-title %}
{% block content %}
<section class="content">
    <div class="container-fluid">
        <!-- Small boxes (Stat box) -->
        <div class="container">
            <div class="card">
                <div class="card-header text-white" style="background: #21618C">MENU<h3 class="card-title"></h3>
                </div>
                <div class="card-body">
                    <form method="post" action="#">
                        {% csrf_token %}
                    <div class="row">

                        <div class="col-md-2">
                            <label>Année</label>
                            <select name="annee" class="form-control">
                                {% for an in annees %}
                                <option value="{{ an.id }}">{{ an }}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="col-md-2">
                            <label>Niveau</label>
                            <select name="niveau" class="form-control">
                                {% for niveau in niveaux %}
                                <option value="{{ niveau.id }}">{{ niveau }}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="col-md-2">
                            <label>Moyenne (> ou =)</label>
                           <!-- <input type="number" name="moyenne" class="form-control" value="10" required/> -->
                            {% render_field form.moyenne class="form-control" %}
                        </div>
                        <div class="col-md-2" style="">
                            <label>Taux </label>
                             <!--<input type="number" name="taux" class="form-control" value="80" required/> -->
                            <div class="row">
                                <div class="col-md-12" style="display:flex;flex-direction:row;">
                                    <select name="symbole" class="form-control col-md-5">
                                        <option value="<"><</option>
                                        <option value=">"> > </option>
                                    </select>
                                    {% render_field form.taux class="form-control" %}
                                </div>

                            </div>
                        </div>
                        <div class="col-md-2" style="margin-left:0px;">
                            <button style="margin-top:30px;" name="compFilter" type="submit" class='btn btn-primary'><i class="fa fa-search"></i>&nbsp; Trier</button>
                        </div>

                    </div>
                     <hr/>
                        <h4>
                        <!--<td>Année: <span style="font-weight:bold;color:red;">{{anfil}}</span> | -->
                            {% if an1 %}
                                <!--UFR: <span style="font-weight:bold;color:red;">{{UFR.code}}</span> | -->
                                Année: <span style="font-weight:bold;color:red;">{{an1}}</span> |
                                Niveau: <span style="font-weight:bold;color:red;">{{niveau}}</span> |
                                Moyenne: <span style="font-weight:bold;color:red;">{{moy}}</span> |
                                Taux: <span style="font-weight:bold;color:red;">{{symb}} {{taux}}</span>
                            {% endif %}
                        </h4>

                    </form>
                </div>

            </div>

      </div>
    </div>
</section>


<div class="card mb-3">
    <div class="card-header">
        <i class="fas fa-table"></i>
        LISTE DES ETUDIANTS COMPENSABLES
    </div>
    <div class="card-body">
        <div class="table-responsive">
            <table class="table table-bordered table-striped" id="dataTable" width="100%" cellspacing="0">
                <thead>
                <tr>
                    <th width="100">NCE</th>
                    <th>NOMS & PRENOM(S)</th>
                    <th width="30">SEXE</th>
                    <th width="75">MOY. A.</th>
                    <th width="90">% CRE. A.</th>
                    <th width="50"></th>
                </tr>
                </thead>
                <tfoot>
                <tr>
                    <th width="100">NCE</th>
                    <th>NOMS & PRENOM(S)</th>
                    <th width="30">SEXE</th>
                    <th width="70">MOY. A.</th>
                    <th width="90">% CRE. A.</th>
                    <th width="50"></th>
                </tr>
                </tfoot>
                <tbody>
                {% for etudiant in etudiants %}
                <tr>
                    <td style="font-weight:bold;">{{ etudiant.nce }}</td>
                    <td>{{ etudiant }}</td>
                    <td>{{ etudiant.sexe }}</td>
                    <td>{{etudiant|create_list_2_obj:an1|get_moyenne_annuelle_etudiant|stringformat:".2f"}}</td>
                    <td>{{etudiant|create_list_2_obj:an1|taux_credit_valide_annuel|stringformat:".2f"}}</td>
                    <td>
                        <a href="{% url 'EspaceEnseignant:compens_etudiant' etudiant.id an1.id %}" target="_blank" class="btn btn-warning btn-sm" ><i class="fa fa-eye"></i> Voir</a>
                    </td>

                </tr>

              {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock content %}

{% block custom_js %}

{% endblock custom_js %}