{% extends 'base.html' %}
{% load calctags %}
{% block top %}
{% endblock %}

{% block body %}

  <p>{% if demo %} Non sono state inviate mail - modalita' demo attiva {% endif %}</p>

  <p>DOMINI CHE HANNO SUPERATO LA SOGLIA</p>
  <table class='table table-striped table-hover'>
    <tr>
      <th scope='col'>dominio</th>
      <th scope='col'>rilevamento</th>
      <th scope='col'>target</th>
      <th scope='col'>Attuale</th>
      <th scope='col'>Precedente</th>
      <th scope='col'>Variazione</th>
      <th scope='col'>Extra Target</th>
    </tr>
    {% for i in  domini %}
      {% if i|QuotaAlert %}
        <tr>
          <td>{{ i.nome }}</td>
          <td>{{ i.date_mail_quota }}</td>
          <td>{{ i.target.spazio|Giga }} - {{ i.target.nome }}</td>
          <td>{{ i|SumQuota|Giga }}</td>
          <td>{{ i|SumLast|Giga }}</td>
          <td>{{ i|DiffQuota|Giga }}</td>
          <td>{{ i|QuotaAlert|Giga }}</td>
        </tr>
      {% endif %}
    {% endfor %}
  </table>

  <br><br>
  <p>Lista domini in essere</p>

  <table class='table table-striped table-hover'>
    <thead>
      <tr>
        <th scope='col'>Dominio</th>
	<th scope='col'>Target</th>
        <th scope='col'>Attuale</th>
        <th scope='col'>Precedente</th>
        <th scope='col'>Differenza</th>
	<th scope='col'>Extra Target</th>
      </tr>
    </thead>
    <tbody>
      {% for d in domini %}
      <tr {% if d|QuotaAlert %} class='bg-warning' {% endif %}>
          <td scope='row'>{{ d.nome }} </td>
	  <td>{{ d.target.nome }}({{ d.target.spazio|Giga }})</td>
          <td>{{ d|SumQuota|Giga }}</td>
	  <td>{{ d|SumLast|Giga }} </td>
	  <td>{{ d|DiffQuota|Giga }}</td>
	  <td>{{ d|QuotaAlert|Giga }}</td>
        </tr>
      {% endfor %}
      </form>
    </tbody>
{% endblock %}


