templates/_includes/_car_buy_js.html.twig line 1

Open in your IDE?
  1. <script type="text/javascript">
  2.     $('.btn-add-client').on('click', function(e) {
  3.         launchModal('{{ path('client_new_modal') }}');
  4.     });
  5.     $('.btn-add-vehicle').on('click', function(e) {
  6.         launchModal('{{ path('car_new_modal') }}');
  7.     });
  8.     $("#car_buy_client").select2( {
  9.         placeholder: "Seleccionar cliente",
  10.         allowClear: true
  11.     });
  12.     $("#car_buy_carSwap333").select2( {
  13.         placeholder: "Seleccionar vehĂ­culo",
  14.         allowClear: true
  15.     });
  16.     $('#car_buy_price').mask("#.##0", {reverse: true, maxlength: false});
  17.     $('#car_buy_moneyAdvance').mask("#.##0", {reverse: true, maxlength: false});
  18.     checkAllowDate( $('#car_buy_allow_date') );
  19.     {% if car_buy.isDoneDate != null %}
  20.         $('#car_buy_allow_date').prop('checked', true);
  21.         $('#car_buy_isDoneDate').prop('disabled', false);
  22.     {% endif %}
  23.     $('#car_buy_allow_date').on('change', function(e) {
  24.         checkAllowDate($(this));
  25.     });
  26.     function checkAllowDate(selector) {
  27.         if ( selector.prop('checked') ) {
  28.             $('#car_buy_isDoneDate').prop('disabled', false);
  29.         } else {
  30.             $('#car_buy_isDoneDate').prop('disabled', true);
  31.         }
  32.     }
  33.     function validate() {
  34.         if ( $('#car_buy_isDone').prop('checked') && !$('#car_buy_allow_date').prop('checked') ) {
  35.             alert('{{ label|default('You must enter a buy date'|trans) }}');
  36.             return false;
  37.         }
  38.         if ( $('#car_buy_isDone').prop('checked') ) {
  39.             return confirm('{{ label|default('Keep in mind that once the purchase is completed it can only be modified by an administrator'|trans) }}');
  40.         } else {
  41.             return true;
  42.         }
  43.     }
  44. </script>