|
Lines 4-11
var bookings_table;
Link Here
|
| 4 |
$(document).ready(function () { |
4 |
$(document).ready(function () { |
| 5 |
// Load bookings table on tab selection |
5 |
// Load bookings table on tab selection |
| 6 |
$("#bookings-tab").on("click", function () { |
6 |
$("#bookings-tab").on("click", function () { |
|
|
7 |
let filter_expired = true; |
| 8 |
let additional_filters = { |
| 9 |
patron_id: patron_borrowernumber, |
| 10 |
end_date: function () { |
| 11 |
if (filter_expired) { |
| 12 |
let today = new Date(); |
| 13 |
return { ">=": today.toISOString() } |
| 14 |
} else { |
| 15 |
return; |
| 16 |
} |
| 17 |
} |
| 18 |
}; |
| 19 |
|
| 7 |
if (!bookings_table) { |
20 |
if (!bookings_table) { |
| 8 |
var today = new Date(); |
21 |
|
| 9 |
var bookings_table_url = "/api/v1/bookings"; |
22 |
var bookings_table_url = "/api/v1/bookings"; |
| 10 |
bookings_table = $("#bookings_table").kohaTable( |
23 |
bookings_table = $("#bookings_table").kohaTable( |
| 11 |
{ |
24 |
{ |
|
Lines 87-99
$(document).ready(function () {
Link Here
|
| 87 |
}, |
100 |
}, |
| 88 |
], |
101 |
], |
| 89 |
}, |
102 |
}, |
| 90 |
table_settings_bookings_table, |
103 |
table_settings_bookings_table, 0, additional_filters |
| 91 |
0, |
|
|
| 92 |
{ |
| 93 |
patron_id: patron_borrowernumber, |
| 94 |
end_date: { ">=": today.toISOString() }, |
| 95 |
} |
| 96 |
); |
104 |
); |
| 97 |
} |
105 |
} |
| 98 |
}); |
106 |
}); |
|
|
107 |
|
| 108 |
var txtActivefilter = _("Show expired"); |
| 109 |
var txtInactivefilter = _("Hide expired"); |
| 110 |
$("#expired_filter").on("click", function () { |
| 111 |
if ($(this).hasClass('filtered')) { |
| 112 |
filter_expired = false; |
| 113 |
$(this).html('<i class="fa fa-filter"></i> ' + txtInactivefilter); |
| 114 |
} else { |
| 115 |
filter_expired = true; |
| 116 |
$(this).html('<i class="fa fa-bars"></i> ' + txtActivefilter); |
| 117 |
} |
| 118 |
bookings_table.DataTable().draw(); |
| 119 |
$(this).toggleClass('filtered'); |
| 120 |
}); |
| 121 |
|
| 99 |
}); |
122 |
}); |
| 100 |
- |
|
|