Commit 5e0f7902 authored by Skia's avatar Skia

Merge branch 'counter' into 'master'

Pagination for cash sumary

See merge request !53
parents 3fd4d4b0 493d48bc
Pipeline #802 passed with stage
in 3 minutes and 28 seconds
......@@ -38,7 +38,7 @@
</tr>
</thead>
<tbody>
{% for c in cashsummary_list.order_by('-date') %}
{% for c in cashsummary_list %}
<tr>
<td>{{ user_profile_link(c.user) }}</td>
<td>{{ c.counter }}</td>
......@@ -55,6 +55,26 @@
{% endfor %}
</tbody>
</table>
<br>
{% if is_paginated %}
{% if page_obj.has_previous() %}
<a href="?page={{ page_obj.previous_page_number() }}">{% trans %}Previous{% endtrans %}</a>
{% else %}
<span class="disabled">{% trans %}Previous{% endtrans %}</span>
{% endif %}
{% for i in paginator.page_range %}
{% if page_obj.number == i %}
<span class="active">{{ i }} <span class="sr-only">({% trans %}current{% endtrans %})</span></span>
{% else %}
<a href="?page={{ i }}">{{ i }}</a>
{% endif %}
{% endfor %}
{% if page_obj.has_next() %}
<a href="?page={{ page_obj.next_page_number() }}">{% trans %}Next{% endtrans %}</a>
{% else %}
<span class="disabled">{% trans %}Next{% endtrans %}</span>
{% endif %}
{% endif %}
{% else %}
{% trans %}There is no cash register summary in this website.{% endtrans %}
{% endif %}
......
......@@ -938,6 +938,8 @@ class CashSummaryListView(CanEditPropMixin, CounterAdminTabsMixin, ListView):
template_name = 'counter/cash_summary_list.jinja'
context_object_name = "cashsummary_list"
current_tab = "cash_summary"
queryset = CashRegisterSummary.objects.all().order_by('-date')
paginate_by = settings.SITH_COUNTER_CASH_SUMMARY_LENGTH
def get_context_data(self, **kwargs):
""" Add sums to the context """
......
......@@ -357,6 +357,9 @@ SITH_COUNTER_BANK = [
('LA-POSTE', 'La Poste'),
]
# Defines pagination for cash summary
SITH_COUNTER_CASH_SUMMARY_LENGTH = 50
# Defines which product type is the refilling type, and thus increases the account amount
SITH_COUNTER_PRODUCTTYPE_REFILLING = 11
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment