Lines 247-253
Link Here
|
247 |
[%# In case or SeparateHoldings we may need to display the number of biblios in each tab %] |
247 |
[%# In case or SeparateHoldings we may need to display the number of biblios in each tab %] |
248 |
[%# Do we need separate/new endpoints or do we hack the somewhere client-side? %] |
248 |
[%# Do we need separate/new endpoints or do we hack the somewhere client-side? %] |
249 |
let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; |
249 |
let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; |
250 |
let embed = ["+strings,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk"]; |
250 |
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"]; |
251 |
[% IF Koha.Preference('LocalCoverImages') %] |
251 |
[% IF Koha.Preference('LocalCoverImages') %] |
252 |
embed.push('cover_image_ids'); |
252 |
embed.push('cover_image_ids'); |
253 |
[% END %] |
253 |
[% END %] |
Lines 497-578
Link Here
|
497 |
} |
497 |
} |
498 |
}, |
498 |
}, |
499 |
{ |
499 |
{ |
500 |
data: "me.lost_status", |
500 |
data: "me._status", |
501 |
className: "status", |
501 |
className: "status", |
502 |
searchable: false, // FIXME We are losing the ability to search on the status |
502 |
searchable: false, // FIXME We are losing the ability to search on the status |
503 |
orderable: false, |
503 |
orderable: false, |
504 |
render: function (data, type, row, meta) { |
504 |
render: function (data, type, row, meta) { |
505 |
let nodes = ""; |
505 |
let nodes = ""; |
506 |
if ( row.checkout ) { |
506 |
row._status.split(",").forEach( status => { |
507 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
507 |
if ( status == 'checked_out' || status == 'local_use') { |
508 |
row.checkout.patron.library = { name: libraries_names.get(row.checkout.patron.library_id) }; |
508 |
nodes += '<span>'; |
509 |
|
509 |
|
510 |
nodes += '<span>'; |
510 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
511 |
if ( row.checkout.onsite_checkout ) { |
511 |
row.checkout.patron.library = { name: libraries_names.get(row.checkout.patron.library_id) }; |
512 |
let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
512 |
let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
513 |
nodes += _("Currently in local use by %s").format(patron_to_html); |
513 |
|
514 |
} else { |
514 |
if ( status == 'local_use' ) { |
515 |
nodes += '<span class="holding_status datedue">'; |
515 |
nodes += _("Currently in local use by %s").format(patron_to_html); |
516 |
let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
516 |
} else { |
517 |
nodes += _("Checked out to %s").format(patron_to_html); |
517 |
nodes += '<span class="datedue">'; |
|
|
518 |
nodes += _("Checked out to %s").format(patron_to_html); |
519 |
} |
520 |
nodes += ': '; |
521 |
nodes += _("due %s").format($date(row.checkout.due_date, { as_due_date: true })); |
522 |
nodes += "</span>" |
523 |
|
518 |
} |
524 |
} |
519 |
nodes += ': '; |
525 |
if ( status == 'in_transit' ) { |
520 |
nodes += _("due %s").format($date(row.checkout.due_date, { as_due_date: true })); |
526 |
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))); |
521 |
nodes += "</span>" |
|
|
522 |
} else if ( row.transfer ) { |
523 |
if ( row.transfer.datesent ) { |
524 |
nodes += '<span class="holding_status 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))); |
525 |
} else { |
526 |
nodes += '<span class="holding_status 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))); |
527 |
} |
527 |
} |
528 |
} |
|
|
529 |
|
528 |
|
530 |
if ( row.lost_status ) { |
529 |
if ( status == 'transit_pending' ) { |
531 |
let lost_lib = av_lost.get(row.lost_status.toString()) || _("Unavailable (lost or missing"); |
530 |
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))); |
532 |
nodes += '<span class="holding_status lost">%s</span>'.format(escape_str(lost_lib)); |
531 |
} |
533 |
[% IF Koha.Preference('ClaimReturnedLostValue') %] |
532 |
|
534 |
const hasReturnClaims = row.return_claims.filter(rc => !rc.resolution).length > 0 ? true : false |
533 |
if ( status == 'lost' ) { |
|
|
534 |
let lost_lib = av_lost.get(row.lost_status.toString()) || _("Unavailable (lost or missing"); |
535 |
nodes += '<span class="lost">%s</span>'.format(escape_str(lost_lib)); |
536 |
|
537 |
const hasReturnClaims = row.return_claims && row.return_claims.filter(rc => !rc.resolution).length > 0 ? true : false |
535 |
if(hasReturnClaims) { |
538 |
if(hasReturnClaims) { |
536 |
nodes += '<span class="holding_status claimed_returned">' + _("(Claimed returned)") + '</span>'; |
539 |
nodes += '<span class="holding_status claimed_returned">' + _("(Claimed returned)") + '</span>'; |
537 |
} |
540 |
} |
538 |
[% END %] |
541 |
} |
539 |
} |
|
|
540 |
|
542 |
|
541 |
if ( row.withdrawn ) { |
543 |
if ( status == 'withdrawn' ) { |
542 |
let withdrawn_lib = av_withdrawn.get(row.withdrawn.toString()) || _("Withdrawn"); |
544 |
let withdrawn_lib = av_withdrawn.get(row.withdrawn.toString()) || _("Withdrawn"); |
543 |
nodes += '<span class="holding_status wdn">%s</span>'.format(escape_str(withdrawn_lib)); |
545 |
nodes += '<span class="wdn">%s</span>'.format(escape_str(withdrawn_lib)); |
544 |
} |
546 |
} |
545 |
|
547 |
|
546 |
if ( row.damaged_status ) { |
548 |
if ( status == 'damaged' ) { |
547 |
let damaged_lib = av_damaged.get(row.damaged_status.toString()) || _("Damaged"); |
549 |
let damaged_lib = av_damaged.get(row.damaged_status.toString()) || _("Damaged"); |
548 |
nodes += '<span class="holding_status dmg">%s</span>'.format(escape_str(damaged_lib)); |
550 |
nodes += '<span class="dmg">%s</span>'.format(escape_str(damaged_lib)); |
549 |
} |
551 |
} |
550 |
|
552 |
|
551 |
if ( row.not_for_loan_status || item_types_notforloan.get(row.item_type_id) ) { |
553 |
if ( status == 'not_for_loan' ) { |
552 |
let not_for_loan_lib = av_not_for_loan.get(row.not_for_loan_status.toString()); |
554 |
let not_for_loan_lib = av_not_for_loan.get(row.not_for_loan_status.toString()); |
553 |
nodes += '<span class="holding_status notforloan">%s'.format(_("Not for loan")) + ( not_for_loan_lib ? '<span class="reason"> (%s)</span>'.format(escape_str(not_for_loan_lib)) : '' ) + '</span>'; |
555 |
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>'; |
554 |
} |
556 |
} |
555 |
|
557 |
|
556 |
if ( row.first_hold ) { |
558 |
if ( status == 'on_hold') { |
557 |
if ( row.first_hold.waiting_date ) { |
559 |
if ( row.first_hold.waiting_date ) { |
558 |
if ( row.first_hold.desk ) { |
560 |
if ( row.first_hold.desk ) { |
559 |
nodes += '<span class="holding_status 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))); |
561 |
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)))); |
|
|
562 |
} else { |
563 |
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)))); |
564 |
} |
565 |
[% IF Koha.Preference('canreservefromotherbranches') %] |
566 |
if ( row.first_hold.waiting_date || row.first_hold.priority == 1 ) { |
567 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
568 |
row.first_hold.patron.library = { name: libraries_names.get(row.first_hold.patron.library_id) }; |
569 |
|
570 |
let patron_to_html = $patron_to_html(row.first_hold.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
571 |
nodes += ' <span class="heldfor">%s</span>'.format(_("Hold for: %s").format(patron_to_html)); |
572 |
} |
573 |
[% END %] |
560 |
} else { |
574 |
} else { |
561 |
nodes += '<span class="holding_status waitingat">%s</span>'.format(_("Waiting at %s since %s.").format(row.first_hold._strings.pickup_library_id.str, $date(row.first_hold.waiting_date))); |
575 |
nodes += ' <span class="holdonitem">%s</span>'.format(_("There is an item level hold on this item (priority = %s).").format(row.first_hold.priority)); |
562 |
} |
576 |
} |
563 |
[% IF Koha.Preference('canreservefromotherbranches') %] |
|
|
564 |
if ( row.first_hold.waiting_date || row.first_hold.priority == 1 ) { |
565 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
566 |
row.first_hold.patron.library = { name: libraries_names.get(row.first_hold.patron.library_id) }; |
567 |
|
568 |
let patron_to_html = $patron_to_html(row.first_hold.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
569 |
nodes += ' <span class="holding_status heldfor">%s</span>'.format(_("Hold for: %s").format(patron_to_html)); |
570 |
} |
571 |
[% END %] |
572 |
} else { |
573 |
nodes += ' <span class="holding_status holdonitem">%s</span>'.format(_("There is an item level hold on this item (priority = %s).").format(row.first_hold.priority)); |
574 |
} |
577 |
} |
575 |
} |
|
|
576 |
|
578 |
|
577 |
[% IF Koha.Preference('UseRecalls') %] |
579 |
[% IF Koha.Preference('UseRecalls') %] |
578 |
if ( row.recall && ( row.item_id === row.recall.item_id ) ) { |
580 |
if ( row.recall && ( row.item_id === row.recall.item_id ) ) { |
Lines 587-604
Link Here
|
587 |
} |
589 |
} |
588 |
} |
590 |
} |
589 |
[% END %] |
591 |
[% END %] |
|
|
592 |
if ( status == 'available' ) { |
593 |
nodes += ' <span>%s</span>'.format(_("Available")) |
594 |
} |
590 |
|
595 |
|
591 |
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 ) ) )) { |
596 |
if ( status == 'restricted') { |
592 |
nodes += ' <span class="holding_status available">%s</span>'.format(_("Available")) |
597 |
nodes += '<span class="restricted">(%s)</span>'.format(escape_str(av_restricted.get(row.restricted_status.toString()))); |
593 |
} |
598 |
} |
594 |
|
599 |
if ( status == 'in_bundle') { |
595 |
if ( row.restricted_status ) { |
600 |
nodes += '<span class="bundled">%s</span>'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true }))); |
596 |
nodes += '<span class="holding_status restricted">(%s)</span>'.format(escape_str(av_restricted.get(row.restricted_status.toString()))); |
601 |
} |
597 |
} |
602 |
}); |
598 |
|
|
|
599 |
if ( row.in_bundle ) { |
600 |
nodes += '<span class="holding_status bundled">%s</span>'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true }))); |
601 |
} |
602 |
return nodes; |
603 |
return nodes; |
603 |
} |
604 |
} |
604 |
}, |
605 |
}, |
605 |
- |
|
|