{% extends '@ChillPerson/CRUD/view.html.twig' %}

{% block content %}
{% embed '@ChillPerson/CRUD/_view_content.html.twig' %}
    {% block crud_content_header %}
        <h1>{{ ('crud.' ~ crud_name ~ '.title_view')|trans({'%person%': person|chill_entity_render_string }) }}</h1>
    {% endblock crud_content_header %}

    {% block crud_content_view_details %}
        <dl class="chill_view_data">
            <dt>Date du rapport</dt>
            <dd>{{ entity.reportDate|format_date('short') }}</dd>

            <h2>Compétences</h2>

            <dt>Langues parlées</dt>
            <dd>
                    {% if entity.spokenLanguages is null or entity.spokenLanguages|length == 0 %}
                        {{ null|chill_print_or_message }}
                    {% else %}
                        {% for lang in entity.spokenLanguages %}
                            {{ lang.name|localize_translatable_string }}{% if not loop.last %},{% endif %}
                        {% endfor %}
                    {% endif %}
            </dd>

            <h2>Formation</h2>

            <dt>Niveau de formation</dt>
            <dd>
                {{ (entity.formationLevel is null ? null : ('formation_level.' ~ entity.formationLevel))|chill_print_or_message("Aucune information") }}
            </dd>

            <dt>Type de formation</dt>
            <dd>
                {{ (entity.formationType is null ? null : ('formation_type.' ~ entity.formationType))|chill_print_or_message("Aucune information") }}
            </dd>
        </dl>

        <h3>Formations suivies</h3>

        {% if entity.formations|length > 0 %}
            {% for f in entity.formations %}
                <div class="flex-table">
                    <div class="job__cv-view__formations__formation">
                        <h4>{{ f.title }}{% if f.organisme is not empty %} <span style="font-size: 85%;">auprès de <span style="font-style: italic;">{{ f.organisme }}</span></span>{% endif %}</h4>

                        <dl class="chill_view_data">

                            <dt>Dates de formation</dt>
                            <dd>
                                {% if f.startDate is null and f.endDate is null %}
                                    {{ null|chill_print_or_message("Aucune date indiquée") }}
                                {% elseif f.startDate is null %}
                                    Jusqu'au {{ f.endDate|format_date('short') }} <span class="chill-no-data-statement">(date de début inconnue)</span>
                                {% elseif f.endDate is null %}
                                    Depuis le {{ f.startDate|format_date('short') }} <span class="chill-no-data-statement">(date de fin inconnue)</span>
                                {% else %}
                                    Du {{ f.startDate|format_date('short') }} au {{ f.endDate|format_date('short') }}
                                {% endif %}
                            </dd>

                            <dt>Diplôme</dt>
                            <dd>
                                <p>Diplôme obtenu: {{ (f.diplomaObtained is null ? null : ('diploma_obtained.' ~ f.diplomaObtained))|chill_print_or_message("Aucune information") }}</p>
                                <p>Diplôme reconnu en France: {{ (f.diplomaReconnue is null ? null : ('diploma_reconnu.' ~ f.diplomaReconnue))|chill_print_or_message("Aucune information") }}</p>
                            </dd>
                        </dl>
                    </div>
                </div>
            {% endfor %}
        {% else %}
            <span class="chill-no-data-statement">{{ 'No education'|trans }}</span>
        {% endif %}

        <h3>Expériences</h3>

        {% if entity.formations|length > 0 %}
            {% for f in entity.experiences %}
                <div class="flex-table">
                    <div class="job__cv-view__experiences_experience">
                        <h4>{{ f.poste }} {% if f.structure is not empty %}<span style="font-size: 85%;">auprès de <span style=" font-style: italic;">{{ f.structure }}</span></span>{% endif %}</h4>

                        <dl class="chill_view_data">
                            <dt>Dates de l'expérience</dt>
                            <dd>
                                {% if f.startDate is null and f.endDate is null %}
                                    {{ null|chill_print_or_message("Aucune date indiquée") }}
                                {% elseif f.startDate is null %}
                                    Jusqu'au {{ f.endDate|format_date('short') }} <span class="chill-no-data-statement">(date de début inconnue)</span>
                                {% elseif f.endDate is null %}
                                    Depuis le {{ f.startDate|format_date('short') }} <span class="chill-no-data-statement">(date de fin inconnue)</span>
                                {% else %}
                                    Du {{ f.startDate|format_date('short') }} au {{ f.endDate|format_date('short') }}
                                {% endif %}
                            </dd>

                            <dt>Type de contrat</dt>
                            <dd>
                                {{ (f.contratType is null ? null : ('xp_contrat_type.'~f.contratType))|chill_print_or_message }}
                            </dd>

                            {% if f.notes is not empty %}
                                <dt>Notes</dt>
                                <dd>
                                    {{ f.notes|chill_print_or_message(null, 'blockquote') }}
                                </dd>
                            {% endif %}
                        </dl>
                    </div>
                </div>
            {% endfor %}
        {% else %}
            <p class="chill-no-data-statement">Aucune formation renseignée</p>
        {% endif %}

        <h3>Note</h3>

        {{ entity.notes|chill_print_or_message("Aucune note", 'blockquote') }}
    {% endblock crud_content_view_details %}
    {% block content_view_actions_duplicate_link %}{% endblock %}
    {% block content_view_actions_back %}
        <li class="cancel">
            <a class="btn btn-cancel" href="{{ chill_return_path_or('chill_job_report_index', { 'person': entity.person.id }) }}">
                {{ 'Cancel'|trans }}
            </a>
        </li>
    {% endblock %}
{% endembed %}
{% endblock %}

{% block css %}
    <style>
    div.job__cv-view__experiences > div {
        padding: 0 0.5em 0.5em 0.5em;
    }
    div.job__cv-view__experiences > div:nth-child(2n+1) {
        background-color: var(--chill-llight-gray);
    }
    div.job__cv-view__experiences > div:nth-child(2n) {
        background-color: var(--chill-beige);
    }
    </style>
{% endblock %}
