mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 02:24:26 +00:00
eboutic: fix account amount
This commit is contained in:
parent
6b06b647bc
commit
00c96f5b71
@ -33,10 +33,13 @@
|
||||
</ul>
|
||||
<p>
|
||||
<strong>{% trans %}Basket amount: {% endtrans %}{{ "%0.2f"|format(basket.get_total()) }} €</strong>
|
||||
|
||||
{% if customer_amount != None %}
|
||||
<br>
|
||||
{% trans %}Current account amount: {% endtrans %}<strong>{{ "%0.2f"|format(customer_amount) }} €</strong>
|
||||
<br>
|
||||
{% trans %}Remaining account amount: {% endtrans %}<strong>{{ "%0.2f"|format(customer_amount - basket.get_total()) }} €</strong>
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<form method="post" action="{{ url('eboutic:command') }}">
|
||||
|
@ -27,12 +27,16 @@
|
||||
{% endfor %}
|
||||
<tbody>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<strong>{% trans %}Basket amount: {% endtrans %}{{ "%0.2f"|format(basket.get_total()) }} €</strong>
|
||||
|
||||
{% if customer_amount != None %}
|
||||
<br>
|
||||
{% trans %}Current account amount: {% endtrans %}<strong>{{ "%0.2f"|format(customer_amount) }} €</strong>
|
||||
<br>
|
||||
{% trans %}Remaining account amount: {% endtrans %}<strong>{{ "%0.2f"|format(customer_amount - basket.get_total()) }} €</strong>
|
||||
{% endif %}
|
||||
</p>
|
||||
{% if settings.SITH_EBOUTIC_CB_ENABLED %}
|
||||
<form method="post" action="{{ settings.SITH_EBOUTIC_ET_URL }}">
|
||||
|
@ -107,7 +107,10 @@ class EbouticMain(TemplateView):
|
||||
kwargs["basket"] = self.basket
|
||||
kwargs["eboutic"] = Counter.objects.filter(type="EBOUTIC").first()
|
||||
kwargs["categories"] = ProductType.objects.all()
|
||||
kwargs["customer_amount"] = self.request.user.customer.amount
|
||||
if hasattr(self.request.user, "customer"):
|
||||
kwargs["customer_amount"] = self.request.user.customer.amount
|
||||
else:
|
||||
kwargs["customer_amount"] = None
|
||||
if not self.request.user.was_subscribed:
|
||||
kwargs["categories"] = kwargs["categories"].exclude(
|
||||
id=settings.SITH_PRODUCTTYPE_SUBSCRIPTION
|
||||
@ -151,7 +154,10 @@ class EbouticCommand(TemplateView):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(EbouticCommand, self).get_context_data(**kwargs)
|
||||
kwargs["customer_amount"] = self.request.user.customer.amount
|
||||
if hasattr(self.request.user, "customer"):
|
||||
kwargs["customer_amount"] = self.request.user.customer.amount
|
||||
else:
|
||||
kwargs["customer_amount"] = None
|
||||
kwargs["et_request"] = OrderedDict()
|
||||
kwargs["et_request"]["PBX_SITE"] = settings.SITH_EBOUTIC_PBX_SITE
|
||||
kwargs["et_request"]["PBX_RANG"] = settings.SITH_EBOUTIC_PBX_RANG
|
||||
|
Loading…
Reference in New Issue
Block a user