Allow to change order of refund list

This commit is contained in:
Raphael Michel
2021-01-20 18:10:40 +01:00
parent 898ae3e2bc
commit 35270e7032
2 changed files with 37 additions and 6 deletions

View File

@@ -1506,6 +1506,9 @@ class VoucherTagFilterForm(FilterForm):
class RefundFilterForm(FilterForm):
orders = {'provider': 'provider', 'state': 'state', 'order': 'order__code',
'source': 'source', 'amount': 'amount', 'created': 'created'}
provider = forms.ChoiceField(
label=_('Payment provider'),
choices=[
@@ -1542,6 +1545,10 @@ class RefundFilterForm(FilterForm):
qs = qs.filter(state__in=[OrderRefund.REFUND_STATE_CREATED, OrderRefund.REFUND_STATE_TRANSIT,
OrderRefund.REFUND_STATE_EXTERNAL])
if fdata.get('ordering'):
qs = qs.order_by(self.get_order_by())
else:
qs = qs.order_by('-created')
return qs

View File

@@ -38,12 +38,36 @@
<table class="table table-condensed table-hover">
<thead>
<tr>
<th>#</th>
<th>{% trans "Payment provider" %}</th>
<th>{% trans "Start date" %}</th>
<th>{% trans "Source" %}</th>
<th>{% trans "Status" %}</th>
<th class="text-right flip">{% trans "Amount" %}</th>
<th>
#
<a href="?{% url_replace request 'ordering' '-order' %}"><i class="fa fa-caret-down"></i></a>
<a href="?{% url_replace request 'ordering' 'order' %}"><i class="fa fa-caret-up"></i></a></th>
</th>
<th>
{% trans "Payment provider" %}
<a href="?{% url_replace request 'ordering' '-provider' %}"><i class="fa fa-caret-down"></i></a>
<a href="?{% url_replace request 'ordering' 'provider' %}"><i class="fa fa-caret-up"></i></a></th>
</th>
<th>
{% trans "Start date" %}
<a href="?{% url_replace request 'ordering' '-created' %}"><i class="fa fa-caret-down"></i></a>
<a href="?{% url_replace request 'ordering' 'created' %}"><i class="fa fa-caret-up"></i></a></th>
</th>
<th>
{% trans "Source" %}
<a href="?{% url_replace request 'ordering' '-source' %}"><i class="fa fa-caret-down"></i></a>
<a href="?{% url_replace request 'ordering' 'source' %}"><i class="fa fa-caret-up"></i></a></th>
</th>
<th>
{% trans "Status" %}
<a href="?{% url_replace request 'ordering' '-state' %}"><i class="fa fa-caret-down"></i></a>
<a href="?{% url_replace request 'ordering' 'state' %}"><i class="fa fa-caret-up"></i></a></th>
</th>
<th class="text-right flip">
{% trans "Amount" %}
<a href="?{% url_replace request 'ordering' '-amount' %}"><i class="fa fa-caret-down"></i></a>
<a href="?{% url_replace request 'ordering' 'amount' %}"><i class="fa fa-caret-up"></i></a></th>
</th>
<th class="text-right flip">{% trans "Actions" %}</th>
</tr>
</thead>