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


{% block title %} Demandes des paiement 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 %}

    <p>
        {% if not dossier.justificatifsPaiement is null %}
            <a href="#" onclick="window.open('{{path('download_justificatifs', {'dossierID' : dossier.numero})}}','justificatifs','width=1020,height=800')" class="button-rond-md align-middle mr-8"><i class="fas fa-download"></i></a><a href="#" onclick="window.open('{{path('download_justificatifs', {'dossierID' : dossier.numero})}}','justificatifs','width=1020,height=800')"  class="action">Rappel de la liste des pièces à fournir</a>
        {% else %}
            <a class="button-rond-md align-middle mr-8" title="Aucun justificatif n'est renseigné pour ce dossier" style="background-color: gray"><i class="fas fa-download" style="color: white;"></i></a><a class="action" title="Aucun justificatif n'est renseigné pour ce dossier" style="color: gray">Rappel de la liste des pièces à fournir</a>
        {% endif %}
    </p>
    
    <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_demandes', {dossierID : previousDossier}) }}" 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_demandes', {dossierID : nextDossier}) }}" 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 active">
                                <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">
                                <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 plr-16 pt-48 pb-16 background-white">

                        {% if (not is_granted('ROLE_PREVIOUS_ADMIN')) %}
                        <div class="position-absolute z-3 top-back8 right-16">
                            <p class="mb-16">
                                    <i class="fas fa-plus"></i>
                                </a>
                            </p>
                        </div>
                        {% endif %}

                        <div class="table-responsive">
                            <table id="myTable" class="display">
                                <thead class="background-blue">
                                <tr>
                                    <th style="display: none;"></th>
                                    <th class="pl-8 pr-16 ptb-16"><a class="popover-aide" data-placement="bottom">Date de demande</a></th>
                                    <th class="pl-8 pr-16 ptb-16"><a class="popover-aide" data-placement="bottom">Type de décompte</a></th>
                                    <th class="pl-8 pr-16 ptb-16"><a class="popover-aide" data-placement="bottom">Montant</a></th>
                                    <th class="pl-8 pr-16 ptb-16"><a class="popover-aide" data-placement="bottom">Etat</a></th>
                                    <!--th class="pl-8 pr-16 ptb-16"><a class="popover-aide" data-placement="bottom">Action</a></th-->
                                </tr>
                                </thead>
                                <tbody>
                                {% for d in demandes %}
                                    <tr>
                                        {% if '30/11/-0001' not in d.date|date('Y/m/d') and d.date is not null %}
                                            <td style="display: none;">{{d.date ? d.date|date('Y/m/d') }}</td>
                                        {% else %}
                                            <td style="display: none;"></td>
                                        {% endif %}

                                        {% if '30/11/-0001' not in d.date|date('d/m/Y') and d.date is not null %}
                                            <td class="plr-8 ptb-24">{{d.date ? d.date|date('d/m/Y') }}</td>
                                        {% else %}
                                            <td class="plr-8 ptb-24"></td>
                                        {% endif %}

                                        <td class="plr-8 ptb-24">{% if not d.typeDecompte is null %}{{ d.typeDecompte }}{% endif %}</td>
                                        <td class="plr-8 ptb-24">{% if not d.montant is null %}{{ d.montant|number_format(2,',',' ') }} €{% endif %}</td>
                                        <td class="plr-8 ptb-24">{% if not d.etat is null %}<span class="tag ptb-8 plr-16 background-purple">{{ d.etat }}</span>{% endif %}</td>
                                        {# if d.etat|lower=='incomplète' or d.etat|lower=='incomplete' or d.etat|lower=='brouillon' #}<!--td class="plr-8 ptb-24"><a href="{{path('new_demande', {dossierID : dossier.numero, demandeID : d.id})}}" class="button-rond-xs align-middle"><i class="fas fa-pencil-alt"></i></a></td-->
                                        {# else #}<!--td class="plr-8 ptb-24"></td--> {# endif #}
                                    </tr>
                                {% endfor %}

                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

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


</div>
{% endblock %}
