1{% load projecttags %}
2<!-- '{{f.class}}' filter -->
3{% with f.class as  key %}
4
5<div id="filter_{{f.class}}" class="modal fade"  tabindex="-1" role="dialog" aria-hidden="true">
6  <div class="modal-dialog">
7    <div class="modal-content">
8      <form>
9        <input type="hidden" name="search" value="{%if request.GET.search %}{{request.GET.search}}{%endif%}"/>
10        <div class="modal-header">
11          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
12          {% if search_term %}
13          <h3>Filter {{total_count}} {%if filter_search_display%}{{filter_search_display|title}}{%else%}{{objectname|title}}{%endif%} matching '{{search_term}}' by '{{tc.name}}'</h3>
14          {% else %}
15          <h3>Filter {%if filter_search_display%}{{filter_search_display|title}}{%else%}{{objectname|title}}{%endif%} by '{{tc.name}}'</h3>
16          {% endif %}
17        </div>
18        <div class="modal-body">
19          <p>{{f.label}}</p>
20          <div class="radio">
21            <label>
22              <input type="radio" name="filter" {%if request.GET.filter%}{{f.options|check_filter_status:request.GET.filter}} {%else%} checked {%endif%} value="" data-key="{{key}}">  All {%if filter_search_display%}{{filter_search_display|title}}{%else%}{{objectname|title}}{%endif%}
23            </label>
24          </div>
25          {% for option in f.options %}
26          <div class="radio">
27            {% if option.1 == 'daterange' %}
28            <label>
29              <input type="radio" name="filter" id="filter_value_{{key}}" {%if key == daterange_selected %}checked{%endif%} value="{{option.1}}" data-key="{{key}}"> {{option.0}}
30              {% else %}
31              {% if 1 %}
32              <label>
33                <input type="radio" name="filter" {%if request.GET.filter == option.1 %}checked{%endif%}  value="{{option.1}}" data-key="{{key}}"> {{option.0}}
34                {% comment "do not disable radio selections by count for now" %}{% else %}
35                <label class="text-muted">
36                  <input type="radio" name="filter" disabled {%if request.GET.filter == option.1 %}checked{%endif%}  value="{{option.1}}" data-key="{{key}}"> {{option.0}}
37                  {% endcomment %}{% endif %}
38                  {% endif %}
39                  {% if option.3 %}<i class="icon-question-sign get-help" data-placement="right" title="{{option.3}}"></i>{% endif %}
40                </label></div>
41                {% if option.1 == 'daterange' %}
42                <input type="text" id="date_from_{{key}}" name="date_from_{{key}}" disabled class="input-sm" /><label class="help-inline">to</label>
43                <input type="text" id="date_to_{{key}}" name="date_to_{{key}}" disabled class="input-sm"  />
44                <label class="help-inline get-help" >(dd/mm/yyyy)</label>
45        </div>
46        {% endif %}
47        {% endfor %}
48        <!-- daterange persistence -->
49        {% if last_date_from and last_date_to %}
50        <input type="hidden" id="last_date_from_{{key}}" name="last_date_from" value="{{last_date_from}}"/>
51        <input type="hidden" id="last_date_to_{{key}}" name="last_date_to"   value="{{last_date_to}}"/>
52        {% endif %}
53    </div>
54    <div class="modal-footer">
55      <div class="row">
56        <div class="col-md-6">
57          <button type="submit" class="btn btn-primary" data-key="{{key}}">Apply</button>
58        </div>
59        <div class="col-md-6">
60          {% if request.GET.filter %}
61          {% if request.GET.filter|string_remove_regex:':.*' != f.options.0.1|string_remove_regex:':.*' %}
62          <p class="text-right text-muted">You can only apply one filter to the table. This filter will override the current filter.</p>
63          {% endif %}
64          {% endif %}
65        </div>
66      </div>
67    </div>
68      </form>
69  </div><!-- /.modal-content -->
70</div><!-- /.modal-dialog -->
71</div> <!--/.modal -->
72{% endwith %}
73