{% 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 - Client Summary{% endblock %}
{% block pagebanner %}Clients - Summary{% endblock %}

{% block body_onload %}javascript:hide_table_array(hide_tables){% endblock %}

{% block extra_header_info %}
<script type="text/javascript">
var hide_tables = new Array({{ summary_data|length }});
{% for summary in summary_data %}
hide_tables[{{ forloop.counter0 }}] = "table_{{ summary.name }}";
{% endfor %}
</script>
{% endblock%}

{% block content %}
  <div class='detail_header'>
    <h2>{{ node_count }} nodes reporting in</h2>
  </div>
{% if summary_data %}
  {% for summary in summary_data  %}
    <div class='entry_list'>
      <div class='entry_list_head element_list_head' onclick='javascript:toggleMe("table_{{ summary.name }}");'>
        <h3>{{ summary.nodes|length }} {{ summary.label }}</h3>
        <div class='entry_expand_tab' id='plusminus_table_{{ summary.name }}'>[+]</div>
      </div>

      <table id='table_{{ summary.name }}' class='entry_list'>
        {% for node in summary.nodes|sort_interactions_by_name %}
          <tr class='{% cycle listview,listview_alt %}'>
              <td><a href='{% url "reports_client_detail_pk" hostname=node.client.name pk=node.id %}'>{{ node.client.name }}</a></td>
          </tr>
        {% endfor %}
      </table>
    </div>
  {% endfor %}
{% else %}
    <p>No data to report on</p>
{% endif %}
{% endblock %}
