{% extends "main.html.twig" %}
{% block content %}
<div id="perfil">
    <div class="module-content">
        <div class="header">
            <h2>{% trans %}Perfil{% endtrans %}</h2>
            <p>{% trans %}Visualize e atualize o seu perfil{% endtrans %}</p>
        </div>
        <form method="post" action="{{ baseUrl() }}/profile">
            {% if salvo %}
            <div class="alert alert-success">
                {% trans %}Perfil atualizado com sucesso{% endtrans %}
            </div>
            {% endif %}
            <div class="form-group">
                <label for="login">{% trans %}Login{% endtrans %}</label>
                <input id="login" type="text" class="w150 form-control" value="{{ usuario.login }}" disabled="true" />
            </div>
            <div class="form-group">
                <label for="nome">{% trans %}Nome{% endtrans %}</label>
                <input id="nome" type="text" name="nome" class="w150 form-control" value="{{ usuario.nome }}" />
            </div>
            <div class="form-group">
                <label for="sobrenome">{% trans %}Sobrenome{% endtrans %}</label>
                <input id="sobrenome" type="text" name="sobrenome" class="w300 form-control" value="{{ usuario.sobrenome }}" />
            </div>
            {% if usuario.senha %}
            <div class="form-group">
                <a href="#dialog-senha"
                   class="btn btn-default"
                   data-toggle="modal">
                    <span class="glyphicon glyphicon-exclamation-sign"></span> 
                    {% trans %}Alterar senha{% endtrans %}
                </a>
            </div>
            {% endif %}
            <div class="buttons">
                <button type="submit" class="btn btn-primary">
                    {% trans %}Salvar{% endtrans %}
                </button>
            </div>
        </form>
    </div>
</div>

<div id="dialog-senha" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">{% trans %}Alterar senha{% endtrans %}</h4>
            </div>
            <div class="modal-body">
                <div id="dialog-message" class="alert" style="display:none">
                </div>
                <div class="form-group required">
                    <label for="senha_atual" class="w150">{% trans %}Senha atual{% endtrans %}</label>
                    <input id="senha_atual" type="password" class="form-control" />
                </div>
                <div class="form-group required">
                    <label for="senha_nova" class="w150">{% trans %}Nova senha{% endtrans %}</label>
                    <input id="senha_nova" type="password" class="form-control" />
                </div>
                <div class="form-group required">
                    <label for="senha_confirmacao" class="w150">{% trans %}Confirmar nova senha{% endtrans %}</label>
                    <input id="senha_confirmacao" type="password" class="form-control" />
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">{% trans %}Fechar{% endtrans %}</button>
                <button type="button" class="btn btn-primary" onclick="SGA.Perfil.alterarSenha()">{% trans %}Alterar{% endtrans %}</button>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    SGA.Perfil.labelSenhaAlterada = "{% trans %}Senha alterada com sucesso{% endtrans %}";
</script>
{% endblock %}