{% set taxonFilter = gridConfig.useMainTaxonForFilter() ? resultSet.mainTaxonFilter : resultSet.taxonFilter %}

<section class="filters-wrapper collapse-panel" id="filters-wrapper">
    <ul class="collapse-group custom-collapse">
        {% if resultSet.filters|length == 0 and resultSet.priceFilter is empty and taxonFilter is empty %}
            <li>
                {{ 'monsieurbiz_searchplugin.filters.no_filter'|trans }}
            </li>
        {% else %}
            {% set path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge(app.request.query.all)) %}
            <form name="filters-form" method="get" action="{{ path }}">
                {% include '@DediSyliusTheme/theme/MonsieurBizSyliusSearchPlugin/views/Common/_appliedFilters.html.twig' %}

                {% if taxonFilter is not empty %}
                    {% include '@MonsieurBizSyliusSearchPlugin/Common/_filter.html.twig' with {'filter': taxonFilter} %}
                {% endif %}

                {% if resultSet.priceFilter is not empty %}
                    {% include '@MonsieurBizSyliusSearchPlugin/Common/_rangeFilter.html.twig' with {'filter': resultSet.priceFilter} %}
                {% endif %}

                {% for filter in resultSet.filters %}
                    {% include '@MonsieurBizSyliusSearchPlugin/Common/_filter.html.twig' with {'filter': filter} %}
                {% endfor %}

                {# Don't loose current sorting #}
                {% set sorting = app.request.query.get('sorting') %}
                {% if sorting is not empty %}
                    {% for sort, order in sorting %}
                        <input type="hidden" name="sorting[{{ sort }}]" value="{{ order }}" />
                    {% endfor %}
                {% endif %}

                {# Don't loose current limit #}
                {% set limit = app.request.query.get('limit') %}
                {% if limit is not empty %}
                    <input type="hidden" name="limit" value="{{ limit }}" />
                {% endif %}
                {% if gridConfig.haveToApplyManuallyFilters() %}
                    <li class="list-group-item">
                        <button type="submit" class="btn btn-primary btn-block">
                            <i class="search icon"></i> {{ 'monsieurbiz_searchplugin.filters.apply_filters' | trans }}
                        </button>
                    </li>
                {% endif %}
            </form>
        {% endif %}
    </ul>
</section>
