{% extends "base.html" %}
{% load i18n range units %}
{% block extra_head %}
{{form.media}}
{% endblock %}
{% block content %}
<div class='dashboard'>
  <h2>{% trans "Archaeological files" %}</h2>

  <h3>{% trans "Global informations" %}</h3>
  <div>
    <p><strong>{% trans "Total:" %}</strong> {{dashboard.total_number}}</p>
    {% for type in dashboard.types %}
    <p><strong>{{type.file_type__label}}{% trans ":"%}</strong> {{type.number}}</p>
    {% endfor %}
    <div class='table'>
    <table>
      <caption>{% trans "By year"%}</caption>
      <tr>
      {% for year in dashboard.by_year %}<th>{{year.date.year}}</th>{% endfor %}
      </tr>
      <tr>
      {% for year in dashboard.by_year %}<td>{{year.number}}</td>{% endfor%}
      </tr>
    </table>
    </div>

    <div class='table'>
    <table>
      <caption>{% trans "By month"%}</caption>
      <tr>
      {% for month in dashboard.by_month %}<th>{{month.date|date:"F Y"|capfirst}}</th>{% endfor %}
      </tr>
      <tr>
      {% for month in dashboard.by_month %}<td>{{month.number}}</td>{% endfor%}
      </tr>
    </table>
    </div>

  </div>

  <h3>{% trans "Research archaeology" %}</h3>
  <div>
    <p><strong>{% trans "Total:" %}</strong> {{dashboard.research.total_number}}</p>
    <div class='table'>
    <table>
      <caption>{% trans "By year"%}</caption>
      <tr>
      {% for year in dashboard.research.by_year %}<th>{{year.date.year}}</th>{% endfor %}
      </tr>
      <tr>
      {% for year in dashboard.research.by_year %}<td>{{year.number}}</td>{% endfor%}
      </tr>
    </table>
    </div>

    <div class='table'>
    <table>
      <caption>{% trans "By month"%}</caption>
      <tr>
      {% for month in dashboard.research.by_month %}<th>{{month.date|date:"F Y"|capfirst}}</th>{% endfor %}
      </tr>
      <tr>
      {% for month in dashboard.research.by_month %}<td>{{month.number}}</td>{% endfor%}
      </tr>
    </table>
    </div>

    <div class='table'>
    <table>
      <caption>{% trans "By department"%}</caption>
      <tr>
      {% for dpt in dashboard.research.by_dpt %}<th>{{dpt.department__label}}</th>{% endfor %}
      </tr>
      <tr>
      {% for dpt in dashboard.research.by_dpt %}<td>{{dpt.number}}</td>{% endfor%}
      </tr>
    </table>
    </div>

    <div class='table'>
    <table>
      <caption>{% trans "Main towns"%}</caption>
      <tr>
      {% for town in dashboard.research.towns %}<th>{{town.town__name}}</th>{% endfor %}
      </tr>
      <tr>
      {% for town in dashboard.research.towns %}<td>{{town.number}}</td>{% endfor%}
      </tr>
    </table>
    </div>

  </div>

  <h3>{% trans "Rescue archaeology" %}</h3>
  <div>
    <p><strong>{% trans "Total:" %}</strong> {{dashboard.rescue.total_number}}</p>

    <div class='table'>
    <table>
      <caption>{% trans "By saisine type"%}</caption>
      <tr>
      {% for saisine in dashboard.rescue.saisine %}<th>{{saisine.saisine_type__label}}</th>{% endfor %}
      </tr>
      <tr>
      {% for saisine in dashboard.rescue.saisine %}<td>{{saisine.number}}</td>{% endfor%}
      </tr>
    </table>
    </div>

    <div class='table'>
    <table>
      <caption>{% trans "By administrative act"%}</caption>
      <tr>
      {% for act in dashboard.rescue.administrative_act %}<th>{{act.act_type__label}}</th>{% endfor %}
      </tr>
      <tr>
      {% for act in dashboard.rescue.administrative_act %}<td>{{act.number}}</td>{% endfor%}
      </tr>
    </table>
    </div>

    <div class='table'>
    <table>
      <caption>{% trans "By year"%}</caption>
      <tr>
      {% for year in dashboard.rescue.by_year %}<th>{{year.date.year}}</th>{% endfor %}
      </tr>
      <tr>
      {% for year in dashboard.rescue.by_year %}<td>{{year.number}}</td>{% endfor%}
      </tr>
    </table>
    </div>

    <div class='table'>
    <table>
      <caption>{% trans "By month"%}</caption>
      <tr>
      {% for month in dashboard.rescue.by_month %}<th>{{month.date|date:"F Y"|capfirst}}</th>{% endfor %}
      </tr>
      <tr>
      {% for month in dashboard.rescue.by_month %}<td>{{month.number}}</td>{% endfor%}
      </tr>
    </table>
    </div>

    <p><strong>{% trans "Archaeological files linked to at least one operation:" %}</strong> {{dashboard.rescue.with_associated_operation}}</p>
    <p><strong>{% trans "Archaeological files linked to at least one operation (%):" %}</strong> {{dashboard.rescue.with_associated_operation_percent}}</p>

    <div class='table'>
    <table>
      <caption>{% trans "Archaeological files linked to at least one operation (%)"%}</caption>
      <tr>
      {% for year in dashboard.rescue.operational_by_year %}<th>{{year.date.year}}</th>{% endfor %}
      </tr>
      <tr>
      {% for year in dashboard.rescue.operational_by_year %}<td>{{year.number}}</td>{% endfor%}
      </tr>
    </table>
    </div>

    <div class='table'>
    <table>
      <caption>{% trans "By department"%}</caption>
      <tr>
      {% for dpt in dashboard.rescue.by_dpt %}<th>{{dpt.department__label}}</th>{% endfor %}
      </tr>
      <tr>
      {% for dpt in dashboard.rescue.by_dpt %}<td>{{dpt.number}}</td>{% endfor%}
      </tr>
    </table>
    </div>

    <div class='table'>
    <table>
      <caption>{% trans "Surface by department (ha)"%}</caption>
      <tr>
      {% for dpt in dashboard.rescue.surface_by_dpt %}<th>{{dpt.department__label}}</th>{% endfor %}
      </tr>
      <tr>
      {% for dpt in dashboard.rescue.surface_by_dpt %}<td>{{dpt.number|m2_to_ha}}</td>{% endfor%}
      </tr>
    </table>
    </div>

    <div class='table'>
    <table>
      <caption>{% trans "Main towns by number"%}</caption>
      <tr>
      {% for town in dashboard.rescue.towns %}<th>{{town.town__name}}</th>{% endfor %}
      </tr>
      <tr>
      {% for town in dashboard.rescue.towns %}<td>{{town.number}}</td>{% endfor%}
      </tr>
    </table>
    </div>

    <div class='table'>
    <table>
      <caption>{% trans "Main towns by surface (ha)"%}</caption>
      <tr>
      {% for town in dashboard.rescue.surface_by_town %}<th>{{town.town__name}}</th>{% endfor %}
      </tr>
      <tr>
      {% for town in dashboard.rescue.surface_by_town %}<td>{{town.number|m2_to_ha}}</td>{% endfor%}
      </tr>
    </table>
    </div>

  </div>
</div>
{% endblock %}
