{% trans_default_domain 'FOSUserBundle' %}

{% form_theme form with ['Front/Form/fields.html.twig'] %}

{% set constUserTypeProf = constant('AppBundle\\Enum\\UserType::TEACHER') %}

<div class="form form-user-profile">
    <h1 class="form-title">Modifier mes informations</h1>

    <div class="info-system">
        {% for flashMessage in app.session.flashbag.get('info') %}<div class="alert alert-info">{{ flashMessage }}</div>{% endfor %}
    </div>

    {{ form_start(form, {attr: {class: 'form-user-profile-form'}}) }}
        
        
        <fieldset class="bg-alabaster">
            <legend>{{ 'form.front.profile.fieldset.personalinfos.legend'|trans({}, 'form') }}</legend>

            {#{ form_row(form.username) }#}
            {{ form_row(form.photoFile) }}
            {{ form_row(form.honorific) }}
            {{ form_row(form.firstname) }}
            {{ form_row(form.lastname) }}
            {{ form_row(form.email) }}
            {{ form_row(form.phone) }}
            {{ form_row(form.mobile) }}
            {#{ form_row(form.birthday) }#}

            {% if constUserTypeProf == app.user.type %}
                {#{ form_row(form.shoeSize) }#}
                {{ form_row(form.categoryJob) }}
                {{ form_row(form.job) }}
                {{ form_row(form.jobOther) }}
                {#{ form_row(form.classroom) }#}
                {#{ form_row(form.professionalDiscover) }#}
            {% else %}
                {#{ form_row(form.personalAddress) }#}
                {{ form_row(form.personalCity) }}
                {{ form_row(form.personalZipcode) }}
                {{ form_row(form.personalLatitude) }}
                {{ form_row(form.personalLongitude) }}
                {#{ form_row(form.categoryJob) }#}
                {{ form_row(form.job) }}
                {{ form_row(form.jobOther) }}
                {{ form_row(form.formation) }}
                {{ form_row(form.formationType) }}
                {{ form_row(form.aboutMe) }}
                {{ form_row(form.publictransport) }}
                {{ form_row(form.transportkm) }}
                {{ form_row(form.transporttime) }}
                {{ form_row(form.availabilities) }}
                {{ form_row(form.classroom) }}
                {{ form_row(form.nbcontribution) }}
            {% endif %}

            {#{ form_row(form.newsletter) }#}
        </fieldset>
        
        {% if constUserTypeProf == app.user.type %}
        <fieldset class="bg-alabaster">
            <legend>{{ 'form.front.profile.fieldset.establishment.legend'|trans({}, 'form') }}</legend>
            {{ form_row(form.establishmentType) }}
            {{ form_row(form.establishmentEducation) }}
            {{ form_row(form.establishmentName) }}
            {{ form_row(form.establishmentAddress) }}
            {{ form_row(form.establishmentCity) }}
            {{ form_row(form.establishmentZipcode) }}
            {{ form_row(form.latitude) }}
            {{ form_row(form.longitude) }}
            {#{ form_row(form.academy) }#}
            {{ form_row(form.rep) }}
            {#{ form_row(form.establishmentEmail) }#}
            {{ form_row(form.bossEmail) }}
        </fieldset>
        {% else %}
        <fieldset class="bg-alabaster">
            <legend>{{ 'form.front.profile.fieldset.company.legend'|trans({}, 'form') }}</legend>
            {{ form_row(form.establishment) }}
            {{ form_row(form.establishmentNameOther) }}
            {{ form_row(form.establishmentAddress) }}
            {{ form_row(form.establishmentCity) }}
            {{ form_row(form.establishmentZipcode) }}
            {{ form_row(form.latitude) }}
            {{ form_row(form.longitude) }}
            {{ form_row(form.establishmentSector) }}
            {{ form_row(form.establishmentSectorOther) }}
        </fieldset>
        {% endif %}
        

        <fieldset class="bg-alabaster">
            <legend>{{ 'form.front.profile.fieldset.password.legend'|trans({}, 'form') }}</legend>
            {{ form_row(form.current_password) }}
            {{ form_row(form.plainPassword) }}
        </fieldset>

        <fieldset class="bg-alabaster">
            <legend>{{ 'form.front.profile.fieldset.communication.legend'|trans({}, 'form') }}</legend>
            {{ form_row(form.newsletter) }}

            {{ form_row(form.submit) }}
        </fieldset>

    {{ form_end(form) }}
</div>
