Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MUR date filter #3036

Merged
merged 6 commits into from
Jul 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions fec/legal/templates/layouts/legal-doc-search-results.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@
</button>
<div class="filters__content">
<form id="category-filters" action="/data/legal/search/{{ result_type }}">
<div class="filters__inner">
<input id="search-type" type="hidden" name="search_type" value="{{ result_type }}">
{% block filters %}
{% endblock %}
</div>
<input id="search-type" type="hidden" name="search_type" value="{{ result_type }}">
{% block filters %}
{% endblock %}
</form>
</div>
</div>
Expand Down
24 changes: 13 additions & 11 deletions fec/legal/templates/legal-search-results-adrs.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@
{% endblock %}

{% block filters %}
{{ legal.keyword_search(result_type, query) }}
<div class="filter">
<label class="label" for="case_no">ADR number</label>
<input id="case_no" name="case_no" type="text" value="{{ case_no }}">
</div>
<div class="filter">
<label class="label" for="case_respondents">ADR respondents</label>
<input id="case_respondents" name="case_respondents" type="text" value="{{ case_respondents }}">
</div>
<div class="filter">
<button type="submit" class="button button--cta">Apply filters</button>
<div class="filters__inner">
{{ legal.keyword_search(result_type, query) }}
<div class="filter">
<label class="label" for="case_no">ADR number</label>
<input id="case_no" name="case_no" type="text" value="{{ case_no }}">
</div>
<div class="filter">
<label class="label" for="case_respondents">ADR respondents</label>
<input id="case_respondents" name="case_respondents" type="text" value="{{ case_respondents }}">
</div>
<div class="filter">
<button type="submit" class="button button--cta">Apply filters</button>
</div>
</div>
{% endblock %}

Expand Down
2 changes: 2 additions & 0 deletions fec/legal/templates/legal-search-results-afs.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{% endblock %}

{% block filters %}
<div class="filters__inner">
{{ legal.keyword_search(result_type, query) }}
<div class="filter">
<label class="label" for="case_no">Administrative fine number</label>
Expand All @@ -21,6 +22,7 @@
<div class="filter">
<button type="submit" class="button button--cta">Apply filters</button>
</div>
</div>
{% endblock %}

{% block message %}
Expand Down
52 changes: 41 additions & 11 deletions fec/legal/templates/legal-search-results-murs.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,47 @@
{% endblock %}

{% block filters %}
{{ legal.keyword_search(result_type, query) }}
<div class="filter">
<label class="label" for="case_no">MUR number</label>
<input id="case_no" name="case_no" type="text" value="{{ case_no }}">
</div>
<div class="filter">
<label class="label" for="case_respondents">MUR respondents</label>
<input id="case_respondents" name="case_respondents" type="text" value="{{ case_respondents }}">
</div>
<div class="filter">
<button type="submit" class="button button--cta">Apply filters</button>
<div class="filters__inner">
{{ legal.keyword_search(result_type, query) }}
<div class="filter">
<label class="label" for="case_no">MUR number</label>
<input id="case_no" name="case_no" type="text" value="{{ case_no }}">
</div>
<div class="filter">
<label class="label" for="case_respondents">MUR respondents</label>
<input id="case_respondents" name="case_respondents" type="text" value="{{ case_respondents }}">
</div>
<div class="filter">
<legend class="label">Case open date range</legend>
<div class="range range--date js-date-range">
<div class="range__input range__input--min" data-filter="range">
<label for="case_min_open_date">Beginning</label>
<input id="case_min_open_date" name="case_min_open_date" placeholder="mm/dd/yyyy" value="{{ case_min_open_date }}">
</div>
<div class="range__hyphen">-</div>
<div class="range__input range__input--max" data-filter="range">
<label for="case_max_open_date">Ending</label>
<input id="case_max_open_date" name="case_max_open_date" placeholder="mm/dd/yyyy" value="{{ case_max_open_date }}">
</div>
</div>
</div>
<div class="filter">
<legend class="label">Case close date range</legend>
<div class="range range--date js-date-range">
<div class="range__input range__input--min" data-filter="range">
<label for="case_min_close_date">Beginning</label>
<input id="case_min_close_date" name="case_min_close_date" placeholder="mm/dd/yyyy" value="{{ case_min_close_date }}">
</div>
<div class="range__hyphen">-</div>
<div class="range__input range__input--max" data-filter="range">
<label for="case_max_close_date">Ending</label>
<input id="case_max_close_date" name="case_max_close_date" placeholder="mm/dd/yyyy" value="{{ case_max_close_date }}">
</div>
</div>
</div>
<div class="filter">
<button type="submit" class="button button--cta u-margin--top">Apply filters</button>
</div>
</div>
{% endblock %}

