club_sellings.jinja 2.48 KB
Newer Older
Skia's avatar
Skia committed
1
{% extends "core/base.jinja" %}
2
{% from 'core/macros.jinja' import user_profile_link, paginate %}
Skia's avatar
Skia committed
3 4 5

{% block content %}
<h3>{% trans %}Sellings{% endtrans %}</h3>
6
<form id="form" action="?page=1" method="post">
Skia's avatar
Skia committed
7 8 9
    {% csrf_token %}
    {{ form }}
    <p><input type="submit" value="{% trans %}Show{% endtrans %}" /></p>
Sli's avatar
Sli committed
10
    <p><input type="submit" value="{% trans %}Download as cvs{% endtrans %}" formaction="{{ url('club:sellings_csv', club_id=object.id) }}"/></p>
Skia's avatar
Skia committed
11 12
</form>
<p>
Skia's avatar
Skia committed
13
{% trans %}Quantity: {% endtrans %}{{ total_quantity }} {% trans %}units{% endtrans %}<br/>
Sli's avatar
Sli committed
14
{% trans %}Total: {% endtrans %}{{ total }}<br/>
Sli's avatar
Sli committed
15
{% trans %}Benefit: {% endtrans %}{{ benefit }}
Skia's avatar
Skia committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
</p>
<table>
    <thead>
        <tr>
            <td>{% trans %}Date{% endtrans %}</td>
            <td>{% trans %}Counter{% endtrans %}</td>
            <td>{% trans %}Barman{% endtrans %}</td>
            <td>{% trans %}Customer{% 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>
31
    {% for s in paginated_result %}
Skia's avatar
Skia committed
32 33 34
        <tr>
            <td>{{ s.date|localtime|date(DATETIME_FORMAT) }} {{ s.date|localtime|time(DATETIME_FORMAT) }}</td>
            <td>{{ s.counter }}</td>
Skia's avatar
Skia committed
35
            {% if s.seller %}
Skia's avatar
Skia committed
36
            <td><a href="{{ s.seller.get_absolute_url() }}">{{ s.seller.get_display_name() }}</a></td>
Skia's avatar
Skia committed
37 38 39 40
            {% else %}
            <td></td>
            {% endif %}
            {% if s.customer %}
Skia's avatar
Skia committed
41
            <td><a href="{{ s.customer.user.get_absolute_url() }}">{{ s.customer.user.get_display_name() }}</a></td>
Skia's avatar
Skia committed
42 43 44
            {% else %}
            <td></td>
            {% endif %}
Skia's avatar
Skia committed
45 46 47 48
            <td>{{ s.label }}</td>
            <td>{{ s.quantity }}</td>
            <td>{{ s.quantity * s.unit_price }}</td>
            <td>{{ s.get_payment_method_display() }}</td>
49 50 51
            {% if s.is_owned_by(user) %}
                <td><a href="{{ url('counter:selling_delete', selling_id=s.id) }}">{% trans %}Delete{% endtrans %}</a></td>
            {% endif %}
Skia's avatar
Skia committed
52 53 54 55
        </tr>
    {% endfor %}
    </tbody>
</table>
56 57 58 59 60 61 62 63
<script type="text/javascript">
    function formPagination(link){
        $("form").attr("action", link.href);
        link.href = "javascript:void(0)"; // block link action
        $("form").submit();
    }
</script>
{{ paginate(paginated_result, paginator, "formPagination(this)") }}
Skia's avatar
Skia committed
64 65 66 67
{% endblock %}