{% extends 'base.html' %}
{% load i18n %}
{% block body_class%}{%if pie_data%} class="tundra"{%endif%}{%endblock body_class%}
{% block headers %}{%if pie_data %}
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}js/dijit/themes/tundra/tundra.css" />
<script type="text/javascript">
        var djConfig = { parseOnLoad:true, isDebug:false };
		var json_data = {{pie_data|safe}};
</script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/dojo/dojo.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/lib.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/reports.common.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}js/reports.pie.js"></script>
{%endif%}
{% endblock headers %}
{% block submenu %}
&nbsp;
{% endblock submenu %}
{% block title %}
{% blocktrans %}Reports - {{report_title}}{% endblocktrans %}
{% endblock title %}
{% block heading %}
{% blocktrans %}Reports - {{report_title}}{% endblocktrans %}
{% endblock heading %}
{% block content %}
<div class="Grid_heading">
    <div class="Grid_hash">#</div>
    <div class="Grid_Address">{% trans "Address" %}</div>
    <div class="Grid_Count">{% trans "Count" %}</div>
    <div class="Grid_Volume">{% trans "Volume" %}</div>
    <div class="Grid_Graph">&nbsp;</div>
</div>
<div class="lightblue_div">
    <div id="graphrows" class="Graph_rows_col">
        {% load messages_extras %}
        {% for item in top_items %}
        <div class="graph_row">
            <div class="row_hash">{{ forloop.counter }}.</div>
            <div class="row_address">
                <div class="pie_{{forloop.counter}} pie"></div>&nbsp;
                {% if item.from_address %}{{item.from_address|tds_trunc:42}}{%endif%}
                {% if item.from_domain %}{{item.from_domain}}{%endif%}
                {% if item.to_address %}{{item.to_address|tds_trunc:42}}{%endif%}
                {% if item.to_domain %}{{item.to_domain}}{%endif%}
            </div>
            <div class="row_count">{{ item.num_count }}</div>
            <div class="row_volume">{{ item.total_size|filesizeformat }}</div>
        </div>
        {% endfor %}
    </div>
    <div class="Graph_pie_col">
        <div id="chart" style="width: 350px; height: 284px;">
		<noscript>{% trans "Javascript required to view graphs" %}</noscript>
        </div>
    </div>
</div>
<div id="filterrow" class="lightblue_div{% if not active_filters %} hide{% endif %}">
    <div class="filterrow">
        {% trans "Filters have been applied :" %}
        <span id="fhl">
            {% for f in active_filters %}
            	&nbsp;<a href="{% url remove-filter forloop.counter0 %}"><img src="/static/imgs/sm-del.png" alt="x"/></a> "{{ f.filter_field }} {{f.filter_by}} {{f.filter_value}}"
				{% if not forloop.last %},{% endif %}
            {% endfor %}
        </span>
    </div>
</div>
{% include "reports/filter.form.html" %}
{% endblock content %}
