Lines 46-51
Link Here
|
46 |
filters = [ |
46 |
filters = [ |
47 |
{ id = 'filter-expired', label_show = t('Include expired'), label_hide = t('Exclude expired') }, |
47 |
{ id = 'filter-expired', label_show = t('Include expired'), label_hide = t('Exclude expired') }, |
48 |
{ id = 'filter-cancelled', label_show = t('Include cancelled'), label_hide = t('Exclude cancelled') }, |
48 |
{ id = 'filter-cancelled', label_show = t('Include cancelled'), label_hide = t('Exclude cancelled') }, |
|
|
49 |
{ id = 'filter-completed', label_show = t('Include completed'), label_hide = t('Exclude completed') }, |
49 |
] |
50 |
] |
50 |
filter_class = 'bookings' |
51 |
filter_class = 'bookings' |
51 |
%] |
52 |
%] |
Lines 125-131
Link Here
|
125 |
content: !isActive ? `<s>${patronContent}</s>` : patronContent, |
126 |
content: !isActive ? `<s>${patronContent}</s>` : patronContent, |
126 |
className: booking.status === "cancelled" ? "cancelled" : "", |
127 |
className: booking.status === "cancelled" ? "cancelled" : "", |
127 |
[% IF CAN_user_circulate_manage_bookings %] |
128 |
[% IF CAN_user_circulate_manage_bookings %] |
128 |
editable: booking.status !== "cancelled" ? { remove: true, updateTime: true } : false, |
129 |
editable: !["cancelled", "completed"].includes(booking.status) ? { remove: true, updateTime: true } : false, |
129 |
[% ELSE %] |
130 |
[% ELSE %] |
130 |
editable: false, |
131 |
editable: false, |
131 |
[% END %] |
132 |
[% END %] |
Lines 210-216
Link Here
|
210 |
} |
211 |
} |
211 |
); |
212 |
); |
212 |
|
213 |
|
213 |
const additional_filters = AdditionalFilters.init(["filter-expired", "filter-cancelled"]) |
214 |
const additional_filters = AdditionalFilters.init(["filter-expired", "filter-cancelled", "filter-completed"]) |
214 |
.onChange((filters, { anyFiltersNotApplied }) => { |
215 |
.onChange((filters, { anyFiltersNotApplied }) => { |
215 |
bookings_table.DataTable().ajax.reload(() => { |
216 |
bookings_table.DataTable().ajax.reload(() => { |
216 |
bookings_table |
217 |
bookings_table |
Lines 232-237
Link Here
|
232 |
if (isNotApplied(filters['filter-cancelled'])) { |
233 |
if (isNotApplied(filters['filter-cancelled'])) { |
233 |
filtered.push("cancelled"); |
234 |
filtered.push("cancelled"); |
234 |
} |
235 |
} |
|
|
236 |
if (isNotApplied(filters['filter-completed'])) { |
237 |
filtered.push("completed"); |
238 |
} |
235 |
return { "-in": filtered }; |
239 |
return { "-in": filtered }; |
236 |
} |
240 |
} |
237 |
}); |
241 |
}); |
Lines 373-379
Link Here
|
373 |
"orderable": false, |
377 |
"orderable": false, |
374 |
"render": function(data, type, row, meta) { |
378 |
"render": function(data, type, row, meta) { |
375 |
let result = ""; |
379 |
let result = ""; |
376 |
const is_readonly = row.status === "cancelled"; |
380 |
const is_readonly = ["cancelled", "completed"].includes(row.status); |
377 |
[% IF CAN_user_circulate_manage_bookings %] |
381 |
[% IF CAN_user_circulate_manage_bookings %] |
378 |
if (!is_readonly) { |
382 |
if (!is_readonly) { |
379 |
result += ` |
383 |
result += ` |
Lines 421-429
Link Here
|
421 |
<input type="hidden" name="borrowernumber" value="%s"/> |
425 |
<input type="hidden" name="borrowernumber" value="%s"/> |
422 |
<input type="hidden" name="barcode" value="%s"/> |
426 |
<input type="hidden" name="barcode" value="%s"/> |
423 |
<input type="hidden" name="duedatespec" value="%s"/> |
427 |
<input type="hidden" name="duedatespec" value="%s"/> |
424 |
<input type="hidden" name="booking_id" value="%s"/> |
|
|
425 |
<button id="checkout_action" class="btn btn-default btn-xs" type="submit"> |
428 |
<button id="checkout_action" class="btn btn-default btn-xs" type="submit"> |
426 |
%s |
429 |
<i class="fa fa-check-circle" aria-hidden="true"></i> %s |
427 |
</button> |
430 |
</button> |
428 |
</form> |
431 |
</form> |
429 |
`.format( |
432 |
`.format( |
Lines 431-437
Link Here
|
431 |
escape_str(row.patron_id), |
434 |
escape_str(row.patron_id), |
432 |
escape_str(row.item.external_id), |
435 |
escape_str(row.item.external_id), |
433 |
escape_str(row.end_date), |
436 |
escape_str(row.end_date), |
434 |
escape_str(row.booking_id), |
|
|
435 |
_("Transform to checkout") |
437 |
_("Transform to checkout") |
436 |
); |
438 |
); |
437 |
} |
439 |
} |
438 |
- |
|
|