{% extends 'up_squelette.html' %}


{% block main %}

<!--<div class="page-header">
<h1>Profil</h1>
</div>-->

<div class="row">

        <div class="col-sm-3"></div>
        <div class="col-sm-6">
          <div class="panel panel-primary">
            <div class="panel-heading">
              <h3 class="panel-title">Mon profil</h3>
            </div>
              <div class="panel-body">
                 <form method="POST" action="" enctype="multipart/form-data">
                     <div id="fic">
                         <label> Photo de profil </label>
                         <input type="file" name="fic" id="fic"/><br>
                         <img id="fic" src="/profil/{{ username }}/{{ profil['avatar'] }}" class="img-rounded" alt=""/>
                     </div>
                 <br>
                 <label>Nom </label>
                 <input type="text" name="nom" id="nom" value="{% if profil['nom'] != None %}{{ profil['nom'] }}{%endif%}" class="form-control"><br />
                 <label>Prenom </label>
                 <input type="text" name="prenom" id="prenom" value="{% if profil['nom'] != None %}{{ profil['prenom'] }}{%endif%}" class="form-control"><br />
                 <label> Age </label>
                 <input type="text" name="age" value="{% if profil['age'] != None %}{{ profil['age'] }}{%endif%}" class="form-control"><br />
                 <label> Mail de secours </label>
                 <input type="text" name="mail_rescue" id="mail_rescue" value="{% if profil['nom'] != None %}{{ profil['mail_rescue'] }}{%endif%}" class="form-control"><br />
                 <button id="tada" class="btn btn-default btn-primary" type="submit">Envoyer</button>
                 </form>
                 {# on affiche les messages d'erreur puis les messages de succes #}
                 {% for categorie in ['error', 'succes'] %}
                   {% with msgs = get_flashed_messages(category_filter=[categorie]) %}
                     {% if msgs %}
                       <div class="flashed {{ categorie }}">
                         {% for m in msgs %}
                           <p>{{ m|safe }}</p>
                         {% endfor %}
                       </div>
                     {% endif %}
                   {% endwith %}
                 {% endfor %}

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

{% endblock %}