{% extends "layout.jinja2" %}

{% block content %}

    {% if message %}
        <div class="alert alert-danger">
            {{ message }}
        </div>
    {% endif %}

<div class="row">
    <div class="card mb-0">
        <div class="card-body">
    <form action="{{ url }}" method="post" role="form">

        <div class="mb-3">
            <label class="form-label required-field" for="name">Nom</label>
            {% if name != '0'  %}
                <input class="form-control" name="name" type="text" readonly value="{{user.name}}">
            {% else %}
                <input class="form-control" name="name" type="text" value="{{user.name}}">
            {% endif %}
        </div>
        <div class="mb-3">
            <label class="form-label required-field" for="password">Mot de passe</label>
            <input class="form-control" name="password" type="password">
        </div>

        <br>
        <div class="mb-3">					
            <a class="btn btn-light" href="{{ url_retour }}"><span class="glyphicon glyphicon-chevron-left"></span> Retour</a>
            <button class="btn btn-primary" type="submit" name="form.submitted">
                <span class="glyphicon glyphicon-ok"></span> Enregistrer</button>
            {% if request.authenticated_userid == 'admin' %}
                <button class="btn btn-warning" type="submit" name="form.deleted">
                    <span class="glyphicon glyphicon-remove"></span> Supprimer</button>
            {% endif %}
            
        </div>


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

{% endblock %}
