{% load i18n static %}
{% if cl.search_fields %}
    <div class="{{ direction.panel }}">
        <form id="changelist-search" method="get">
            <div class="row">
                <div class="col-md-4 pr-md-1">
                    <div class="form-group">
                        <input type="text" class="form-control" size="40" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar" autofocus>
                    </div>
                </div>
                <div class="col-md-2 px-md-1">
                    <div class="form-group">
                        <button type="submit" class="btn btn-fill btn-sm btn-primary">{% trans 'Search' %}</button>
                    </div>
                </div>
                <div class="col-md-2 pl-md-1">
                    <div class="form-group">
                        {% 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 %}
                        {% for pair in cl.params.items %}
                            {% if pair.0 != search_var %}
                                <input type="hidden" name="{{ pair.0 }}" value="{{ pair.1 }}">
                            {% endif %}
                        {% endfor %}
                    </div>
                </div>
            </div>
        </form>
    </div>
{% endif %}
