<p>Owned by <%= owner.toHTML() %>.</p>
<% if (!_.isEmpty(current_loan)) { %>
  <p>
    <span class="label label-info">Loaned</span>
    to <%= current_loan.get('recipient_user').toHTML() %>.
    <% /* IMPLEMENTME add "since", needs proper loan records */ %>
  </p>
<% } %>
<p>
  <% if (current_reservation) { %>
    <span class="label">Reserved</span>
    by <%= current_reservation.get('user').toHTML() %>
    <% if (current_reservation.get('type') == 'recipe') { %>
      for <a href="<%- window.beaker_url_prefix %>recipes/<%- current_reservation.get('recipe_id') %>">R:<%- current_reservation.get('recipe_id') %></a>
    <% } %>
    <time datetime="<%- moment.utc(current_reservation.get('start_time')).toISOString() %>"
          title="<%- moment.utc(current_reservation.get('start_time')).local().format('YYYY-MM-DD HH:mm:ss Z') %>">
      <%- moment.utc(current_reservation.get('start_time')).fromNow() %></time>.
  <% } else { %>
    <span class="label">Idle</span> since
    <% var idle_since = previous_reservation ? previous_reservation.get('finish_time') : created_date; %>
    <time datetime="<%- moment.utc(idle_since).toISOString() %>"
          title="<%- moment.utc(idle_since).local().format('YYYY-MM-DD HH:mm:ss Z') %>">
      <%- moment.utc(idle_since).fromNow() %></time>.
  <% } %>
</p>
<% if (queue_size) { %>
  <p><%- queue_size %> queued recipes could use this system.</p>
<% } %>
<p>
  <% if (can_return) { %>
    <a href="#" class="btn btn-block return" data-loading-text="<i class='fa fa-spinner fa-spin'></i> Returning&hellip;">Return</a>
  <% } else if (can_take && can_return_loan) { %>
    <% /*
    Normally we want to show only *one* quick action button here, to avoid 
    bloating the "quick info" boxes. However this is a special case for the 
    situation where a system is loaned to the current user. In that case there 
    are two equally likely actions they might want to do: take the system (if 
    they just got the loan), or return the loan (if they have already 
    taken+returned the system and are now done with it).
    */ %>
    <div class="btn-group btn-group-justified" style="display: block;">
      <a href="#" class="btn take" data-loading-text="<i class='fa fa-spinner fa-spin'></i> Taking&hellip;">Take</a>
      <a href="#" class="btn return-loan" data-loading-text="<i class='fa fa-spinner fa-spin'></i> Returning loan&hellip;">Return Loan</a>
    </div>
  <% } else if (can_take) { %>
    <a href="#" class="btn btn-block take" data-loading-text="<i class='fa fa-spinner fa-spin'></i> Taking&hellip;">Take</a>
  <% } else if (can_return_loan) { %>
    <a href="#" class="btn btn-block return-loan" data-loading-text="<i class='fa fa-spinner fa-spin'></i> Returning loan&hellip;">Return Loan</a>
  <% } else if (can_borrow) { %>
    <a href="#" class="btn btn-block borrow" data-loading-text="<i class='fa fa-spinner fa-spin'></i> Borrowing&hellip;">Borrow</a>
  <% } else if (can_reserve) { %>
    <a href="<%- beaker_url_prefix %>reserveworkflow/?system=<%- fqdn %>" class="btn btn-block">Schedule Reservation</a>
  <% } else if (_.isEmpty(window.beaker_current_user)) { %>
    <button type="button" class="btn btn-block" disabled="disabled">Not logged in</button>
  <% } else { %>
    <button type="button" class="btn btn-block request-loan" data-loading-text="<i class='fa fa-spinner fa-spin'></i> Requesting loan&hellip;">Request Loan</button>
  <% } %>
</p>
