diff --git a/eboutic/templates/eboutic/eboutic_main.jinja b/eboutic/templates/eboutic/eboutic_main.jinja index 042c7b4e..d416161e 100644 --- a/eboutic/templates/eboutic/eboutic_main.jinja +++ b/eboutic/templates/eboutic/eboutic_main.jinja @@ -31,10 +31,22 @@ {{ add_product(i.product_id, '+') }} {{ i.product_name }}: {{ "%0.2f"|format(i.product_unit_price*i.quantity) }} € {% endfor %} -

{% trans %}Total: {% endtrans %}{{ "%0.2f"|format(basket.get_total()) }} €

+

+ {% trans %}Basket amount: {% endtrans %}{{ "%0.2f"|format(basket.get_total()) }} € + + {% if customer_amount != None %} +
+ {% trans %}Current account amount: {% endtrans %}{{ "%0.2f"|format(customer_amount) }} € +
+ {% trans %}Remaining account amount: {% endtrans %}{{ "%0.2f"|format(customer_amount - basket.get_total()) }} € + {% endif %} +

+
{% csrf_token %} +

+

diff --git a/eboutic/templates/eboutic/eboutic_makecommand.jinja b/eboutic/templates/eboutic/eboutic_makecommand.jinja index aed01ae6..b9a3ed4d 100644 --- a/eboutic/templates/eboutic/eboutic_makecommand.jinja +++ b/eboutic/templates/eboutic/eboutic_makecommand.jinja @@ -27,13 +27,25 @@ {% endfor %} -

Total: {{ basket.get_total() }} €

+ +

+ {% trans %}Basket amount: {% endtrans %}{{ "%0.2f"|format(basket.get_total()) }} € + + {% if customer_amount != None %} +
+ {% trans %}Current account amount: {% endtrans %}{{ "%0.2f"|format(customer_amount) }} € +
+ {% trans %}Remaining account amount: {% endtrans %}{{ "%0.2f"|format(customer_amount - basket.get_total()) }} € + {% endif %} +

{% if settings.SITH_EBOUTIC_CB_ENABLED %}
+

{% for (field_name,field_value) in et_request.items() -%} {% endfor %} +

{% endif %} {% if basket.items.filter(type_id=settings.SITH_COUNTER_PRODUCTTYPE_REFILLING).exists() %} diff --git a/eboutic/views.py b/eboutic/views.py index 21a8fead..45d79249 100644 --- a/eboutic/views.py +++ b/eboutic/views.py @@ -107,6 +107,10 @@ class EbouticMain(TemplateView): kwargs["basket"] = self.basket kwargs["eboutic"] = Counter.objects.filter(type="EBOUTIC").first() kwargs["categories"] = ProductType.objects.all() + 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 @@ -150,6 +154,10 @@ class EbouticCommand(TemplateView): def get_context_data(self, **kwargs): kwargs = super(EbouticCommand, self).get_context_data(**kwargs) + 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 diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index a826a20a..a2c4e0f3 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-10-21 10:28+0200\n" +"POT-Creation-Date: 2019-10-21 22:04+0200\n" "PO-Revision-Date: 2016-07-18\n" "Last-Translator: Skia \n" "Language-Team: AE info \n" @@ -733,7 +733,6 @@ msgstr "Nature de l'opération" #: club/templates/club/club_sellings.jinja:14 #: counter/templates/counter/counter_click.jinja:90 #: counter/templates/counter/counter_main.jinja:28 -#: eboutic/templates/eboutic/eboutic_main.jinja:34 msgid "Total: " msgstr "Total : " @@ -4320,7 +4319,22 @@ msgstr "id du type du produit" msgid "basket" msgstr "panier" +#: eboutic/templates/eboutic/eboutic_main.jinja:35 +#: eboutic/templates/eboutic/eboutic_makecommand.jinja:31 +msgid "Basket amount: " +msgstr "Valeur du panier : " + #: eboutic/templates/eboutic/eboutic_main.jinja:37 +#: eboutic/templates/eboutic/eboutic_makecommand.jinja:33 +msgid "Current account amount: " +msgstr "Solde actuel : " + +#: eboutic/templates/eboutic/eboutic_main.jinja:39 +#: eboutic/templates/eboutic/eboutic_makecommand.jinja:35 +msgid "Remaining account amount: " +msgstr "Solde restant : " + +#: eboutic/templates/eboutic/eboutic_main.jinja:45 msgid "Proceed to command" msgstr "Procéder à la commande" @@ -4328,18 +4342,18 @@ msgstr "Procéder à la commande" msgid "Basket state" msgstr "État du panier" -#: eboutic/templates/eboutic/eboutic_makecommand.jinja:36 +#: eboutic/templates/eboutic/eboutic_makecommand.jinja:42 msgid "Pay with credit card" msgstr "Payer avec une carte bancaire" -#: eboutic/templates/eboutic/eboutic_makecommand.jinja:40 +#: eboutic/templates/eboutic/eboutic_makecommand.jinja:46 msgid "" "AE account payment disabled because your basket contains refilling items." msgstr "" "Paiement par compte AE désactivé parce que votre panier contient des bons de " "rechargement." -#: eboutic/templates/eboutic/eboutic_makecommand.jinja:45 +#: eboutic/templates/eboutic/eboutic_makecommand.jinja:51 msgid "Pay with Sith account" msgstr "Payer avec un compte AE" @@ -4355,7 +4369,7 @@ msgstr "Le paiement a été effectué" msgid "Return to eboutic" msgstr "Retourner à l'eboutic" -#: eboutic/views.py:217 +#: eboutic/views.py:219 msgid "You do not have enough money to buy the basket" msgstr "Vous n'avez pas assez d'argent pour acheter le panier"