Lines 234-240
Link Here
|
234 |
[%# In case or SeparateHoldings we may need to display the number of biblios in each tab %] |
234 |
[%# In case or SeparateHoldings we may need to display the number of biblios in each tab %] |
235 |
[%# Do we need separate/new endpoints or do we hack the somewhere client-side? %] |
235 |
[%# Do we need separate/new endpoints or do we hack the somewhere client-side? %] |
236 |
let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; |
236 |
let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; |
237 |
let embed = ["+strings,home_library,holding_library,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk"]; |
237 |
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"]; |
238 |
[% IF Koha.Preference('LocalCoverImages') %] |
238 |
[% IF Koha.Preference('LocalCoverImages') %] |
239 |
embed.push('cover_image_ids'); |
239 |
embed.push('cover_image_ids'); |
240 |
[% END %] |
240 |
[% END %] |
Lines 472-553
Link Here
|
472 |
} |
472 |
} |
473 |
}, |
473 |
}, |
474 |
{ |
474 |
{ |
475 |
data: "me.lost_status", |
475 |
data: "me._status", |
476 |
className: "status", |
476 |
className: "status", |
477 |
searchable: false, // FIXME We are losing the ability to search on the status |
477 |
searchable: false, // FIXME We are losing the ability to search on the status |
478 |
orderable: false, |
478 |
orderable: false, |
479 |
render: function (data, type, row, meta) { |
479 |
render: function (data, type, row, meta) { |
480 |
let nodes = ""; |
480 |
let nodes = ""; |
481 |
if ( row.checkout ) { |
481 |
row._status.split(",").forEach( status => { |
482 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
482 |
if ( status == 'checked_out' || status == 'local_use') { |
483 |
row.checkout.patron.library = { name: libraries_names.get(row.checkout.patron.library_id) }; |
483 |
nodes += '<span>'; |
484 |
|
484 |
|
485 |
nodes += '<span>'; |
485 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
486 |
if ( row.checkout.onsite_checkout ) { |
486 |
row.checkout.patron.library = { name: libraries_names.get(row.checkout.patron.library_id) }; |
487 |
let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
487 |
let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
488 |
nodes += _("Currently in local use by %s").format(patron_to_html); |
488 |
|
489 |
} else { |
489 |
if ( status == 'local_use' ) { |
490 |
nodes += '<span class="datedue">'; |
490 |
nodes += _("Currently in local use by %s").format(patron_to_html); |
491 |
let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
491 |
} else { |
492 |
nodes += _("Checked out to %s").format(patron_to_html); |
492 |
nodes += '<span class="datedue">'; |
|
|
493 |
nodes += _("Checked out to %s").format(patron_to_html); |
494 |
} |
495 |
nodes += ': '; |
496 |
nodes += _("due %s").format($date(row.checkout.due_date, { as_due_date: true })); |
497 |
nodes += "</span>" |
498 |
|
493 |
} |
499 |
} |
494 |
nodes += ': '; |
500 |
if ( status == 'in_transit' ) { |
495 |
nodes += _("due %s").format($date(row.checkout.due_date, { as_due_date: true })); |
|
|
496 |
nodes += "</span>" |
497 |
} else if ( row.transfer ) { |
498 |
if ( row.transfer.datesent ) { |
499 |
nodes += '<span class="intransit">%s</span>'.format(_("In transit from %s to %s since %s").format(escape_str(row.transfer._strings.from_library.str), escape_str(row.transfer._strings.to_library.str), $date(row.transfer.datesent))); |
501 |
nodes += '<span class="intransit">%s</span>'.format(_("In transit from %s to %s since %s").format(escape_str(row.transfer._strings.from_library.str), escape_str(row.transfer._strings.to_library.str), $date(row.transfer.datesent))); |
500 |
} else { |
502 |
} |
|
|
503 |
|
504 |
if ( status == 'transit_pending' ) { |
501 |
nodes += '<span class="transitrequested">%s</span>'.format(_("Transit pending from %s to %s since %s").format(escape_str(row.transfer._strings.from_library.str), escape_str(row.transfer._strings.to_library.str), $date(row.transfer.daterequested))); |
505 |
nodes += '<span class="transitrequested">%s</span>'.format(_("Transit pending from %s to %s since %s").format(escape_str(row.transfer._strings.from_library.str), escape_str(row.transfer._strings.to_library.str), $date(row.transfer.daterequested))); |
502 |
} |
506 |
} |
503 |
} |
|
|
504 |
|
507 |
|
505 |
if ( row.lost_status ) { |
508 |
if ( status == 'lost' ) { |
506 |
let lost_lib = av_lost.get(row.lost_status.toString()) || _("Unavailable (lost or missing"); |
509 |
let lost_lib = av_lost.get(row.lost_status.toString()) || _("Unavailable (lost or missing"); |
507 |
nodes += '<span class="lost">%s</span>'.format(escape_str(lost_lib)); |
510 |
nodes += '<span class="lost">%s</span>'.format(escape_str(lost_lib)); |
508 |
[% IF Koha.Preference('ClaimReturnedLostValue') %] |
511 |
|
509 |
const hasReturnClaims = row.return_claims.filter(rc => !rc.resolution).length > 0 ? true : false |
512 |
const hasReturnClaims = row.return_claims && row.return_claims.filter(rc => !rc.resolution).length > 0 ? true : false |
510 |
if(hasReturnClaims) { |
513 |
if(hasReturnClaims) { |
511 |
nodes += '<span class="claimed_returned">' + _("(Claimed returned)") + '</span>'; |
514 |
nodes += '<span class="claimed_returned">' + _("(Claimed returned)") + '</span>'; |
512 |
} |
515 |
} |
513 |
[% END %] |
516 |
} |
514 |
} |
|
|
515 |
|
517 |
|
516 |
if ( row.withdrawn ) { |
518 |
if ( status == 'withdrawn' ) { |
517 |
let withdrawn_lib = av_withdrawn.get(row.withdrawn.toString()) || _("Withdrawn"); |
519 |
let withdrawn_lib = av_withdrawn.get(row.withdrawn.toString()) || _("Withdrawn"); |
518 |
nodes += '<span class="wdn">%s</span>'.format(escape_str(withdrawn_lib)); |
520 |
nodes += '<span class="wdn">%s</span>'.format(escape_str(withdrawn_lib)); |
519 |
} |
521 |
} |
520 |
|
522 |
|
521 |
if ( row.damaged_status ) { |
523 |
if ( status == 'damaged' ) { |
522 |
let damaged_lib = av_damaged.get(row.damaged_status.toString()) || _("Damaged"); |
524 |
let damaged_lib = av_damaged.get(row.damaged_status.toString()) || _("Damaged"); |
523 |
nodes += '<span class="dmg">%s</span>'.format(escape_str(damaged_lib)); |
525 |
nodes += '<span class="dmg">%s</span>'.format(escape_str(damaged_lib)); |
524 |
} |
526 |
} |
525 |
|
527 |
|
526 |
if ( row.not_for_loan_status || item_types_notforloan.get(row.item_type_id) ) { |
528 |
if ( status == 'not_for_loan' ) { |
527 |
let not_for_loan_lib = av_not_for_loan.get(row.not_for_loan_status.toString()); |
529 |
let not_for_loan_lib = av_not_for_loan.get(row.not_for_loan_status.toString()); |
528 |
nodes += '<span class="notforloan">%s'.format(_("Not for loan")) + ( not_for_loan_lib ? '<span class="reason"> (%s)</span>'.format(escape_str(not_for_loan_lib)) : '' ) + '</span>'; |
530 |
nodes += '<span class="notforloan">%s'.format(_("Not for loan")) + ( not_for_loan_lib ? '<span class="reason"> (%s)</span>'.format(escape_str(not_for_loan_lib)) : '' ) + '</span>'; |
529 |
} |
531 |
} |
530 |
|
532 |
|
531 |
if ( row.first_hold ) { |
533 |
if ( status == 'on_hold') { |
532 |
if ( row.first_hold.waiting_date ) { |
534 |
if ( row.first_hold.waiting_date ) { |
533 |
if ( row.first_hold.desk ) { |
535 |
if ( row.first_hold.desk ) { |
534 |
nodes += '<span class="waitingat">%s</span>'.format(_("Waiting at %s, %s since %s.").format(row.first_hold._strings.pickup_library_id.str, row.first_hold.desk.desk_name, $date(row.first_hold.waiting_date))); |
536 |
nodes += '<span class="waitingat">%s</span>'.format(_("Waiting at %s, %s since %s.".format(row.first_hold._strings.pickup_library_id.str, row.first_hold.desk.desk_name, $date(row.first_hold.waiting_date)))); |
|
|
537 |
} else { |
538 |
nodes += '<span class="waitingat">%s</span>'.format(_("Waiting at %s since %s.".format(row.first_hold._strings.pickup_library_id.str, $date(row.first_hold.waiting_date)))); |
539 |
} |
540 |
[% IF Koha.Preference('canreservefromotherbranches') %] |
541 |
if ( row.first_hold.waiting_date || row.first_hold.priority == 1 ) { |
542 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
543 |
row.first_hold.patron.library = { name: libraries_names.get(row.first_hold.patron.library_id) }; |
544 |
|
545 |
let patron_to_html = $patron_to_html(row.first_hold.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
546 |
nodes += ' <span class="heldfor">%s</span>'.format(_("Hold for: %s").format(patron_to_html)); |
547 |
} |
548 |
[% END %] |
535 |
} else { |
549 |
} else { |
536 |
nodes += '<span class="waitingat">%s</span>'.format(_("Waiting at %s since %s.").format(row.first_hold._strings.pickup_library_id.str, $date(row.first_hold.waiting_date))); |
550 |
nodes += ' <span class="holdonitem">%s</span>'.format(_("There is an item level hold on this item (priority = %s).").format(row.first_hold.priority)); |
537 |
} |
551 |
} |
538 |
[% IF Koha.Preference('canreservefromotherbranches') %] |
|
|
539 |
if ( row.first_hold.waiting_date || row.first_hold.priority == 1 ) { |
540 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
541 |
row.first_hold.patron.library = { name: libraries_names.get(row.first_hold.patron.library_id) }; |
542 |
|
543 |
let patron_to_html = $patron_to_html(row.first_hold.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
544 |
nodes += ' <span class="heldfor">%s</span>'.format(_("Hold for: %s").format(patron_to_html)); |
545 |
} |
546 |
[% END %] |
547 |
} else { |
548 |
nodes += ' <span class="holdonitem">%s</span>'.format(_("There is an item level hold on this item (priority = %s).").format(row.first_hold.priority)); |
549 |
} |
552 |
} |
550 |
} |
|
|
551 |
|
553 |
|
552 |
[% IF Koha.Preference('UseRecalls') %] |
554 |
[% IF Koha.Preference('UseRecalls') %] |
553 |
if ( row.recall && ( row.item_id === row.recall.item_id ) ) { |
555 |
if ( row.recall && ( row.item_id === row.recall.item_id ) ) { |
Lines 562-579
Link Here
|
562 |
} |
564 |
} |
563 |
} |
565 |
} |
564 |
[% END %] |
566 |
[% END %] |
|
|
567 |
if ( status == 'available' ) { |
568 |
nodes += ' <span>%s</span>'.format(_("Available")) |
569 |
} |
565 |
|
570 |
|
566 |
if ( ! ( row.not_for_loan_status || item_types_notforloan.get(row.item_type_id) || row.checked_out_date || row.lost_status || row.withdrawn || row.damaged_status || row.transfer || row.first_hold || ( row.recall && ( row.item_id === row.recall.item_id ) ) )) { |
571 |
if ( status == 'restricted') { |
567 |
nodes += ' <span>%s</span>'.format(_("Available")) |
572 |
nodes += '<span class="restricted">(%s)</span>'.format(escape_str(av_restricted.get(row.restricted_status.toString()))); |
568 |
} |
573 |
} |
569 |
|
|
|
570 |
if ( row.restricted_status ) { |
571 |
nodes += '<span class="restricted">(%s)</span>'.format(escape_str(av_restricted.get(row.restricted_status.toString()))); |
572 |
} |
573 |
|
574 |
|
574 |
if ( row.in_bundle ) { |
575 |
if ( status == 'restricted') { |
575 |
nodes += '<span class="bundled">%s</span>'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true }))); |
576 |
nodes += '<span class="bundled">%s</span>'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true }))); |
576 |
} |
577 |
} |
|
|
578 |
}); |
577 |
return nodes; |
579 |
return nodes; |
578 |
} |
580 |
} |
579 |
}, |
581 |
}, |
580 |
- |
|
|