{% extends "base-timeview.html" %}
{% load bcfg2_tags %}
{% comment %}
This is needed for Django versions less than 1.5
{% endcomment %}
{% load url from future %}

{% block title %}Bcfg2 - Detailed Client Listing{% endblock %}
{% block pagebanner %}Clients - Detailed View{% endblock %}

{% block content %}
  {% filter_navigator %}
<div class='client_list_box'>
{% if entry_list %}
  <table cellpadding="3">
  <tr id='table_list_header' class='listview'>
    <td class='left_column'>{% sort_link 'client' 'Node' %}</td>
    <td class='right_column' style='width:75px'>{% sort_link 'state' 'State' %}</td>
    <td class='right_column_narrow'>{% sort_link '-good' 'Good' %}</td>
    <td class='right_column_narrow'>{% sort_link '-bad' 'Bad' %}</td>
    <td class='right_column_narrow'>{% sort_link '-modified' 'Modified' %}</td>
    <td class='right_column_narrow'>{% sort_link '-extra' 'Extra' %}</td>
    <td class='right_column'>{% sort_link 'timestamp' 'Last Run' %}</td>
    <td class='right_column_wide'>{% sort_link 'server' 'Server' %}</td>
  </tr>
  {% for entry in entry_list %}
  <tr class='{% cycle listview,listview_alt %}'>
    <td class='left_column'><a href='{% url "Bcfg2.Reporting.views.client_detail" hostname=entry.client.name pk=entry.id %}'>{{ entry.client.name }}</a></td>
    <td class='right_column' style='width:75px'><a href='{% add_url_filter state=entry.state %}'
      class='{{entry|determine_client_state}}'>{{ entry.state }}</a></td>
    <td class='right_column_narrow'>{{ entry.good_count }}</td>
    <td class='right_column_narrow'>{{ entry.bad_count }}</td>
    <td class='right_column_narrow'>{{ entry.modified_count }}</td>
    <td class='right_column_narrow'>{{ entry.extra_count }}</td>
    <td class='right_column'><span {% if entry.timestamp|isstale:entry_max %}class='dirty-lineitem'{% endif %}>{{ entry.timestamp|date:"Y-m-d\&\n\b\s\p\;H:i"|safe }}</span></td>
    <td class='right_column_wide'>
       {% if entry.server %}
         <a href='{% add_url_filter server=entry.server %}'>{{ entry.server }}</a>
       {% else %}
         &nbsp;
       {% endif %}
    </td>
  </tr>
  {% endfor %}
  </table>
{% else %}
    <p>No client records are available.</p>
{% endif %}
</div>
{% endblock %}
