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