{% trans_default_domain 'FOSUserBundle' %}

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

<div class="block block-donnees">
    <h3>Mes données personnelles</h3>
    <div class="block-donnees-user">
        <div class="block-donnees-photo photo-badge">
            {% if app.user.photo %}
                <img alt="Photo de profil" src="{{ app.user.getWebPhoto|imagine_filter('48Lx48H') }}">
            {% else %}
                {{ include('Front/_component/icon.html.twig', {id: 'user--user', class:'icon-profile-default'}) }}
            {% endif %}
        </div>
        <div>
            <dl class="block-donnees-details">
                <dt>Nom</dt>
                <dd>{{ app.user.lastname }}</dd>

                <dt>Prénom</dt>
                <dd>{{ app.user.firstname }}</dd>

                {% if app.user.personaladdress is not null %}
                    <dt>Adresse personnelle</dt>
                    <dd>
                        {{ app.user.personaladdress }}<br/>
                        {{ app.user.personalzipcode }} {{ app.user.personalcity }}
                    </dd>
                {% endif %}

                {% if constUserTypeProf == app.user.type %}
                    <dt>Matière enseignée</dt>
                    <dd>
                        {% if app.user.job is not null %}
                            {{ app.user.job }}
                        {% else %}
                            {{ app.user.jobOther }}
                        {% endif %}
                    </dd>

                    <dt>Établissement</dt>
                    <dd>{{ app.user.establishmentname }}</dd>

                    <dt>Niveaux enseignés</dt>
                    <dd>{{ app.user.classroom|join(' / ') }}</dd>
                {% else %}
                    <dt>Métier</dt>
                    <dd>{{ app.user.job }}</dd>

                    <dt>Entreprise</dt>
                    <dd>{{ app.user.establishment }}</dd>
                {% endif %}

                {% if app.user.birthday is not null %}
                    <dt>Date de naissance</dt>
                    <dd>{{ app.user.birthday|date("d/m/Y") }}</dd>
                {% endif %}

                <dt>Téléphone</dt>
                <dd>{{ app.user.phone }}</dd>

                <dt>Mail</dt>
                <dd>{{ app.user.email }}</dd>

                <dt>Adresse de {% if constUserTypeProf == app.user.type %}lʼétablissement{% else %}lʼentreprise{% endif %}</dt>
                <dd>
                    {{ app.user.establishmentaddress }}<br/>
                    {{ app.user.establishmentzipcode }} {{ app.user.establishmentcity }}
                </dd>
            </dl>
            <p>
                <a class="edit-infos highlighted" href="{{ path('fos_user_profile_edit') }}">
                    {{ include('Front/_component/icon.html.twig', {id: 'edit'}) }}
                    Modifier mes informations
                </a>
            </p>
        </div>
    </div>
</div>