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

{% block title %}Echeances du dossier {{ dossier }}{% 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="echeancier-dossier-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>

        <div id="echeancier-dossier-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 mb-16">
                        <div class="row m-0">
                            <div class="col-xs-6 p-0">
                                <h2 class="align-middle">Dossier {{ dossier }}</h2>
                            </div>
                            <div class="col-xs-6 p-0 text-align-r">
                                {% if not previousDossier is null  %}<a href="{{ path('echeance_dossier', {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('echeance_dossier', {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-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" href="#" data-content="Libellé d’aide à la compréhension" data-placement="bottom">Echéance</a></th>
                                        <th class="pl-8 pr-16 ptb-16"><a class="popover-aide" href="#" data-content="Libellé d’aide à la compréhension" data-placement="bottom">Code modalité PF</a></th>
                                        <th class="pl-8 pr-16 ptb-16"><a class="popover-aide" href="#" data-content="Libellé d’aide à la compréhension" data-placement="bottom">Libellé modalité PF</a></th>
                                        <th class="pl-8 pr-16 ptb-16"><a class="popover-aide" href="#" data-content="Libellé d’aide à la compréhension" data-placement="bottom">Montant</a></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for e in echeances %}
                                        <tr>
                                            {% if '30/11/-0001' not in  e.dateEcheance|date('d/m/Y') and e.dateEcheance is not null %}
                                                <td class="plr-8 ptb-24">{{e.dateEcheance ? e.dateEcheance|date('d/m/Y') }}</td>
                                            {% else %}
                                                <td class="plr-8 ptb-24"></td>
                                            {% endif %}
                                            <td class="plr-8 ptb-24">{{ e.codeModalite }}</td>
                                            <td class="plr-8 ptb-24">{{ e.libelle }}</td>
                                            <td class="plr-8 ptb-24">{{ e.montant|number_format(2,',',' ') }}€</td>
                                        </tr>
                                    {% endfor %}
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <th class="plr-8 ptb-24" colspan="3">Total des montants du dossier :</th>
                                        <th class="plr-8 ptb-24">{{ total|number_format(2,',',' ') }} €</th>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </div>

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





{% endblock %}