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