{% extends "menu_left.html.twig" %}

{% block title %}Documents à disposition{% endblock %}

{% block main %}

    <div id="doc-dispo-intro" class="row plr-16 ptb-24">
        <!-- INTRO-->
        <div class="col-xs-12 p-0">
            <div class="bloc-base p-16">
                {% if not entete is null and not entete.texte==''%}
                    <div class="col-xs-12 p-0">
                        <div class="bloc-base p-16">
                            {{ entete.texte|raw }}
                        </div>
                    </div>
                {% else %}
                <p>
                    Retrouvez sur cette page les différents documents mis à votre disposition.
                </p>
                {% endif %}
            </div>
        </div>
    </div>

    <div id="doc-dispo-tableau" class="row plr-16 ptb-24">
        <!-- TABLEAU-->
        <div class="col-xs-12 p-0">
            <div class="bloc-base p-16">
                <div class="row m-0">
                    <div class="col-xs-12 p-16 background-white">
                        <div class="table-responsive">
                            <table id="myTable" class="display">
                                <thead class="background-blue">
                                    <tr>
                                        <th class="plr-8 ptb-16">Nom du document</th>
                                        <th class="plr-8 ptb-16">Thématique</th>
                                        <th class="plr-8 ptb-16">Date de dépôt</th>
                                        <th class="plr-8 ptb-16">Interlocuteur</th>
                                        <th class="plr-8 ptb-16">Commentaire</th>
                                        <th class="plr-8 ptb-16">Lien</th>
                                    </tr>
                                </thead>
                                <tbody>
                                {% for doc in documents %}
                                    <tr style="{% if doc[0] == 1 %} background: #e1e10042 !important; {% endif %}">
                                        <td class="plr-8 ptb-24"><a href="#" class="table-lien">{{ doc[1].nom }}</a></td>
                                        <td class="plr-8 ptb-24"><span class="tag ptb-8 plr-16 background-purple">{{ doc[1].thematiqueCode is null ? '' : doc[1].thematiqueCode }}</span></td>
                                        {% if '30/11/-0001' not in  doc[1].dateDepot|date('d/m/Y') and doc[1].dateDepot is not null %}
                                            <td class="plr-8 ptb-24">{{ doc[1].dateDepot ? doc[1].dateDepot|date('d/m/Y') }}</td>
                                        {% else %}
                                            <td class="plr-8 ptb-24"></td>
                                        {% endif %}
                                        <td class="plr-8 ptb-24">{{ doc[1].interlocuteurSiret.siret != '' ? doc[1].interlocuteurSiret.raisonSociale : '' }}</td>
                                        <td class="plr-8 ptb-24">{{ doc[1].commentaire }}</td>
                                        <td class="plr-8 ptb-24"><a href="{{ path('downloadFile', { 'id': doc[1].id, 'type': 'dispo'}) }}" class="button-rond-xs align-middle"><i class="fas fa-download"></i></a></td>
                                    </tr>
                                {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>

{% endblock %}