{% extends '::layout.html.twig' %}

{% block title %}
    Profile
{% endblock %}

{% block head %}
    <!-- Custom styles for login/register/contact/upload template -->
    <link href="{{ asset('css/forms.css') }}" rel="stylesheet">
{% endblock %}

{% block activeProfile %}
    class="active"
{% endblock %}

{% block content %}
    <div class="container">

        {% for label, flashes in app.session.flashbag.all %}
            {% for flash in flashes %}
                <div class="alert alert-success">
                    {{ flash }}
                </div>
            {% endfor %}
        {% endfor %}

        <form action="{{ path("profile") }}" class="form-signin" role="form" id="profile" method="POST" {{ form_enctype(form) }}>

            <h2 class="form-signin-heading">My profile</h2>


            {{ form_widget(form.email, { 'attr': {
            'id' : 'email',
            'name' : 'email',
            'class' : 'form-control',
            'placeholder' : 'Email address',
            'autofocus' : ''
            } }) }}

            {% if form_errors(form.email) %}
                <div class="alert alert-danger">{{ form_errors(form.email) }}</div>
            {% endif %}

            <div style="margin-bottom: 30px"></div>

            {{ form_widget(form.password, { 'required' : '' }) }}

            {% if form_errors(form.password) %}
                <div class="alert alert-danger">{{ form_errors(form.password) }}</div>
            {% endif %}

            <div style="margin-bottom: 35px"></div>

            {{ form_widget(form.firstName, { 'attr': {
            'id' : 'first_name',
            'name' : 'first_name',
            'class' : 'form-control',
            'placeholder' : 'First name'
            } }) }}

            {% if form_errors(form.firstName) %}
                <div class="alert alert-danger">{{ form_errors(form.firstName) }}</div>
            {% endif %}

            {{ form_widget(form.lastName, { 'attr': {
            'id' : 'last_name',
            'name' : 'last_name',
            'class' : 'form-control',
            'placeholder' : 'Last name'
            } }) }}

            {% if form_errors(form.lastName) %}
                <div class="alert alert-danger">{{ form_errors(form.lastName) }}</div>
            {% endif %}

            <button class="btn btn-lg btn-primary btn-block" type="submit">Save changes</button>

            {{ form_rest(form) }}
        </form>

    </div> <!-- /container -->
{% endblock %}