{% extends 'respo_pedag/base_respo.html' %}
{% load static %}
{% load custom_tag %}
{% block custom_css %}

{% endblock custom_css %}
{% block m-title %}Programmes {% if validite %} du<span style="color:red;"> {{validite.dateDebut|date:'d-m-Y'}}</span> au <span style="color:red;"> {{validite.dateFin|date:'d-m-Y'}}</span>{% endif %}{% 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"><h3 class="card-title"></h3>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col" style="text-align:center;font-size:18px;">
                            PROGRAMME DU <span style="color:red;font-size:20px;">{{validite.dateDebut|date:'d-m-Y'}}</span> AU <span style="color:red;font-size:20px;">{{validite.dateFin|date:'d-m-Y'}}</span>
                        </div>
                    </div><br/>
                    <i> Sélectionnez le NIVEAU et l'UFR pour voir le programme</i>
                    <form action="#" method="post">
                        {% csrf_token %}
                      <div class="row" style="display:flex;flex-direction:row;">
                          <div class="col-md-2">
                          <select name="niveau" class="form-control">
                              <option value="0000">------ NIVEAU -------</option>
                                {% for niveau in niveaux %}
                                <option value="{{ niveau.id }}">{{ niveau }}</option>
                                {% endfor %}
                          </select>
                        </div>
                        <div class="col-md-3">
                            <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">
                          <select name="ufr" class="form-control">
                              <option value="0000">------ UFR -------</option>
                                {% for ufr in UFRS %}
                                <option value="{{ ufr.id }}">{{ ufr }}</option>
                                {% endfor %}
                          </select>
                        </div>
                          <div class="col">
                          <button type="submit" class='btn btn-primary'><i class="fa fa-search"></i> Filtrer</button>
                        </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:150px;">
                                    <a class="btn  {% if programme.id|check_salle_added == 'existe'  %} btn-success{% else %} btn-primary{% endif %} text-white" href="{% url 'EspaceEnseignant:rp_add_salle' programme.id %}"><i class="fa fa-plus"></i> Salles</a>
                                </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 %}