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