Lines 207-213
Link Here
|
207 |
[%# In case or SeparateHoldings we may need to display the number of biblios in each tab %] |
207 |
[%# In case or SeparateHoldings we may need to display the number of biblios in each tab %] |
208 |
[%# Do we need separate/new endpoints or do we hack the somewhere client-side? %] |
208 |
[%# Do we need separate/new endpoints or do we hack the somewhere client-side? %] |
209 |
let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; |
209 |
let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; |
210 |
let embed = ["+strings,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk"]; |
210 |
let embed = ["+strings,_status,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk"]; |
211 |
[% IF Koha.Preference('LocalCoverImages') %] |
211 |
[% IF Koha.Preference('LocalCoverImages') %] |
212 |
embed.push('cover_image_ids'); |
212 |
embed.push('cover_image_ids'); |
213 |
[% END %] |
213 |
[% END %] |
Lines 440-537
Link Here
|
440 |
} |
440 |
} |
441 |
}, |
441 |
}, |
442 |
{ |
442 |
{ |
443 |
data: "me.lost_status", |
443 |
data: "me._status", |
444 |
className: "status", |
444 |
className: "status", |
445 |
searchable: false, // FIXME We are losing the ability to search on the status |
445 |
searchable: false, // FIXME We are losing the ability to search on the status |
446 |
orderable: false, |
446 |
orderable: false, |
447 |
render: function (data, type, row, meta) { |
447 |
render: function (data, type, row, meta) { |
448 |
let nodes = ""; |
448 |
let nodes = ""; |
449 |
if ( row.checkout ) { |
449 |
row._status.split(",").forEach( status => { |
450 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
450 |
if ( status == 'checked_out' || status == 'local_use') { |
451 |
row.checkout.patron.library = { name: libraries_names.get(row.checkout.patron.library_id) }; |
451 |
nodes += '<span>'; |
452 |
|
452 |
|
453 |
nodes += '<span>'; |
453 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
454 |
if ( row.checkout.onsite_checkout ) { |
454 |
row.checkout.patron.library = { name: libraries_names.get(row.checkout.patron.library_id) }; |
455 |
let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
455 |
let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
456 |
nodes += _("Currently in local use by %s").format(patron_to_html); |
456 |
|
457 |
} else { |
457 |
if ( status == 'local_use' ) { |
458 |
nodes += '<span class="datedue">'; |
458 |
nodes += _("Currently in local use by %s").format(patron_to_html); |
459 |
let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
459 |
} else { |
460 |
nodes += _("Checked out to %s").format(patron_to_html); |
460 |
nodes += '<span class="datedue">'; |
|
|
461 |
nodes += _("Checked out to %s").format(patron_to_html); |
462 |
} |
463 |
nodes += ': '; |
464 |
nodes += _("due %s").format($date(row.checkout.due_date, { as_due_date: true })); |
465 |
nodes += "</span>" |
466 |
|
461 |
} |
467 |
} |
462 |
nodes += ': '; |
468 |
if ( status == 'in_transit' ) { |
463 |
nodes += _("due %s").format($date(row.checkout.due_date, { as_due_date: true })); |
|
|
464 |
nodes += "</span>" |
465 |
} else if ( row.transfer ) { |
466 |
if ( row.transfer.datesent ) { |
467 |
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))); |
469 |
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))); |
468 |
} else { |
470 |
} |
|
|
471 |
|
472 |
if ( status == 'transit_pending' ) { |
469 |
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))); |
473 |
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))); |
470 |
} |
474 |
} |
471 |
} |
|
|
472 |
|
475 |
|
473 |
if ( row.lost_status ) { |
476 |
if ( status == 'lost' ) { |
474 |
let lost_lib = av_lost.get(row.lost_status.toString()) || _("Unavailable (lost or missing"); |
477 |
let lost_lib = av_lost.get(row.lost_status.toString()) || _("Unavailable (lost or missing"); |
475 |
nodes += '<span class="lost">%s</span>'.format(escape_str(lost_lib)); |
478 |
nodes += '<span class="lost">%s</span>'.format(escape_str(lost_lib)); |
476 |
} |
479 |
} |
477 |
|
480 |
|
478 |
if ( row.withdrawn ) { |
481 |
if ( status == 'withdrawn' ) { |
479 |
let withdrawn_lib = av_withdrawn.get(row.withdrawn.toString()) || _("Withdrawn"); |
482 |
let withdrawn_lib = av_withdrawn.get(row.withdrawn.toString()) || _("Withdrawn"); |
480 |
nodes += '<span class="wdn">%s</span>'.format(escape_str(withdrawn_lib)); |
483 |
nodes += '<span class="wdn">%s</span>'.format(escape_str(withdrawn_lib)); |
481 |
} |
484 |
} |
482 |
|
485 |
|
483 |
if ( row.damaged_status ) { |
486 |
if ( status == 'damaged' ) { |
484 |
let damaged_lib = av_damaged.get(row.damaged_status.toString()) || _("Damaged"); |
487 |
let damaged_lib = av_damaged.get(row.damaged_status.toString()) || _("Damaged"); |
485 |
nodes += '<span class="dmg">%s</span>'.format(escape_str(damaged_lib)); |
488 |
nodes += '<span class="dmg">%s</span>'.format(escape_str(damaged_lib)); |
486 |
} |
489 |
} |
487 |
|
490 |
|
488 |
if ( row.not_for_loan_status || item_types_notforloan.get(row.item_type_id) ) { |
491 |
if ( status == 'not_for_loan' ) { |
489 |
let not_for_loan_lib = av_not_for_loan.get(row.not_for_loan_status.toString()); |
492 |
let not_for_loan_lib = av_not_for_loan.get(row.not_for_loan_status.toString()); |
490 |
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>'; |
493 |
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>'; |
491 |
} |
494 |
} |
492 |
|
495 |
|
493 |
if ( row.first_hold ) { |
496 |
if ( status == 'on_hold') { |
494 |
if ( row.first_hold.waiting_date ) { |
497 |
if ( row.first_hold.waiting_date ) { |
495 |
if ( row.first_hold.desk ) { |
498 |
if ( row.first_hold.desk ) { |
496 |
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)))); |
499 |
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)))); |
|
|
500 |
} else { |
501 |
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)))); |
502 |
} |
503 |
[% IF Koha.Preference('canreservefromotherbranches') %] |
504 |
if ( row.first_hold.waiting_date || row.first_hold.priority == 1 ) { |
505 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
506 |
row.first_hold.patron.library = { name: libraries_names.get(row.first_hold.patron.library_id) }; |
507 |
|
508 |
let patron_to_html = $patron_to_html(row.first_hold.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
509 |
nodes += ' <span class="heldfor">%s</span>'.format(_("Hold for: %s").format(patron_to_html)); |
510 |
} |
511 |
[% END %] |
497 |
} else { |
512 |
} else { |
498 |
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)))); |
513 |
nodes += ' <span class="holdonitem">%s</span>'.format(_("There is an item level hold on this item (priority = %s).").format(row.first_hold.priority)); |
499 |
} |
514 |
} |
500 |
[% IF Koha.Preference('canreservefromotherbranches') %] |
|
|
501 |
if ( row.first_hold.waiting_date || row.first_hold.priority == 1 ) { |
502 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
503 |
row.first_hold.patron.library = { name: libraries_names.get(row.first_hold.patron.library_id) }; |
504 |
|
505 |
let patron_to_html = $patron_to_html(row.first_hold.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
506 |
nodes += ' <span class="heldfor">%s</span>'.format(_("Hold for: %s").format(patron_to_html)); |
507 |
} |
508 |
[% END %] |
509 |
} else { |
510 |
nodes += ' <span class="holdonitem">%s</span>'.format(_("There is an item level hold on this item (priority = %s).").format(row.first_hold.priority)); |
511 |
} |
515 |
} |
512 |
} |
|
|
513 |
|
516 |
|
514 |
[% IF Koha.Preference('UseRecalls') %] |
517 |
[% IF Koha.Preference('UseRecalls') %] |
515 |
if ( row.recall ) { |
518 |
if ( status == 'recalled' ) { |
516 |
if ( row.recall.waiting_date ) { |
519 |
if ( row.recall.waiting_date ) { |
517 |
nodes += '<span>%s</span>'.format(_("Waiting at %s since %s").format(escape_str(row.recall.pickup_library_id.str), $date(row.recall.waiting_date))); |
520 |
nodes += '<span>%s</span>'.format(_("Waiting at %s since %s").format(escape_str(row.recall.pickup_library_id.str), $date(row.recall.waiting_date))); |
518 |
} else { |
521 |
} else { |
519 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
522 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
520 |
row.recall.patron.library = { name: libraries_names.get(row.recall.patron.library_id) }; |
523 |
row.recall.patron.library = { name: libraries_names.get(row.recall.patron.library_id) }; |
521 |
|
524 |
|
522 |
let patron_to_html = $patron_to_html(row.recall.patron, {url: true, display_cardnumber: true, hide_patron_name }); |
525 |
let patron_to_html = $patron_to_html(row.recall.patron, {url: true, display_cardnumber: true, hide_patron_name }); |
523 |
nodes += '<span>%s</span>'.format(_("recalled by %s on %s").format(patron_to_html, $date(row.recall.created_date))) |
526 |
nodes += '<span>%s</span>'.format(_("recalled by %s on %s").format(patron_to_html, $date(row.recall.created_date))) |
|
|
527 |
} |
524 |
} |
528 |
} |
525 |
} |
529 |
[% END %] |
526 |
[% END %] |
|
|
527 |
|
530 |
|
528 |
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 ) ) { |
531 |
if ( status == 'available' ) { |
529 |
nodes += ' <span>%s</span>'.format(_("Available")) |
532 |
nodes += ' <span>%s</span>'.format(_("Available")) |
530 |
} |
533 |
} |
531 |
|
534 |
|
532 |
if ( row.restricted_status ) { |
535 |
if ( status == 'restricted') { |
533 |
nodes += '<span class="restricted">(%s)</span>'.format(escape_str(av_restricted.get(row.restricted_status.toString()))); |
536 |
nodes += '<span class="restricted">(%s)</span>'.format(escape_str(av_restricted.get(row.restricted_status.toString()))); |
534 |
} |
537 |
} |
|
|
538 |
}); |
535 |
|
539 |
|
536 |
[% IF bundlesEnabled %] |
540 |
[% IF bundlesEnabled %] |
537 |
if ( row.in_bundle ) { |
541 |
if ( row.in_bundle ) { |
538 |
- |
|
|