templates/bubble/bubble_update.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}- Mise à jour d'une bulle{% endblock %}
  3. {% block breadcrumb %}
  4.     <!-- ============================================================== -->
  5.     <!-- Bread crumb and right sidebar toggle -->
  6.     <!-- ============================================================== -->
  7.     <div class="page-breadcrumb">
  8.         <div class="row custom-between">
  9.             <div class="align-self-center">
  10.                 <h1 class="page-title text-dark font-weight-medium mb-1 text-break">{% trans %}Modifier une bulle{% endtrans %}</h1>
  11.                 <div class="d-flex align-items-center">
  12.                     <nav aria-label="breadcrumb">
  13.                         <ol class="breadcrumb m-0 p-0">
  14.                             <li class="breadcrumb-item">
  15.                                 <li class="breadcrumb-item"><a href="{{ path('home') }}">{% trans %}Page d'accueil{% endtrans %}</a>&nbsp;>&nbsp;&nbsp;>&nbsp;<a href="{{ path('bubble') }}">{% trans %}Mes bulles{% endtrans %}</a>&nbsp;>&nbsp;<span>{% trans %}Modifier une bulle{% endtrans %}</span>
  16.                             </li>
  17.                         </ol>
  18.                     </nav>
  19.                 </div>
  20.             </div>
  21.         </div>
  22.     </div>
  23. {% endblock %}
  24. {% block content %}
  25.     <div class="row">
  26.         <div class="col-12">
  27.             <div class="card">
  28.                 <div class="card-header mc-bg text-white">
  29.                     {% trans %}Informations de la bulle{% endtrans %}
  30.                 </div>
  31.                 <div class="card-body">
  32.                     {{ form_start(bubbleForm) }}
  33.                     <div class="input-group mb-3">
  34.                         <div class="input-group-prepend">
  35.                             <label class="input-group-text" ><i data-feather="tag"
  36.                                                                 class="feather-icon"></i></label>
  37.                         </div>
  38.                         {{ form_widget(bubbleForm.bubble_name, { 'attr' : {
  39.                             'placeholder' : 'Nom de la bulle'
  40.                         }}) }}
  41.                     </div>
  42.                     {% if form_errors(bubbleForm.bubble_name)%}
  43.                         <div class="alert alert-danger">{{ form_errors(bubbleForm.bubble_name) }}</div>
  44.                     {% endif %}
  45.                     <div class="input-group mb-3">
  46.                         <div class="input-group-prepend">
  47.                             <label class="input-group-text" ><i data-feather="mail"
  48.                                                                 class="feather-icon"></i></label>
  49.                         </div>
  50.                         {{ form_widget(bubbleForm.b_address, { 'attr' : {
  51.                             'placeholder' : 'Adresse'
  52.                         }}) }}
  53.                     </div>
  54.                     {% if form_errors(bubbleForm.b_address)%}
  55.                         <div class="alert alert-danger">{{ form_errors(bubbleForm.b_address) }}</div>
  56.                     {% endif %}
  57.                     <div class="input-group mb-3">
  58.                         <div class="input-group-prepend">
  59.                             <label class="input-group-text" ><i data-feather="map-pin"
  60.                                                                 class="feather-icon"></i></label>
  61.                         </div>
  62.                         {{ form_widget(bubbleForm.b_postal_code, { 'attr' : {
  63.                             'placeholder' : 'Code postal'
  64.                         }}) }}
  65.                     </div>
  66.                     {% if form_errors(bubbleForm.b_postal_code)%}
  67.                         <div class="alert alert-danger">{{ form_errors(bubbleForm.b_postal_code) }}</div>
  68.                     {% endif %}
  69.                     <div class="input-group mb-3">
  70.                         <div class="input-group-prepend">
  71.                             <label class="input-group-text" ><i data-feather="home"
  72.                                                                 class="feather-icon"></i></label>
  73.                         </div>
  74.                         {{ form_widget(bubbleForm.b_city_name, { 'attr' : {
  75.                             'placeholder' : 'Ville'
  76.                         }}) }}
  77.                     </div>
  78.                     {% if form_errors(bubbleForm.b_city_name)%}
  79.                         <div class="alert alert-danger">{{ form_errors(bubbleForm.b_city_name) }}</div>
  80.                     {% endif %}
  81.                     <div class="input-group mb-3">
  82.                         <div class="input-group-prepend">
  83.                             <label class="input-group-text" ><i data-feather="map"
  84.                                                                 class="feather-icon"></i></label>
  85.                         </div>
  86.                         {{ form_widget(bubbleForm.b_country, { 'attr' : {
  87.                             'placeholder' : 'Pays'
  88.                         }}) }}
  89.                     </div>
  90.                     {% if form_errors(bubbleForm.b_country)%}
  91.                         <div class="alert alert-danger">{{ form_errors(bubbleForm.b_country) }}</div>
  92.                     {% endif %}
  93.                     <div class="input-group mb-3">
  94.                         <div class="input-group-prepend">
  95.                             <label class="input-group-text" ><i data-feather="check-square"
  96.                                                                 class="feather-icon"></i></label>
  97.                         </div>
  98.                         {{ form_widget(bubbleForm.is_qc_updatable, { 'attr' : {
  99.                             'placeholder' : 'Contrôle qualité'
  100.                         }}) }}
  101.                     </div>
  102.                     {% if form_errors(bubbleForm.is_qc_updatable)%}
  103.                         <div class="alert alert-danger">{{ form_errors(bubbleForm.is_qc_updatable) }}</div>
  104.                     {% endif %}
  105.                     <div class="input-group mb-3">
  106.                         <div class="input-group-prepend">
  107.                             <label class="input-group-text" ><i data-feather="user"
  108.                                                                 class="feather-icon"></i></label>
  109.                         </div>
  110.                         {{ form_widget(bubbleForm.stripe_customer_id, { 'attr' : {
  111.                             'placeholder' : 'Identifiant du client'
  112.                         }}) }}
  113.                     </div>
  114.                     {% if form_errors(bubbleForm.stripe_customer_id)%}
  115.                         <div class="alert alert-danger">{{ form_errors(bubbleForm.stripe_customer_id) }}</div>
  116.                     {% endif %}
  117.                     <div class="input-group mb-3">
  118.                         <div class="input-group-prepend">
  119.                             <label class="input-group-text" ><i data-feather="credit-card"
  120.                                                                 class="feather-icon"></i></label>
  121.                         </div>
  122.                         {{ form_widget(bubbleForm.stripe_pay_method_id, { 'attr' : {
  123.                             'placeholder' : 'Méthode de paiement'
  124.                         }}) }}
  125.                     </div>
  126.                     {% if form_errors(bubbleForm.stripe_pay_method_id)%}
  127.                         <div class="alert alert-danger">{{ form_errors(bubbleForm.stripe_pay_method_id) }}</div>
  128.                     {% endif %}
  129.                     {# Number of crédit Field >>> #}
  130.                     <div class="number-credit-error" style="color: red; display: none">{% trans %}Veuillez entrer une valeur supérieure ou égale à 0,01.{% endtrans %}</div>
  131.                     <div class="number-credit-error-dec" style="color: red; display: none">{% trans %}Merci d'indiquer un nombre à deux décimales maximum{% endtrans %}</div>
  132.                     <div class="input-group mb-3">
  133.                         <div class="input-group-prepend">
  134.                             <label class="input-group-text" ><i data-feather="hash"
  135.                                                                 class="feather-icon"></i></label>
  136.                         </div>
  137.                         {{ form_widget(bubbleForm.number_credit, { 'attr' : {
  138.                             'placeholder' : 'Nombre de crédits'
  139.                         }}) }}
  140.                     </div>
  141.                     {% if form_errors(bubbleForm.number_credit) %}
  142.                         <div class="alert alert-danger">{{ form_errors(bubbleForm.number_credit) }}</div>
  143.                     {% endif %}
  144.                     {# <<< Number of crédit Field #}
  145.                     {# Credit value Field >>> #}
  146.                     <div class="credit-value-error" style="color: red; display: none">{% trans %}Veuillez entrer une valeur supérieure ou égale à 0,01.{% endtrans %}</div>
  147.                     <div class="credit-value-error-dec" style="color: red; display: none">{% trans %}Merci d'indiquer un nombre à deux décimales maximum{% endtrans %}</div>
  148.                     <div class="credits mb-3">
  149.                         {{ form_widget(bubbleForm.credit_value, { 'attr' : {
  150.                             'placeholder' : 'Valeur d\'un crédit'
  151.                         }}) }}
  152.                     </div>
  153.                     {% if form_errors(bubbleForm.credit_value) %}
  154.                         <div class="alert alert-danger">{{ form_errors(bubbleForm.credit_value) }}</div>
  155.                     {% endif %}
  156.                     {# <<< Credit value Field #}
  157.                     {# Ad valorem value Field >>> #}
  158.                     {# <div class="ad-valorem-error" style="color: red; display: none">{% trans %}Veuillez entrer une valeur supérieure ou égale à 0,01.{% endtrans %}</div>
  159.                     <div class="ad-valorem-error-dec" style="color: red; display: none">{% trans %}Merci d'indiquer un nombre à deux décimales maximum{% endtrans %}</div> #}
  160.                     {# <div class="input-group ad-valorem mb-3">
  161.                         <div class="input-group-prepend">
  162.                             <label class="input-group-text" ><i data-feather="plus-square"
  163.                                                                 class="feather-icon"></i></label>
  164.                         </div>
  165.                         {{ form_widget(bubbleForm.ad_valorem, { 'attr' : {
  166.                             'placeholder' : "Valeur de l'ad valorem Vistory (en %)"
  167.                         }}) }}
  168.                     </div> #}
  169.                     {# {% if form_errors(bubbleForm.ad_valorem) %}
  170.                         <div class="alert alert-danger">{{ form_errors(bubbleForm.ad_valorem) }}</div>
  171.                     {% endif %} #}
  172.                     {# <<< Ad valorem value Field #}
  173.                     <button class="btn btn-primary btn-mc-to-load update-bubble-button" type="submit">
  174.                         <span class="btn-mc-loader d-none spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
  175.                         <span class="btn-mc-loading-text">{% trans %}Valider{% endtrans %}
  176.                     </button>
  177.                     {{ form_end(bubbleForm) }}
  178.                 </div>
  179.             </div>
  180.         </div>
  181.     </div>
  182. {% endblock %}
  183. {% block javascripts %}
  184.     {{ parent() }}
  185.     <script>
  186.         $(document).ready(function() {
  187.             
  188.             var numberCredit = true;
  189.             var creditValue = true;
  190.             var numberCreditDec = true;
  191.             var creditValueDec = true;
  192.             var adValoremDec = true;
  193.             //----- NUMBER CREDIT -----/
  194.             $('#bubble_edit_number_credit').blur(function(){
  195.                 if($('#bubble_edit_number_credit').val() < 0.01 && $('#bubble_edit_number_credit').val() != 0) {
  196.                     if($('#bubble_edit_number_credit').val() != ''){
  197.                         $('#bubble_edit_number_credit').css('border', 'solid red 1px');
  198.                         $('.update-bubble-button').attr('disabled', true);
  199.                         $('.number-credit-error').show()
  200.                         numberCredit = false
  201.                     } 
  202.                 } else {
  203.                     $('#bubble_edit_number_credit').css('border', '1px solid #e9ecef');
  204.                     $('.number-credit-error').hide()
  205.                         numberCredit = true
  206.                 }
  207.                 if ($('#bubble_edit_number_credit').val() > 0.01 && (/\.\d{3,}/.test($('#bubble_edit_number_credit').val()) || /\,\d{3,}/.test($('#bubble_number_credit').val()))) {
  208.                     $('#bubble_edit_number_credit').css('border', 'solid red 1px');
  209.                     $('.update-bubble-button').attr('disabled', true)
  210.                     $('.number-credit-error-dec').show();
  211.                     numberCreditDec = false
  212.                 } else {
  213.                     $('#bubble_number_credit').css('border', '1px solid #e9ecef');
  214.                     $('.number-credit-error-dec').hide();
  215.                     numberCreditDec = true
  216.                 }
  217.              
  218.                 if(numberCredit == true && creditValue == true && numberCreditDec == true && creditValueDec == true && adValoremDec == true) {
  219.                     $('.update-bubble-button').attr('disabled', false)
  220.                 }
  221.             })
  222.             //----- CREDIT VALUE -----//
  223.             $('#bubble_edit_credit_value').blur(function(){
  224.                 if($('#bubble_edit_credit_value').val() < 0.01) {
  225.                     if($('#bubble_edit_credit_value').val() != ''){
  226.                         $('#bubble_edit_credit_value').css('border', 'solid red 1px');
  227.                         $('.update-bubble-button').attr('disabled', true);
  228.                         $('.credit-value-error').show()
  229.                         creditValue = false
  230.                     } 
  231.                 } else {
  232.                     $('#bubble_edit_credit_value').css('border', '1px solid #e9ecef');
  233.                     $('.credit-value-error').hide()
  234.                     creditValue = true
  235.                 }
  236.                 if ($('#bubble_edit_credit_value').val() > 0.01 && (/\.\d{3,}/.test($('#bubble_edit_credit_value').val()) || /\,\d{3,}/.test($('#bubble_credit_value').val()))) {
  237.                     $('#bubble_edit_credit_value').css('border', 'solid red 1px');
  238.                     $('.update-bubble-button').attr('disabled', true)
  239.                     $('.credit-value-error-dec').show();
  240.                     creditValueDec = false
  241.                 } else {
  242.                     $('#bubble_edit_credit_value').css('border', '1px solid #e9ecef');
  243.                     $('.credit-value-error-dec').hide();
  244.                     creditValueDec = true
  245.                 }
  246.              
  247.                 if(numberCredit == true && creditValue == true && numberCreditDec == true && creditValueDec == true && adValoremDec == true) {
  248.                     $('.update-bubble-button').attr('disabled', false)
  249.                 }
  250.             })
  251.             //----- AD VALOREM -----//
  252.             /*$('#bubble_edit_ad_valorem').blur(function(){
  253.                 
  254.                 if($('#bubble_edit_ad_valorem').val() < 0) {
  255.                     if($('#bubble_edit_ad_valorem').val() != ''){
  256.                         $('#bubble_edit_ad_valorem').css('border', 'solid red 1px');
  257.                         $('.update-bubble-button').attr('disabled', true)
  258.                         $('.ad-valorem-error').show()
  259.                     }
  260.                 } else {
  261.                     $('#bubble_edit_ad_valorem').css('border', '1px solid #e9ecef');
  262.                     $('.ad-valorem-error').hide()
  263.                 } 
  264.                 if ($('#bubble_edit_ad_valorem').val() >= 0 && (/\.\d{3,}/.test($('#bubble_edit_ad_valorem').val()) || /\,\d{3,}/.test($('#bubble_edit_ad_valorem').val()))) {
  265.                     $('#bubble_edit_ad_valorem').css('border', 'solid red 1px');
  266.                     $('.update-bubble-button').attr('disabled', true)
  267.                     $('.ad-valorem-error-dec').show();
  268.                     adValoremDec = false
  269.                 } else {
  270.                     $('#bubble_edit_ad_valorem').css('border', '1px solid #e9ecef');
  271.                     $('.ad-valorem-error-dec').hide();
  272.                     adValoremDec = true
  273.                 }
  274.                 if(numberCredit == true && creditValue == true && numberCreditDec == true && creditValueDec == true && adValoremDec == true) {
  275.                     $('.update-bubble-button').attr('disabled', false)
  276.                 }
  277.             })*/
  278.             
  279.             $('#bubble_edit_ad_valorem').on('input', function() {
  280.                 let adValorem = $(this).val();
  281.                 let adValoremError = $('.ad-valorem-error');
  282.                 /* if (/\.\d{3,}/.test(adValorem) || /\,\d{3,}/.test(adValorem)) {
  283.                     adValoremError.show();
  284.                     const twoDecimalPlacesMessage = '<span style="color: red; font-size: 11px; padding: 0 0 0 20px; ">' +
  285.                         '{% trans %}Veuillez entrer une valeur supérieure à 0.01.{% endtrans %}' +
  286.                         '</span>';
  287.                     adValoremError.html(twoDecimalPlacesMessage)
  288.                 } else {
  289.                     adValoremError.hide();
  290.                 } */ 
  291.             });
  292.             const credictsElt = $(".credits");
  293.             credictsElt.find('.input-group-text').remove();
  294.             credictsElt.find('.input-group-prepend').remove();
  295.             credictsElt.find('.input-group-append').remove();
  296.             const credictsIcon = "<span class='credicts-icon'>€</span>";
  297.             credictsElt.find('.input-group').prepend(credictsIcon);
  298.         });
  299.         $('.js-example-basic-single').select2();
  300.     </script>
  301. {% endblock %}