Expand Down
4 changes: 2 additions & 2 deletions fec/legal/templates/partials/legal-pagination.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<div class="dataTables_info">{{ results.offset | int + 1 }}&ndash;{{ results.offset | int + results[result_type + '_returned'] | int }} of about {{ results.total_all }}</div>
<div class="dataTables_paginate">
{% if results.offset | int > 0 %}
<a class="paginate_button previous" href="/data/legal/search/{{ result_type }}/?search={{ query }}&case_respondents={{case_respondents}}&offset={{ results.offset | int - results.limit | int }}#results-{{ result_type }}">Previous</a>
<a class="paginate_button previous" href="/data/legal/search/{{ result_type }}/?search={{ query }}&case_respondents={{ case_respondents }}&case_min_open_date={{ case_min_open_date }}&case_max_open_date={{ case_max_open_date }}&case_min_close_date={{ case_min_close_date }}&case_max_close_date={{ case_max_close_date }}&offset={{ results.offset | int - results.limit | int }}#results-{{ result_type }}">Previous</a>
{% else %}
<span class="paginate_button previous is-disabled">Previous</span>
{% endif %}
{% if results.offset | int + results.limit | int < results.total_all | int %}
<a class="paginate_button next" href="/data/legal/search/{{ result_type }}/?search={{ query }}&case_respondents={{case_respondents}}&offset={{ results.offset | int + results.limit | int }}#results-{{ result_type }}">Next</a>
<a class="paginate_button next" href="/data/legal/search/{{ result_type }}/?search={{ query }}&case_respondents={{ case_respondents }}&case_min_open_date={{ case_min_open_date }}&case_max_open_date={{ case_max_open_date }}&case_min_close_date={{ case_min_close_date }}&case_max_close_date={{ case_max_close_date }}&offset={{ results.offset | int + results.limit | int }}#results-{{ result_type }}">Next</a>
{% else %}
<span class="paginate_button next is-disabled">Next</span>
{% endif %}
Expand Down
3 changes: 2 additions & 1 deletion fec/legal/templates/partials/legal-search-results-mur.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
{{ highlight|safe }} &hellip;
{% endfor %}
</div>
<div><strong>Date closed:</strong> {{ mur.close_date | date('%Y') | default('Unknown', True) }}</div>
<div><strong>Date opened:</strong> {{ mur.open_date | date('%m/%d/%Y') | default('Unknown', True) }}</div>
<div><strong>Date closed:</strong> {{ mur.close_date | date('%m/%d/%Y') | default('Unknown', True) }}</div>
{% if mur.mur_type == 'current' %}
{# Archived MUR subjects are a tree-structure so we don't render them inline #}
<div>
Expand Down
21 changes: 19 additions & 2 deletions fec/legal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,32 @@ def legal_doc_search_mur(request):
offset = request.GET.get('offset', 0)
case_no = request.GET.get('case_no', '')
case_respondents = request.GET.get('case_respondents', '')

results = api_caller.load_legal_search_results(query, 'murs', offset=offset, case_no=case_no, case_respondents=case_respondents)
case_min_open_date = request.GET.get('case_min_open_date', '')
case_max_open_date = request.GET.get('case_max_open_date', '')
case_min_close_date = request.GET.get('case_min_close_date', '')
case_max_close_date = request.GET.get('case_max_close_date', '')

results = api_caller.load_legal_search_results(
query, 'murs',
offset=offset,
case_no=case_no,
case_respondents=case_respondents,
case_min_open_date=case_min_open_date,
case_max_open_date=case_max_open_date,
case_min_close_date=case_min_close_date,
case_max_close_date=case_max_close_date
)

return render(request, 'legal-search-results-murs.jinja', {
'parent': 'legal',
'results': results,
'result_type': 'murs',
'case_no': case_no,
'case_respondents': case_respondents,
'case_min_open_date': case_min_open_date,
'case_max_open_date': case_max_open_date,
'case_min_close_date': case_min_close_date,
'case_max_close_date': case_max_close_date,
'query': query
})

Expand Down