mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 10:34:21 +00:00
Add refillings list
This commit is contained in:
parent
63ae89b30a
commit
39ce14804a
@ -18,7 +18,8 @@
|
||||
<a href="{{ url('counter:stats', counter_id=c.id) }}">{% trans %}Stats{% endtrans %}</a> -
|
||||
{% endif %}
|
||||
{% if user.is_owner(c) %}
|
||||
<a href="{{ url('counter:prop_admin', counter_id=c.id) }}">{% trans %}Props{% endtrans %}</a>
|
||||
<a href="{{ url('counter:prop_admin', counter_id=c.id) }}">{% trans %}Props{% endtrans %}</a> -
|
||||
<a href="{{ url('counter:refilling_list', counter_id=c.id) }}">{% trans %}Refillings list{% endtrans %}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
@ -39,7 +40,8 @@
|
||||
<a href="{{url('stock:new', counter_id=c.id)}}">{% trans %}Create new stock{% endtrans%}</a> -
|
||||
{% endif %}
|
||||
{% if user.is_owner(c) %}
|
||||
<a href="{{ url('counter:prop_admin', counter_id=c.id) }}">{% trans %}Props{% endtrans %}</a>
|
||||
<a href="{{ url('counter:prop_admin', counter_id=c.id) }}">{% trans %}Props{% endtrans %}</a> -
|
||||
<a href="{{ url('counter:refilling_list', counter_id=c.id) }}">{% trans %}Refillings list{% endtrans %}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
33
counter/templates/counter/refilling_list.jinja
Normal file
33
counter/templates/counter/refilling_list.jinja
Normal file
@ -0,0 +1,33 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
{% from 'core/macros.jinja' import paginate %}
|
||||
|
||||
{% block title %}
|
||||
{%- trans %}Refilling list{% endtrans %} -- {{ counter.name }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>{% trans %}Refilling{% endtrans %}</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<th>{% trans %}Customer{% endtrans %}</th>
|
||||
<th>{% trans %}Amount{% endtrans %}</th>
|
||||
<th>{% trans %}Payment method{% endtrans %}</th>
|
||||
<th>{% trans %}Seller{% endtrans %}</th>
|
||||
<th>{% trans %}Actions{% endtrans %}</th>
|
||||
</tr>
|
||||
{%- for refilling in object_list %}
|
||||
<tr>
|
||||
<td><a href="{{ url('core:user_profile', user_id=refilling.customer.user.id) }}">{{ refilling.customer }}</a></td>
|
||||
<td>{{ refilling.amount }}</td>
|
||||
<td>{{ refilling.payment_method }}</td>
|
||||
<td>{{ refilling.operator }}</td>
|
||||
<td><a href="{{ url('counter:refilling_delete', refilling_id=refilling.id)}}">Delete</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{%- endfor %}
|
||||
{% if is_paginated %}
|
||||
{{ paginate(page_obj, paginator) }}
|
||||
{% endif %}
|
||||
{%- endblock %}
|
||||
|
@ -56,6 +56,8 @@ urlpatterns = [
|
||||
url(r'^admin/eticket/(?P<eticket_id>[0-9]+)$', EticketEditView.as_view(), name='edit_eticket'),
|
||||
url(r'^admin/selling/(?P<selling_id>[0-9]+)/delete$', SellingDeleteView.as_view(), name='selling_delete'),
|
||||
url(r'^admin/refilling/(?P<refilling_id>[0-9]+)/delete$', RefillingDeleteView.as_view(), name='refilling_delete'),
|
||||
url(r'^admin/(?P<counter_id>[0-9]+)/refillings$', CounterRefillingListView.as_view(), name='refilling_list'),
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
@ -1280,3 +1280,23 @@ class EticketPDFView(CanViewMixin, DetailView):
|
||||
p.showPage()
|
||||
p.save()
|
||||
return response
|
||||
|
||||
|
||||
class CounterRefillingListView(CounterAdminTabsMixin, CounterAdminMixin, ListView):
|
||||
"""
|
||||
List of refillings on a counter
|
||||
"""
|
||||
model = Refilling
|
||||
template_name = 'counter/refilling_list.jinja'
|
||||
current_tab = "counters"
|
||||
paginate_by = 30
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
self.counter = get_object_or_404(Counter, pk=kwargs['counter_id'])
|
||||
self.queryset = Refilling.objects.filter(counter__id=self.counter.id)
|
||||
return super(CounterRefillingListView, self).dispatch(request, *args, **kwargs)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(CounterRefillingListView, self).get_context_data(**kwargs)
|
||||
kwargs['counter'] = self.counter
|
||||
return kwargs
|
||||
|
Loading…
Reference in New Issue
Block a user