Merge branch 'add-account-amount' into 'master'

Add the account amount to the eboutic

See merge request ae/Sith!254
This commit is contained in:
Antoine Bartuccio 2019-10-28 23:37:33 +01:00
commit f42daa01c5
4 changed files with 54 additions and 8 deletions

View File

@ -31,10 +31,22 @@
{{ add_product(i.product_id, '+') }} {{ i.product_name }}: {{ "%0.2f"|format(i.product_unit_price*i.quantity) }} €</li>
{% endfor %}
</ul>
<p><strong>{% trans %}Total: {% endtrans %}{{ "%0.2f"|format(basket.get_total()) }} €</strong></p>
<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') }}">
{% csrf_token %}
<p>
<input type="submit" value="{% trans %}Proceed to command{% endtrans %}" />
</p>
</form>
</div>
<div>

View File

@ -27,13 +27,25 @@
{% endfor %}
<tbody>
</table>
<p><strong>Total: </strong>{{ basket.get_total() }} €</p>
<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 }}">
<p>
{% for (field_name,field_value) in et_request.items() -%}
<input type="hidden" name="{{ field_name }}" value="{{ field_value }}">
{% endfor %}
<input type="submit" value="{% trans %}Pay with credit card{% endtrans %}" />
</p>
</form>
{% endif %}
{% if basket.items.filter(type_id=settings.SITH_COUNTER_PRODUCTTYPE_REFILLING).exists() %}

View File

@ -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

View File

@ -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 <skia@libskia.so>\n"
"Language-Team: AE info <ae.info@utbm.fr>\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"