Add a nice animation on successful refilling

This commit is contained in:
Antoine Bartuccio 2024-12-16 00:58:23 +01:00
parent f63fb59cbf
commit 379527cd58
2 changed files with 7 additions and 2 deletions

View File

@ -44,6 +44,11 @@ exportToHtml("loadCounter", (config: CounterConfig) => {
).data.amount; ).data.amount;
}, },
async onRefillingSuccess() {
await this.updateBalance();
document.getElementById("selling-accordion").click();
},
async handleCode(event: SubmitEvent) { async handleCode(event: SubmitEvent) {
const code = ( const code = (
$(event.target).find("#code_field").val() as string $(event.target).find("#code_field").val() as string

View File

@ -32,7 +32,7 @@
</div> </div>
<div id="click_form"> <div id="click_form">
<h5>{% trans %}Selling{% endtrans %}</h5> <h5 id="selling-accordion">{% trans %}Selling{% endtrans %}</h5>
<div> <div>
{% set counter_click_url = url('counter:click', counter_id=counter.id, user_id=customer.user_id) %} {% set counter_click_url = url('counter:click', counter_id=counter.id, user_id=customer.user_id) %}
@ -103,7 +103,7 @@
{% if refilling_fragment %} {% if refilling_fragment %}
<h5>{% trans %}Refilling{% endtrans %}</h5> <h5>{% trans %}Refilling{% endtrans %}</h5>
<div <div
@htmx:after-request="updateBalance()" @htmx:after-request="onRefillingSuccess()"
> >
{{ refilling_fragment }} {{ refilling_fragment }}
</div> </div>