|
Lines 72-77
Link Here
|
| 72 |
var bookings_table; |
72 |
var bookings_table; |
| 73 |
var timeline; |
73 |
var timeline; |
| 74 |
let biblionumber = "[% biblionumber | uri %]"; |
74 |
let biblionumber = "[% biblionumber | uri %]"; |
|
|
75 |
addPermissions({ |
| 76 |
CAN_user_circulate_manage_bookings: [% CAN_user_circulate_manage_bookings ? 1 : 0 | html %], |
| 77 |
}); |
| 78 |
</script> |
| 79 |
<script> |
| 75 |
$(document).ready(function(){ |
80 |
$(document).ready(function(){ |
| 76 |
|
81 |
|
| 77 |
var items = $.ajax({ |
82 |
var items = $.ajax({ |
|
Lines 115-125
Link Here
|
| 115 |
end: dayjs(booking.end_date).toDate(), |
120 |
end: dayjs(booking.end_date).toDate(), |
| 116 |
content: !isActive ? `<s>${patronContent}</s>` : patronContent, |
121 |
content: !isActive ? `<s>${patronContent}</s>` : patronContent, |
| 117 |
className: booking.status === "cancelled" ? "cancelled" : "", |
122 |
className: booking.status === "cancelled" ? "cancelled" : "", |
| 118 |
[% IF CAN_user_circulate_manage_bookings %] |
123 |
...(permissions.CAN_user_circulate_manage_bookings |
| 119 |
editable: !["cancelled", "completed"].includes(booking.status) ? { remove: true, updateTime: true } : false, |
124 |
? {editable: !["cancelled", "completed"].includes(booking.status) ? { remove: true, updateTime: true } : false} |
| 120 |
[% ELSE %] |
125 |
: {editable: false} |
| 121 |
editable: false, |
126 |
), |
| 122 |
[% END %] |
|
|
| 123 |
type: 'range', |
127 |
type: 'range', |
| 124 |
group: booking.item_id ?? 0, |
128 |
group: booking.item_id ?? 0, |
| 125 |
}); |
129 |
}); |
|
Lines 170-176
Link Here
|
| 170 |
// set end datetime hours and minutes to the end of the day |
174 |
// set end datetime hours and minutes to the end of the day |
| 171 |
let endDate = dayjs(data.end).endOf('day'); |
175 |
let endDate = dayjs(data.end).endOf('day'); |
| 172 |
|
176 |
|
| 173 |
$('#placeBookingModal').modal('show', $('<button data-booking="'+data.id+'" data-biblionumber="[% biblionumber | uri %]" data-itemnumber="'+data.group+'" data-patron="'+data.patron+'" data-pickup_library="'+data.pickup_library+'" data-start_date="'+startDate.toISOString()+'" data-end_date="'+endDate.toISOString()+'">')); |
177 |
$('#placeBookingModal').modal('show', $('<button data-booking="'+data.id+'" data-biblionumber="' + biblionumber + '" data-itemnumber="'+data.group+'" data-patron="'+data.patron+'" data-pickup_library="'+data.pickup_library+'" data-start_date="'+startDate.toISOString()+'" data-end_date="'+endDate.toISOString()+'">')); |
| 174 |
$('#placeBookingModal').on('hide.bs.modal', function(e) { |
178 |
$('#placeBookingModal').on('hide.bs.modal', function(e) { |
| 175 |
if (update_success) { |
179 |
if (update_success) { |
| 176 |
update_success = 0; |
180 |
update_success = 0; |
|
Lines 363-370
Link Here
|
| 363 |
render: function(data, type, row, meta) { |
367 |
render: function(data, type, row, meta) { |
| 364 |
let result = ""; |
368 |
let result = ""; |
| 365 |
const is_readonly = ["cancelled", "completed"].includes(row.status); |
369 |
const is_readonly = ["cancelled", "completed"].includes(row.status); |
| 366 |
[% IF CAN_user_circulate_manage_bookings %] |
370 |
if (permissions.CAN_user_circulate_manage_bookings && !is_readonly) { |
| 367 |
if (!is_readonly) { |
|
|
| 368 |
result += ` |
371 |
result += ` |
| 369 |
<button type="button" class="btn btn-default btn-xs edit-action" |
372 |
<button type="button" class="btn btn-default btn-xs edit-action" |
| 370 |
data-bs-toggle="modal" |
373 |
data-bs-toggle="modal" |
|
Lines 403-411
Link Here
|
| 403 |
escape_str(row.booking_id), |
406 |
escape_str(row.booking_id), |
| 404 |
_("Cancel") |
407 |
_("Cancel") |
| 405 |
); |
408 |
); |
|
|
409 |
const csrf_token = $('meta[name="csrf-token"]').attr("content"); |
| 406 |
result += ` |
410 |
result += ` |
| 407 |
<form name="checkout-transform" method="post" action="/cgi-bin/koha/circ/circulation.pl?borrowernumber=%s"> |
411 |
<form name="checkout-transform" method="post" action="/cgi-bin/koha/circ/circulation.pl?borrowernumber=%s"> |
| 408 |
[% INCLUDE 'csrf-token.inc' %] |
412 |
<input type="hidden" name="csrf_token" value="${csrf_token}" /> |
| 409 |
<input type="hidden" name="op" value="cud-checkout"/> |
413 |
<input type="hidden" name="op" value="cud-checkout"/> |
| 410 |
<input type="hidden" name="borrowernumber" value="%s"/> |
414 |
<input type="hidden" name="borrowernumber" value="%s"/> |
| 411 |
<input type="hidden" name="barcode" value="%s"/> |
415 |
<input type="hidden" name="barcode" value="%s"/> |
|
Lines 422-428
Link Here
|
| 422 |
_("Transform to checkout") |
426 |
_("Transform to checkout") |
| 423 |
); |
427 |
); |
| 424 |
} |
428 |
} |
| 425 |
[% END %] |
|
|
| 426 |
return result; |
429 |
return result; |
| 427 |
} |
430 |
} |
| 428 |
}] |
431 |
}] |
| 429 |
- |
|
|