{% load form_helpers %}
{% load helpers %}
{% load i18n %}

<form action="." method="get">
  <div class="card">
    <div class="card-body overflow-visible d-flex flex-wrap justify-content-between py-3">
      {% for field in filter_form.hidden_fields %}
        {{ field }}
      {% endfor %}
      {# List filters by group #}
      {% for fieldset in filter_form.fieldsets %}
        <div class="col col-12">
          {% render_fieldset filter_form fieldset %}
        </div>
      {% empty %}
        {# List all non-customfield filters as declared in the form class #}
        {% for field in filter_form.visible_fields %}
          {% if not filter_form.custom_fields or field.name not in filter_form.custom_fields %}
            <div class="col col-12">
              {% render_field field %}
            </div>
          {% endif %}
        {% endfor %}
      {% endfor %}
      {% if filter_form.custom_fields %}
        {# List all custom field filters #}
        <div class="col col-12">
          <div class="hr-text">
            <span>{% trans "Custom Fields" %}</span>
          </div>
          {% for name in filter_form.custom_fields %}
            {% with field=filter_form|get_item:name %}
              {% render_field field %}
            {% endwith %}
          {% endfor %}
        </div>
      {% endif %}
    </div>
  </div>
  <div class="btn-float-group-right me-1">
    <button type="button" class="btn btn-outline-danger btn-float" data-reset-select>
      <i class="mdi mdi-backspace"></i> {% trans "Reset" %}
    </button>
    <button type="submit" class="btn btn-primary">
      <i class="mdi mdi-magnify"></i> {% trans "Search" %}
    </button>
  </div>
</form>
