|
Lines 372-385
Link Here
|
| 372 |
|
372 |
|
| 373 |
return status_label; |
373 |
return status_label; |
| 374 |
} |
374 |
} |
| 375 |
$("#illrequestlist").dataTable($.extend(true, {}, dataTablesDefaults, { |
375 |
$("#illrequestlist").kohaTable({ |
|
|
376 |
order: [[ 0, "desc" ]], |
| 377 |
dom: '<"dt-info"i><"top pager"<"table_entries"lp>>tr<"bottom pager"ip>', |
| 378 |
paging: true, |
| 379 |
embed: ['+strings','extended_attributes'], |
| 380 |
ajax: { url: '/api/v1/public/patrons/[% logged_in_user.borrowernumber | uri %]/ill/requests' }, |
| 381 |
columnDefs: [ { |
| 382 |
render: function (data, type, row, meta) { |
| 383 |
if ( data && type == 'display' ) { |
| 384 |
return data.escapeHtml(); |
| 385 |
} |
| 386 |
return data; |
| 387 |
} |
| 388 |
} ], |
| 376 |
columns: [ |
389 |
columns: [ |
| 377 |
{ |
390 |
{ |
| 378 |
data: 'ill_request_id', |
391 |
data: 'ill_request_id', |
| 379 |
sortable: true, |
392 |
sortable: true |
| 380 |
render: (data, type, row, meta) => { |
|
|
| 381 |
return data; |
| 382 |
}, |
| 383 |
}, |
393 |
}, |
| 384 |
{ |
394 |
{ |
| 385 |
data: 'author', |
395 |
data: 'author', |
|
Lines 397-406
Link Here
|
| 397 |
}, |
407 |
}, |
| 398 |
{ |
408 |
{ |
| 399 |
data: 'ill_backend_id', |
409 |
data: 'ill_backend_id', |
| 400 |
sortable: true, |
410 |
sortable: true |
| 401 |
render: (data, type, row, meta) => { |
|
|
| 402 |
return escape_str(data); |
| 403 |
}, |
| 404 |
}, |
411 |
}, |
| 405 |
{ |
412 |
{ |
| 406 |
data: 'type', |
413 |
data: 'type', |
|
Lines 437-481
Link Here
|
| 437 |
return `<a href="/cgi-bin/koha/opac-illrequests.pl?op=view&illrequest_id=${row.ill_request_id}" class="btn btn-primary btn-sm">View</a>`; |
444 |
return `<a href="/cgi-bin/koha/opac-illrequests.pl?op=view&illrequest_id=${row.ill_request_id}" class="btn btn-primary btn-sm">View</a>`; |
| 438 |
}, |
445 |
}, |
| 439 |
} |
446 |
} |
| 440 |
], |
447 |
] |
| 441 |
"order": [[ 0, "desc" ]], |
448 |
}); |
| 442 |
"dom": '<"dt-info"i><"top pager"<"table_entries"lp>>tr<"bottom pager"ip>', |
|
|
| 443 |
"paging": true, |
| 444 |
"serverSide": true, |
| 445 |
"ajax": { |
| 446 |
"cache": true, |
| 447 |
"url": '/api/v1/patrons/[% logged_in_user.borrowernumber | html %]/ill/requests', |
| 448 |
'beforeSend': function (xhr, settings) { |
| 449 |
this._xhr = xhr; |
| 450 |
xhr.setRequestHeader('x-koha-embed', '+strings,extended_attributes'); |
| 451 |
}, |
| 452 |
"data": (data, settings) => { |
| 453 |
const order = data.order[0]; |
| 454 |
const order_by = (order.dir == 'asc' ? '+' : '-') + 'me.' + data.columns[order.column].data; |
| 455 |
const page = Math.floor(data.start / data.length) + 1; |
| 456 |
return { |
| 457 |
_page: page, |
| 458 |
_per_page: data.length, |
| 459 |
_order_by: order_by, |
| 460 |
}; |
| 461 |
}, |
| 462 |
'dataFilter': function (data, type) { |
| 463 |
const json = {data: JSON.parse(data)}; |
| 464 |
if (total = this._xhr.getResponseHeader('x-total-count')) { |
| 465 |
json.recordsTotal = total; |
| 466 |
json.recordsFiltered = total; |
| 467 |
} |
| 468 |
if (total = this._xhr.getResponseHeader('x-base-total-count')) { |
| 469 |
json.recordsTotal = total; |
| 470 |
} |
| 471 |
if (draw = this._xhr.getResponseHeader('x-koha-request-id')) { |
| 472 |
json.draw = draw; |
| 473 |
} |
| 474 |
|
| 475 |
return JSON.stringify(json); |
| 476 |
}, |
| 477 |
}, |
| 478 |
})); |
| 479 |
$("#backend-dropdown-options").removeClass("nojs"); |
449 |
$("#backend-dropdown-options").removeClass("nojs"); |
| 480 |
[% IF services_json.length > 0 %] |
450 |
[% IF services_json.length > 0 %] |
| 481 |
var services = [% services_json | $raw %]; |
451 |
var services = [% services_json | $raw %]; |
| 482 |
- |
|
|