<p>
  <% if (status == 'Removed') { %>
    <span class="label label-important">Removed</span>
  <% } else if (status == 'Broken') { %>
    <span class="label label-warning">Out of service</span> since
  <% } else if (status == 'Automated' || status == 'Manual') { %>
    <span class="label label-success">Operational</span> since
  <% } else { %>
    <span class="label"><%- status %></span> since
  <% } %>
  <time datetime="<%- moment.utc(status_since).toISOString() %>"
        title="<%- moment.utc(status_since).local().format('YYYY-MM-DD HH:mm:ss Z') %>">
    <%- moment.utc(status_since).fromNow() %></time>.
</p>
<% if (status_reason) { %>
<p class="system-status-reason"><%- status_reason %></p>
<% } %>
<% if (recipes_run_past_week) { %>
  <p>
    <%- Math.round(recipes_aborted_past_week * 100. / recipes_run_past_week) %>% of recipes
    (<%- recipes_aborted_past_week %> out of <%- recipes_run_past_week %>)
    aborted in the past week.
  </p>
<% } %>
<!-- XXX most recent note? most recent power failure output? -->
<p>
<% if (can_change_status && (status == 'Broken' || status == 'Removed')) { %>
  <!-- For now we don't know whether the status is supposed to be set back to 
  Automated or Manual, so we just punt and show the Scheduler Settings tab 
  and let the user figure it out. But ideally, this would be a one-click 
  operation to mark a system as unbroken. -->
  <a href="#scheduler-settings" class="btn btn-block">Return to service</a>
<% } else if (can_change_status) { %>
  <a href="#scheduler-settings" class="btn btn-block">Remove from service</a>
<% } else if (_.isEmpty(window.beaker_current_user)) { %>
  <button type="button" class="btn btn-block" disabled="disabled">Not logged in</button>
<% } %>
<!-- If user is logged in, allow him to report a problem with system.
     The button is disabled if system is already marked as `Broken` or `Removed`. -->
<% if (!_.isEmpty(window.beaker_current_user)) { %>
  <button type="button" class="btn btn-block report-problem"
        <% if (status == 'Broken' || status == 'Removed') { %> disabled <% } %>
        >Report problem</button>
<% } %>
</p>
