
{% extends 'layout.twig' %}

{% block body %}
<section>
    <div class="contenu" id="liste-evenements">
        <header class="bs-row">
            <h1 class="bs-col-auto">{{ 'Liste des évènements de facture' | trad }}</h1>
            <form class="bs-col-auto ml-auto"
                action="{{ path('Ajax.Outil.appelAsync') }}"
                onsubmit="return ajaxSubmit(event, new FormData(document.getElementById('filtre_facture')))"
                data-onsuccess="successPopupExport"
            >
                <input type="hidden" name="exportPathAction" 
                    value="{{ path('Facture.Event.export') }}"
                />
                <button class="principal m-0" type="submit">
                    {{- 'Exporter' | trad -}}
                </button>
            </form>
        </header>
        {{ ariane() }}
        <form method="post" name="filtre_facture" id="filtre_facture">
            <div class="filtreBtn">
                <button type="submit" class="principal button btn_filtre last button_right">{{ 'Filtrer' | trad }}</button>
                <button class="secondaire button ajout button_right" id="buttonCollapseFA"  data-toggle="collapse" href="#filtre_avances" >
                    {{  'Filtres avancés' | trad }}
                </button>
                <input type="hidden" id="retract" value="{{'Retracter' | trad}}">
                <input type="hidden" id="advancedFilters" value="{{ 'Filtres avancés' | trad }}">
            </div>
            <div id="filtre_avances" class="collapse clearfix">
                {{ filtreAvance(post, filtreAvance, initFiltreAvance) }}  
            </div>
            <div class="resultat_filtre">
                {{ bullFiltre(post, 'filtre_facture') }}
            </div>
            <table class="table table-hover">
                <thead class="thead-dark">
                    <tr>
                        <th scope="col" width="5%">{{ triTable('TYPE',  infoPagination.filter.tri_TYPE, 'Type' | trad, '', '', 'filtre_facture') }}</th>
                        <th scope="col" width="8%">{{ triTable('NUM_FACT',  infoPagination.filter.tri_NUM_FACT, 'N° Enreg.' | trad, '', '', 'filtre_facture') }}</th>
                        <th scope="col" width="100px">{{ triTable('FACT_FOU',  infoPagination.filter.tri_FACT_FOU, 'Réf. Frs' | trad, '', '', 'filtre_facture') }}</th>
                        <th scope="col">{{ triTable('CODE_STE',  infoPagination.filter.tri_CODE_STE, 'Société' | trad, '', '', 'filtre_facture') }}</th>
                        <th scope="col">{{ triTable('CODE_FOUR',  infoPagination.filter.tri_CODE_FOUR, 'Fournisseur' | trad, '', '', 'filtre_facture') }}</th>
                        <th scope="col" width="6%">{{ 'Actions' | trad }}</th>
                    </tr>
                </thead>
                <tbody>
                    <tr class="recherche">
                        <td>{{ filterSelect('TYPE', infoPagination.filter.filter_TYPE, listeType, 'filtre_facture','','','','', 'Type' | trad) }}</td>
                        <td>{{ filterTable('NUM_FACT', infoPagination.filter.filter_NUM_FACT, '', '', '', 'filtre_facture','', 'N° Enreg.' | trad) }}</td>
                        <td>{{ filterTable('FACT_FOU', infoPagination.filter.filter_FACT_FOU, '', '', '', 'filtre_facture','', 'Réf. Frs' | trad) }}</td>
                        <td>{{ zoomFilter('egal_SOCIETE'~spliter()~'RAIS_SOC', infoPagination.filter['filter_egal_SOCIETE'~spliter()~'RAIS_SOC'], '', 'filtre_facture', path('Ajax.liste.societe'), 'Liste des sociétés' | trad, '','', 'Société' | trad) }}</td>
                        <td>{{ zoomFilter('CODE_FOUR'~spliter()~'RS', infoPagination.filter['filter_CODE_FOUR'~spliter()~'RS'], '', 'filtre_facture', path('Ajax.liste.fournisseur'), 'Liste des fournisseurs' | trad, '','', 'Fournisseur' | trad) }}</td>
                        <td></td>
                    </tr>
                    {% for facture in factures %}
                    <tr id="facture{{ facture.NUM_FACT }}">
                        <td >{{ listeType[facture.TYPE] }}</td>
                        <td class="montant toggleSlide" onclick="toggleSlide('{{ path('Facture.Event.detailFacEvent') }}' , 'facture{{ facture.NUM_FACT }}detail', {id : {{ facture.NUM_FACT }} } );">{{ facture.NUM_FACT }}</td>
                        <td>{{ facture.FACT_FOU }}</td>
                        <td>{{ facture.CODE_STE|societeTrad | convert_encoding('UTF-8', 'ISO-8859-1') }}{% if facture.CODE_STE!='' %} ({{ facture.CODE_STE }}){% endif %}</td>
                        <td>{{ facture.RS | convert_encoding('UTF-8', 'ISO-8859-1') }}{% if facture.CODE_FOUR!='' %} ({{ facture.CODE_FOUR }}){% endif %}</td>
                        <td>
                            <div class="parametrage">
                                {{ menuContextuel('facture'~facture.NUM_FACT, false, facture.menuContextuel, 6) }}

                            </div>
                        </td>
                    </tr>
                    <tr class="detail_ligne hide_detail" id="facture{{ facture.NUM_FACT }}detail" ></tr>
                    {% endfor %}
                </tbody>
            </table>
            {{ paginations(path('Facture.Event.listeEvenements'),infoPagination.nombreDePage, infoPagination.page, infoPagination.post) }}
        </form>
    </div>
</section>
<script>
function exportFacEvent() {
    
}
</script>
{% endblock %}