Bug 8287: Improve "show checked out items" filter on the overdues report

The "Show any items currently checked out" was confusing, especially if
the "From" and "To" due date filters were passed.

This patch moves the checkbox close to the 2 other filters and show/hide
the due date filters when needed.

Test plan:
0. Have some overdue
1. Search for overdues
2. Confirm that the filters are shown/hidden depending on the status of
the checkbox
3. Fill "To" with a date, tick the checkbox, submit the form
=> Confirm that the date was not taken into account

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-12-16 15:28:50 +01:00
parent a63748e241
commit 35994c1da5

View file

@ -116,14 +116,25 @@
<h4>Filter on:</h4>
<fieldset><legend>Date due:</legend>
<ol>
<li><label for="from">From:</label>
<li class="radio">
<label for="showall">Show any items currently checked out:</label>
[% IF ( showall ) %]
<input type="checkbox" id="showall" name="showall" value="show" checked="checked" />
[% ELSE %]
<input type="checkbox" id="showall" name="showall" value="show" />
[% END %]
</li>
<li class="date_due_filter">
<label for="from">From:</label>
<input type="text" id="from" name="dateduefrom" size="10" value="[% filters.dateduefrom | $KohaDates %]" class="datepickerfrom" />
</li>
<li>
<li class="date_due_filter">
<label for="to">To:</label>
<input type="text" id="to" name="datedueto" size="10" value="[% filters.datedueto | $KohaDates %]" class="datepickerto" />
</li>
</ol></fieldset>
</ol>
</fieldset>
<ol>
<li><label>Name or cardnumber:</label><input type="text" name="borname" value="[% filters.borname | html %]" /></li>
<li><label>Patron category:</label><select name="borcat" id="borcat"><option value="">Any</option>
@ -132,6 +143,7 @@
[% END %]
</select>
</li>
<li><label>Patron flags:</label>
<select name="borflag" size="1" id="borflag">
<option value="">None</option>
@ -202,13 +214,6 @@
</select>
</li>
<li class="radio"><label for="showall">Show any items currently checked out:</label>
[% IF ( showall ) %]
<input type="checkbox" id="showall" name="showall" value="show" checked="checked" />
[% ELSE %]
<input type="checkbox" id="showall" name="showall" value="show" />
[% END %]
</li>
</ol>
<fieldset class="action">
<input type="submit" value="Apply filter" class="submit" />
@ -277,6 +282,18 @@
});
}
function update_date_due_filters_visibility(){
if( $("#showall").is(":checked")) {
$(".date_due_filter").hide();
$("#from").prop("disabled", true);
$("#to").prop("disabled", true);
} else {
$(".date_due_filter").show();
$("#from").prop("disabled", false);
$("#to").prop("disabled", false);
}
}
$(document).ready(function(){
var columns_settings = [% TablesSettings.GetColumns( 'circ', 'overdues', 'circ-overdues', 'json' ) | $raw %];
KohaTable("overduest", {
@ -285,6 +302,11 @@
"autoWidth": false,
"stateSave": true
}, columns_settings);
$("#showall").on("change", function(){
update_date_due_filters_visibility();
});
update_date_due_filters_visibility();
});
</script>
[% END %]