user_account_detail.jinja 3.78 KB
Newer Older
Sli's avatar
Sli committed
1
2
3
4
5
6
7
8
9
10
{% extends "core/base.jinja" %}

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

{% block content %}
{% if customer %}
<h3>{% trans %}User account{% endtrans %}</h3>
<p>{% trans %}Amount: {% endtrans %}{{ customer.amount }}</p>
Skia's avatar
Skia committed
11
<p><a href="{{ url('core:user_account', user_id=profile.id) }}">{% trans %}Back{% endtrans %}</a></p>
Sli's avatar
Sli committed
12
13
14
15
16
17
18
19
20
21
22
23
24
{% if customer.refillings.exists() %}
<h4>{% trans %}Refillings{% endtrans %}</h4>
<table>
    <thead>
        <tr>
            <td>{% trans %}Date{% endtrans %}</td>
            <td>{% trans %}Counter{% endtrans %}</td>
            <td>{% trans %}Barman{% endtrans %}</td>
            <td>{% trans %}Amount{% endtrans %}</td>
            <td>{% trans %}Payment method{% endtrans %}</td>
        </tr>
    </thead>
    <tbody>
25
26
    {% for i in customer.refillings.order_by('-date').filter(
        date__year=year, date__month=month) %}
Sli's avatar
Sli committed
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
        <tr>
        <td>{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}</td>
        <td>{{ i.counter }}</td>
        <td><a href="{{ i.operator.get_absolute_url() }}">{{ i.operator.get_display_name() }}</a></td>
        <td>{{ i.amount }}</td>
        <td>{{ i.get_payment_method_display() }}</td>
        {% if i.is_owned_by(user) %}
            <td><a href="{{ url('counter:refilling_delete', refilling_id=i.id) }}">Delete</a></td>
        {% endif %}
    </tr>
{% endfor %}
    </tbody>
</table>
{% endif %}
{% if customer.buyings.exists() %}
<h4>{% trans %}Account buyings{% endtrans %}</h4>
<table>
    <thead>
        <tr>
            <td>{% trans %}Date{% endtrans %}</td>
            <td>{% trans %}Counter{% endtrans %}</td>
            <td>{% trans %}Barman{% endtrans %}</td>
            <td>{% trans %}Label{% endtrans %}</td>
            <td>{% trans %}Quantity{% endtrans %}</td>
            <td>{% trans %}Total{% endtrans %}</td>
            <td>{% trans %}Payment method{% endtrans %}</td>
        </tr>
    </thead>
    <tbody>
56
57
    {% for i in customer.buyings.order_by('-date').all().filter(
        date__year=year, date__month=month) %}
Sli's avatar
Sli committed
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
        <tr>
        <td>{{ i.date|localtime|date(DATETIME_FORMAT) }} - {{ i.date|localtime|time(DATETIME_FORMAT) }}</td>
        <td>{{ i.counter }}</td>
        <td><a href="{{ i.seller.get_absolute_url() }}">{{ i.seller.get_display_name() }}</a></td>
        <td>{{ i.label }}</td>
        <td>{{ i.quantity }}</td>
        <td>{{ i.quantity * i.unit_price }}</td>
        <td>{{ i.get_payment_method_display() }}</td>
        {% if i.is_owned_by(user) %}
            <td><a href="{{ url('counter:selling_delete', selling_id=i.id) }}">Delete</a></td>
        {% endif %}
    </tr>
{% endfor %}
    </tbody>
</table>
{% endif %}
{% if customer.user.invoices.exists() %}
<h4>{% trans %}Eboutic invoices{% endtrans %}</h4>
<table>
    <thead>
        <tr>
            <td>{% trans %}Date{% endtrans %}</td>
            <td>{% trans %}Items{% endtrans %}</td>
            <td>{% trans %}Amount{% endtrans %}</td>
        </tr>
    </thead>
    <tbody>
85
86
    {% for i in customer.user.invoices.order_by('-date').all().filter(
        date__year=year, date__month=month) %}
Sli's avatar
Sli committed
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
        <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.quantity }} x {{ it.product_name }} - {{ it.product_unit_price }}</li>
                {% endfor %}
            </ul>
        </td>
        <td>{{ i.get_total() }}</td>
    </tr>
{% endfor %}
    </tbody>
</table>
{% endif %}
{% else %}
<p>{% trans %}User has no account{% endtrans %}</p>
{% endif %}
Skia's avatar
Skia committed
105
<p><a href="{{ url('core:user_account', user_id=profile.id) }}">{% trans %}Back{% endtrans %}</a></p>
Sli's avatar
Sli committed
106
{% endblock %}