{% load i18n static haveli_list_filters %}
{% if cl.search_fields or cl.has_filters %}
<div id="toolbar">
    <form id="changelist-search" method="get">
        <div><!-- DIV needed for valid HTML -->
            {% if cl.search_fields %}
            <label for="searchbar"><img src="{% static 'admin/img/search.svg' %}" alt="Search"></label>
            <input type="text" size="40" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar" autofocus>
            {% endif %}
            {% spaceless %}
                {% if cl.has_filters %}
                    {% block filters %}
                        {% if cl.has_filters %}
                            <span class="search-filters">
                                {% for spec in cl.filter_specs %}
                                    {% haveli_list_filter_select cl spec %}
                                    &nbsp;
                                {% endfor %}
                            </span>
                        {% endif %}
                    {% endblock %}
                {% endif %}
            {% endspaceless %}
            <input type="submit" value="{% trans 'Search' %}">
            {% if show_result_count %}
                <span class="small quiet">
                    {% blocktrans count counter=cl.result_count %}{{ counter }} result{% plural %}{{ counter }} results{% endblocktrans %} (<a href="?{% if cl.is_popup %}_popup=1{% endif %}">{% if cl.show_full_result_count %}{% blocktrans with full_result_count=cl.full_result_count %}{{ full_result_count }} total{% endblocktrans %}{% else %}{% trans "Show all" %}{% endif %}</a>)
                </span>
            {% endif %}
        </div>
    </form>
</div>
{% endif %}