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> {{ add_product(i.product_id, '+') }} {{ i.product_name }}: {{ "%0.2f"|format(i.product_unit_price*i.quantity) }} €</li>
{% endfor %} {% endfor %}
</ul> </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') }}"> <form method="post" action="{{ url('eboutic:command') }}">
{% csrf_token %} {% csrf_token %}
<p>
<input type="submit" value="{% trans %}Proceed to command{% endtrans %}" /> <input type="submit" value="{% trans %}Proceed to command{% endtrans %}" />
</p>
</form> </form>
</div> </div>
<div> <div>

View File

@ -27,13 +27,25 @@
{% endfor %} {% endfor %}
<tbody> <tbody>
</table> </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 %} {% if settings.SITH_EBOUTIC_CB_ENABLED %}
<form method="post" action="{{ settings.SITH_EBOUTIC_ET_URL }}"> <form method="post" action="{{ settings.SITH_EBOUTIC_ET_URL }}">
<p>
{% for (field_name,field_value) in et_request.items() -%} {% for (field_name,field_value) in et_request.items() -%}
<input type="hidden" name="{{ field_name }}" value="{{ field_value }}"> <input type="hidden" name="{{ field_name }}" value="{{ field_value }}">
{% endfor %} {% endfor %}
<input type="submit" value="{% trans %}Pay with credit card{% endtrans %}" /> <input type="submit" value="{% trans %}Pay with credit card{% endtrans %}" />
</p>
</form> </form>
{% endif %} {% endif %}
{% if basket.items.filter(type_id=settings.SITH_COUNTER_PRODUCTTYPE_REFILLING).exists() %} {% 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["basket"] = self.basket
kwargs["eboutic"] = Counter.objects.filter(type="EBOUTIC").first() kwargs["eboutic"] = Counter.objects.filter(type="EBOUTIC").first()
kwargs["categories"] = ProductType.objects.all() 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: if not self.request.user.was_subscribed:
kwargs["categories"] = kwargs["categories"].exclude( kwargs["categories"] = kwargs["categories"].exclude(
id=settings.SITH_PRODUCTTYPE_SUBSCRIPTION id=settings.SITH_PRODUCTTYPE_SUBSCRIPTION
@ -150,6 +154,10 @@ class EbouticCommand(TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(EbouticCommand, self).get_context_data(**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"] = OrderedDict()
kwargs["et_request"]["PBX_SITE"] = settings.SITH_EBOUTIC_PBX_SITE kwargs["et_request"]["PBX_SITE"] = settings.SITH_EBOUTIC_PBX_SITE
kwargs["et_request"]["PBX_RANG"] = settings.SITH_EBOUTIC_PBX_RANG kwargs["et_request"]["PBX_RANG"] = settings.SITH_EBOUTIC_PBX_RANG

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Report-Msgid-Bugs-To: \n" "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" "PO-Revision-Date: 2016-07-18\n"
"Last-Translator: Skia <skia@libskia.so>\n" "Last-Translator: Skia <skia@libskia.so>\n"
"Language-Team: AE info <ae.info@utbm.fr>\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 #: club/templates/club/club_sellings.jinja:14
#: counter/templates/counter/counter_click.jinja:90 #: counter/templates/counter/counter_click.jinja:90
#: counter/templates/counter/counter_main.jinja:28 #: counter/templates/counter/counter_main.jinja:28
#: eboutic/templates/eboutic/eboutic_main.jinja:34
msgid "Total: " msgid "Total: "
msgstr "Total : " msgstr "Total : "
@ -4320,7 +4319,22 @@ msgstr "id du type du produit"
msgid "basket" msgid "basket"
msgstr "panier" 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_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" msgid "Proceed to command"
msgstr "Procéder à la commande" msgstr "Procéder à la commande"
@ -4328,18 +4342,18 @@ msgstr "Procéder à la commande"
msgid "Basket state" msgid "Basket state"
msgstr "État du panier" msgstr "État du panier"
#: eboutic/templates/eboutic/eboutic_makecommand.jinja:36 #: eboutic/templates/eboutic/eboutic_makecommand.jinja:42
msgid "Pay with credit card" msgid "Pay with credit card"
msgstr "Payer avec une carte bancaire" msgstr "Payer avec une carte bancaire"
#: eboutic/templates/eboutic/eboutic_makecommand.jinja:40 #: eboutic/templates/eboutic/eboutic_makecommand.jinja:46
msgid "" msgid ""
"AE account payment disabled because your basket contains refilling items." "AE account payment disabled because your basket contains refilling items."
msgstr "" msgstr ""
"Paiement par compte AE désactivé parce que votre panier contient des bons de " "Paiement par compte AE désactivé parce que votre panier contient des bons de "
"rechargement." "rechargement."
#: eboutic/templates/eboutic/eboutic_makecommand.jinja:45 #: eboutic/templates/eboutic/eboutic_makecommand.jinja:51
msgid "Pay with Sith account" msgid "Pay with Sith account"
msgstr "Payer avec un compte AE" msgstr "Payer avec un compte AE"
@ -4355,7 +4369,7 @@ msgstr "Le paiement a été effectué"
msgid "Return to eboutic" msgid "Return to eboutic"
msgstr "Retourner à l'eboutic" msgstr "Retourner à l'eboutic"
#: eboutic/views.py:217 #: eboutic/views.py:219
msgid "You do not have enough money to buy the basket" msgid "You do not have enough money to buy the basket"
msgstr "Vous n'avez pas assez d'argent pour acheter le panier" msgstr "Vous n'avez pas assez d'argent pour acheter le panier"