|
Lines 25-30
Link Here
|
| 25 |
<th id="[% tab | html %]_itemcallnumber" data-colname="itemcallnumber">Call number</th> |
25 |
<th id="[% tab | html %]_itemcallnumber" data-colname="itemcallnumber">Call number</th> |
| 26 |
<th id="[% tab | html %]_enumchron" data-colname="enumchron">Serial enumeration / chronology</th> |
26 |
<th id="[% tab | html %]_enumchron" data-colname="enumchron">Serial enumeration / chronology</th> |
| 27 |
<th id="[% tab | html %]_status" data-colname="status">Status</th> |
27 |
<th id="[% tab | html %]_status" data-colname="status">Status</th> |
|
|
28 |
<th id="[% tab | html %]_displays" data-colname="displays">Displays</th> |
| 28 |
<th id="[% tab | html %]_lastseen" data-colname="lastseen">Last seen</th> |
29 |
<th id="[% tab | html %]_lastseen" data-colname="lastseen">Last seen</th> |
| 29 |
<th id="[% tab | html %]_issues" data-colname="issues">Checkouts</th> |
30 |
<th id="[% tab | html %]_issues" data-colname="issues">Checkouts</th> |
| 30 |
<th id="[% tab | html %]_renewals" data-colname="renewals">Renewals</th> |
31 |
<th id="[% tab | html %]_renewals" data-colname="renewals">Renewals</th> |
|
Lines 175-181
Link Here
|
| 175 |
$("input[name='itemnumber'][type='checkbox']", tab).prop('checked', false); |
176 |
$("input[name='itemnumber'][type='checkbox']", tab).prop('checked', false); |
| 176 |
itemSelectionBuildActionLinks(tab_id); |
177 |
itemSelectionBuildActionLinks(tab_id); |
| 177 |
}); |
178 |
}); |
| 178 |
|
|
|
| 179 |
}); |
179 |
}); |
| 180 |
|
180 |
|
| 181 |
let filters_shown = false; |
181 |
let filters_shown = false; |
|
Lines 256-262
Link Here
|
| 256 |
[%# In case or SeparateHoldings we may need to display the number of biblios in each tab %] |
256 |
[%# In case or SeparateHoldings we may need to display the number of biblios in each tab %] |
| 257 |
[%# Do we need separate/new endpoints or do we hack the somewhere client-side? %] |
257 |
[%# Do we need separate/new endpoints or do we hack the somewhere client-side? %] |
| 258 |
let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; |
258 |
let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; |
| 259 |
let embed = ["+strings,_status,home_library,holding_library,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk"]; |
259 |
let embed = ["+strings,_status,effective_home_library,effective_holding_library,home_library,holding_library,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk"]; |
| 260 |
[% IF Koha.Preference('LocalCoverImages') %] |
260 |
[% IF Koha.Preference('LocalCoverImages') %] |
| 261 |
embed.push('cover_image_ids'); |
261 |
embed.push('cover_image_ids'); |
| 262 |
[% END %] |
262 |
[% END %] |
|
Lines 332-337
Link Here
|
| 332 |
return $("#" + tab_id + "_status select").val(); |
332 |
return $("#" + tab_id + "_status select").val(); |
| 333 |
}; |
333 |
}; |
| 334 |
|
334 |
|
|
|
335 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 336 |
const displaysFetch = $.ajax({ |
| 337 |
url: '/api/v1/displays', |
| 338 |
async: false, |
| 339 |
method: 'GET', |
| 340 |
headers: { 'x-koha-embed': 'display_items' }, |
| 341 |
error: error => { |
| 342 |
console.error(error); |
| 343 |
}, |
| 344 |
}); |
| 345 |
const displays = displaysFetch.responseJSON || []; |
| 346 |
[% ELSE %] |
| 347 |
const displays = []; |
| 348 |
[% END %] |
| 349 |
|
| 335 |
var items_table = $("#" + tab_id + '_table').kohaTable({ |
350 |
var items_table = $("#" + tab_id + '_table').kohaTable({ |
| 336 |
ajax: { url: item_table_url }, |
351 |
ajax: { url: item_table_url }, |
| 337 |
order: [], |
352 |
order: [], |
|
Lines 382-395
Link Here
|
| 382 |
[% END %] |
397 |
[% END %] |
| 383 |
[% IF ( item_level_itypes ) %] |
398 |
[% IF ( item_level_itypes ) %] |
| 384 |
{ |
399 |
{ |
|
|
400 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 401 |
data: "me.effective_item_type_id", // FIXME Cannot filter by biblioitem.itemtype |
| 402 |
searchable: false, |
| 403 |
orderable: false, |
| 404 |
[% ELSE %] |
| 385 |
data: "me.item_type_id", // FIXME Cannot filter by biblioitem.itemtype |
405 |
data: "me.item_type_id", // FIXME Cannot filter by biblioitem.itemtype |
| 386 |
datatype: "coded_value:item_type", |
406 |
datatype: "coded_value:item_type", |
| 387 |
dataFilter: "item_types", |
407 |
dataFilter: "item_types", |
| 388 |
className: "itype", |
408 |
className: "itype", |
| 389 |
searchable: true, |
409 |
searchable: true, |
| 390 |
orderable: true, |
410 |
orderable: true, |
|
|
411 |
[% END %] |
| 391 |
render: function (data, type, row, meta) { |
412 |
render: function (data, type, row, meta) { |
| 392 |
let node = ''; |
413 |
let node = ''; |
|
|
414 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 415 |
let effective_item_type_description = row._strings.effective_item_type_id ? row._strings.effective_item_type_id.str : row.effective_item_type_id; |
| 416 |
[% UNLESS noItemTypeImages %] |
| 417 |
let image_location = item_type_image_locations[row.effective_item_type_id]; |
| 418 |
node += image_location |
| 419 |
? '<img class="itemtype-image" src="%s" alt="" /> '.format(escape_str(image_location), escape_str(effective_item_type_description), escape_str(effective_item_type_description)) |
| 420 |
: ''; |
| 421 |
[% END %] |
| 422 |
node += '<span class="itypedesc itypetext">%s</span>'.format(escape_str(effective_item_type_description)); |
| 423 |
[% ELSE %] |
| 393 |
let item_type_description = row._strings.item_type_id ? row._strings.item_type_id.str : row.item_type_id; |
424 |
let item_type_description = row._strings.item_type_id ? row._strings.item_type_id.str : row.item_type_id; |
| 394 |
[% UNLESS noItemTypeImages %] |
425 |
[% UNLESS noItemTypeImages %] |
| 395 |
let image_location = item_type_image_locations[row.item_type_id]; |
426 |
let image_location = item_type_image_locations[row.item_type_id]; |
|
Lines 398-457
Link Here
|
| 398 |
: ''; |
429 |
: ''; |
| 399 |
[% END %] |
430 |
[% END %] |
| 400 |
node += '<span class="itypedesc itypetext">%s</span>'.format(escape_str(item_type_description)); |
431 |
node += '<span class="itypedesc itypetext">%s</span>'.format(escape_str(item_type_description)); |
|
|
432 |
[% END %] |
| 433 |
|
| 401 |
return node; |
434 |
return node; |
| 402 |
} |
435 |
} |
| 403 |
}, |
436 |
}, |
| 404 |
[% END %] |
437 |
[% END %] |
| 405 |
{ |
438 |
{ |
|
|
439 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 440 |
data: "me.effective_holding_library_id", |
| 441 |
searchable: false, |
| 442 |
orderable: false, |
| 443 |
[% ELSE %] |
| 406 |
data: "holding_library.name:me.holding_library_id", |
444 |
data: "holding_library.name:me.holding_library_id", |
| 407 |
datatype: "coded_value:library", |
445 |
datatype: "coded_value:library", |
| 408 |
dataFilter: "libraries", |
|
|
| 409 |
className: "location", |
| 410 |
searchable: true, |
446 |
searchable: true, |
| 411 |
orderable: true, |
447 |
orderable: true, |
|
|
448 |
dataFilter: "libraries", |
| 449 |
className: "location", |
| 450 |
[% END %] |
| 412 |
render: function (data, type, row, meta) { |
451 |
render: function (data, type, row, meta) { |
| 413 |
return escape_str(row._strings.holding_library_id ? row._strings.holding_library_id.str : row.holding_library_id); |
452 |
let nodes = ""; |
|
|
453 |
let effective_holding_library_id_str = row._strings.effective_holding_library_id ? row._strings.effective_holding_library_id.str : row.effective_holding_library_id; |
| 454 |
let holding_library_id_str = row._strings.holding_library_id ? row._strings.holding_library_id.str : row.holding_library_id; |
| 455 |
|
| 456 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 457 |
if (holding_library_id_str != effective_holding_library_id_str) { |
| 458 |
nodes += '<a href="javascript:void(0)" onClick="handlePermanentLocation(this)" data-header="' + _("Permanent holding branch") + '" data-body="' + holding_library_id_str + '">'; |
| 459 |
nodes += ' <i class="fa fa-info-circle" aria-hidden="true"></i>'; |
| 460 |
nodes += '</a> '; |
| 461 |
} |
| 462 |
[% END %] |
| 463 |
|
| 464 |
nodes += escape_str(effective_holding_library_id_str || ''); |
| 465 |
|
| 466 |
nodes = '<span>' + nodes + '</span>'; |
| 467 |
return nodes; |
| 414 |
} |
468 |
} |
| 415 |
}, |
469 |
}, |
| 416 |
{ |
470 |
{ |
|
|
471 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 472 |
data: "me.effective_home_library_id", |
| 473 |
searchable: false, |
| 474 |
orderable: false, |
| 475 |
[% ELSE %] |
| 417 |
data: "home_library.name:me.home_library_id", |
476 |
data: "home_library.name:me.home_library_id", |
| 418 |
datatype: "coded_value:library", |
477 |
datatype: "coded_value:library", |
| 419 |
dataFilter: "libraries", |
|
|
| 420 |
className: "homebranch", |
| 421 |
searchable: true, |
478 |
searchable: true, |
| 422 |
orderable: true, |
479 |
orderable: true, |
|
|
480 |
dataFilter: "libraries", |
| 481 |
className: "location", |
| 482 |
[% END %] |
| 423 |
render: function (data, type, row, meta) { |
483 |
render: function (data, type, row, meta) { |
| 424 |
return escape_str(row._strings.home_library_id ? row._strings.home_library_id.str : row.home_library_id); |
484 |
let nodes = ""; |
|
|
485 |
let effective_home_library_id_str = row._strings.effective_home_library_id ? row._strings.effective_home_library_id.str : row.effective_home_library_id; |
| 486 |
let home_library_id_str = row._strings.home_library_id ? row._strings.home_library_id.str : row.home_library_id; |
| 487 |
|
| 488 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 489 |
if (home_library_id_str != effective_home_library_id_str) { |
| 490 |
nodes += '<a href="javascript:void(0)" onClick="handlePermanentLocation(this)" data-header="' + _("Permanent home branch") + '" data-body="' + home_library_id_str + '">'; |
| 491 |
nodes += ' <i class="fa fa-info-circle" aria-hidden="true"></i>'; |
| 492 |
nodes += '</a> '; |
| 493 |
} |
| 494 |
[% END %] |
| 495 |
|
| 496 |
nodes += escape_str(effective_home_library_id_str || ''); |
| 497 |
|
| 498 |
nodes = '<span>' + nodes + '</span>'; |
| 499 |
return nodes; |
| 425 |
} |
500 |
} |
| 426 |
}, |
501 |
}, |
| 427 |
{ |
502 |
{ |
|
|
503 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 504 |
data: "me.effective_location", |
| 505 |
searchable: false, |
| 506 |
orderable: false, |
| 507 |
[% ELSE %] |
| 428 |
data: "me.location", |
508 |
data: "me.location", |
| 429 |
datatype: "coded_value:location", |
|
|
| 430 |
searchable: true, |
509 |
searchable: true, |
| 431 |
orderable: true, |
510 |
orderable: true, |
|
|
511 |
[% END %] |
| 432 |
render: function (data, type, row, meta) { |
512 |
render: function (data, type, row, meta) { |
| 433 |
let nodes = '<span class="shelvingloc">'; |
513 |
let nodes = ""; |
| 434 |
[%# If permanent location is defined, show description or code and %] |
514 |
let effective_loc_str = row._strings.effective_location ? row._strings.effective_location.str : row.effective_location; |
| 435 |
[%# display current location in parentheses. If not, display current location. %] |
|
|
| 436 |
[%# Note that permanent location is a code, and location may be an authval. %] |
| 437 |
let loc_str = row._strings.location ? row._strings.location.str : row.location; |
515 |
let loc_str = row._strings.location ? row._strings.location.str : row.location; |
| 438 |
if ( row.permanent_location && row.permanent_location != row.location ) { |
516 |
|
| 439 |
let permanent_loc_str = av_loc.get(row.permanent_location); |
517 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 440 |
nodes += '%s (%s)'.format(escape_str(permanent_loc_str), escape_str(loc_str)); |
518 |
if (loc_str != effective_loc_str) { |
| 441 |
} else { |
519 |
nodes += '<a href="javascript:void(0)" onClick="handlePermanentLocation(this)" data-header="' + _("Permanent shelving location") + '" data-body="' + loc_str + '">'; |
| 442 |
nodes += escape_str(loc_str); |
520 |
nodes += ' <i class="fa fa-info-circle" aria-hidden="true"></i>'; |
| 443 |
} |
521 |
nodes += '</a> '; |
| 444 |
nodes += '</span>'; |
522 |
} |
|
|
523 |
[% END %] |
| 524 |
|
| 525 |
nodes += escape_str(effective_loc_str || ''); |
| 526 |
|
| 527 |
nodes = '<span>' + nodes + '</span>'; |
| 445 |
return nodes; |
528 |
return nodes; |
| 446 |
} |
529 |
} |
| 447 |
}, |
530 |
}, |
| 448 |
{ |
531 |
{ |
|
|
532 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 533 |
data: "me.effective_collection_code", |
| 534 |
searchable: false, |
| 535 |
orderable: false, |
| 536 |
[% ELSE %] |
| 449 |
data: "me.collection_code", |
537 |
data: "me.collection_code", |
| 450 |
datatype: "coded_value:collection_code", |
|
|
| 451 |
searchable: true, |
538 |
searchable: true, |
| 452 |
orderable: true, |
539 |
orderable: true, |
|
|
540 |
[% END %] |
| 453 |
render: function (data, type, row, meta) { |
541 |
render: function (data, type, row, meta) { |
| 454 |
return escape_str(row._strings.collection_code ? row._strings.collection_code.str : row.collection_code); |
542 |
let nodes = ""; |
|
|
543 |
let effective_ccode_str = row._strings.effective_collection_code ? row._strings.effective_collection_code.str : row.effective_collection_code; |
| 544 |
let ccode_str = row._strings.collection_code ? row._strings.collection_code.str : row.collection_code; |
| 545 |
|
| 546 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 547 |
if (ccode_str != effective_ccode_str) { |
| 548 |
nodes += '<a href="javascript:void(0)" onClick="handlePermanentLocation(this)" data-header="' + _("Permanent collection") + '" data-body="' + ccode_str + '">'; |
| 549 |
nodes += ' <i class="fa fa-info-circle" aria-hidden="true"></i>'; |
| 550 |
nodes += '</a> '; |
| 551 |
} |
| 552 |
[% END %] |
| 553 |
|
| 554 |
nodes += escape_str(effective_ccode_str || ''); |
| 555 |
|
| 556 |
nodes = '<span>' + nodes + '</span>'; |
| 557 |
return nodes; |
| 455 |
} |
558 |
} |
| 456 |
}, |
559 |
}, |
| 457 |
[% IF Koha.Preference('EnableItemGroups') %] |
560 |
[% IF Koha.Preference('EnableItemGroups') %] |
|
Lines 601-606
Link Here
|
| 601 |
} |
704 |
} |
| 602 |
} |
705 |
} |
| 603 |
[% END %] |
706 |
[% END %] |
|
|
707 |
|
| 604 |
if ( status == 'available' ) { |
708 |
if ( status == 'available' ) { |
| 605 |
nodes += ' <span>%s</span>'.format(_("Available")) |
709 |
nodes += ' <span>%s</span>'.format(_("Available")) |
| 606 |
} |
710 |
} |
|
Lines 615-620
Link Here
|
| 615 |
return nodes; |
719 |
return nodes; |
| 616 |
} |
720 |
} |
| 617 |
}, |
721 |
}, |
|
|
722 |
{ |
| 723 |
data: "me.displays", |
| 724 |
searchable: false, |
| 725 |
orderable: false, |
| 726 |
render: function (data, type, row, meta) { |
| 727 |
let nodes = ""; |
| 728 |
|
| 729 |
[% IF Koha.Preference('UseDisplayModule') && CAN_user_displays %] |
| 730 |
displays.forEach(display => { |
| 731 |
display.display_items.forEach(display_item => { |
| 732 |
if (display_item.itemnumber === row.item_id) |
| 733 |
nodes += '<li><span class="on_display"><a href="/cgi-bin/koha/display/displays/%s">%s</a></span></li>'.format(display.display_id, display.display_name); |
| 734 |
}); |
| 735 |
}); |
| 736 |
|
| 737 |
if (nodes != "") |
| 738 |
nodes = '<ul>' + nodes + '</ul>'; |
| 739 |
[% END %] |
| 740 |
|
| 741 |
return nodes; |
| 742 |
} |
| 743 |
}, |
| 618 |
{ |
744 |
{ |
| 619 |
data: "me.last_seen_date", |
745 |
data: "me.last_seen_date", |
| 620 |
type: "date", |
746 |
type: "date", |
|
Lines 744-762
Link Here
|
| 744 |
{ |
870 |
{ |
| 745 |
data: "me.public_notes", |
871 |
data: "me.public_notes", |
| 746 |
className: "itemnotes", |
872 |
className: "itemnotes", |
|
|
873 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 874 |
searchable: false, |
| 875 |
orderable: false, |
| 876 |
[% ELSE %] |
| 747 |
searchable: true, |
877 |
searchable: true, |
| 748 |
orderable: true, |
878 |
orderable: true, |
|
|
879 |
[% END %] |
| 749 |
render: function (data, type, row, meta) { |
880 |
render: function (data, type, row, meta) { |
| 750 |
return row.public_notes ? escape_str(row.public_notes).replaceAll('\n', '<br />') : ''; |
881 |
let nodes = ""; |
|
|
882 |
|
| 883 |
nodes = row.public_notes ? escape_str(row.public_notes).replaceAll('\n', '<br />') : ''; |
| 884 |
|
| 885 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 886 |
displays.forEach(display => { |
| 887 |
display.display_items.forEach(display_item => { |
| 888 |
if ((display_item.itemnumber === row.item_id) && (display.public_note)) |
| 889 |
nodes += '<p><span class="public_note on_display">%s</span></p>'.format(display.public_note); |
| 890 |
}); |
| 891 |
}); |
| 892 |
[% END %] |
| 893 |
|
| 894 |
return nodes; |
| 751 |
} |
895 |
} |
| 752 |
}, |
896 |
}, |
| 753 |
{ |
897 |
{ |
| 754 |
data: "me.internal_notes", |
898 |
data: "me.internal_notes", |
| 755 |
className: "nonpublicnote", |
899 |
className: "nonpublicnote", |
|
|
900 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 901 |
searchable: false, |
| 902 |
orderable: false, |
| 903 |
[% ELSE %] |
| 756 |
searchable: true, |
904 |
searchable: true, |
| 757 |
orderable: true, |
905 |
orderable: true, |
|
|
906 |
[% END %] |
| 758 |
render: function (data, type, row, meta) { |
907 |
render: function (data, type, row, meta) { |
| 759 |
return escape_str(row.internal_notes); |
908 |
let nodes = ""; |
|
|
909 |
|
| 910 |
nodes = row.internal_notes ? escape_str(row.internal_notes) : ''; |
| 911 |
|
| 912 |
[% IF Koha.Preference('UseDisplayModule') %] |
| 913 |
displays.forEach(display => { |
| 914 |
display.display_items.forEach(display_item => { |
| 915 |
if ((display_item.itemnumber === row.item_id) && (display.staff_note)) |
| 916 |
nodes += '<p><span class="internal_note on_display">%s</span></p>'.format(display.staff_note); |
| 917 |
}); |
| 918 |
}); |
| 919 |
[% END %] |
| 920 |
|
| 921 |
return nodes; |
| 760 |
} |
922 |
} |
| 761 |
}, |
923 |
}, |
| 762 |
[% IF Koha.Preference('EasyAnalyticalRecords') %] |
924 |
[% IF Koha.Preference('EasyAnalyticalRecords') %] |
|
Lines 920-925
Link Here
|
| 920 |
}); |
1082 |
}); |
| 921 |
return items_table; |
1083 |
return items_table; |
| 922 |
} |
1084 |
} |
|
|
1085 |
|
| 1086 |
const handlePermanentLocation = ((element) => { |
| 1087 |
const header = $(element).attr('data-header'); |
| 1088 |
const body = $(element).attr('data-body'); |
| 1089 |
|
| 1090 |
$('#permanant_location_modal_label').text(header); |
| 1091 |
$('#permanant_location_modal_body').html('<ul><li>' + body + '</li></ul>'); |
| 1092 |
$('#permanant_location_modal').modal('show'); |
| 1093 |
|
| 1094 |
return false; |
| 1095 |
}); |
| 1096 |
|
| 923 |
function safe_link(uri,link_text) { |
1097 |
function safe_link(uri,link_text) { |
| 924 |
let node = document.createElement('a'); |
1098 |
let node = document.createElement('a'); |
| 925 |
let url_str = '#'; |
1099 |
let url_str = '#'; |