@@ -, +, @@
---
.../prog/en/modules/bookings/list.tt | 33 ++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt
@@ -43,6 +43,10 @@
Bookings for [% INCLUDE 'biblio-title-head.inc' %]
@@ -198,6 +202,18 @@
}
);
+ let filter_expired = true;
+ let additional_filters = {
+ end_date: function(){
+ if ( filter_expired ) {
+ let today = new Date();
+ return { ">=": today.toISOString() }
+ } else {
+ return;
+ }
+ }
+ };
+
var bookings_table_url = "/api/v1/biblios/[% biblionumber | uri %]/bookings";
bookings_table = $('#bookings_table').kohaTable({
"ajax": {
@@ -281,7 +297,22 @@
return result;
}
}]
- }, [], 0);
+ }, [], 0, additional_filters);
+
+ var txtActivefilter = _("Show expired");
+ var txtInactivefilter = _("Hide expired");
+ $("#expired_filter").on("click", function() {
+ if ($(this).hasClass('filtered')){
+ filter_expired = false;
+ $(this).html(' '+txtInactivefilter);
+ } else {
+ filter_expired = true;
+ $(this).html(' '+txtActivefilter);
+ }
+ bookings_table.DataTable().draw();
+ $(this).toggleClass('filtered');
+ });
+
});
[% END %]
--