{% load django_listing %}

<form{{ filters.form_attrs }}>
    {% gethiddens_filters_form listing %}
    {% if filters.form_attrs.method.lower == "post" %}{% csrf_token %}{% endif %}
    {{ filters.form.non_field_errors }}

    {% include "django_listing/default/filters_form_fields.html" with layout=filters.form_layout %}
    {% include "django_listing/default/filters_form_layout_advanced.html" %}

    <div class="form-buttons">
        {% for button in filters.form_buttons %}
            {% if button == 'reset' %}
                {% if filters.form_reset_label %}
                    {% if filters.listing.accept_ajax %}
                        <button type="reset" class="{{ filters.theme_form_reset_class }}">
                            <span class="button-icon-label">
                                <span class="button-icon {{ filters.theme_form_reset_icon }}"></span>
                                <span class="button-label">{{ filters.form_reset_label }}</span>
                            </span>
                        </button>
                    {% else %}
                        <a class="{{ filters.theme_form_reset_class }}"
                           href="{{ filters.get_form_reset_url }}">
                            <span class="button-icon-label">
                                <span class="button-icon {{ filters.theme_form_reset_icon }}"></span>
                                <span class="button-label">{{ filters.form_reset_label }}</span>
                            </span>
                        </a>
                    {% endif %}
                {% endif %}
            {% elif button == 'submit' %}
                {% if filters.form_submit_label %}
                    <button type="submit"
                           name="f_do_filter"
                           class="{{ filters.theme_form_submit_class }}"
                           value="{{ filters.form_submit_label }}"
                    >
                        <span class="button-icon-label">
                            <span class="button-icon {{ filters.theme_form_submit_icon }}"></span>
                            <span class="button-label">{{ filters.form_submit_label }}</span>
                        </span>
                    </button>
                {% endif %}
            {% elif button == 'advanced' %}
                {% if filters.form_advanced_label %}
                    <a class="{{ filters.theme_form_advanced_class }}">
                        <span class="button-icon-label">
                            {% if filters.show_advanced %}
                                <span class="button-icon down {{ filters.theme_form_advanced_down_icon }}" style="display: none"></span>
                                <span class="button-icon up {{ filters.theme_form_advanced_up_icon }}"></span>
                            {% else %}
                                <span class="button-icon down {{ filters.theme_form_advanced_down_icon }}"></span>
                                <span class="button-icon up {{ filters.theme_form_advanced_up_icon }}" style="display: none"></span>
                            {% endif %}
                            <span class="button-label">{{ filters.form_advanced_label }}</span>
                        </span>
                    </a>
                {% endif %}
            {% endif %}
        {% endfor %}
    </div>
</form>