Lines 1-4
Link Here
|
1 |
/* global __ */ |
1 |
/* global __, ServerSideCheckoutsTables: false */ |
2 |
|
2 |
|
3 |
function CheckRenewCheckinBoxes() { |
3 |
function CheckRenewCheckinBoxes() { |
4 |
$("#RenewChecked").prop("disabled", !$(".renew:checked").length); |
4 |
$("#RenewChecked").prop("disabled", !$(".renew:checked").length); |
Lines 61-97
function LoadIssuesTable() {
Link Here
|
61 |
processing: msg_loading, |
61 |
processing: msg_loading, |
62 |
}, |
62 |
}, |
63 |
autoWidth: false, |
63 |
autoWidth: false, |
64 |
dom: '<"table_controls"B>rt', |
64 |
order: [], |
65 |
columns: [ |
65 |
columns: [ |
66 |
{ |
|
|
67 |
data: function (oObj) { |
68 |
return oObj.sort_order; |
69 |
}, |
70 |
}, |
71 |
{ |
72 |
data: function (oObj) { |
73 |
if (oObj.issued_today) { |
74 |
return ( |
75 |
"<strong>" + |
76 |
__("Today's checkouts") + |
77 |
"</strong>" |
78 |
); |
79 |
} else { |
80 |
return ( |
81 |
"<strong>" + |
82 |
__("Previous checkouts") + |
83 |
"</strong>" |
84 |
); |
85 |
} |
86 |
}, |
87 |
}, |
88 |
{ |
66 |
{ |
89 |
data: "date_due", |
67 |
data: "date_due", |
90 |
visible: false, |
68 |
render: function (data, type, oObj) { |
91 |
}, |
|
|
92 |
{ |
93 |
orderData: 2, // Sort on hidden unformatted date due column |
94 |
data: function (oObj) { |
95 |
let date_due_formatted = $datetime(oObj.date_due, { |
69 |
let date_due_formatted = $datetime(oObj.date_due, { |
96 |
as_due_date: true, |
70 |
as_due_date: true, |
97 |
no_tz_adjust: true, |
71 |
no_tz_adjust: true, |
Lines 142-148
function LoadIssuesTable() {
Link Here
|
142 |
}, |
116 |
}, |
143 |
}, |
117 |
}, |
144 |
{ |
118 |
{ |
145 |
data: function (oObj) { |
119 |
data: "title", |
|
|
120 |
render: function (data, type, oObj) { |
146 |
let title = |
121 |
let title = |
147 |
"<span id='title_" + |
122 |
"<span id='title_" + |
148 |
oObj.itemnumber + |
123 |
oObj.itemnumber + |
Lines 247-275
function LoadIssuesTable() {
Link Here
|
247 |
type: "anti-the", |
222 |
type: "anti-the", |
248 |
}, |
223 |
}, |
249 |
{ |
224 |
{ |
250 |
data: function (oObj) { |
225 |
data: "recordtype", |
|
|
226 |
render: function (data, type, oObj) { |
251 |
return oObj.recordtype_description.escapeHtml(); |
227 |
return oObj.recordtype_description.escapeHtml(); |
252 |
}, |
228 |
}, |
253 |
}, |
229 |
}, |
254 |
{ |
230 |
{ |
255 |
data: function (oObj) { |
231 |
data: "itemtype", |
|
|
232 |
render: function (data, type, oObj) { |
256 |
return oObj.itemtype_description.escapeHtml(); |
233 |
return oObj.itemtype_description.escapeHtml(); |
257 |
}, |
234 |
}, |
258 |
}, |
235 |
}, |
259 |
{ |
236 |
{ |
260 |
data: function (oObj) { |
237 |
data: "collection", |
|
|
238 |
render: function (data, type, oObj) { |
261 |
return oObj.collection |
239 |
return oObj.collection |
262 |
? oObj.collection.escapeHtml() |
240 |
? oObj.collection.escapeHtml() |
263 |
: ""; |
241 |
: ""; |
264 |
}, |
242 |
}, |
265 |
}, |
243 |
}, |
266 |
{ |
244 |
{ |
267 |
data: function (oObj) { |
245 |
data: "location", |
|
|
246 |
render: function (data, type, oObj) { |
268 |
return oObj.location ? oObj.location.escapeHtml() : ""; |
247 |
return oObj.location ? oObj.location.escapeHtml() : ""; |
269 |
}, |
248 |
}, |
270 |
}, |
249 |
}, |
271 |
{ |
250 |
{ |
272 |
data: function (oObj) { |
251 |
data: "homebranch", |
|
|
252 |
render: function (data, type, oObj) { |
273 |
return oObj.homebranch |
253 |
return oObj.homebranch |
274 |
? oObj.homebranch.escapeHtml() |
254 |
? oObj.homebranch.escapeHtml() |
275 |
: ""; |
255 |
: ""; |
Lines 277-315
function LoadIssuesTable() {
Link Here
|
277 |
}, |
257 |
}, |
278 |
{ |
258 |
{ |
279 |
data: "issuedate", |
259 |
data: "issuedate", |
280 |
visible: false, |
260 |
render: function (data, type, oObj) { |
281 |
}, |
|
|
282 |
{ |
283 |
orderData: 10, // Sort on hidden unformatted issuedate column |
284 |
data: function (oObj) { |
285 |
return $datetime(oObj.issuedate, { |
261 |
return $datetime(oObj.issuedate, { |
286 |
no_tz_adjust: true, |
262 |
no_tz_adjust: true, |
287 |
}); |
263 |
}); |
288 |
}, |
264 |
}, |
289 |
}, |
265 |
}, |
290 |
{ |
266 |
{ |
291 |
data: function (oObj) { |
267 |
data: "branchcode", |
|
|
268 |
render: function (data, type, oObj) { |
292 |
return oObj.branchname |
269 |
return oObj.branchname |
293 |
? oObj.branchname.escapeHtml() |
270 |
? oObj.branchname.escapeHtml() |
294 |
: ""; |
271 |
: ""; |
295 |
}, |
272 |
}, |
296 |
}, |
273 |
}, |
297 |
{ |
274 |
{ |
298 |
data: function (oObj) { |
275 |
data: "itemcallnumber", |
|
|
276 |
render: function (data, type, oObj) { |
299 |
return oObj.itemcallnumber |
277 |
return oObj.itemcallnumber |
300 |
? oObj.itemcallnumber.escapeHtml() |
278 |
? oObj.itemcallnumber.escapeHtml() |
301 |
: ""; |
279 |
: ""; |
302 |
}, |
280 |
}, |
303 |
}, |
281 |
}, |
304 |
{ |
282 |
{ |
305 |
data: function (oObj) { |
283 |
data: "copynumber", |
|
|
284 |
render: function (data, type, oObj) { |
306 |
return oObj.copynumber |
285 |
return oObj.copynumber |
307 |
? oObj.copynumber.escapeHtml() |
286 |
? oObj.copynumber.escapeHtml() |
308 |
: ""; |
287 |
: ""; |
309 |
}, |
288 |
}, |
310 |
}, |
289 |
}, |
311 |
{ |
290 |
{ |
312 |
data: function (oObj) { |
291 |
data: "charge", |
|
|
292 |
render: function (data, type, oObj) { |
313 |
if (!oObj.charge) oObj.charge = 0; |
293 |
if (!oObj.charge) oObj.charge = 0; |
314 |
return ( |
294 |
return ( |
315 |
'<span style="text-align: right; display: block;">' + |
295 |
'<span style="text-align: right; display: block;">' + |
Lines 320-326
function LoadIssuesTable() {
Link Here
|
320 |
className: "nowrap", |
300 |
className: "nowrap", |
321 |
}, |
301 |
}, |
322 |
{ |
302 |
{ |
323 |
data: function (oObj) { |
303 |
data: "fine", |
|
|
304 |
render: function (data, type, oObj) { |
324 |
if (!oObj.fine) oObj.fine = 0; |
305 |
if (!oObj.fine) oObj.fine = 0; |
325 |
return ( |
306 |
return ( |
326 |
'<span style="text-align: right; display: block;">' + |
307 |
'<span style="text-align: right; display: block;">' + |
Lines 331-337
function LoadIssuesTable() {
Link Here
|
331 |
className: "nowrap", |
312 |
className: "nowrap", |
332 |
}, |
313 |
}, |
333 |
{ |
314 |
{ |
334 |
data: function (oObj) { |
315 |
data: "price", |
|
|
316 |
render: function (data, type, oObj) { |
335 |
if (!oObj.price) oObj.price = 0; |
317 |
if (!oObj.price) oObj.price = 0; |
336 |
return ( |
318 |
return ( |
337 |
'<span style="text-align: right; display: block;">' + |
319 |
'<span style="text-align: right; display: block;">' + |
Lines 343-349
function LoadIssuesTable() {
Link Here
|
343 |
}, |
325 |
}, |
344 |
{ |
326 |
{ |
345 |
orderable: false, |
327 |
orderable: false, |
346 |
data: function (oObj) { |
328 |
render: function (data, type, oObj) { |
347 |
var content = ""; |
329 |
var content = ""; |
348 |
var msg = ""; |
330 |
var msg = ""; |
349 |
var span_style = ""; |
331 |
var span_style = ""; |
Lines 555-561
function LoadIssuesTable() {
Link Here
|
555 |
}, |
537 |
}, |
556 |
{ |
538 |
{ |
557 |
orderable: false, |
539 |
orderable: false, |
558 |
data: function (oObj) { |
540 |
render: function (data, type, oObj) { |
559 |
if (oObj.can_renew_error == "recalled") { |
541 |
if (oObj.can_renew_error == "recalled") { |
560 |
return ( |
542 |
return ( |
561 |
"<a href='/cgi-bin/koha/recalls/request.pl?biblionumber=" + |
543 |
"<a href='/cgi-bin/koha/recalls/request.pl?biblionumber=" + |
Lines 589-595
function LoadIssuesTable() {
Link Here
|
589 |
}, |
571 |
}, |
590 |
{ |
572 |
{ |
591 |
orderable: false, |
573 |
orderable: false, |
592 |
data: function (oObj) { |
574 |
render: function (data, type, oObj) { |
593 |
let content = ""; |
575 |
let content = ""; |
594 |
|
576 |
|
595 |
if (oObj.return_claim_id) { |
577 |
if (oObj.return_claim_id) { |
Lines 615-621
function LoadIssuesTable() {
Link Here
|
615 |
}, |
597 |
}, |
616 |
{ |
598 |
{ |
617 |
orderable: false, |
599 |
orderable: false, |
618 |
data: function (oObj) { |
600 |
render: function (data, type, oObj) { |
619 |
var s = |
601 |
var s = |
620 |
"<input type='checkbox' name='itemnumbers' value='" + |
602 |
"<input type='checkbox' name='itemnumbers' value='" + |
621 |
oObj.itemnumber + |
603 |
oObj.itemnumber + |
Lines 644-656
function LoadIssuesTable() {
Link Here
|
644 |
$("#totalfine").html(total_fine.format_price()); |
626 |
$("#totalfine").html(total_fine.format_price()); |
645 |
$("#totalprice").html(total_price.format_price()); |
627 |
$("#totalprice").html(total_price.format_price()); |
646 |
}, |
628 |
}, |
647 |
paging: false, |
629 |
paging: ServerSideCheckoutsTables, |
648 |
processing: true, |
630 |
processing: true, |
649 |
serverSide: false, |
631 |
serverSide: ServerSideCheckoutsTables, |
650 |
ajax: { |
632 |
ajax: { |
651 |
url: "/cgi-bin/koha/svc/checkouts?borrowernumber=%s".format( |
633 |
url: "/cgi-bin/koha/svc/checkouts", |
652 |
borrowernumber |
634 |
data(data) { |
653 |
), |
635 |
return Object.assign({}, data, { |
|
|
636 |
borrowernumber, |
637 |
date_due_sorton: "issues.date_due", |
638 |
title_sorton: "biblio.title", |
639 |
recordtype_sorton: "biblioitems.itemtype", |
640 |
itemtype_sorton: "items.itype", |
641 |
collection_sorton: "items.ccode", |
642 |
location_sorton: "items.location", |
643 |
homebranch_sorton: "items.homebranch", |
644 |
issuedate_sorton: "issues.issuedate", |
645 |
branchcode_sorton: "issues.branchcode", |
646 |
itemcallnumber_sorton: "items.itemcallnumber", |
647 |
copynumber_sorton: "items.copynumber", |
648 |
}); |
649 |
}, |
654 |
}, |
650 |
}, |
655 |
bKohaAjaxSVC: true, |
651 |
bKohaAjaxSVC: true, |
656 |
rowGroup: { |
652 |
rowGroup: { |
Lines 667-673
function LoadIssuesTable() {
Link Here
|
667 |
CheckRenewCheckinBoxes(); |
663 |
CheckRenewCheckinBoxes(); |
668 |
|
664 |
|
669 |
// Build a summary of checkouts grouped by itemtype |
665 |
// Build a summary of checkouts grouped by itemtype |
670 |
var checkoutsByItype = json.aaData.reduce(function (obj, row) { |
666 |
var checkoutsByItype = json.data.reduce(function (obj, row) { |
671 |
obj[row.type_for_stat] = (obj[row.type_for_stat] || 0) + 1; |
667 |
obj[row.type_for_stat] = (obj[row.type_for_stat] || 0) + 1; |
672 |
return obj; |
668 |
return obj; |
673 |
}, {}); |
669 |
}, {}); |
Lines 696-701
function LoadIssuesTable() {
Link Here
|
696 |
table_settings_issues_table |
692 |
table_settings_issues_table |
697 |
); |
693 |
); |
698 |
|
694 |
|
|
|
695 |
var groupingSwitch = $('<input type="checkbox">') |
696 |
.attr("id", "issues-table-row-grouping-switch") |
697 |
.attr("checked", "checked") |
698 |
.css("vertical-align", "middle") |
699 |
.change(function () { |
700 |
if (this.checked) { |
701 |
issuesTable.api().rowGroup().enable(); |
702 |
issuesTable.api().draw(); |
703 |
} else { |
704 |
issuesTable.api().rowGroup().disable(); |
705 |
issuesTable.api().draw(); |
706 |
} |
707 |
}); |
708 |
$("<div></div>") |
709 |
.css("float", "left") |
710 |
.css("padding", "0.3em 0.5em") |
711 |
.css("line-height", "1.9em") |
712 |
.append(groupingSwitch) |
713 |
.append(" ") |
714 |
.append( |
715 |
'<label for="issues-table-row-grouping-switch">' + |
716 |
__("Group today's checkouts") + |
717 |
"</label>" |
718 |
) |
719 |
.appendTo("#issues-table_wrapper .top.pager"); |
720 |
|
699 |
if ($("#issues-table").length) { |
721 |
if ($("#issues-table").length) { |
700 |
$("#issues-table_processing").position({ |
722 |
$("#issues-table_processing").position({ |
701 |
of: $("#issues-table"), |
723 |
of: $("#issues-table"), |
Lines 1091-1106
$(document).ready(function () {
Link Here
|
1091 |
relativesIssuesTable = $("#relatives-issues-table").kohaTable( |
1113 |
relativesIssuesTable = $("#relatives-issues-table").kohaTable( |
1092 |
{ |
1114 |
{ |
1093 |
autoWidth: false, |
1115 |
autoWidth: false, |
1094 |
dom: '<"table_controls"B>rt', |
|
|
1095 |
order: [], |
1116 |
order: [], |
1096 |
columns: [ |
1117 |
columns: [ |
1097 |
{ |
1118 |
{ |
1098 |
data: "date_due", |
1119 |
data: "date_due", |
1099 |
visible: false, |
1120 |
render: function (data, type, oObj) { |
1100 |
}, |
|
|
1101 |
{ |
1102 |
orderData: 0, // Sort on hidden unformatted date due column |
1103 |
data: function (oObj) { |
1104 |
var today = new Date(); |
1121 |
var today = new Date(); |
1105 |
var due = new Date(oObj.date_due); |
1122 |
var due = new Date(oObj.date_due); |
1106 |
let date_due_formatted = $datetime( |
1123 |
let date_due_formatted = $datetime( |
Lines 1119-1125
$(document).ready(function () {
Link Here
|
1119 |
}, |
1136 |
}, |
1120 |
}, |
1137 |
}, |
1121 |
{ |
1138 |
{ |
1122 |
data: function (oObj) { |
1139 |
data: "title", |
|
|
1140 |
render: function (data, type, oObj) { |
1123 |
let title = |
1141 |
let title = |
1124 |
"<span class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + |
1142 |
"<span class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + |
1125 |
oObj.biblionumber + |
1143 |
oObj.biblionumber + |
Lines 1218-1241
$(document).ready(function () {
Link Here
|
1218 |
type: "anti-the", |
1236 |
type: "anti-the", |
1219 |
}, |
1237 |
}, |
1220 |
{ |
1238 |
{ |
1221 |
data: function (oObj) { |
1239 |
data: "recordtype", |
|
|
1240 |
render: function (data, type, oObj) { |
1222 |
return oObj.recordtype_description.escapeHtml(); |
1241 |
return oObj.recordtype_description.escapeHtml(); |
1223 |
}, |
1242 |
}, |
1224 |
}, |
1243 |
}, |
1225 |
{ |
1244 |
{ |
1226 |
data: function (oObj) { |
1245 |
data: "itemtype", |
|
|
1246 |
render: function (data, type, oObj) { |
1227 |
return oObj.itemtype_description.escapeHtml(); |
1247 |
return oObj.itemtype_description.escapeHtml(); |
1228 |
}, |
1248 |
}, |
1229 |
}, |
1249 |
}, |
1230 |
{ |
1250 |
{ |
1231 |
data: function (oObj) { |
1251 |
data: "collection", |
|
|
1252 |
render: function (data, type, oObj) { |
1232 |
return oObj.collection |
1253 |
return oObj.collection |
1233 |
? oObj.collection.escapeHtml() |
1254 |
? oObj.collection.escapeHtml() |
1234 |
: ""; |
1255 |
: ""; |
1235 |
}, |
1256 |
}, |
1236 |
}, |
1257 |
}, |
1237 |
{ |
1258 |
{ |
1238 |
data: function (oObj) { |
1259 |
data: "location", |
|
|
1260 |
render: function (data, type, oObj) { |
1239 |
return oObj.location |
1261 |
return oObj.location |
1240 |
? oObj.location.escapeHtml() |
1262 |
? oObj.location.escapeHtml() |
1241 |
: ""; |
1263 |
: ""; |
Lines 1243-1298
$(document).ready(function () {
Link Here
|
1243 |
}, |
1265 |
}, |
1244 |
{ |
1266 |
{ |
1245 |
data: "issuedate", |
1267 |
data: "issuedate", |
1246 |
visible: false, |
1268 |
render: function (data, type, oObj) { |
1247 |
}, |
|
|
1248 |
{ |
1249 |
orderData: 7, // Sort on hidden unformatted issuedate column |
1250 |
data: function (oObj) { |
1251 |
return $datetime(oObj.issuedate, { |
1269 |
return $datetime(oObj.issuedate, { |
1252 |
no_tz_adjust: true, |
1270 |
no_tz_adjust: true, |
1253 |
}); |
1271 |
}); |
1254 |
}, |
1272 |
}, |
1255 |
}, |
1273 |
}, |
1256 |
{ |
1274 |
{ |
1257 |
data: function (oObj) { |
1275 |
data: "branchcode", |
|
|
1276 |
render: function (data, type, oObj) { |
1258 |
return oObj.branchname |
1277 |
return oObj.branchname |
1259 |
? oObj.branchname.escapeHtml() |
1278 |
? oObj.branchname.escapeHtml() |
1260 |
: ""; |
1279 |
: ""; |
1261 |
}, |
1280 |
}, |
1262 |
}, |
1281 |
}, |
1263 |
{ |
1282 |
{ |
1264 |
data: function (oObj) { |
1283 |
data: "itemcallnumber", |
|
|
1284 |
render: function (data, type, oObj) { |
1265 |
return oObj.itemcallnumber |
1285 |
return oObj.itemcallnumber |
1266 |
? oObj.itemcallnumber.escapeHtml() |
1286 |
? oObj.itemcallnumber.escapeHtml() |
1267 |
: ""; |
1287 |
: ""; |
1268 |
}, |
1288 |
}, |
1269 |
}, |
1289 |
}, |
1270 |
{ |
1290 |
{ |
1271 |
data: function (oObj) { |
1291 |
data: "copynumber", |
|
|
1292 |
render: function (data, type, oObj) { |
1272 |
return oObj.copynumber |
1293 |
return oObj.copynumber |
1273 |
? oObj.copynumber.escapeHtml() |
1294 |
? oObj.copynumber.escapeHtml() |
1274 |
: ""; |
1295 |
: ""; |
1275 |
}, |
1296 |
}, |
1276 |
}, |
1297 |
}, |
1277 |
{ |
1298 |
{ |
1278 |
data: function (oObj) { |
1299 |
data: "charge", |
|
|
1300 |
render: function (data, type, oObj) { |
1279 |
if (!oObj.charge) oObj.charge = 0; |
1301 |
if (!oObj.charge) oObj.charge = 0; |
1280 |
return parseFloat(oObj.charge).toFixed(2); |
1302 |
return parseFloat(oObj.charge).toFixed(2); |
1281 |
}, |
1303 |
}, |
1282 |
}, |
1304 |
}, |
1283 |
{ |
1305 |
{ |
1284 |
data: function (oObj) { |
1306 |
data: "fine", |
|
|
1307 |
render: function (data, type, oObj) { |
1285 |
if (!oObj.fine) oObj.fine = 0; |
1308 |
if (!oObj.fine) oObj.fine = 0; |
1286 |
return parseFloat(oObj.fine).toFixed(2); |
1309 |
return parseFloat(oObj.fine).toFixed(2); |
1287 |
}, |
1310 |
}, |
1288 |
}, |
1311 |
}, |
1289 |
{ |
1312 |
{ |
1290 |
data: function (oObj) { |
1313 |
data: "price", |
|
|
1314 |
render: function (data, type, oObj) { |
1291 |
if (!oObj.price) oObj.price = 0; |
1315 |
if (!oObj.price) oObj.price = 0; |
1292 |
return parseFloat(oObj.price).toFixed(2); |
1316 |
return parseFloat(oObj.price).toFixed(2); |
1293 |
}, |
1317 |
}, |
1294 |
}, |
1318 |
}, |
1295 |
{ |
1319 |
{ |
|
|
1320 |
orderable: false, |
1296 |
data: function (oObj) { |
1321 |
data: function (oObj) { |
1297 |
return ( |
1322 |
return ( |
1298 |
"<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=" + |
1323 |
"<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=" + |
Lines 1314-1328
$(document).ready(function () {
Link Here
|
1314 |
}, |
1339 |
}, |
1315 |
}, |
1340 |
}, |
1316 |
], |
1341 |
], |
1317 |
paging: false, |
1342 |
paging: ServerSideCheckoutsTables, |
1318 |
processing: true, |
1343 |
processing: true, |
1319 |
serverSide: false, |
1344 |
serverSide: ServerSideCheckoutsTables, |
1320 |
ajax: { |
1345 |
ajax: { |
1321 |
url: "/cgi-bin/koha/svc/checkouts?%s".format( |
1346 |
url: "/cgi-bin/koha/svc/checkouts", |
1322 |
relatives_borrowernumbers |
1347 |
data(data) { |
1323 |
.map(b => "borrowernumber=%s".format(b)) |
1348 |
return Object.assign({}, data, { |
1324 |
.join("&") |
1349 |
borrowernumber: relatives_borrowernumbers, |
1325 |
), |
1350 |
date_due_sorton: "issues.date_due", |
|
|
1351 |
title_sorton: "biblio.title", |
1352 |
recordtype_sorton: "biblioitems.itemtype", |
1353 |
itemtype_sorton: "items.itype", |
1354 |
collection_sorton: "items.ccode", |
1355 |
location_sorton: "items.location", |
1356 |
homebranch_sorton: "items.homebranch", |
1357 |
issuedate_sorton: "issues.issuedate", |
1358 |
branchcode_sorton: "issues.branchcode", |
1359 |
itemcallnumber_sorton: "items.itemcallnumber", |
1360 |
copynumber_sorton: "items.copynumber", |
1361 |
}); |
1362 |
}, |
1326 |
}, |
1363 |
}, |
1327 |
bKohaAjaxSVC: true, |
1364 |
bKohaAjaxSVC: true, |
1328 |
}, |
1365 |
}, |