2016-09-08 01:29:49 +00:00
|
|
|
{% extends "core/base.jinja" %}
|
2019-11-27 23:30:51 +00:00
|
|
|
{% from 'core/macros.jinja' import user_profile_link, paginate %}
|
2016-09-08 01:29:49 +00:00
|
|
|
|
|
|
|
{% block content %}
|
2024-07-23 22:16:31 +00:00
|
|
|
<h3>{% trans %}Sales{% endtrans %}</h3>
|
|
|
|
<form id="form" action="?page=1" method="post">
|
2016-09-08 01:29:49 +00:00
|
|
|
{% csrf_token %}
|
|
|
|
{{ form }}
|
|
|
|
<p><input type="submit" value="{% trans %}Show{% endtrans %}" /></p>
|
2016-11-07 21:05:09 +00:00
|
|
|
<p><input type="submit" value="{% trans %}Download as cvs{% endtrans %}" formaction="{{ url('club:sellings_csv', club_id=object.id) }}"/></p>
|
2024-07-23 22:16:31 +00:00
|
|
|
</form>
|
|
|
|
<p>
|
|
|
|
{% trans %}Quantity: {% endtrans %}{{ total_quantity }} {% trans %}units{% endtrans %}<br/>
|
|
|
|
{% trans %}Total: {% endtrans %}{{ total }} €<br/>
|
|
|
|
{% trans %}Benefit: {% endtrans %}{{ benefit }} €
|
|
|
|
</p>
|
|
|
|
<table>
|
2016-09-08 01:29:49 +00:00
|
|
|
<thead>
|
2024-07-23 22:16:31 +00:00
|
|
|
<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>
|
2016-09-08 01:29:49 +00:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
2024-07-23 22:16:31 +00:00
|
|
|
{% for s in paginated_result %}
|
2016-09-08 01:29:49 +00:00
|
|
|
<tr>
|
2024-07-23 22:16:31 +00:00
|
|
|
<td>{{ s.date|localtime|date(DATETIME_FORMAT) }} {{ s.date|localtime|time(DATETIME_FORMAT) }}</td>
|
|
|
|
<td>{{ s.counter }}</td>
|
|
|
|
{% if s.seller %}
|
2016-09-08 01:29:49 +00:00
|
|
|
<td><a href="{{ s.seller.get_absolute_url() }}">{{ s.seller.get_display_name() }}</a></td>
|
2024-07-23 22:16:31 +00:00
|
|
|
{% else %}
|
2016-09-29 16:17:44 +00:00
|
|
|
<td></td>
|
2024-07-23 22:16:31 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if s.customer %}
|
2016-09-08 01:29:49 +00:00
|
|
|
<td><a href="{{ s.customer.user.get_absolute_url() }}">{{ s.customer.user.get_display_name() }}</a></td>
|
2024-07-23 22:16:31 +00:00
|
|
|
{% else %}
|
2016-09-29 16:17:44 +00:00
|
|
|
<td></td>
|
2024-07-23 22:16:31 +00:00
|
|
|
{% endif %}
|
|
|
|
<td>{{ s.label }}</td>
|
|
|
|
<td>{{ s.quantity }}</td>
|
|
|
|
<td>{{ s.quantity * s.unit_price }} €</td>
|
|
|
|
<td>{{ s.get_payment_method_display() }}</td>
|
|
|
|
{% if s.is_owned_by(user) %}
|
|
|
|
<td><a href="{{ url('counter:selling_delete', selling_id=s.id) }}">{% trans %}Delete{% endtrans %}</a></td>
|
|
|
|
{% endif %}
|
2016-09-08 01:29:49 +00:00
|
|
|
</tr>
|
2024-07-23 22:16:31 +00:00
|
|
|
{% endfor %}
|
2016-09-08 01:29:49 +00:00
|
|
|
</tbody>
|
2024-07-23 22:16:31 +00:00
|
|
|
</table>
|
2024-09-25 12:35:13 +00:00
|
|
|
{# TODO: Replace this pagination by an Alpine pagination #}
|
2024-07-23 22:16:31 +00:00
|
|
|
<script type="text/javascript">
|
2019-11-28 00:15:57 +00:00
|
|
|
function formPagination(link){
|
2024-07-23 22:16:31 +00:00
|
|
|
$("form").attr("action", link.href);
|
|
|
|
link.href = "javascript:void(0)"; // block link action
|
|
|
|
$("form").submit();
|
2019-11-28 00:15:57 +00:00
|
|
|
}
|
2024-07-23 22:16:31 +00:00
|
|
|
</script>
|
|
|
|
{{ paginate(paginated_result, paginator, "formPagination(this)") }}
|
2016-09-08 01:29:49 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
|
|
|