one CGV button for and etransaction and sith account

This commit is contained in:
imperosol
2026-05-27 23:06:02 +02:00
committed by TitouanDor
parent b5332e95c7
commit 2ee53d201e
2 changed files with 33 additions and 52 deletions
-1
View File
@@ -141,7 +141,6 @@ form {
display: block;
margin: calc(var(--nf-input-size) * 1.5) auto 10px;
line-height: 1;
white-space: nowrap;
.fields-centered {
padding: 10px 10px 0;
@@ -59,13 +59,21 @@
<div @htmx:after-request="fill">
{{ billing_infos_form }}
</div>
{% include "core/base/notifications.jinja" %}
<form
method="post"
action="{{ settings.SITH_EBOUTIC_ET_URL }}"
id="bank-form"
onsubmit="return validateCgv()"
>
{% endif %}
{% include "core/base/notifications.jinja" %}
<form method="post" id="payment-form">
{# In order to have one CGV button for both payment means,
there is only one form, which action will be given
the `formaction` attribute of the selected submit input #}
<div class="form-group margin-bottom">
<input type="checkbox" id="cgv" name="cgv" required>
<label for="cgv">
{% trans trimmed %}I have read and I accept{% endtrans %}
<a href="">{% trans %}the general terms and conditions{% endtrans%}</a>
{%trans%}of the student association of the UTBM{% endtrans %}
</label>
</div>
{% if settings.SITH_EBOUTIC_CB_ENABLED %}
<template x-for="[key, value] in Object.entries(data)" :key="key">
<input type="hidden" :name="key" :value="value">
</template>
@@ -79,30 +87,23 @@
:disabled="!isCbAvailable"
{% endif %}
class="btn btn-blue"
formaction="{{ settings.SITH_EBOUTIC_ET_URL }}"
value="{% trans %}Pay with credit card{% endtrans %}"
/>
</form>
{% else %}
<div class="alert alert-yellow">
{% trans trimmed %}
Credit card payments are currently disabled on the eboutic.
You may still refill your account in one of the AE counters.
Please excuse us for the inconvenience.
{% endtrans %}
</div>
{% 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', basket_id=basket.id) }}"
name="sith-pay-form"
id="sith-form"
onsubmit="return validateCgv()"
>
{% else %}
<div class="alert alert-yellow">
{% trans trimmed %}
Credit card payments are currently disabled on the eboutic.
You may still refill your account in one of the AE counters.
Please excuse us for the inconvenience.
{% endtrans %}
</div>
{% 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 %}
{% csrf_token %}
<input
{% if basket.is_expired %}
@@ -112,29 +113,10 @@
{% endif %}
class="btn btn-blue"
type="submit"
formaction="{{ url('eboutic:pay_with_sith', basket_id=basket.id) }}"
value="{% trans %}Pay with Sith account{% endtrans %}"
/>
</form>
{% endif %}
<div class="cgv-block">
<input type="checkbox" id="cgv" name="cgv" value="1" required>
<label for="cgv">
{% trans trimmed %}I have read and accept {% endtrans %}
<a href="">{% trans %}the general terms and conditions{% endtrans%}</a>
{%trans%}of the student assosiation of UTBM{% endtrans %}
</label>
</div>
<script>
function validateCgv() {
const checkbox = document.getElementById('cgv');
if (!checkbox.checked) {
checkbox.focus();
return false;
}
return true;
}
</script>
{% endif %}
</form>
</div>
{% endblock %}