

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


{% block title %} Documents dossier d'aide {% endblock %}


{% block main %}
    {% if app.request.query.has('searchedValue') %}
        {% set searchedValue =  app.request.query.all['searchedValue'] %}
    {% endif %}
    {% if app.request.query.has('pageNumber') %}
        {% set pageNumber =  app.request.query.all['pageNumber'] %}
    {% endif %}
<div class="container-fluid">


    <div id="dossier-aide-intro" class="row plr-16 ptb-24">
        <!-- INTRO-->
        <div class="col-xs-12 p-0">
            <div class="bloc-base p-16">
                <p><a href="{{ path('participations_list') }}{% if searchedValue is defined and pageNumber is defined %}?searchedValue={{ searchedValue }}&pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is not defined and pageNumber is defined %}?pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is defined and pageNumber is not defined %}?searchedValue={{ searchedValue }}{% endif %}"
                      class="button-rond-xs align-middle mr-8"><i class="fas fa-arrow-left"></i></a>Participations financières</p>
            </div>
        </div>
    </div>

    {% 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>
    {% endif %}

    <div id="dossier-aide-tableau" class="row plr-16 ptb-24">
        <!-- TABLEAU-->
        <div class="col-xs-12 p-0">
            <div class="bloc-base p-16">
                <div class="bloc-title">
                    <div class="row m-0">
                        <div class="col-xs-6 p-0">
                            <h2 class="align-middle">Dossier d'aide N° {{ dossier.numero }}</h2>
                        </div>
                        <div class="col-xs-6 p-0 text-align-r">
                            {% if not previousDossier is null  %}<a href="{{ path('dossier_aide_documents', {dossierID : previousDossier}) }}{% if searchedValue is defined and pageNumber is defined %}?searchedValue={{ searchedValue }}&pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is not defined and pageNumber is defined %}?pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is defined and pageNumber is not defined %}?searchedValue={{ searchedValue }}{% endif %}" class="button-rond-xs align-middle mr-8"><i class="fas fa-arrow-left"></i></a>{% endif %}{% if not nextDossier is null %}<a href="{{ path('dossier_aide_documents', {dossierID : nextDossier}) }}{% if searchedValue is defined and pageNumber is defined %}?searchedValue={{ searchedValue }}&pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is not defined and pageNumber is defined %}?pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is defined and pageNumber is not defined %}?searchedValue={{ searchedValue }}{% endif %}" class="button-rond-xs align-middle"><i class="fas fa-arrow-right"></i></a>{% endif %}
                        </div>
                    </div>
                </div>
                <div class="row m-0">
                    <div class="col-xs-12 p-0 mt-24 mb-24">
                        <ul id="content-nav-tabs" class="nav divider-grey-b">
                            <li class="pr-24 nav-item">
                                <a class="plr-0 pt-0 pb-24 nav-link" href="{{ path('dossier_aide_informations', {dossierID : dossier.numero}) }}{% if searchedValue is defined and pageNumber is defined %}?searchedValue={{ searchedValue }}&pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is not defined and pageNumber is defined %}?pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is defined and pageNumber is not defined %}?searchedValue={{ searchedValue }}{% endif %}">Informations</a>
                            </li>
                            <li class="plr-24 nav-item">
                                <a class="plr-0 pt-0 pb-24 nav-link" href="{{ path('dossier_aide_modalites', {dossierID : dossier.numero}) }}{% if searchedValue is defined and pageNumber is defined %}?searchedValue={{ searchedValue }}&pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is not defined and pageNumber is defined %}?pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is defined and pageNumber is not defined %}?searchedValue={{ searchedValue }}{% endif %}">Modalités d'aide</a>
                            </li>
                            <li class="plr-24 nav-item">
                                <a class="plr-0 pt-0 pb-24 nav-link" href="{{ path('dossier_aide_demandes', {dossierID : dossier.numero}) }}{% if searchedValue is defined and pageNumber is defined %}?searchedValue={{ searchedValue }}&pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is not defined and pageNumber is defined %}?pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is defined and pageNumber is not defined %}?searchedValue={{ searchedValue }}{% endif %}">Demandes de paiement</a>
                            </li>
                            <li class="plr-24 nav-item">
                                <a class="plr-0 pt-0 pb-24 nav-link" href="{{ path('dossier_aide_encaissements', {dossierID : dossier.numero}) }}{% if searchedValue is defined and pageNumber is defined %}?searchedValue={{ searchedValue }}&pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is not defined and pageNumber is defined %}?pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is defined and pageNumber is not defined %}?searchedValue={{ searchedValue }}{% endif %}">Encaissements</a>
                            </li>
                            <li class="plr-24 nav-item active">
                                <a class="plr-0 pt-0 pb-24 nav-link" href="{{ path('dossier_aide_documents', {dossierID : dossier.numero}) }}{% if searchedValue is defined and pageNumber is defined %}?searchedValue={{ searchedValue }}&pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is not defined and pageNumber is defined %}?pageNumber={{ pageNumber }}{% endif %}{% if searchedValue is defined and pageNumber is not defined %}?searchedValue={{ searchedValue }}{% endif %}">Documents</a>
                            </li>
                        </ul>
                    </div>
                </div>
                <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="pl-8 pr-16 ptb-16"><a class="popover-aide" data-placement="bottom">Nom du document</a></th -->
                                    <th class="pl-8 pr-16 ptb-16"><a class="popover-aide" data-placement="bottom">Objet du document</a></th>
                                    <th class="pl-8 pr-16 ptb-16"><a class="popover-aide" data-placement="bottom">Date du document</a></th>            
                                    <th class="pl-8 pr-16 ptb-16"><a class="popover-aide" data-placement="bottom">Lien</a></th>
                                </tr>
                                </thead>
                                <tbody>
                                {% for d in documents %}
                                    <tr>
                                        <!--td class="plr-8 ptb-24">{# d.documentNom #}</td-->
                                        <td class="plr-8 ptb-24">{{ d.commentaire }}</td>
                                        {% if '30/11/-0001' not in d.dateCreated|date('d/m/Y') and d.dateCreated is not null %}
                                            <td class="plr-8 ptb-24">{{d.dateCreated ? d.dateCreated|date('d/m/Y') }}</td>
                                        {% else %}
                                            <td class="plr-8 ptb-24"></td>
                                        {% endif %}
                                        <td class="plr-8 ptb-24"><a href="{{ path('download_doc_dossier_aide', { 'dossierID': dossier.numero, 'documentID' : d.id}) }}" class="button-rond-xs align-middle"><i class="fas fa-download"></i></a></td>
                                    </tr>
                                {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block javascript %}
    {{ parent() }}

    <script type="text/javascript">
       $('#myTable').dataTable({
                "order": [[ 1, "desc" ]],
                "aoColumns": [
                    null,
                    { "sType": "date-uk" },
                    null,
                ]
            });    
    </script>

{% endblock %}