{% extends 'dg_ufr/base_ufr.html' %}
{% load static %}
{% 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"><h3 class="card-title"></h3>
                </div>
                <div class="card-body">

                    <i> Sélectionnez la CLASSE pour voir le programme</i>
                    <form action="#" method="post">
                        {% csrf_token %}
                      <div class="row" style="display:flex;flex-direction:row;">
                          <div class="col-md-3">
                          <select name="niveau" class="form-control">
                              <option value="0000">------ CLASSE -------</option>
                                {% for niveau in niveaux %}
                                <option value="{{ niveau.id }}">{{ niveau }}</option>
                                {% endfor %}
                          </select>
                        </div>
                          <div class="col-md-4">
                            <select name="periode" class="form-control">
                                <option value="aucun">------- Periode -----</option>
                                {% for periode in validites %}
                                <option value="{{ periode.id }}">{{ periode.dateDebut|date:'d-m-Y' }} au {{ periode.dateFin|date:'d-m-Y' }}</option>
                                {% endfor %}
                            </select>
                        </div>
                          <div class="col">
                          <button type="submit" class='btn btn-primary'><i class="fa fa-search"></i> Filtrer</button>
                        </div>
                        <div class="col-md-1">
                          <select name="ufr" class="form-control" hidden>
                              <option value="0000">------ UFR -------</option>
                                {% for ufr in UFRS %}
                                <option value="{{ ufr.id }}">{{ ufr }}</option>
                                {% endfor %}
                          </select>
                        </div>

                      </div>
                    </form>
                </div>
            </div>
            <div class="row">
                <div class="col" style="text-align:center;font-size:18px;">

                </div>
            </div>
            {% if validite %}
            <div class="card">
                <div class="card-header text-white" style="background: #21618C;text-transform:uppercase;"><h3 class="card-title">{% if niveau and ufr %}{{niveau}} --- {{ufr}}{% endif %}</h3>
                </div>
                <div class="card-body">
                    <table class="table table-striped">
                        <thead>
                            <th>Programmes</th>
                            <th>Actions</th>
                        </thead>
                        <tbody>
                        {% for programme in programmes %}
                            <tr>
                                <td>{{ programme.ecue }}</td>
                                <td style="width:200px;">
                                   <a class="btn  btn-primary text-white" href="{% if programme %}{% url 'EspaceEnseignant:edit_programme' programme.id %}{% endif %}"><i class="fa fa-edit"></i>&nbsp; Edit</a>
                                    <button class="btn  btn-danger text-white" data-toggle="modal" data-target="#stop{{programme.id}}"><i class="fa fa-stop"></i>&nbsp; Stop</button>
                                    {% include 'dg_ufr/modal_stop.html' %}
                                </td>
                            </tr>
                        {% empty %}
                            <tr>
                                <td colspan="2"><center>Aucun résultat</center></td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
            {% endif %}

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

{% endblock content %}

{% block custom_js %}

{% endblock custom_js %}