{% extends 'layout.twig' %}

{% block body %}
<section class="contenu clearfix"  id="listeFormat">
	<h1>
		{{ 'Catalogues externes' | trad }}

        <a class="principal button" href="{{ path('Catalogue.AffectationTypeArticle.parArticle') }}">{{ 'Affectation des types d\'article' }}</a>
        <a class="principal button">{{ 'Affectation des rayons' }}</a>
	</h1>
		
    {{ ariane() }}

	<div class="tab-content" id="tab-content">
		<form method="post" name="filtre_catalogue" id="filtre_catalogue">		
			<div id="refreshDiv">
                <table class="table table-hover">
                    <thead class="thead-dark">
                        <tr>
                            <th scope="col" width="175px">{{ triTable('ID_CATAL',  post.tri_ID_CATAL, 'Catalogue' | trad, '', '', 'filtre_catalogue') }}</th>
                            <th scope="col">{{ triTable('DESCRIPTION_CATA',  post.tri_DESCRIPTION_CATA, 'Description du catalogue' | trad, '', '', 'filtre_catalogue') }}</th>

                            <th scope="col">{{ triTable('VERSCATA',  post.tri_VERSCATA, 'Version du catalogue' | trad, '', '', 'filtre_catalogue') }}</th>
                            <th scope="col">{{ triTable('STATUT',  post.tri_STATUT, 'Statut' | trad, '', '', 'filtre_catalogue') }}</th>
                            <th scope="col">{{ triTable('DATEPUB',  post.tri_DATEPUB, 'Publication du' | trad, '', '', 'filtre_catalogue') }}</th>
                            <th scope="col">{{ triTable('VALIDCATA',  post.tri_VALIDCATA, 'Validité au' | trad, '', '', 'filtre_catalogue') }}</th>

                            <th scope="col" width="150px">{{ triTable('TYPECATA',  post.tri_TYPECATA, 'Type de catalogue' | trad, '', '', 'filtre_catalogue') }}</th>

                            <th scope="col">{{ triTable('IDFORMAT',  post.tri_IDFORMAT, 'Format' | trad, '', '', 'filtre_catalogue') }}</th>

                            <th scope="col" width="100px">{{ 'Actions' | trad }}</th>
                        </tr>
                    </thead>

                    <tbody>
                        <tr class="recherche">
                            <td>{{ filterTable('ID_CATAL', post.filter_ID_CATAL, '', '', '', 'filtre_catalogue', '', '') }}</td>
                            <td>{{ filterTable('DESCRIPTION_CATA', post.filter_DESCRIPTION_CATA, '', '', '', 'filtre_catalogue', '', '') }}</td>

                            <td>{{ filterTable('VERSCATA', post.filter_VERSCATA, '', '', '', 'filtre_catalogue', '', '') }}</td>
                            <td>{{ filterSelect('STATUT', post.filter_STATUT, listeStatut, '', '', 'filtre_catalogue', '', '') }}</td>
                            <td>{{ filterTable('date_DATEPUB', post.filter_date_DATEPUB, '', '', '','filtre_catalogue', 'datepicker','Publication du') }}</td>
                            <td>{{ filterTable('date_VALIDCATA', post.filter_date_VALIDCATA, '', '', '','filtre_catalogue', 'datepicker','Validité au') }}</td>

                            <td>
                                {{ filterSelect('TYPECATA', post.filter_TYPECATA, typeCatlogue, 'filtre_catalogue', '','', '', '', '') }}
                            </td>                            

                            <td>
                                {{ zoomFilter('IDFORMAT', post.filter_IDFORMAT, '', 'filtre_catalogue', path('Ajax.liste.entityList', {entity:'CFormats'}),'Liste des formats' | trad) }}
                            </td>

                            <td></td>
                        </tr>
                        {% for catalogue in listeCatalogue %}
                            <tr  id="tr{{ loop.index }}">
                                <td>{{ catalogue.ID_CATAL }}</td>
                                <td>{{ catalogue.DESCRIPTION_CATA }}</td>

                                <td>{{ catalogue.VERSCATA }}</td>
                                <td>{{ listeStatut[catalogue.STATUT] }}</td>
                                <td>{{ catalogue.DATEPUB |dateTrad }}</td>
                                <td>{{ catalogue.VALIDCATA |dateTrad }}</td>

                                <td>{{ typeCatlogue[catalogue.TYPECATA] }}</td>

                                <td>{% if catalogue.IDFORMAT %}{{ catalogue.DESCFRMT }} ({{ catalogue.IDFORMAT }}){% endif %}</td>

                                <td>{{ menuContextuel('tr'~loop.index, false, catalogue.menuContextuel, 8) }}</td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>

        {{ paginations(path('Catalogue.CatalogueExterne.listeCatalogue'),infoPagination.nombreDePage, infoPagination.page, infoPagination.post, '') }}
        </form>


    </div>
</section>
{% endblock %}