user_account.jinja 2.44 KB
Newer Older
Skia's avatar
Skia committed
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{% extends "core/user_base.jinja" %}

{% block title %}
{% trans user_name=profile.get_display_name() %}{{ user_name }}'s account{% endtrans %}
{% endblock %}

{% block infos %}
<h3>{% trans %}User account{% endtrans %}</h3>
<p>{% trans %}Amount: {% endtrans %}{{ customer.amount }}</p>
{% if customer.refillings.exists() %}
<h4>{% trans %}Refillings{% endtrans %}</h4>
<table>
    <thead>
        <tr>
            <td>{% trans %}Date{% endtrans %}</td>
            <td>{% trans %}Barman{% endtrans %}</td>
            <td>{% trans %}Amount{% endtrans %}</td>
        </tr>
    </thead>
    <tbody>
    {% for i in customer.refillings.all() %}
        <tr>
        <td>{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}</td>
        <td>{{ i.operator }}</td>
        <td>{{ i.amount }}</td>
    </tr>
{% endfor %}
    </tbody>
</table>
{% endif %}
{% if customer.buyings.exists() %}
<h4>{% trans %}Buyings{% endtrans %}</h4>
<table>
    <thead>
        <tr>
            <td>{% trans %}Date{% endtrans %}</td>
            <td>{% trans %}Barman{% endtrans %}</td>
            <td>{% trans %}Product{% endtrans %}</td>
            <td>{% trans %}Quantity{% endtrans %}</td>
            <td>{% trans %}Total{% endtrans %}</td>
        </tr>
    </thead>
    <tbody>
    {% for i in customer.buyings.all() %}
        <tr>
        <td>{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}</td>
        <td>{{ i.seller }}</td>
        <td>{{ i.product }}</td>
        <td>{{ i.quantity }}</td>
        <td>{{ i.quantity * i.unit_price }}</td>
    </tr>
{% endfor %}
    </tbody>
</table>
{% endif %}
{% if customer.user.invoices.exists() %}
<h4>{% trans %}Invoices{% endtrans %}</h4>
<table>
    <thead>
        <tr>
            <td>{% trans %}Date{% endtrans %}</td>
            <td>{% trans %}Items{% endtrans %}</td>
            <td>{% trans %}Amount{% endtrans %}</td>
        </tr>
    </thead>
    <tbody>
    {% for i in customer.user.invoices.all() %}
        <tr>
        <td>{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}</td>
        <td>
            <ul>
                {% for it in i.items.all() %}
                <li>{{ it.product_name }} - {{ it.product_unit_price }}</li>
                {% endfor %}
            </ul>
        </td>
        <td>{{ i.get_total() }}</td>
    </tr>
{% endfor %}
    </tbody>
</table>
{% endif %}
{% endblock %}