Lines 2485-2495
Link Here
|
2485 |
|
2485 |
|
2486 |
}); |
2486 |
}); |
2487 |
[% END %] |
2487 |
[% END %] |
2488 |
const can_edit_items_from = [% To.json(can_edit_items_from) | $raw %]; |
2488 |
const can_edit_items_from = [% To.json(can_edit_items_from || {}) | $raw %]; |
2489 |
const item_type_image_locations = [% To.json(item_type_image_locations) | $raw %]; |
2489 |
const item_type_image_locations = [% To.json(item_type_image_locations) | $raw %]; |
2490 |
const av_loc = new Map([% To.json(AuthorisedValues.Get('LOC')) | $raw %].map( av => [av.authorised_value, av.lib])); |
2490 |
const av_loc = new Map([% To.json(AuthorisedValues.Get('LOC')) | $raw %].map( av => [av.authorised_value, av.lib])); |
|
|
2491 |
const av_lost = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.itemlost' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
2492 |
const av_withdrawn = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.withdrawn' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
2493 |
const av_damaged = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.damaged' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
2494 |
const av_not_for_loan= new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.notforloan' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
2495 |
const av_restricted = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.restricted' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
2491 |
let table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; |
2496 |
let table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; |
2492 |
let embed = ["+strings"]; |
2497 |
let embed = ["+strings,checkout,checkout.patron,transfer,first_hold,first_hold.patron,item_type"]; |
2493 |
[% IF Koha.Preference('LocalCoverImages') %] |
2498 |
[% IF Koha.Preference('LocalCoverImages') %] |
2494 |
embed.push('cover_image_ids'); |
2499 |
embed.push('cover_image_ids'); |
2495 |
[% END %] |
2500 |
[% END %] |
Lines 2499-2504
Link Here
|
2499 |
[% IF biblio.serial %] |
2504 |
[% IF biblio.serial %] |
2500 |
embed.push('serialitem.serial'); |
2505 |
embed.push('serialitem.serial'); |
2501 |
[% END %] |
2506 |
[% END %] |
|
|
2507 |
[% IF Koha.Preference('UseRecalls') %] |
2508 |
embed.push('recall', 'recall.patron') |
2509 |
[% END %] |
2510 |
embed.push('in_bundle', 'bundle_host'); |
2502 |
let table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %]; |
2511 |
let table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %]; |
2503 |
var items_table = $("#table_items").kohaTable({ |
2512 |
var items_table = $("#table_items").kohaTable({ |
2504 |
ajax: { url: table_url }, |
2513 |
ajax: { url: table_url }, |
Lines 2659-2670
Link Here
|
2659 |
} |
2668 |
} |
2660 |
}, |
2669 |
}, |
2661 |
{ |
2670 |
{ |
2662 |
data: "", |
2671 |
data: "me.lost_status", |
2663 |
className: "status", |
2672 |
className: "status", |
2664 |
searchable: false, // FIXME |
2673 |
searchable: false, // FIXME We are losing the ability to search on the status |
2665 |
orderable: true, |
2674 |
orderable: false, |
2666 |
render: function (data, type, row, meta) { |
2675 |
render: function (data, type, row, meta) { |
2667 |
return "status"; // FIXME Display status |
2676 |
let nodes = ""; |
|
|
2677 |
if ( row.checkout ) { |
2678 |
nodes += '<span>'; |
2679 |
if ( row.checkout.onsite_checkout ) { |
2680 |
if ( can_edit_items_from[row.holding_library_id] ){ |
2681 |
let patron_to_html = $patron_to_html(row.checkout.patron); [%# FIXME What about hide_patron_infos_if_needed?? %] |
2682 |
nodes += _("Currently in local use by %s").format(patron_to_html); |
2683 |
} else { |
2684 |
nodes += _("Currently in local use"); |
2685 |
} |
2686 |
} else { |
2687 |
nodes += '<span class="datedue">'; |
2688 |
if ( can_edit_items_from[row.holding_library_id] ){ |
2689 |
let patron_to_html = $patron_to_html(row.checkout.patron); [%# FIXME What about hide_patron_infos_if_needed?? %] |
2690 |
nodes += _("Checked out to %s").format(patron_to_html); |
2691 |
} else { |
2692 |
nodes += _("Checked out"); |
2693 |
} |
2694 |
} |
2695 |
nodes += ': '; |
2696 |
nodes += _("due %s").format($date(row.checkout.due_date)); [%# FIXME Missing due date formatting here, $date do not have as_due_date option %] |
2697 |
nodes += "</span>" |
2698 |
} else if ( row.transfer ) { |
2699 |
if ( row.transfer.datesent ) { |
2700 |
nodes += '<span class="intransit">%s</span>'.format(_("In transit from %s to %s since %s").format(row.transfer.frombranch, row.transfer.tobranch, $date(row.transfer.datesent))); [%# FIXME display library names, not codes, do we use _strings here? %] |
2701 |
} else { |
2702 |
nodes += '<span class="transitrequested">%s</span>'.format(_("Transit pending from %s to %s since %s").format(row.transfer.frombranch, row.transfer.tobranch, $date(row.transfer.daterequested))); [%# FIXME See above %] |
2703 |
} |
2704 |
} |
2705 |
|
2706 |
if ( row.lost_status ) { |
2707 |
let lost_lib = av_lost.get(row.lost_status.toString()) || _("Unavailable (lost or missing"); |
2708 |
nodes += '<span class="lost">%s</span>'.format(lost_lib); |
2709 |
} |
2710 |
|
2711 |
if ( row.withdrawn ) { |
2712 |
let withdrawn_lib = av_withdrawn.get(row.withdrawn.toString()) || _("Withdrawn"); |
2713 |
nodes += '<span class="wdn">%s</span>'.format(withdrawn_lib); |
2714 |
} |
2715 |
|
2716 |
if ( row.damaged ) { |
2717 |
let damaged_lib = av_damaged.get(row.damaged.toString()) || _("Damaged"); |
2718 |
nodes += '<span class="dmg">%s</span>'.format(damaged_lib); |
2719 |
} |
2720 |
|
2721 |
if ( row.not_for_loan_status || row.item_type.notforloan ) { |
2722 |
let not_for_loan_lib = av_not_for_loan.get(row.not_for_loan_status.toString()); |
2723 |
nodes += '<span class="notforloan">%s'.format(_("Not for loan")) + ( not_for_loan_lib ? '<span class="reason"> (%s)</span>'.format(not_for_loan_lib) : '' ) + '</span>'; |
2724 |
} |
2725 |
|
2726 |
if ( row.first_hold ) { |
2727 |
if ( row.first_hold.waiting_date ) { |
2728 |
[%# FIXME Display library names instead of codes %] |
2729 |
[%# FIXME We lost the desk name, we need an additional embed %] |
2730 |
nodes += '<span class="waitingat">%s</span>'.format(_("Waiting at %s since %s.".format(row.first_hold.pickup_library_id, $date(row.first_hold.waiting_date)))); |
2731 |
[% IF Koha.Preference('canreservefromotherbranches') %] |
2732 |
if ( row.first_hold.waiting_date || row.first_hold.priority == 1 ) { |
2733 |
let patron_to_html = $patron_to_html(row.first_hold.patron); [%# FIXME What about hide_patron_infos_if_needed?? %] |
2734 |
nodes += ' <span class="heldfor">%s</span>'.format(_("Hold for: %s").format(patron_to_html)); |
2735 |
} |
2736 |
[% END %] |
2737 |
} else { |
2738 |
nodes += '<span class="holdonitem">%s</span>'.format(_("There is an item level hold on this item (priority = %s).").format(row.first_hold.priority)); |
2739 |
} |
2740 |
} |
2741 |
|
2742 |
[% IF Koha.Preference('UseRecalls') %] |
2743 |
if ( row.recall ) { |
2744 |
if ( row.recall.waiting_date ) { |
2745 |
nodes += '<span>%s</span>'.format(_("Waiting at %s since %s").format(row.recall.pickup_library_id, $date(row.recall.waiting_date))); # FIXME Display library names instead of codes |
2746 |
} else { |
2747 |
let patron_to_html = $patron_to_html(row.recall.patron); |
2748 |
nodes += '<span>%s</span>'.format(_("recalled by %s on %s").format(patron_to_html, row.recall.created_date)); |
2749 |
} |
2750 |
} |
2751 |
[% END %] |
2752 |
|
2753 |
if ( ! ( row.not_for_loan_status || row.item_type.notforloan || row.checked_out_date || row.lost_status || row.withdrawn || row.damaged || row.transfer || row.first_hold || row.recall ) ) { |
2754 |
nodes += ' <span>%s</span>'.format(_("Available")) |
2755 |
} |
2756 |
|
2757 |
if ( row.restricted_status ) { |
2758 |
nodes += '<span class="restricted">(%s)</span>'.format(av_restricted.get(row.restricted_status.toString())); |
2759 |
} |
2760 |
|
2761 |
if ( row.in_bundle ) { |
2762 |
nodes += '<span class="bundled">%s</span>'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true }))); |
2763 |
} |
2764 |
return nodes; |
2668 |
} |
2765 |
} |
2669 |
}, |
2766 |
}, |
2670 |
{ |
2767 |
{ |
2671 |
- |
|
|