user_account.jinja 2.16 KB
Newer Older
1
{% extends "core/base.jinja" %}
2

Sli's avatar
Sli committed
3
{% macro monthly(obj) %}
4
5
6
<div>
    <table>
        <thead>
Sli's avatar
Sli committed
7
            <tr>
8
9
10
                <td>{% trans %}Year{% endtrans %}</td>
                <td>{% trans %}Month{% endtrans %}</td>
                <td>{% trans %}Total{% endtrans %}</td>
Sli's avatar
Sli committed
11
            </tr>
12
13
14
15
16
17
18
19
20
21
22
23
24
        </thead>
        <tbody>
        {% for array in obj %}
            {% for tuple in array %}
                {% if tuple[0] != 0 %}
                {% set link=url('core:user_account_detail', user_id=profile.id, year=tuple[1].year, month=tuple[1].month) %}
                <tr>
                    <td><a href="{{ link }}">{{ tuple[1].year }}</a></td>
                    <td><a href="{{ link }}">{{ tuple[1]|date("E") }}</a></td>
                    <td><a href="{{ link }}">{{ tuple[0] }}</a></td>
                </tr>
                {% endif %}
            {% endfor %}
Sli's avatar
Sli committed
25
        {% endfor %}
26
27
28
        </tbody>
    </table>
</div>
Sli's avatar
Sli committed
29
30
31
32
33
34
35
36
37
38
{% endmacro %}

{% 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>
39
<div id="drop">
Sli's avatar
Sli committed
40
{% if customer.refillings.exists() %}
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
    {% if customer.buyings.exists() %}
    <h5>{% trans %}Account buyings{% endtrans %}</h5>
        {{ monthly(buyings_month) }}
    {% endif %}
    <h5>{% trans %}Refillings{% endtrans %}</h5>
        {{ monthly(refilling_month) }}
    {% endif %}
    {% if customer.user.invoices.exists() %}
    <h5>{% trans %}Eboutic invoices{% endtrans %}</h5>
        {{ monthly(invoices_month) }}
    {% endif %}
    {% if etickets %}
    <h4>{% trans %}Etickets{% endtrans %}</h4>
    <div>
        <ul>
        {% for s in etickets %}
        <li><a href="{{ url('counter:eticket_pdf', selling_id=s.id) }}">{{ s.quantity }} x {{ s.product.eticket }}</a></li>
        {% endfor %}
        </ul>
    </div>
    {% endif %}
</div>
Skia's avatar
Skia committed
63
64
65
{% else %}
<p>{% trans %}User has no account{% endtrans %}</p>
{% endif %}
66
67
{% endblock %}

68
69
70
71
72
73
74
75
{% block script %}
{{ super() }}
<script>
$(function(){
    $("#drop").accordion();
});
</script>
{% endblock %}
76
77