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

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

{% set bodyClass = 'tangerine' %}

{% block body %}
<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 %}
    <a class="btn btn-theme float-right" href="{{ path('espace_perso_prof_itdlc_add') }}">{{ 'word.make_request'|trans({}, 'word') }}</a>
 </div>

<div class="block-operations">
    <div class="operations">
        <div class="operations-list">
            {% if constant('AppBundle\\Enum\\UserType::TEACHER') == app.user.type %}
                {% if (operations is defined and operations is iterable and operations|length > 0) or (demandes is defined and demandes is iterable and demandes|length > 0) or (operationsDone is defined and operationsDone is iterable and operationsDone|length > 0) %}
                    <div class="operation-block blockProgramed list-cards">
                        {{ include('Front/User/_component/describeOperationItdlc.html.twig', {operations:operations, type: constUserTypeProf}) }}
                    </div>
                    
                    <div class="demande-block blockItdlc list-cards">
                        {{ include('Front/User/_component/describeDemandeItdlc.html.twig', {demandes:demandes}) }}
                    </div>
                    <div class="operation-block blockCancelled list-cards">
                        {{ include('Front/User/_component/describeOperationItdlc.html.twig', {operations:operationsCancelled, type: constUserTypeProf}) }}
                    </div>
                    <div class="operation-block blockRealized list-cards">
                        {{ include('Front/User/_component/describeOperationItdlc.html.twig', {operations:operationsDone, type: constUserTypeProf}) }}
                    </div>
                {% else %}
                    <div class="alert alert-warning text-center">
                        Vous n'avez aucune demande en cours. <br/>Pour participer à l'une de nos opérations faites une nouvelle demande
                    </div>   
                {% endif %}

                {#{ include('Front/User/_component/listeOtherType.html.twig', {othersUsers:othersUsers}) }#}
            {% else %} {# Engineer #}
                
            {% endif %}
        </div>
    </div>      
</div>
{% endblock %}

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

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