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; display: block;
margin: calc(var(--nf-input-size) * 1.5) auto 10px; margin: calc(var(--nf-input-size) * 1.5) auto 10px;
line-height: 1; line-height: 1;
white-space: nowrap;
.fields-centered { .fields-centered {
padding: 10px 10px 0; padding: 10px 10px 0;
@@ -59,13 +59,21 @@
<div @htmx:after-request="fill"> <div @htmx:after-request="fill">
{{ billing_infos_form }} {{ billing_infos_form }}
</div> </div>
{% include "core/base/notifications.jinja" %} {% endif %}
<form {% include "core/base/notifications.jinja" %}
method="post" <form method="post" id="payment-form">
action="{{ settings.SITH_EBOUTIC_ET_URL }}" {# In order to have one CGV button for both payment means,
id="bank-form" there is only one form, which action will be given
onsubmit="return validateCgv()" 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"> <template x-for="[key, value] in Object.entries(data)" :key="key">
<input type="hidden" :name="key" :value="value"> <input type="hidden" :name="key" :value="value">
</template> </template>
@@ -79,30 +87,23 @@
:disabled="!isCbAvailable" :disabled="!isCbAvailable"
{% endif %} {% endif %}
class="btn btn-blue" class="btn btn-blue"
formaction="{{ settings.SITH_EBOUTIC_ET_URL }}"
value="{% trans %}Pay with credit card{% endtrans %}" value="{% trans %}Pay with credit card{% endtrans %}"
/> />
</form> {% else %}
{% else %} <div class="alert alert-yellow">
<div class="alert alert-yellow"> {% trans trimmed %}
{% trans trimmed %} Credit card payments are currently disabled on the eboutic.
Credit card payments are currently disabled on the eboutic. You may still refill your account in one of the AE counters.
You may still refill your account in one of the AE counters. Please excuse us for the inconvenience.
Please excuse us for the inconvenience. {% endtrans %}
{% endtrans %} </div>
</div> {% endif %}
{% endif %} {% if basket.contains_refilling_item %}
{% if basket.contains_refilling_item %} <p>{% trans %}AE account payment disabled because your basket contains refilling items.{% endtrans %}</p>
<p>{% trans %}AE account payment disabled because your basket contains refilling items.{% endtrans %}</p> {% elif basket.total > user.account_balance %}
{% elif basket.total > user.account_balance %} <p>{% trans %}AE account payment disabled because you do not have enough money remaining.{% endtrans %}</p>
<p>{% trans %}AE account payment disabled because you do not have enough money remaining.{% endtrans %}</p> {% else %}
{% else %}
<form
method="post"
action="{{ url('eboutic:pay_with_sith', basket_id=basket.id) }}"
name="sith-pay-form"
id="sith-form"
onsubmit="return validateCgv()"
>
{% csrf_token %} {% csrf_token %}
<input <input
{% if basket.is_expired %} {% if basket.is_expired %}
@@ -112,29 +113,10 @@
{% endif %} {% endif %}
class="btn btn-blue" class="btn btn-blue"
type="submit" type="submit"
formaction="{{ url('eboutic:pay_with_sith', basket_id=basket.id) }}"
value="{% trans %}Pay with Sith account{% endtrans %}" value="{% trans %}Pay with Sith account{% endtrans %}"
/> />
</form> {% endif %}
{% endif %} </form>
<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>
</div> </div>
{% endblock %} {% endblock %}