{% extends 'Front/Render/Modal/layout.html.twig' %}

{% set modalClass = 'content' %}
{% set headerClass = 'bg-tangerine' %}
{% set bodyClass = '' %}
{% set footerClass = '' %}

{% set isLoggedUserTeacher = constant('AppBundle\\Enum\\UserType::TEACHER') == app.user.type %}

{% if isLoggedUserTeacher %}
    {% set preferences_txt_unchecked = ('sentence.preferences.engineer.select')|trans({}, 'sentence') %}
    {% set preferences_txt_checked = ('sentence.preferences.engineer.selected')|trans({}, 'sentence') %}
{% else %}
    {% set preferences_txt_unchecked = ('sentence.preferences.teacher.select')|trans({}, 'sentence') %}
    {% set preferences_txt_checked = ('sentence.preferences.teacher.selected')|trans({}, 'sentence') %}
{% endif %}

{% block header %}
    <div class="container">
        <div class="row">
            <div class="col-md-4">
                <div class="photo-badge" {% if user.photo is not empty %}style="background-image: url({{ user.getWebPhoto|imagine_filter('150Lx150H')|replace({' ' : '%20'}) }})"{% endif %}>
                    {% if user.photo is empty %}
                        {{ include('Front/_component/icon.html.twig', {id: 'user--user', class:'icon-profile-default'}) }}
                    {% endif %}
                </div>
            </div>
            <div class="col-md-8">
                <h3 class="item-title h6 text-no-transform">
                    {{ user.firstname }} {#{ user.lastname }#}
                </h3>
                <p class="text-small">
                    {% if user.categoryJob is not empty %}{{ user.categoryJob|transconst('AppBundle\\Enum\\UserJobTeacherCategory') }}{% else %}{% if user.jobOther is not empty %}{{ user.jobOther }}{% else %}{{ user.job|transconst('AppBundle\\Enum\\UserJobTeacher') }}{% endif %}{% endif %} , {{ user.establishmentName ?? user.establishmentNameOther }}
                </p>
            </div>
        </div>
    </div>
{% endblock %}

{% block body %}
    <p>
        <strong>{{ 'form.profile.teacher.jobcategory.label'|trans({}, 'form') }} &nbsp;:</strong>
        {{ user.categoryJob|transconst('AppBundle\\Enum\\UserJobTeacherCategory') }}
    </p>

    <p>
        <strong>{{ 'form.profile.teacher.job.label'|trans({}, 'form') }} &nbsp;:</strong>
        {% if user.jobOther is not empty %}{{ user.jobOther }}{% else %}{{ user.job|transconst('AppBundle\\Enum\\UserJobTeacher') }}{% endif %}
    </p>
    {# <p>
        <strong>{{ 'form.profile.teacher.classroom.label'|trans({}, 'form') }}&nbsp;:</strong>
        {{ user.classroom|join(' / ') }}
    </p> #}
    <p>
        <strong>{{ 'form.profile.teacher.establishment.label'|trans({}, 'form') }}&nbsp;:</strong>
        {{ user.establishmentName ?? user.establishmentNameOther }}<br />
        {{ user.establishmentAddress }}<br />
        {{ user.establishmentZipcode }} {{ user.establishmentCity }}
    </p>
{% endblock %}

{% block footer %}
    {% if display_preference %}  
        <p class="preference">
            <button id="modal_user_pref_{{ user.id }}_select" type="button" class="btn btn-sm select-preference-user{% if isPreferred %} has-select-icon{% endif %}" data-user="{{ user.id }}">
                {% if isPreferred %}  
                    {{ preferences_txt_checked|raw }}
                {% else %}
                    {{ preferences_txt_unchecked|raw }}
                {% endif %}
            </button>
        </p>
    {% endif %}
{% endblock %}