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

{% set constUserTypeEng = constant('AppBundle\\Enum\\UserType::ENGINEER') %}

{% set bodyClass = 'tangerine' %}

{% block body %}
{% if constUserTypeEng == app.user.type %}
    {% if (operationsItdlc is defined and operationsItdlc is empty) %}
        <div class="espace-perso-actions clearfix">
            <a class="btn btn-theme float-right" href="{{ path('espace_perso_inge_itdlc') }}">{{ 'word.register_or_modify'|trans({}, 'word') }}</a>
        </div>
    {% endif %}
{% endif %}

    <div class="espace-perso-actions clearfix">
    {% if files is defined and files is not null %}
        {%for file in files %}
        <div class="mb-2">
            <a href="{{ asset( file.path, 'medias_documents') }}" target="_blank" class="btn btn-sm btn-theme">
            {% if file.linkLabel is not empty %}
                {{ file.linkLabel }}
            {% else %}
            Télécharger : {{ file.title }}
            {% endif %}
            </a>
            </div>
        {% endfor %}
    {% endif %}
    {% if videos is defined and videos is not null %}
        {%for video in videos %}
            <a href="https://www.youtube.com/watch?v={{video.path }}" target="_blank" class="btn btn-sm btn-theme">
            {% if video.linkLabel is not empty %}
                    {{ video.linkLabel }}
            {% else %}
                Visionner : {{ video.title }}</a>
            {% endif %}
            </a>
        {% endfor %}
    {% endif %}
    </div>

<div class="block-operations">
    <div class="operations">
        <div class="operations-list">
            {% if constUserTypeEng == app.user.type %}
                
                 {% if (demandesItdlcWaitingValidation is defined and demandesItdlcWaitingValidation|length > 0 ) or (operationsItdlc is defined and operationsItdlc is iterable and operationsItdlc|length > 0) or (operationsItdlcDone is defined and operationsItdlcDone is iterable and operationsItdlcDone|length > 0) %}
                     <div class="operation-block blockProgramed list-cards">
                        {{ include('Front/User/_component/describeMerItdlc.html.twig', {operations:demandesItdlcWaitingValidation, type: constUserTypeEng}) }}
                    </div>

                    <div class="operation-block blockProgramed list-cards">
                        {{ include('Front/User/_component/describeOperationItdlc.html.twig', {operations:operationsItdlc, type: constUserTypeEng}) }}
                    </div>
                    
                    <div class="operation-block blockRealized list-cards">
                        {{ include('Front/User/_component/describeOperationItdlc.html.twig', {operations:operationsItdlcDone, type: constUserTypeEng}) }}
                    </div>

                    {#<div class="alert alert-warning text-center">#}
                        {#Vos demandes sont en cours de traitement et apparaîtront ici une fois traitées.#}
                    {#</div>#}
                {% else %}
                    <div class="alert alert-warning text-center">
                        Vous n'avez aucune demande d'intervention en cours. {#<br/>Pour participer à l'une de nos opérations, Inscrivez-vous et rendez-vous disponibles aux Demandes d'Établissements.#}
                    </div>   
                {% endif %}
            {% endif %}
        </div>
    </div>      
</div>
{% endblock %}

{% block before_body %} 
    {% set pageHeaderActiveMenu = 'operations' %}
    {% include "Front/_part/page-header-profile.html.twig" %}
{% endblock %}

{% block after_body %} 
    {% include "Front/User/Engineer/first_login.html.twig" %}
{% endblock %}