mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
Cancellation/refund: prefer placeholder over value
This commit is contained in:
@@ -5,6 +5,7 @@ from django import forms
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.template.defaultfilters import floatformat
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.timezone import make_aware, now
|
from django.utils.timezone import make_aware, now
|
||||||
from django.utils.translation import (
|
from django.utils.translation import (
|
||||||
@@ -121,7 +122,10 @@ class CancelForm(ConfirmPaymentForm):
|
|||||||
prs = self.instance.payment_refund_sum
|
prs = self.instance.payment_refund_sum
|
||||||
if prs > 0:
|
if prs > 0:
|
||||||
change_decimal_field(self.fields['cancellation_fee'], self.instance.event.currency)
|
change_decimal_field(self.fields['cancellation_fee'], self.instance.event.currency)
|
||||||
self.fields['cancellation_fee'].initial = Decimal('0.00')
|
self.fields['cancellation_fee'].widget.attrs['placeholder'] = floatformat(
|
||||||
|
Decimal('0.00'),
|
||||||
|
settings.CURRENCY_PLACES.get(self.instance.event.currency, 2)
|
||||||
|
)
|
||||||
self.fields['cancellation_fee'].max_value = prs
|
self.fields['cancellation_fee'].max_value = prs
|
||||||
else:
|
else:
|
||||||
del self.fields['cancellation_fee']
|
del self.fields['cancellation_fee']
|
||||||
|
|||||||
@@ -45,7 +45,11 @@
|
|||||||
{% trans "Automatically refund" context "amount_label" %}
|
{% trans "Automatically refund" context "amount_label" %}
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" name="refund-{{ p.pk }}"
|
<input type="text" name="refund-{{ p.pk }}"
|
||||||
|
{% if p.propose_refund %}
|
||||||
value="{{ p.propose_refund|floatformat:2 }}"
|
value="{{ p.propose_refund|floatformat:2 }}"
|
||||||
|
{% else %}
|
||||||
|
placeholder="{{ p.propose_refund|floatformat:2 }}"
|
||||||
|
{% endif %}
|
||||||
title="" class="form-control">
|
title="" class="form-control">
|
||||||
<span class="input-group-addon">
|
<span class="input-group-addon">
|
||||||
{{ request.event.currency }}
|
{{ request.event.currency }}
|
||||||
@@ -73,7 +77,7 @@
|
|||||||
{% trans "Transfer" context "amount_label" %}
|
{% trans "Transfer" context "amount_label" %}
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" name="refund-offsetting"
|
<input type="text" name="refund-offsetting"
|
||||||
title="" class="form-control" value="{{ 0|floatformat:2 }}">
|
title="" class="form-control" placeholder="{{ 0|floatformat:2 }}">
|
||||||
<span class="input-group-addon">
|
<span class="input-group-addon">
|
||||||
{{ request.event.currency }}
|
{{ request.event.currency }}
|
||||||
</span>
|
</span>
|
||||||
@@ -94,7 +98,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" name="refund-new-giftcard"
|
<input type="text" name="refund-new-giftcard"
|
||||||
title="" class="form-control" value="{{ giftcard_proposal|floatformat:2 }}">
|
title="" class="form-control" placeholder="{{ giftcard_proposal|floatformat:2 }}">
|
||||||
<span class="input-group-addon">
|
<span class="input-group-addon">
|
||||||
{{ request.event.currency }}
|
{{ request.event.currency }}
|
||||||
</span>
|
</span>
|
||||||
@@ -114,7 +118,11 @@
|
|||||||
{% trans "Manually refund" context "amount_label" %}
|
{% trans "Manually refund" context "amount_label" %}
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" name="refund-manual"
|
<input type="text" name="refund-manual"
|
||||||
|
{% if remainder %}
|
||||||
value="{{ remainder|floatformat:2 }}"
|
value="{{ remainder|floatformat:2 }}"
|
||||||
|
{% else %}
|
||||||
|
placeholder="{{ remainder|floatformat:2 }}"
|
||||||
|
{% endif %}
|
||||||
title="" class="form-control">
|
title="" class="form-control">
|
||||||
<span class="input-group-addon">
|
<span class="input-group-addon">
|
||||||
{{ request.event.currency }}
|
{{ request.event.currency }}
|
||||||
|
|||||||
@@ -968,7 +968,7 @@ class OrderTransition(OrderView):
|
|||||||
instance=self.order,
|
instance=self.order,
|
||||||
data=self.request.POST if self.request.method == "POST" else None,
|
data=self.request.POST if self.request.method == "POST" else None,
|
||||||
initial={
|
initial={
|
||||||
'cancellation_fee': self.req.cancellation_fee if self.req else Decimal('0.00')
|
'cancellation_fee': self.req.cancellation_fee if self.req else None
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user