diff --git a/src/Controller/AdherentAdminController.php b/src/Controller/AdherentAdminController.php index 4f2fbe7..dfeb295 100644 --- a/src/Controller/AdherentAdminController.php +++ b/src/Controller/AdherentAdminController.php @@ -47,7 +47,7 @@ class AdherentAdminController extends CRUDController $this->addFlash( 'sonata_flash_success', - 'Prélèvement de ' . $amountDiff . ' MonA' . ' effectué.' + 'Prélèvement de ' . -$amountDiff . ' MonA' . ' effectué.' ); return new RedirectResponse( diff --git a/templates/themes/kohinos/tav/adherent_action_withdraw_down_to_the_ceiling.html.twig b/templates/themes/kohinos/tav/adherent_action_withdraw_down_to_the_ceiling.html.twig index 2e4bb95..8f11076 100644 --- a/templates/themes/kohinos/tav/adherent_action_withdraw_down_to_the_ceiling.html.twig +++ b/templates/themes/kohinos/tav/adherent_action_withdraw_down_to_the_ceiling.html.twig @@ -1,7 +1,14 @@ {% set balance = object.user.adherent.emlcAccount.balance %} {% set ceiling = object.user.adherent.ceiling %} {% if balance and ceiling and balance > ceiling %} - <a class="btn btn-sm btn-default" href="{{ admin.generateObjectUrl('withdrawDownToTheCeiling', object) }}"> + {% set diff = balance - ceiling %} + {% set warnMsg = + 'Vous vous apprêtez à prélever ' ~ diff|number_format ~ ' MonA sur le compte de ' + ~ object.user.adherent ~ ' afin de ramener le solde de son compte au niveau de son plafond autorisé. Poursuivre ?' + %} + <a class="btn btn-sm btn-default" + href="{{ admin.generateObjectUrl('withdrawDownToTheCeiling', object) }}" + onclick="return confirm('{{ warnMsg }}')"> Prélever </a> {% endif %} diff --git a/templates/themes/kohinos/tav/list_user_ssa_ceiling.html.twig b/templates/themes/kohinos/tav/list_user_ssa_ceiling.html.twig index fb12fa3..5984e4f 100644 --- a/templates/themes/kohinos/tav/list_user_ssa_ceiling.html.twig +++ b/templates/themes/kohinos/tav/list_user_ssa_ceiling.html.twig @@ -3,7 +3,10 @@ {%- spaceless %} {% set balance = object.user.adherent.emlcAccount.balance %} {% set ceiling = object.user.adherent.ceiling %} - {% if balance and ceiling and balance > ceiling %} + {% if not ceiling %} + {% set class = 'label label-warning' %} + {% set text = 'profil incomplet' %} + {% elseif balance > ceiling %} {% set class = 'label label-danger' %} {% set text = balance ~ ' > ' ~ ceiling %} {% else %}