{% extends 'other_admin/custom_admin_base.html' %}
{% load static %}
{% block m-title %}Gestion des Comptes > Etudiant{% 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 ETUDIANT</h3>
                </div>
                <div class="card-body">
                    <form method="post" action="{% url 'BasicData:etudiant_add' %}" {% if show_form == "show" %}{% else %}hidden{% endif %}>
                        {% csrf_token %}

                        <div class="form-group">
                            <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 class="form-group">
                            <label>Niveau</label>
                            <select class="form-control" name="niveau" required>
                                {% for niveau in niveaux %}
                                <option value="{{ niveau.id }}">{{ niveau.libelle }}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="form-group">
                            <label>NCE</label>
                            <div>{% render_field form.nce class+="form-control" placeholder="NCE" %}</div>
                        </div>
                        <div class="form-group">
                            <label>Nom</label>
                            <div>{% render_field form.nom class+="form-control" placeholder="Nom" %}</div>
                        </div>
                        <div class="form-group">
                            <label>Prénoms</label>
                            <div>{% render_field form.prenoms class+="form-control" placeholder="Prénoms" %}</div>
                        </div>
                        <div class="form-group">
                            <label>Sexe</label>
                            <div>{% render_field form.sexe class+="form-control" %}</div>
                        </div>
                        <div class="form-group">
                            <label>Date de Naissance</label>
                            <div>{% render_field form.datenaiss type="date" class+="form-control" placeholder="Date de Naissance" %}</div>
                        </div>
                        <div class="form-group">
                            <label>Lieu de naissance</label>
                            <div>{% render_field form.lieunaiss class+="form-control" placeholder="Lieu de Naissance" %}</div>
                        </div>
                        <div class="form-group">
                            <label>Telephone</label>
                            <div>{% render_field form.phone class+="form-control" placeholder="Téléphone" %}</div>
                        </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>

                        <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:etudiant_list' %}" type="button" class="btn btn-secondary" data-dismiss="modal">Retour</a>
                        <a href="{% url 'BasicData:etudiant_add' %}" type="button" class="btn btn-primary" data-dismiss="modal">Ajouter un autre étudiant</a>
                    </div></center>
                </div>
            </div>
      </div>
    </div>
</section>

{% endblock content %}

{% block custom_js %}

{% endblock custom_js %}