{% load i18n %}

<div class="grp-module grp-search-filter">
    <div class="grp-row">
        <form class="search_filter_form search_filter_form_{{ spec.parameter_name }}">
            <label>{% blocktrans with title|capfirst as filter_title %}{{ filter_title }}{% endblocktrans %}</label>
            <div class="field" style="width: 65%; float: left">
                <input type="text" name="{{ spec.parameter_name }}" placeholder="All" value="{{ spec.used_parameters.items.0.1 }}" class="search_filter" />
            </div>
            <input type="submit" value="确定" style="float: right; padding: 3px 9px; height: 22px; margin: 1px 0 0 0; max-width:30%;" class="search_filter_apply" />
        </form>
    </div>

    <script type="text/javascript">
        django.jQuery(function($) {
            $('.grp-search-filter .search_filter_form_{{ spec.parameter_name }} .search_filter_apply').on('click', function (event) {
                event.preventDefault();

                var $form = $(this).parents('form');
                var $input = $form.find('input.search_filter');
                var query_param = $input.prop('name');

                urlParams[query_param] = $input.val();

                if (!urlParams[query_param])
                    delete urlParams[query_param];
                reloadParams()
            });
        });
    </script>
</div>
