{% extends 'vice_president/base_vpr.html' %}
{% load static %}
{% load custom_tag %}
{% load custom_tag_obj %}
{% block content %}
<section class="content">
    <div class="container-fluid">
        <!-- Small boxes (Stat box)-->
        <div class="container">

            <div style="text-align:center;">
                <h4>UFR: <span style="color:red">{{UFR.code}}</span> | ANNEE: <span style="color:red">{{anUniv}}</span> | NIVEAU: <span style="color:red">{{niveau}}</span></h4>
            </div>
            <div class="card">
                <div class="card-header text-white" style="background: #21618C">
                    MENU
                </div>
                <div class="card-body">
                    <form method="post" action="#">
                        {% csrf_token %}
                    <div class="row">
                        <div class="col-md-2" hidden>
                            <select class="form-control" name="annee">
                                {% for an in annees %}
                                <option value="{{an.id}}">{{an}}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="col-md-2">
                            <select class="form-control" name="niveau">
                                {% for niv in niveaux %}
                                <option value="{{niv.id}}">{{niv}}</option>
                                {% endfor %}
                            </select>
                            <input type="text" value="1" name="semestre" hidden>
                        </div>
                        <div class="col-md-2">
                            <button type="submit" name="AnneeFilter" class='btn btn-primary btn-sm'><i class="fa fa-filter"></i> Trier</button>
                        </div>
                    </div>
                    </form>
                </div>
            </div>

            <div class="card">
                <div class="card-header text-white" style="background: #21618C"><h3 class="card-title">LISTE DES ECUE</h3></div>
                <div class="card-body">
                    <table class="table table-striped table-bordered">

                        {% for semestre in semestres %}
                            <tr class="antr">
                                <td colspan="4" class="antd h4"><center>{{semestre.niveau}} : {{semestre}}</center></td>
                            </tr>
                                <tr>
                                  <th>CODE</th>
                                  <th>LIBELLE</th>
                                  <th>UE</th>
                                  <th>DELIBERE</th>
                                </tr>
                              {% for ecue in UFR.id|get_ecue_by_ufr_and_semestre:semestre.id %}
                                <tr>
                                    <td><b>{{ecue.code}}</b></td>
                                    <td style="text-transform:uppercase;">{{ecue.libelle}}</td>
                                    <td style="text-transform:uppercase;">{{ecue.ue.code}}</td>
                                    <td>
                                        {% if ecue.id|check_deliberation_ue_an:annee == 'Oui' %}
                                            <a href="{% url 'EspaceEnseignant:resultat_ecue_pdf' ecue.id %}" target="_blank" class="btn btn-success mx-1 btn-sm"><i class="fa fa-print"></i></a>
                                        {% endif %}
                                    </td>
                                </tr>
                              {% empty %}
                                <tr>
                                    <td colspan="3"><center>Aucune résultat</center></td>
                                </tr>
                              {% endfor %}
                        {% endfor %}

                    </table><br/>
                    <div class="blog">
                        {% include 'other_admin/pagination.html' %}
                    </div>
                </div>
            </div>
        </div>

    </div>
  </section>
{% endblock content %}

{% block custom_js %}

{% endblock custom_js %}