{% set form_id = table.id ~ '-form-filtre' %}

<form class="tab-content" method="post" 
    name="{{ form_id | e('html_attr') }}" 
    id="{{ form_id | e('html_attr') }}"
>
    <div class="resultat_filtre">
        {{ bullFiltre(post, form_id) }}
    </div>
	<table class="table table-hover">
		<thead class="thead-dark">
			<tr>
                {% for col in table.listCol %}
                {#
                    <th scope="col">
                    {{- triTable(
                        col.name,
                        post[ 'tri_' ~ col.name ],
                        col.label,
                        null,
                        null,
                        form_id
                    ) }}</th>
                    #}
                    <th scope="col">{{ col.label }}</th>
				{% endfor %}
                {% if table.action %}
                <th>{# Action #}</th>
                {% endif %}
			</tr>
		</thead>
		<tbody>
            {% if table.hasColSearch ?? true %}
			<tr class="recherche">
                {% for col in table.listCol %}
                {% if col.filter.type == 'text' %}
				<th scope="col">
                    {{- filterTable(
                        col.name,
                        post[ 'filter_' ~ col.name ],
                        '',
                        col.name,
                        '',
                        form_id,
                        '',
                        col.label,
                        '',
                        true
                    ) }}
                </th>
                {% elseif col.filter.type == 'zoom' %}
                {# TODO #}
                {{ zoomFilter(
                    'egal_SOCIETE#point#CODE_STE'~spliter()~'SOCIETE#point#RAIS_SOC',
                    infoPagination.filter['filter_egal_SOCIETE#point#CODE_STE'~spliter()~'SOCIETE#point#RAIS_SOC'],
                    '',
                    form_id,
                    path('Ajax.liste.societe'),
                    'Liste des sociétés' | trad,
                    '',
                    '',
                    'Société' | trad,
                    '',
                    '',
                    'libelle_Societe'
                ) }}
                {% else %}
                <td></td>
                {% endif %}
				{% endfor %}
                {% if table.action %}
                <td>{# Action #}</td>
                {% endif %}
			</tr>
            {% endif %}
			{% for item in table.listRow %}
                <tr>
                    {% for col in table.listCol %}
                        <td class="{{ 
                            col.type in ['integer', 'amount', 'quantity'] ? 
                                'text-right'
                        }}">
                            {% set value = item[ col.name ] %}
                            {% if col.type == 'date' %}
                                {{- value | dateTrad -}}
                            {% elseif col.type == 'amount' %}
                                {{- value | prix -}}
                            {% elseif col.type == 'quantity' %}
                            {# TODO require UNIT #}
                                {{- value | qte -}}
                            {% else %}
                                {{- value -}}
                            {% endif %}
                        </td>
                    {% endfor %}
                    {% if table.action %}
                    <td class="text-right"> 
                        {% block action %}{% endblock %}
                    </td>
                    {% endif %}
                </tr>
            {% else %}
                <tr>
                    <td colspan="{{ table.listCol |length + ( table.action? 1 :0 ) }}" 
                        class="text-center text-muted"
                    >{{ 'Aucun élément' | trad }}</td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
    {% if table.pagination %}
    {{ paginations(
        table.pagination.path,
        table.pagination.nombreDePage,
        table.pagination.page,
        table.pagination.post,
        ''
    ) }}
    {% endif %}
</form>
