{% extends 'dg_ufr/base_ufr.html' %}
{% load static %}
{% block m-title %} Programmer une ECUE{% endblock m-title %}
{% load widget_tweaks %}
{% 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;text-transform:uppercase;"><h3 class="card-title">Programmer un Ecue</h3></div>
                <div class="card-body login-card-body">
                    <div class="row">
                        <div class="col-md-12">
                           <h3><u>Ecue</u>: ({{ecue.code}}) {{ecue.libelle}} </h3><br/><hr/>
                        </div>
                    </div>
                        <form action="#" method="POST" {% if show_form == "show" %}{% else %} hidden {% endif %} >
                            {% csrf_token %}
                            <div class="row">
                                <div class="col-md-2">
                                    <label>Année Universitaire</label>
                                    <select name="annee" class="form-control">programs
                                        <option value="{{ programs.annee.id }}">{{ programs.annee.libelle }}</option>
                                    </select>
                                    <span style="color:red;">{{ form.annee.errors }}</span>
                                </div>

                                <div class="col">
                                    <label>Ecue</label>
                                    <select name="ecue" class="form-control">
                                        <option value="{{ ecue.id }}" style="text-transform:uppercase;">{{ ecue }}</option>
                                    </select>
                                </div>
                                <div class="col-md-2">
                                    <label>Niveau</label>
                                    <select name="niveau" class="form-control">

                                        {% for niveau in niveaux %}
                                         {% if  ecue.ue.niveau == niveau %}
                                        <option value="{{ niveau.id }}" {% if niveau == programs.niveau %} selected{% endif %}>{{ niveau }}</option>
                                            {% endif %}
                                        {% endfor %}
                                    </select>
                                </div>

                                <div class="col-md-3">
                                    <label>Période de validité </label>
                                    <select name="periode" class="form-control">
                                        {% for periode in validites %}
                                        <option value="{{ periode.id }}" {% if periode == programs.validite %} selected{% endif %}>{{ periode.dateDebut|date:'d-m-Y' }} au {{ periode.dateFin|date:'d-m-Y' }}</option>
                                        {% endfor %}
                                    </select>
                                </div>
                            </div><br/>
                            <hr/>

                            <div class="row" style="display:flex;flex-direction:row;">
                                <div class="col">
                                    <label>Lundi</label>
                                    <input class="form-control" type="text" name="lundi" value="{{programs.lundi}}" placeholder="Ex: 08:00-11:00" />
                                    <select name="type_lun" class="form-control">
                                        {% if programs.type_lun %}
                                        <option value="{{programs.type_lun}}">{{programs.type_lun}}</option>
                                        {% endif %}
                                        {% include 'dg_ufr/parts/edt_type.html' %}
                                    </select>
                                    <select hidden name="mode_lun" class="form-control">
                                        {% if programs.mode_lun %}
                                        <option value="{{programs.mode_lun}}">{{programs.mode_lun}}</option>
                                        {% endif %}
                                        <option value="">---Mode--</option>
                                        <option value="Présentiel">Présentiel</option>
                                        <option value="En ligne">En ligne</option>
                                    </select>
                                    <input hidden class="form-control" type="text" name="url_lun" value="{{programs.url_lun}}" placeholder="Ex: https://moncourenlinge.usp" />
                                </div>
                                <div class="col">
                                    <label>Mardi</label>
                                    <input class="form-control" type="text" name="mardi" value="{{programs.mardi}}" placeholder="Ex: 08:00-11:00" />
                                    <select name="type_mar" class="form-control">
                                        {% if programs.type_mar %}
                                        <option value="{{programs.type_mar}}">{{programs.type_mar}}</option>
                                       {% endif %}
                                        {% include 'dg_ufr/parts/edt_type.html' %}
                                    </select>
                                    <select hidden name="mode_mar" class="form-control">
                                        {% if programs.mode_mar %}
                                        <option value="{{programs.mode_mar}}">{{programs.mode_mar}}</option>
                                        {% endif %}
                                        <option value="">---Mode--</option>
                                        <option value="Présentiel">Présentiel</option>
                                        <option value="En ligne">En ligne</option>
                                    </select>
                                    <input hidden class="form-control" type="text" name="url_mar" value="{{programs.url_mar}}" placeholder="Ex: https://moncourenlinge.usp" />
                                </div>
                                <div class="col">
                                    <label>Mercredi</label>
                                    <input class="form-control" type="text" name="mercredi" value="{{programs.mercredi}}" placeholder="Ex: 08:00-11:00" />
                                    <select name="type_mer" class="form-control">
                                        {% if programs.type_mer %}
                                        <option value="{{programs.type_mer}}">{{programs.type_mer}}</option>
                                        {% endif %}
                                        {% include 'dg_ufr/parts/edt_type.html' %}
                                    </select>
                                    <select hidden name="mode_mer" class="form-control">
                                        {% if programs.mode_mer %}
                                        <option value="{{programs.mode_mer}}">{{programs.mode_mer}}</option>
                                        {% endif %}
                                        <option value="">---Mode--</option>
                                        <option value="Présentiel">Présentiel</option>
                                        <option value="En ligne">En ligne</option>
                                    </select>
                                    <input hidden class="form-control" type="text" name="url_mer" value="{{programs.url_mer}}" placeholder="Ex: https://moncourenlinge.usp" />
                                </div>
                                <div class="col">
                                    <label>Jeudi</label>
                                    <input class="form-control" type="text" name="jeudi" value="{{programs.jeudi}}" placeholder="Ex: 08:00-11:00" />
                                    <select name="type_jeu" class="form-control">
                                       {% if programs.type_jeu %}
                                        <option value="{{programs.type_jeu}}">{{programs.type_jeu}}</option>
                                        {% endif %}
                                        {% include 'dg_ufr/parts/edt_type.html' %}
                                    </select>
                                    <select hidden name="mode_jeu" class="form-control">
                                        {% if programs.mode_jeu %}
                                        <option value="{{programs.mode_jeu}}">{{programs.mode_jeu}}</option>
                                        {% endif %}
                                        <option value="">---Mode--</option>
                                        <option value="Présentiel">Présentiel</option>
                                        <option value="En ligne">En ligne</option>
                                    </select>
                                    <input hidden class="form-control" type="text" name="url_jeu" value="{{programs.url_jeu}}" placeholder="Ex: https://moncourenlinge.usp" />
                                </div>
                                <div class="col">
                                    <label>Vendredi</label>
                                    <input class="form-control" type="text" name="vendredi" value="{{programs.vendredi}}" placeholder="Ex: 08:00-11:00" />
                                    <select name="type_ven" class="form-control">
                                        {% if programs.type_ven %}
                                        <option value="{{programs.type_ven}}">{{programs.type_ven}}</option>
                                        {% endif %}
                                        {% include 'dg_ufr/parts/edt_type.html' %}
                                    </select>
                                    <select name="mode_ven" class="form-control" hidden>
                                        {% if programs.mode_ven %}
                                        <option value="{{programs.mode_ven}}">{{programs.mode_ven}}</option>
                                        {% endif %}
                                        <option value="">---Mode--</option>
                                        <option value="Présentiel">Présentiel</option>
                                        <option value="En ligne">En ligne</option>
                                    </select>
                                    <input class="form-control" type="text" name="url_ven" value="{{programs.url_ven}}" placeholder="Ex: https://moncourenlinge.usp" hidden />
                                </div>
                                <div class="col">
                                    <label>Samedi</label>
                                    <input class="form-control" type="text" name="samedi" value="{{programs.samedi}}" placeholder="Ex: 08:00-11:00" />
                                    <select name="type_sam" class="form-control">
                                        {% if programs.type_sam %}
                                        <option value="{{programs.type_sam}}">{{programs.type_sam}}</option>
                                        {% endif %}
                                        {% include 'dg_ufr/parts/edt_type.html' %}
                                    </select>
                                    <select name="mode_sam" class="form-control" hidden>
                                        {% if programs.mode_sam %}
                                        <option value="{{programs.mode_sam}}">{{programs.mode_sam}}</option>
                                        {% endif %}
                                        <option value="">---Mode--</option>
                                        <option value="Présentiel">Présentiel</option>
                                        <option value="En ligne">En ligne</option>
                                    </select>
                                    <input class="form-control" type="text" name="url_sam" value="{{programs.url_sam}}" placeholder="Ex: https://moncourenlinge.usp" hidden />
                                </div>
                            </div>
                                <br/>
                        <button type="submit" class='btn btn-primary'>Enregistrer</button>
                        </form>
                        <center><div {% if show_form == "show" %}hidden{% else %}{% endif %}>
                        <a href="{% url 'EspaceEnseignant:emploi_du_temps_list' %}" type="button" class="btn btn-secondary" data-dismiss="modal">Retour</a>
                        </div></center>

                    </div>
            </div>
              <!-- DONUT CHART --><!-- /.card -->

        </div>

            
    </div>
  </section>

{% endblock content %}

{% block custom_js %}

{% endblock custom_js %}