{% extends "adminfilters/_wrapper.html" %}{% load i18n %}
{% block content %}
    <ul class="adminfilter"
        data-action="{% if spec.value.0 %}clear{% else %}filter{% endif %}"
        data-op="{{ spec.operator }}"
        data-qs="{{ spec.query_string }}">
        {% if spec.error_message %} {{ spec.error_message }} {% endif %}
        <li>
            {% if spec.can_negate %}
                <input type="checkbox"
                       data-group="{{ spec.parameter_name }}"
                       data-lk="{{ spec.lookup_kwarg_negated }}"
                       data-original="{{ spec.lookup_negated_val|lower }}"
                       class="filter-adam negate {{ spec.parameter_name }}"
                       {% if spec.lookup_negated_val == "true" %}checked="checked"{% endif %}>
                {% trans "Exclude" %}
            {% endif %}
        </li>
        <li>
            <input type="text"
                   name="key"
                   data-lk="{{ spec.lookup_kwarg_key }}"
                   data-original="{{ spec.lookup_key_val }}"
                   data-group="{{ spec.parameter_name }}"
                   placeholder="{{ spec.field_placeholder }}"
                   class="filter-adam {{ spec.parameter_name }}"
                   value="{{ spec.lookup_field_val }}"
                   style="width: 90%">

            <span style="display: inline">
            <input type="text"
                   name="value"
                   data-group="{{ spec.parameter_name }}"
                   data-lk="{{ spec.lookup_kwarg_value }}"
                   placeholder="{{ spec.placeholder }}"
                   class="filter-adam {{ spec.parameter_name }}"
                   value="{{ spec.lookup_value_val }}"
                   data-original="{{ spec.lookup_value_val }}"
                   style="width: 90%">
        </span>
        </li>
        {% if spec.button %}
            <li>
            <a class="filter-adam adminfilters button {{ spec.parameter_name }} {% if spec.value.0 %}clear{% else %}filter{% endif %}"
               href="#">{% if spec.value.0 %}{% trans "clear" %}{% else %}{% trans "activate" %}{% endif %}</a>
            </li>
        {% endif %}

    </ul>
{% endblock %}
{% block script %}
    <script type="text/javascript">
        ;(function ($) {
            new DjangoLookupFilterHandler("#{{ spec.html_attrs.id }}", {{ spec.js_options|safe }});
        })(django.jQuery);
    </script>
{% endblock %}
