{% extends 'leprikon/form.html' %}
{% load i18n leprikon_tags sekizai_tags staticfiles %}

{% block content %}
<div class="hidden-print">
{{ block.super }}
</div>

{% if reports %}
<h1>{% blocktrans with date=date %}Debtors list by date {{ date }}{% endblocktrans %}</h1>

<table class="table table-hover">
    <tr>
        <th>{% trans 'Debtor' %}</th>
        <th class="right">{% trans 'Amount due' %}</th>
        <th class="right">{% trans 'Overdue' %}</th>
    </tr>
    {% for user, items in reports.items %}
    <tr id="report-{{ user.id }}" class="clickable" data-toggle="collapse" data-target=".{{ user.id }}-collapsed">
        <th>{{ user.get_full_name | default:user.get_username }}</th>
        <td class="right">{{ items.sum.amount_due | currency }}</td>
        <td class="right">{{ items.sum.overdue | currency }}</td>
    </tr>
    {% for item in items %}
    <tr class="collapse out {{ user.id }}-collapsed">
        <th class="right">
            {{ item.registration }}
        </th>
        <td class="right">
            {{ item.status.amount_due | currency }}
        </td>
        <td class="right">
            {{ item.status.overdue | currency }}
        </td>
    </tr>
    {% endfor %}
    {% endfor %}
    <tr>
        <th>{% trans 'Total' %}</th>
        <td class="right">{{ sum.amount_due | currency }}</td>
        <td class="right">{{ sum.overdue | currency }}</td>
    </tr>
</table>
{% endif %}


{% include 'leprikon/static/bootstrap-datetimepicker.html' %}

{% endblock %}
