mirror of
https://github.com/ae-utbm/sith.git
synced 2025-04-17 03:20:20 +00:00
92 lines
2.8 KiB
Django/Jinja
92 lines
2.8 KiB
Django/Jinja
{% extends "core/base.jinja" %}
|
|
|
|
{% block title %}
|
|
{% trans %}Basket state{% endtrans %}
|
|
{% endblock %}
|
|
|
|
{% block jquery_css %}
|
|
{# Remove jquery css #}
|
|
{% endblock %}
|
|
|
|
{% block additional_js %}
|
|
<script type="module" src="{{ static('bundled/eboutic/makecommand-index.ts') }}"></script>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<h3>{% trans %}Eboutic{% endtrans %}</h3>
|
|
|
|
<script type="text/javascript">
|
|
let billingInfos = {{ billing_infos|safe }};
|
|
</script>
|
|
|
|
<div x-data="etransaction(billingInfos)">
|
|
<p>{% trans %}Basket: {% endtrans %}</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<td>Article</td>
|
|
<td>Quantity</td>
|
|
<td>Unit price</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for item in basket.items.all() %}
|
|
<tr>
|
|
<td>{{ item.product_name }}</td>
|
|
<td>{{ item.quantity }}</td>
|
|
<td>{{ item.product_unit_price }} €</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
|
|
<p>
|
|
<strong>{% trans %}Basket amount: {% endtrans %}{{ "%0.2f"|format(basket.total) }} €</strong>
|
|
|
|
{% if customer_amount != None %}
|
|
<br>
|
|
{% trans %}Current account amount: {% endtrans %}
|
|
<strong>{{ "%0.2f"|format(customer_amount) }} €</strong>
|
|
|
|
{% if not basket.contains_refilling_item %}
|
|
<br>
|
|
{% trans %}Remaining account amount: {% endtrans %}
|
|
<strong>{{ "%0.2f"|format(customer_amount|float - basket.total) }} €</strong>
|
|
{% endif %}
|
|
{% endif %}
|
|
</p>
|
|
<br>
|
|
{% if settings.SITH_EBOUTIC_CB_ENABLED %}
|
|
<div @htmx:after-request="fill">
|
|
{{ billing_infos_form }}
|
|
</div>
|
|
<form
|
|
method="post"
|
|
action="{{ settings.SITH_EBOUTIC_ET_URL }}"
|
|
>
|
|
<template x-for="[key, value] in Object.entries(data)" :key="key">
|
|
<input type="hidden" :name="key" :value="value">
|
|
</template>
|
|
<input
|
|
x-cloak
|
|
type="submit"
|
|
id="bank-submit-button"
|
|
:disabled="!isCbAvailable"
|
|
class="btn btn-blue"
|
|
value="{% trans %}Pay with credit card{% endtrans %}"
|
|
/>
|
|
</form>
|
|
{% endif %}
|
|
{% if basket.contains_refilling_item %}
|
|
<p>{% trans %}AE account payment disabled because your basket contains refilling items.{% endtrans %}</p>
|
|
{% elif basket.total > user.account_balance %}
|
|
<p>{% trans %}AE account payment disabled because you do not have enough money remaining.{% endtrans %}</p>
|
|
{% else %}
|
|
<form method="post" action="{{ url('eboutic:pay_with_sith') }}" name="sith-pay-form">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="action" value="pay_with_sith_account">
|
|
<input class="btn btn-blue" type="submit" value="{% trans %}Pay with Sith account{% endtrans %}"/>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %} |