<div class="sidebox">
    <h3>{{ _('Problem search') }} <i class="fa fa-search"></i>
    </h3>
    <div class="sidebox-content">
        <form id="filter-form" name="form" action="" method="get">
            <div>
                <input id="search" type="text" name="search" value="{{ search_query or '' }}"
                       placeholder="{{ _('Search problems...') }}">
            </div>
            <!-- {% if has_fts %}
                <div>
                    <input id="full_text" type="checkbox" name="full_text" value="1"
                           {% if full_text %}checked{% endif %}>
                    <label for="full_text">{{ _('Full text search') }}</label>
                </div>
            {% endif %} -->
            {% if request.user.is_authenticated %}
                <div>
                    <input id="hide_solved" type="checkbox" name="hide_solved" value="1"
                           {% if hide_solved %}checked{% endif %}>
                    <label for="hide_solved">{{ _('Hide solved problems') }}</label>
                </div>
            {% endif %}
            <div>
                <input id="show_types" type="checkbox" name="show_types" value="1"
                        {% if show_types %} checked{% endif %}>
                <label for="show_types">{{ _('Show problem types') }}</label>
            </div>
            <div>
                <input id="show_editorial" type="checkbox" name="show_editorial" value="1"
                        {% if show_editorial %} checked{% endif %}>
                <label for="show_editorial">{{ _('Show editorial') }}</label>
            </div>
            <div class="filter-form-group">
                <label for="type"><i>{{ _('Organization') }}</i></label>
                <select id="search-org" name="orgs" multiple>
                    {% for org in organizations %}
                        <option value="{{ org.id }}"{% if org.id in org_query %} selected{% endif %}>
                            {{ org.name }}
                        </option>
                    {% endfor %}
                </select> 
            </div>
            <div class="filter-form-group">
                <label for="category"><i>{{ _('Category') }}</i></label>
                <select id="category" name="category">
                    {% if category %}
                        <option value="" selected="selected">{{ _('All') }}</option>
                    {% else %}
                        <option value="">{{ _('All') }}</option>{% endif %}
                    <option disabled="disabled">---</option>
                    {% for group in categories %}
                        <option value="{{ group.id }}"{% if group.id == category %} selected{% endif %}>
                            {{ group.full_name }}
                        </option>
                    {% endfor %}
                </select>

            </div>
            {% if show_types %}
                <div class="filter-form-group">
                    <label for="type"><i>{{ _('Problem types') }}</i></label>
                    <select id="types" name="type" multiple>
                        {% for type in problem_types %}
                            <option value="{{ type.id }}"{% if type.id in selected_types %} selected{% endif %}>
                                {{ type.full_name }}
                            </option>
                        {% endfor %}
                    </select>
                </div>
            {% endif %}
            {% if point_values %}
                <div class="form-label">{{ _('Point range') }}</div>
                <div id="point-slider"></div>
            {% endif %}
            <input id="point-start" type="hidden" name="point_start" {% if point_start and point_start != point_values.min %}value="{{ point_start }}"{% else %}disabled{% endif %}>
            <input id="point-end" type="hidden" name="point_end" {% if point_end and point_end != point_values.max %}value="{{ point_end }}"{% else %}disabled{% endif %}>
            <div class="form-submit-group">
                <a id="go" class="button">{{ _('Go') }}</a>
                <a id="random" class="button">{{ _('Random') }}</a>
            </div>
        </form>
    </div>
</div>