src/Flexy/FrontBundle/Themes/CoWorking/templates/reservation/reservation-offices-step.html.twig line 1

  1. {% extends '@Flexy/FrontBundle/Themes/CoWorking/templates/layout.html.twig' %}
  2. {% block stylesheets %}
  3. {{ parent() }}
  4.  <link rel="stylesheet" href="{{ asset('themes/coworking/css/reservation.css') }}" />
  5.  
  6. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.4.2/chosen.css" />
  7. <style>
  8.   .modal-backdrop.fade.show {
  9.         display: none;
  10. }
  11.  
  12.  
  13. /* css checkbox*/
  14. /* hide checkbox */
  15. input[type="checkbox"] {
  16.   display: none;
  17. }
  18. /* if checkbox is checked, then do these things */
  19. /*input[type="checkbox"]:checked + label {
  20.   color: white;
  21.   background:#FFD86E;
  22.   border-radius: 5px;
  23.   padding: 0px 10px 0px 10px;
  24. }
  25. /* styles when hovering over options */
  26. label:hover {
  27.   cursor: pointer;
  28.   
  29.   /* transitions and animations */
  30.   -webkit-transition: color .5s ease;
  31.   -moz-transition: color .5s ease;
  32.   -ms-transition: color .5s ease;
  33.   -o-transition: color .5s ease;
  34.   transition: color .5s ease;
  35. }
  36.   
  37. input.button {
  38.   
  39.     width:130px;
  40.     height:50px;
  41.     margin: 20px 0 30px 0;
  42.     padding: 0px 20px 0px 20px;
  43.     background: #e6e6e6;
  44.     border-radius:5px;
  45.     border: 1px solid #ccc;
  46.     font-family: OpenSans, sans-serif;
  47.     font-size:16pt;
  48.     color:#444;
  49. }
  50. .Addons label{
  51.     font-size:12px !important;
  52.     font-family: 'roboto';
  53.     font-weight: 500;
  54.     border: 1px solid #80808024;
  55.     margin: 2px;
  56.     padding: 0px 5px 0px 5px;
  57.     border-radius: 5px;
  58. }
  59. .multistep-container .active-button li:not(:first-child) .round-btn:before {
  60.     position: absolute;
  61.     content: '';
  62.     width: 141px;
  63.     height: 3px;
  64.     background-color: #E9F2FA;
  65.     left: -120px;
  66. }
  67. .multistep-container .active-button li {
  68.     display: inline-block;
  69.     width: 140px;
  70. }
  71. .form-check {
  72.     line-height: 22px;
  73. }   
  74. .col-md-12.col-lg-12.col-sm-12.d-flex.justify-content-end.align-items-end.mb-3{
  75.         flex: 0 0 86%;
  76. }
  77.  @media (max-width:767px) {
  78.                 html, body {
  79.                   overflow-x: hidden  !important;
  80.                 }
  81.                 body {
  82.                   position: relative !important;
  83.                 }
  84.                 .col-sm-8.reservation-steeps {
  85.                     padding:0%;
  86.                 }
  87.                 .multistep-container .mutistep-form-area .form-box{
  88.                     position: relative;
  89.                     top: 33px;
  90.                     left: 0px;
  91.                 }
  92.                 .multistep-container .active-button li{
  93.                     display: inline-block;
  94.                     width: 100px;
  95.                 }
  96.                 .panel-sticky{
  97.                     font-size:12px;
  98.                 }
  99.               h6.display-6.header-steeps {
  100.                 margin-left: 3%;
  101.             }
  102.             h6.datetime{
  103.                  margin-left: 3%;
  104.             }
  105.             a#seeDetails {
  106.                 margin-bottom: -11%;
  107.             }
  108.             a#seePrice {
  109.                 float: right;
  110.                 margin-right: 52%;
  111.             }
  112.  }
  113.  
  114.  li.etape1:before {
  115.     background: #7ED670 !important; /* Change the background color */
  116.     color: white !important;
  117. }
  118.  .message {
  119.         
  120.                color: white;
  121.             background: rgb(199, 200, 204);
  122.             
  123.             font-size: 15px;
  124.             padding: 20px;
  125.             border-radius: 10px;
  126.             text-align: center;
  127.             font-weight: bold;
  128.             box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  129.             height: 100px; /* Adjust the height as necessary */
  130.             display: flex;
  131.             align-items: center;
  132.             justify-content: center;
  133.         }
  134.     
  135. </style>
  136.   
  137. {% endblock  %}
  138. {% block body %}
  139.  
  140.  
  141.  
  142.  
  143.   <img src="{{asset('themes/coworking/front/images/office.jpg')}}" style="width: 100%;height: 520px;" class="img-fluid" />
  144.   <div class="container">
  145.     <div class="row justify-content-between">
  146.       <div class="col-sm-8 reservation-steeps">
  147.        
  148.        <div class="row">
  149.           <div class="col-sm-8">
  150.             <h6 style="margin-top:10px">Réservation   
  151.                  {% set displayed_categories = [] %}  
  152.               {% for bureau in products %}
  153.                             {% for cat in bureau.categoriesProduct %}
  154.                              {% if cat.id == subcategory and  cat.id not in displayed_categories %}
  155.                                  
  156.                                  {{cat.name }}
  157.                               {% endif%}
  158.                                  {% set displayed_categories = displayed_categories|merge([cat.id]) %}
  159.                               {% endfor %}
  160.                         {% endfor %}
  161.             </h6>
  162.           </div>
  163.           <div class="col-sm-4" style="margin-top:10px;">
  164.             <a href="/themes/coworking/front/images/BUREAUX.pdf" class="btn-res text-center text-light text-uppercase bg-dark" style="float: right;padding: 8px;border-radius: 6px;font-size:13px;" target="_blank"> NOS TARIFS</a>
  165.           </div>
  166.         </div>
  167.        
  168.        
  169.         <div class="container">
  170.          
  171.               
  172.           
  173.           <div class="row">
  174.               
  175.          <div class="container d-flex justify-content-center align-items-center">
  176.          
  177.          
  178.           <ul id="progressbar">
  179.              <li class="etape1" >   <span>   Type</span>  </li>
  180.            <li class="active" >    <span>   Formule</span></li>
  181.           <li> Date </li>
  182.           <li> Confirmation</li>
  183.           
  184.                 </ul>
  185.            
  186.       </div>
  187.             
  188.             
  189.             <div class="col-xl-12" style="top: 20px ;">
  190.               
  191.               <div class="multistep-container">
  192.                 <div class="mutistep-form-area">
  193.                     
  194.                  
  195.                   <div class="form-box">
  196.                 
  197.                    
  198.                  
  199.                        
  200.                             <div class="container" >
  201.                            
  202.                             <!--     <h5>Veuillez choisir un bureau :</h5>
  203.                    <select name="select" id="select" class="form-control selectpiker">
  204.                         <option value="">Sélectionner votre choix </option>
  205.                         {% for bureau in products %}
  206.                      
  207.                             {% for cat in bureau.categoriesProduct %}
  208.                           
  209.                                 {% if cat.id == subcategory %}
  210.                                     <option value="{{bureau.id }}">BUREAU {{ bureau.name }}</option>
  211.                                 {% endif %}
  212.                             {% endfor %}
  213.                         {% endfor %}
  214.                     </select>-->
  215.                  
  216.                           
  217.               
  218.               
  219.                
  220.                  <div id="form-attribue" style="line-height: 30px;" class="mt-4"> 
  221. <h5>Veuillez choisir une formule  </h5>
  222.             
  223.                   {% for attr in  attributValues %}
  224.                     
  225.                     
  226.                    
  227.                   {% if attr.code == "simple" %}
  228.                
  229.                   
  230.                   <div class="form-check"  >
  231.                 <input class="form-check-input option radio1 "  data-days="10" data-id="{{subcategory}}" data-name="{{subcategoryName}}"  data-price="{{attr.price}}" type="radio" name="radioGroup" class="option" id="radio1" value="{{attr.attribut.name}}" />
  232.                 <label class="form-check-label"  data-days="10" data-id="{{subcategory}}" data-name="{{subcategoryName}}"  data-price="{{attr.price}}" for="radio1">{{attr.attribut.name}}</label><br>
  233.                 <small>
  234.                   
  235.                   {{attr.attribut.description}}
  236.                   </small>
  237.                 </div>
  238.                 
  239.                   {% endif %}
  240.                   {% endfor %}
  241.                   
  242.                  {% set addedValues = [] %}
  243.                 {% if attributValues|length > 0 %}
  244.                 
  245.                  <div class="form-check">
  246.                         <input class="form-check-input" type="radio" name="radioGroup" id="radio2"  />
  247.                         <label class="form-check-label" for="radio2">Location “Pass jours”</label><br>
  248.                         <small>Cette formule est déclinée comme suit :</small>
  249.                         <select style="padding: 4px;" class="col-6  option " id="serviceFormule" >
  250.                        
  251.                              <option value="" data-price=""  >Sélectionner un choix</option>
  252.                     
  253.                          {% for attr in attributValues %}
  254.                          {% if attr.code == "multiple" %}
  255.                           {% set optionId = attr.attribut.name ~ "-" ~ attr.attribut.description ~ "-" ~ subcategory ~ "-" ~ subcategoryName ~ "-" ~ attr.price %}
  256.                             {% if optionId not in addedValues %}
  257.                           {% set _ = addedValues|merge([optionId]) %}
  258.                         <option  value="{{attr.attribut.name}}"  data-days="{{attr.attribut.description}}" data-id="{{subcategory}}" data-name="{{subcategoryName}}"  data-price="{{attr.price}}"  >{{attr.attribut.name}}</option>
  259.                          {% endif %}
  260.                         {% endif %}
  261.                         {% endfor %}
  262.                         </select>
  263.                  </div>
  264.                {% endif %}
  265.              {% for attr in  attributValues %}
  266.                    {% if attr.code == "personalized" %}     
  267.                    
  268.                      
  269.                      <div class="form-check">
  270.                       <input class="form-check-input option radio1 "  data-days="30"  data-id="{{subcategory}}" data-name="{{subcategoryName}}"  {% if(attr.price is null) %} data-price="0"  {% else %}  data-price="{{attr.price}}"  {% endif %}  type="radio" name="radioGroup"  {% if(attr.attribut.name=="Période personnalisée") %}   value="Mois"   {% else %}  value="{{attr.attribut.name}}" {% endif %}  id="radioMois"  />
  271.                       <label class="form-check-label" data-days="30" data-id="{{subcategory}}" data-name="{{subcategoryName}}"  {% if(attr.price is null) %} data-price="0"  {% else %}  data-price="{{attr.price}}"  {% endif %}    for="radio{{ attr.attribut.id}}">  {{ attr.attribut.name}}   </label><br>
  272.                       
  273.                        <small> {{ attr.attribut.description}}</small>
  274.                     </div>
  275.                      
  276.                      {% endif %}
  277.                    {% endfor %}
  278.                  
  279.                     <h5 style="font-weight:bold; margin-top: 10px;">Services supplémentaires </h5>
  280.                     <h6 style="font-weight:bold; margin-top: 10px;">Voulez-vous ajouter des services supplémentaires?</h6>
  281.                     <!--<small style="color:grey">Disponible en location au mois ou à la journée</small>-->
  282.                     <div class="row">
  283.                          <div class="col-sm-12 Addons">
  284.                             {% for service in  services %}
  285.                                     <input id="{{ service.name}}"  data-id="{{service.id}}" data-name="{{service.name}}"  data-price="{{service.price}}"  type="checkbox" class="CK"  name="services" value="{{ service.id}} "><label for="service"> {{ service.name}}  </label> 
  286.                             {% endfor %}<br>
  287.                             
  288.                             
  289.                                    {% set isSimple = false %}
  290.                                 {% for attr in attributValues %}
  291.                                     {% if attr.code == "simple" %}
  292.                                         {% set isSimple = true %}
  293.                                     {% endif %}
  294.                                 {% endfor %}
  295.                                  
  296.                            
  297.                               {% for servicesCommun in  servicesCommuns %}
  298.                                {% if not isSimple %}
  299.                                {% if servicesCommun.id not in [94, 92, 69]  %}
  300.                             <input id="{{ servicesCommun.name }}" data-id="{{ servicesCommun.id }}" data-name="{{ servicesCommun.name }}" data-price="{{ servicesCommun.price }}" type="checkbox" class="CK" name="serviceCommun" value="{{ servicesCommun.id }} ">
  301.                             <label for="service"> {{ servicesCommun.name }} </label>
  302.                              {% endif %}
  303.                             {% else %}
  304.                         <input id="{{ servicesCommun.name }}" data-id="{{ servicesCommun.id }}" data-name="{{ servicesCommun.name }}" data-price="{{ servicesCommun.price }}" type="checkbox" class="CK" name="serviceCommun" value="{{ servicesCommun.id }} ">
  305.                         <label for="service"> {{ servicesCommun.name }} </label>
  306.                            {% endif %}
  307.                               {% endfor %}
  308.                               {#{% for servicesCommun in  servicesCommuns %}
  309.                                     <input id="{{ servicesCommun.name}}" data-id="{{servicesCommun.id}}" data-name="{{servicesCommun.name}}"  data-price="{{servicesCommun.price}}"  type="checkbox" class="CK" name="serviceCommun" value="{{ servicesCommun.id}} "><label for="service"> {{ servicesCommun.name}}   </label>
  310.                                       
  311.                               {% endfor %}#}     
  312.  
  313.                              </div>
  314.                      <!-- <div class="col-sm-12">
  315.                         <small style="color:grey; margin-top: 5px;">Autre</small>
  316.                         <input type="text" class="form-control" id="information" placeholder="Saisissez votre texte ici" style="height: 30px;border-radius: 4px;">
  317.                       </div>-->
  318.                       
  319.                     <!-- <h5 style="font-weight:bold;margin-top: 10px; ">Informations additionnelles </h5>
  320.                      <h6 style="font-weight:bold; margin-top: 10px;">Avez vous des demandes spécifiques ? </h6>
  321.                       <textarea class="form-control" name="demande_specifique" id="textAreaExample1" rows="1" placeholder="Saisissez votre texte Ici" style="font-size: 12px;"></textarea>
  322.                       -->
  323.                        <div class="message" style=" display: none;">Les Services supplémentaires sont indisponibles pour cette sélection.</div>
  324.                     </div>
  325.                     <div class="button-row">
  326.             <a href="{{path("reservationbureaux")}}"   class="btn-res text-center text-light text-uppercase bg-dark ReserveNext__"   style=" border:1px solid #FFCB00 !important; color:black !important;background: #ffff !important;padding:10px; text-decoration:none; width:230px; font-size:12px; font-family:'PT Sans', sans-serif; letter-spacing:2px;">Étape précédente</a>
  327.             &nbsp;&nbsp;
  328.                <a href="{{path("reservationstep2office",{id:subcategory})}}"  id="reservationLink"  class="btn-res text-center text-light text-uppercase bg-dark ReserveNext__"   style="background: #FFCB00 !important;padding:10px; text-decoration:none; width:230px; font-size:12px; font-family:'PT Sans', sans-serif; letter-spacing:2px;">Étape suivante</a>
  329.                                                       
  330.                       </div>
  331.                  </div>
  332.                 
  333.               
  334.                  </div>
  335.                             
  336.                             
  337.                            
  338.                      
  339.            
  340.                     
  341.                    
  342.                   </div>
  343.                    
  344.                 
  345.                 </div>
  346.               </div>
  347.             </div>
  348.           </div>
  349.         </div>
  350.          
  351.       </div>
  352.         <div id="panier" class="col-sm-4 reservation-steeps-panier" style="overflow-y: auto; "> 
  353.       
  354.         {{render(path("ajax_cart"))}}
  355.     </div>
  356.   </div>
  357.   
  358.   
  359. {% endblock %}
  360. {% block javascripts %}
  361.   <!-- MAIN CONTENT -->
  362.  
  363. <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
  364. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
  365.  
  366.  
  367. <script>
  368.  //recuperer la valeur des jours dans le formulaire .
  369.     document.getElementById('reservationLink').addEventListener('click', function() {
  370.          
  371.         var days=0;
  372.         var selectedOption = document.getElementById('serviceFormule');
  373.          var selected = selectedOption.value;
  374.           if(selected != ""){
  375.            days = selectedOption.options[selectedOption.selectedIndex].getAttribute('data-days');
  376.           }else{
  377.          var radioButtons = document.getElementsByName('radioGroup');
  378.           for (var i = 0; i < radioButtons.length; i++) {
  379.             if (radioButtons[i].checked) {
  380.              days = parseInt(radioButtons[i].getAttribute('data-days'));
  381.             break;
  382.             }
  383.         }  }
  384.             
  385.           
  386.     if (days === 0) {
  387.         event.preventDefault(); // Empêche le lien de se déclencher
  388.         alert("Vous n'avez rien sélectionné. Veuillez sélectionner une option.");
  389.     }  
  390.         var link = document.getElementById('reservationLink');
  391.       
  392.        link.href = "{{ path('reservationstep2office', {id: subcategory, 'paramFormule': 'days'}) }}".replace('days', days);
  393.     });
  394.   
  395.     $(document).ready(function(){
  396.     
  397.         /*$("#select").change(function(){
  398.             var selectedValue = $(this).val();
  399.  
  400.              
  401.             $.ajax({
  402.                 url: '/reservation/ajax-formule-reservation',
  403.                 type: 'GET', // ou 'GET' en fonction de votre besoin
  404.                 data: { office : selectedValue },
  405.                 success: function(response) {
  406.                     
  407.                    // Vider le contenu de la div #form-attribue
  408.                $('#form-attribue').empty();
  409.                     
  410.             setTimeout(function() {
  411.               // Cacher la div loader après le délai spécifié (par exemple, 2 secondes)
  412.                  
  413.               // Afficher le résultat dans la div
  414.                    $('#form-attribue').html(response);
  415.              }, 1000); // Délai de 2 secondes (2000 millisecondes)
  416.         
  417.                 
  418.                 },
  419.                 error: function(xhr, status, error) {
  420.                     // Gérez les erreurs ici
  421.                     console.error(error);
  422.                 }
  423.             });
  424.         });*/
  425.   $('#serviceFormule').change(function(){ 
  426.                         var radio = document.getElementById('radio2');
  427.                           radio.checked = true;
  428.                   $('.Addons').show();
  429.              $('.message').hide();
  430.  
  431.     
  432.    });
  433.  var radioButtons = document.getElementsByName('radioGroup');
  434.  var selectElement = document.getElementById('serviceFormule');
  435. radioButtons.forEach(function(radio) {
  436.     radio.addEventListener('click', function() {
  437.         if (radio.id === 'radio2') {
  438.             selectElement.disabled = false;
  439.     
  440.                 
  441.             selectElement.val($('option:nth-child(1)').prop('selected', true));
  442.              $('.Addons').show();
  443.              $('.message').hide()
  444.             
  445.             
  446.         }
  447.         else if(radio.id === 'radio1'){
  448.                
  449.                     $('.Addons').hide();
  450.                     $('.message').show();
  451.         }
  452.         else {
  453.             selectElement.selectedIndex = 0; // Sélection du premier élément
  454.             selectElement.disabled = true;
  455.              $('.Addons').show();
  456.                     $('.message').hide();
  457.         }
  458.     });
  459. });
  460.          $('body').on("click",".option",function() {
  461.            /*var selectedServiceIds = [];
  462.           var formule ="";
  463.             formule = $(".radio1").val();*/
  464.              if ($(this).is(':checked')) {  
  465.         var formule = $(this).val(); 
  466.        
  467.     }
  468.              $('.CK:checked').each(function() {
  469.         // Ajouter l'ID du service sélectionné à la liste
  470.         //selectedServiceIds.push($(this).data('id'));
  471.   
  472.            var currentCheckbox = $(this);
  473.           $.ajax({
  474.                 url: '/reservation/ajax-service-price',
  475.                 type: 'GET', // ou 'GET' en fonction de votre besoin
  476.                 data: { 
  477.                   serviceId : $(this).data('id'),
  478.                   formule : formule
  479.                  },
  480.                 success: function(response) {
  481.                     currentCheckbox.attr('data-price', response);
  482.                     var idProduct = currentCheckbox.attr("data-id");
  483.                     var price = currentCheckbox.attr("data-price");
  484.                     var name = currentCheckbox.attr("data-name");
  485.                      if(price != 0){
  486.                     var actionType = "add";
  487.                      currentCheckbox.next('label').css({'color': 'white', 'background': 'rgb(255, 216, 110)'});
  488.                     }else{
  489.                       var actionType = "remove";
  490.                       currentCheckbox.next('label').css({'color': 'white', 'background': '#C7C8CC'});
  491.                     }
  492.                     
  493.              $.ajax({
  494.                 url:"{{path('ajax_cart')}}",
  495.                 data:{
  496.                   idProduct:idProduct,
  497.                   price:price,
  498.                   name:name,
  499.                   actionType:actionType
  500.                 },
  501.                 success:function(result){
  502.                   console.log(result);
  503.                     $(".reservation-steeps-panier").html(result);
  504.                 }
  505.               });
  506.                             
  507.                        
  508.         },
  509.                 error: function(xhr, status, error) {
  510.                     // Gérez les erreurs ici
  511.                     console.error(error);
  512.                 }
  513.             });
  514.          
  515.   
  516.           
  517.     
  518.         
  519.     });
  520.         
  521.           
  522.     var idProduct = $(this).attr("data-id");
  523.     var price = $(this).attr("data-price");
  524.     var name = $(this).attr("data-name");
  525.     var actionType = "add";
  526.     $.ajax({
  527.       url:"{{path('ajax_cart')}}",
  528.       data:{
  529.         idProduct:idProduct,
  530.         price:price,
  531.         name:name,
  532.         actionType:actionType
  533.       },
  534.       success:function(result){
  535.         console.log(result);
  536.           $(".reservation-steeps-panier").html(result);
  537.       }
  538.     });
  539.     });
  540.              $('body').on("change","select.option",function() {
  541.  var selectedServiceIds = [];
  542.                  if($("#serviceFormule").val() != "" || $("#radio3").val() != ""){
  543.          if($("#serviceFormule").val() != "" ){
  544.                  formule =$("#serviceFormule").val();
  545.                 }else{
  546.                  formule = $(".radio1").val();
  547.                 }
  548.           }
  549.             // Parcourir toutes les cases cochées avec la classe CK
  550.     $('.CK:checked').each(function() {
  551.         // Ajouter l'ID du service sélectionné à la liste
  552.        // selectedServiceIds.push($(this).data('id'));
  553.   
  554.            var currentCheckbox = $(this);
  555.           $.ajax({
  556.                 url: '/reservation/ajax-service-price',
  557.                 type: 'GET', // ou 'GET' en fonction de votre besoin
  558.                 data: { 
  559.                   serviceId : $(this).data('id'),
  560.                   formule : formule
  561.                  },
  562.                 success: function(response) {
  563.                     currentCheckbox.attr('data-price', response);
  564.                     var idProduct = currentCheckbox.attr("data-id");
  565.                     var price = currentCheckbox.attr("data-price");
  566.                     var name = currentCheckbox.attr("data-name");
  567.                     
  568.                      if(price != 0){
  569.                     var actionType = "add";
  570.                      currentCheckbox.next('label').css({'color': 'white', 'background': 'rgb(255, 216, 110)'});
  571.                     }else{
  572.                       var actionType = "remove";
  573.                       currentCheckbox.next('label').css({'color': 'white', 'background': '#C7C8CC'});
  574.                     }
  575.                     
  576.                    
  577.              $.ajax({
  578.                 url:"{{path('ajax_cart')}}",
  579.                 data:{
  580.                   idProduct:idProduct,
  581.                   price:price,
  582.                   name:name,
  583.                   actionType:actionType
  584.                 },
  585.                 success:function(result){
  586.                   console.log(result);
  587.                     $(".reservation-steeps-panier").html(result);
  588.                 }
  589.               });
  590.                             
  591.                        
  592.         },
  593.                 error: function(xhr, status, error) {
  594.                     // Gérez les erreurs ici
  595.                     console.error(error);
  596.                 }
  597.             });
  598.          
  599.   
  600.           
  601.     
  602.         
  603.     });
  604.     
  605.       
  606.                 
  607.           
  608.     var idProduct = $(this).find("option:selected").attr("data-id");
  609.     var price = $(this).find("option:selected").attr("data-price");
  610.     var name = $(this).find("option:selected").attr("data-name");
  611.     var actionType = "add";
  612.    
  613.     $.ajax({
  614.       url:"{{path('ajax_cart')}}",
  615.       data:{
  616.         idProduct:idProduct,
  617.         price:price,
  618.         name:name,
  619.         actionType:actionType
  620.       },
  621.       success:function(result){
  622.         console.log(result);
  623.           $(".reservation-steeps-panier").html(result);
  624.       }
  625.     });
  626.     });
  627.           $('body').on("click",".delete-cart-item",function() {
  628.           
  629.     var idProduct = $(this).attr("data-id");
  630.     var price = $(this).attr("data-price");
  631.     var name = $(this).attr("data-name");
  632.     var actionType = "remove";
  633.     $.ajax({
  634.       url:"{{path('ajax_cart')}}",
  635.       data:{
  636.         idProduct:idProduct,
  637.         price:price,
  638.         name:name,
  639.         actionType:actionType
  640.       },
  641.       success:function(result){
  642.         console.log(result);
  643.           $(".reservation-steeps-panier").html(result);
  644.       }
  645.     });
  646.     });
  647.         // Ajouter la délégation d'événements pour le clic sur le label 'service'
  648. $('#form-attribue').on('click', 'label[for="service"]', function() {
  649.     
  650.     var checkBox = $(this).prev();
  651.     var value = checkBox.val();
  652.     if (checkBox.is(":checked")) {
  653.         checkBox.prop('checked', false);
  654.         console.log("Case à cocher décochée : " + value);
  655.            checkBox.next('label').css({ 'color': '#626262' ,'background': 'none'});   
  656.     var idProduct = checkBox.attr("data-id");
  657.     var price = checkBox.attr("data-price");
  658.     var name = checkBox.attr("data-name");
  659.     var actionType = "remove";
  660.       $.ajax({
  661.       url:"{{path('ajax_cart')}}",
  662.       data:{
  663.         idProduct:idProduct,
  664.         price:price,
  665.         name:name,
  666.         actionType:actionType
  667.       },
  668.       success:function(result){
  669.         console.log(result);
  670.           $(".reservation-steeps-panier").html(result);
  671.       }
  672.     });
  673.  
  674.     } else {
  675.         checkBox.prop('checked', true);
  676.        // console.log("Case à cocher cochée : " + value);
  677.        var formule = "";
  678.        
  679.         
  680.               if($("#serviceFormule").val() != "" || $("#radio1").val() != ""){
  681.                  if($("#serviceFormule").val() != "" ){
  682.                  formule =$("#serviceFormule").val();
  683.                 }
  684.                 else if ($('#radio1').is(':checked')) {
  685.                   formule = $(".radio1").val();
  686.                  }
  687.                  else if ($('#radio1').is(':checked')) {
  688.                   formule = $("#radio1").val();
  689.                  }
  690.                   else if ($('#radioMois').is(':checked')) {
  691.                   formule = $("#radioMois").val();
  692.                  }
  693.               
  694.                      var serviceId = $(this).prev().data('id');
  695.                     var dataElement = $(this).prev();
  696.              $.ajax({
  697.                 url: "{{path('ajaxServicePrice')}}",
  698.                 type: 'GET', // ou 'GET' en fonction de votre besoin
  699.                 data: { 
  700.                   serviceId : value,
  701.                   formule : formule
  702.                  },
  703.                 success: function(response) {
  704.                    // alert(response);
  705.                  
  706.                     dataElement.attr("data-price", response);
  707.                     var idProduct = dataElement.attr("data-id");
  708.                     var price = dataElement.attr("data-price");
  709.                     var name = dataElement.attr("data-name");
  710.                     var actionType = "add";
  711.                  if(price != 0 ){
  712.                 $.ajax({
  713.                 url:"{{path('ajax_cart')}}",
  714.                 data:{
  715.                   idProduct:idProduct,
  716.                   price:price,
  717.                   name:name,
  718.                   actionType:actionType
  719.                 },
  720.                 success:function(result){
  721.                   console.log(result);
  722.                     $(".reservation-steeps-panier").html(result);
  723.                 }
  724.               });
  725.                checkBox.next('label').css({ 'color': 'white' ,'background': '#FFD86E'});
  726.                  
  727.                    }else {
  728.                 // Si le prix est égal à zéro, changer le fond du checkbox en gris
  729.                 checkBox.next('label').css({'color': 'white', 'background': '#C7C8CC'});
  730.             }   
  731.                  
  732.                        
  733.                 },
  734.                 error: function(xhr, status, error) {
  735.                     // Gérez les erreurs ici
  736.                     console.error(error);
  737.                 }
  738.             });
  739.             }
  740.     }
  741.    
  742. });
  743.  
  744.  
  745.  var radioButtons = document.getElementsByName('radioGroup');
  746. for (var i = 0; i < radioButtons.length; i++) {
  747.     if (radioButtons[i].checked) {
  748.         var selectedValue = radioButtons[i].value;
  749.         break;
  750.     }
  751. }
  752. console.log(selectedValue); // Vous pouvez utiliser la valeur comme vous le souhaitez ici
  753.     });
  754.    
  755.  
  756.  
  757. </script>
  758.  
  759. {% endblock %}