{% extends 'dg_ufr/base_ufr.html' %}
{% load static %}
{% load custom_tag %}
{% load custom_tag_obj %}
{% block content %}
<section class="content">
    <div class="container-fluid">
        <!-- Small boxes (Stat box)-->
        {% include "dg_ufr/parts/stats.html" %}
        <div class="container">
            <div style="text-align:center;">
                <h4>ANNEE: <span style="color:red">{{anUniv}}</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">
                            <select class="form-control" name="annee">
                                {% for an in annees %}
                                <option value="{{an.id}}">{{an}}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="col-md-2" hidden>
                            <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 class="col-md-4">
                            <a href="{% url 'EspaceEnseignant:dr_ufr_inactive_ue_home' %}" class="btn btn-warning btn-sm"><i class="fa fa-lightbulb"></i> Désactiver une matière</a>
                        </div>
                    </div>
                    </form>
                </div>
            </div>
            <div class="card">
                <div class="card-header text-white" style="background: #21618C"><h3 class="card-title">LISTE DES MATI&Egrave;RES</h3></div>
                <div class="card-body">
                    <table class="table table-bordered table-striped">
                        {% for semestre in semestres %}
                            {% if UFR.id|get_ue_by_ufr_and_semestre:semestre.id %}
                            <tr class="antr">
                                    <td colspan="4" class="antd h4"><center>{{semestre.niveau}} | {{semestre}}</center></td>
                            </tr>
                              <tr>
                                <th>Code</th>
                                <th>libellé</th>
                                <th>Actions</th>
                              </tr>
                              {% for item in UfrAnId|get_ue_by_ufr_and_semestre_set:semestre.id %}
                                <tr>
                                    <td width="200"><b>{{item.code}}</b></td>
                                    <td style="text-transform:uppercase;">{{item.libelle}}</td>
                                    <td>
                                        <a href="{% url 'EspaceEnseignant:ue_home' item.id anUniv.id item.niveau.id UFR.id %}" class="btn btn-primary mx-1 btn-sm"><i class="fa fa-eye"></i> Gérer</a>
                                        {% if ue.id|check_deliberation_ue == 'Oui' %}
                                        <a href="{% url 'EspaceEnseignant:resultat_ue_new_pdf' item.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>Aucun résultat</center></td>
                                </tr>
                              {% endfor %}
                            {% endif %}
                        {% 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 %}