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