{% extends "base.html" %}
{% load backend_tags %}
{% block content %}
  <h2>Reports</h2>
  
  <a href="">Generate Report</a>
  <!-- 
    {{ sla | pprint }} -->
  <div class='table-responsive'>
  <table class='table table-bordered' style='min-width:1200px'>
    <thead>
    <tr>
      <th>Service</th>
      {% for d in days %}
      <th>{{ d }}</th>
      {% endfor %}
    </tr>
    </thead>
    <tbody>
      {% for x in sla.result %}
        {% for k,v in x.items %}
        <tr>
          <td colspan=32 class='bg-primary'>
            {{ v.sla_name }}
          </td> 
        </tr>
        {% with services=sla_results|kv:v.sla_name %}
          <!--
          <pre>
          {{ services.result.service_instances | pprint }}
          </pre> -->
            {% for s in services.result.service_instances %}
        <tr>
              <td>
                {{ s.service_instance_name }}
              </td>
              {% for d in days %}
              <td></td>
            {% endfor %}
        </tr>
            {% test_value test_status v.sla_name s.service_instance_name as tvalues %}
            {% for rs in tvalues.results_scores %}
            <tr>
              
              <td> - {{ rs.name }}</td><td>{{ rs.raw_value }}</td><td>{{ rs.score }}</td>
            </tr>
            {% endfor %}
          {% endfor %}
        {% endwith %}
      {% endfor %}
      {% endfor %}
    </tbody>
  </table>
  </div>
 <pre>
 SLA Result
    {{ sla_results | pprint }}
 </pre>
 <pre>
Test Status
  {{ test_status | pprint }}
 </pre>
{% endblock %}
