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

View File

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