aboutsummaryrefslogtreecommitdiff
path: root/ihatemoney/templates/statistics.html
blob: af3d9d5b1458efa8972ed2161b4d2e5248ccf8a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{% extends "sidebar_table_layout.html" %}

{% block sidebar %}
    <div id="table_overflow" class="statistics mr-md-n3">
    <table class="balance table">
    <thead>
        <tr class="d-none d-md-table-row">
            <th>{{ _("Who?") }}</th>
            <th class="balance-value">{{ _("Balance") }}</th>
        </tr>
    </thead>
    {% for stat in members_stats|sort(attribute='member.name') %}
    <tr>
        <td class="balance-name">{{ stat.member.name }}</td>
        <td class="balance-value {% if stat.balance|round(2) > 0 %}positive{% elif stat.balance|round(2) < 0 %}negative{% endif %}">
            {% if stat.balance|round(2) > 0 %}+{% endif %}{{ "%.2f" | format(stat.balance) }}
        </td>
    </tr>
    {% endfor %}
    </table>
    </div>
{% endblock %}


{% block content %}
    <div class="d-flex flex-column">
        <table id="bill_table" class="split_bills table table-striped ml-md-n3">
            <thead><tr><th class="d-md-none">{{ _("Who?") }}</th><th>{{ _("Paid") }}</th><th>{{ _("Spent") }}</th></tr></thead>
        <tbody>
        {% for stat in members_stats|sort(attribute='member.name') %}
        <tr>
            <td class="d-md-none">{{ stat.member.name }}</td>
            <td>{{ stat.paid|currencyformat_nc(g.project.default_currency) }}</td>
            <td>{{ stat.spent|currencyformat_nc(g.project.default_currency) }}</td>
        </tr>
        {% endfor %}
        </tbody>
        </table>
        <h2>{{ _("Expenses by Month") }}</h2>
        <table id="monthly_stats" class="table table-striped">
            <thead><tr><th>{{ _("Period") }}</th><th>{{ _("Spent") }}</th></tr></thead>
        <tbody>
        {% for month in months %}
                <tr>
                    <td>{{ _(month.strftime("%B")) }} {{ month.year }}</td>
                    <td>{{ monthly_stats[month.year][month.month]|currencyformat_nc(g.project.default_currency) }}</td>
                </tr>
        {% endfor %}
        </tbody>
        </table>
    </div>

{% endblock %}