{% extends 'other_admin/custom_admin_base.html' %}
{% load static %}
{% block m-title %}Gestion des Comptes > Enseignant{% 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"><h3 class="card-title">AJOUTER UN ENSEIGNANT</h3>
                </div>
                <div class="card-body">
                    <form method="post" action="{% url 'BasicData:enseignant_add' %}" {% if show_form == "show" %}{% else %}hidden{% endif %}>
                        {% csrf_token %}
                        <div class="row">
                            <div class="col">
                                <label>UFR</label>
                                <select class="form-control" name="ufr" required>
                                    {% for ufr in ufrs %}
                                    <option value="{{ ufr.id }}">{{ ufr.libelle }}</option>
                                    {% endfor %}
                                </select>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-4">
                                <label>Nom</label>
                                <div>{% render_field form.nom class+="form-control" placeholder="Nom" %}</div>
                            </div>
                            <div class="col">
                                <label>Prénoms</label>
                                <div>{% render_field form.prenoms class+="form-control" placeholder="Prénoms" %}</div>
                            </div>
                        </div>
                        <br/>
                        <div class="row">
                            <div class="col-md-1">
                                <label>Sexe</label>
                                <div>{% render_field form.sexe class+="form-control" %}</div>
                            </div>
                            <div class="col-md-2">
                                <label>Grade</label>
                                <select class="form-control" name="grade" required>
                                    {% for grad in grade %}
                                    <option value="{{ grad.id }}">{{ grad.libelle }}</option>
                                    {% endfor %}
                                </select>
                            </div>
                            <div class="col-md-2">
                                <label>Statut</label>
                                <div>{% render_field form.statut class+="form-control" %}</div>
                            </div>
                            <div class="col">
                                <label>Spécialité</label>
                                <div>{% render_field form.specialite class+="form-control" placeholder="Spécialité" %}</div>
                            </div>
                        </div><br/>

                        <div class="row">
                            <div class="col-md-3">
                                <label>Date de Naissance</label>
                                <div>{% render_field form.datenaiss type="date" class+="form-control" placeholder="Date de Naissance" %}</div>
                            </div>
                            <div class="col">
                                <label>Lieu de naissance</label>
                                <div>{% render_field form.lieunaiss class+="form-control" placeholder="Lieu de Naissance" %}</div>
                            </div>
                            <div class="col">
                                <label>Telephone</label>
                                <div>{% render_field form.phone class+="form-control" placeholder="Téléphone" %}</div>
                            </div>
                        </div>

                        <div class="form-group">
                            </div>
                        <div class="form-group">
                            </div>
                        <div class="form-group">
                            </div><hr/>
                        <div class="form-group">
                            <label>Email</label>
                            <div>{% render_field form.email class+="form-control" placeholder="Email" %}</div>
                        </div>
                        <div class="form-group">
                            <label>Mot de Passe</label>
                            <div>{% render_field form.password type="password" class+="form-control" placeholder="*************" %}</div>
                        </div>
                        <div class="form-group">
                            <label>Confirmer</label>
                            <div>{% render_field form.password2 type="password" class+="form-control" placeholder="*************" %}</div>
                        </div>
                        <hr/>
                        <div class="form-group">
                            <label>Choisir le rôle</label>
                            <div>{% render_field form.is_ufr_dg class+="form-control" %}</div>
                        </div>

                        <div class="modal-footer">
                        <a href="{% url 'BasicData:etudiant_list' %}" type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</a>
                        <button type="submit" class="btn btn-primary">Enregistrer</button>
                      </div>

                    </form>
                    <center><div {% if show_form == "show" %}hidden{% else %}{% endif %}>
                        <a href="{% url 'BasicData:enseignant_list' %}" type="button" class="btn btn-secondary" data-dismiss="modal">Retour</a>
                        <a href="{% url 'BasicData:enseignant_add' %}" type="button" class="btn btn-primary" data-dismiss="modal">Ajouter un autre Enseignant</a>
                    </div></center>
                </div>
            </div>
      </div>
    </div>
</section>

{% endblock content %}

{% block custom_js %}

{% endblock custom_js %}