templates/mobile/VehiculeMouvementForm.html.twig line 1

  1. {% extends 'mobile/_base.html.twig' %}
  2. {% block title %}Saisir une dépense Carburant{% endblock %}
  3. {% form_theme form 'bootstrap_4_layout.html.twig' %}
  4. {% block body %}
  5.     <div class="panel-primary">
  6.         <div class="panel-heading">
  7.             Saisir une dépense Carburant
  8.         </div>
  9.         <div class="panel-body">
  10.             {% for label, messages in app.flashes(['error','notice']) %}
  11.                 {% for message in messages %}
  12.                     <div class="flash-{{label}}">{% if label == 'notice' %}<i class="fa fa-check fa-1x"></i>{% endif %}{{message}}</div>
  13.                 {% endfor %}
  14.             {% endfor %}
  15.             {{ form_start(form, { 'attr': { 'class': 'form-horizontal'}}) }}
  16.                 {{ form_errors(form) }}
  17.                 {{ form_row(form.compteDebit) }}
  18.                 {{ form_row(form.categorie) }}
  19.                 {{ form_row(form.km) }}
  20.                 {{ form_row(form.litre) }}
  21.                 {{ form_row(form.prixLitre) }}
  22.                 {{ form_row(form.montant) }}
  23.                 {{ form_rest(form) }}
  24.                 <a href="{{ path('mobile_vehicule_mouvement') }}" style="float:rigth;">Saisir un nouveau mouvement</a>
  25.             {{ form_end(form) }}
  26.         </div>
  27.     </div>
  28.     <script>
  29.         $('#vehicule_mouvement_litre').blur(function(){
  30.             calculMontant();
  31.         });
  32.         $('#vehicule_mouvement_prixLitre').blur(function(){
  33.             calculMontant();
  34.         });
  35.         function calculMontant() {
  36.             let litre = $('#vehicule_mouvement_litre').val();
  37.             let prixLitre = $('#vehicule_mouvement_prixLitre').val();
  38.             //alert(litre + ' <=> ' + prixLitre);
  39.             if(litre > 0 && prixLitre > 0) {
  40.                 $('#vehicule_mouvement_montant').val(parseInt(litre * prixLitre * 100)/100);
  41.             }
  42.         }
  43.     </script>
  44. <p></p>
  45. {% endblock %}