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