src/Flexy/FrontBundle/Themes/CoWorking/templates/reservation/reservation-meeting-next.html.twig line 1

  1. {% extends '@Flexy/FrontBundle/Themes/CoWorking/templates/layout.html.twig' %}
  2. {% block stylesheets %}
  3. {{ parent() }}
  4.  
  5.  <link rel="stylesheet" href="{{ asset('themes/coworking/css/reservation.css') }}" />
  6.  
  7. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.4.2/chosen.css" />
  8.  <style>
  9.  
  10.  .card{
  11.    box-shadow: rgba(17, 17, 26, 0.05) 0px 1px 0px, rgba(17, 17, 26, 0.1) 0px 0px 8px ;
  12. }
  13. .custom-tooltip .tooltip-inner {
  14.     background-color: #fff; /* Remplacez #ff0000 par la couleur de votre choix */
  15.     text-align: left;
  16.     color: #000; /* Couleur du texte à l'intérieur de l'info-bulle */
  17. }
  18. /* Tooltip */
  19. .tooltip {
  20.     background-color: #fff; /* Couleur de fond */
  21.     color: #fff; /* Couleur du texte */
  22.     border: 1px solid #fff; /* Bordure */
  23.     border-radius: 4px; /* Coins arrondis */
  24.     padding: 5px 10px; /* Espacement intérieur */
  25.     font-size: 13px; /* Taille de la police */
  26.     box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2); /* Ombre */
  27. }
  28. /* Tooltip - flèche */
  29. .tooltip .arrow::before {
  30.     border-top-color: #fff; /* Couleur de fond */
  31. }
  32. /* Tooltip - position */
  33. .tooltip.top {
  34.     margin-top: -3px; /* Positionnement par rapport à l'élément parent */
  35. }
  36.  .menu {
  37.   display: flex;
  38.   justify-content: space-around;
  39. }
  40. h5 {
  41.     color: #7b7b7b !important;
  42. }
  43. .category {
  44.   flex: 1;
  45.   margin: 0 10px;
  46.   border: 1px solid #ccc;
  47.   border-radius: 5px;
  48.   padding: 10px;
  49. }
  50. h2 {
  51.   font-size: 13px;
  52.   margin-bottom: 5px;
  53.   padding: 5px;
  54. }
  55. .menu .category ul {
  56.   list-style-type: none;
  57.   padding: 0;
  58. }
  59. .menu .category   li {
  60.   margin-bottom: 5px;
  61.  
  62.   font-size: 12px; /* Taille de police légèrement augmentée */
  63. }
  64. /* Style additionnel pour un meilleur aspect */
  65. .menu {
  66.   background-color: #f9f9f9;
  67.   padding: 20px;
  68.   border-radius: 10px;
  69. }
  70. .category {
  71.   background-color: #fff;
  72.   box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  73. }
  74. .list-group li {
  75.   font-size: 11px;
  76.     color: #333;
  77.  
  78. }
  79. /* Ajout de styles de survol pour un effet interactif */
  80. .list-group li:hover {
  81.   color: #FFCB00 !important; /* Changement de couleur au survol */
  82.   cursor: pointer; /* Curseur de la souris en pointeur */
  83. }
  84. /* Animation de survol */
  85. .list-group li:hover {
  86.   transform: scale(1.1); /* Agrandissement au survol */
  87.   transition: transform 0.2s ease; /* Transition fluide */
  88. }
  89. .form-control {
  90.     border-radius: 9px;
  91.      padding: 0px !important
  92. }
  93.   .form-check {
  94.  
  95.     min-height: 1.9rem !important;
  96.     }
  97.   .modal-backdrop.fade.show {
  98.         display: none;
  99. }
  100.  
  101.  
  102. /* css checkbox*/
  103. /* hide checkbox */
  104. input[type="checkbox"] {
  105.   display: none;
  106. }
  107. /* if checkbox is checked, then do these things */
  108. input[type="checkbox"]:checked + label {
  109.   color: white;
  110.   background:#FFD86E;
  111.   border-radius: 5px;
  112.   padding: 0px 10px 0px 10px;
  113. }
  114. /* styles when hovering over options */
  115. label:hover {
  116.   cursor: pointer;
  117.   
  118.   /* transitions and animations */
  119.   -webkit-transition: color .5s ease;
  120.   -moz-transition: color .5s ease;
  121.   -ms-transition: color .5s ease;
  122.   -o-transition: color .5s ease;
  123.   transition: color .5s ease;
  124. }
  125. .boutton-step{
  126.   padding:10px; 
  127.   text-decoration:none; 
  128.   width:230px; 
  129.    font-size: 12px;
  130.     font-family: 'PT Sans', sans-serif;
  131.     letter-spacing:2px;
  132. }
  133.   
  134. input.button {
  135.   
  136.     width:130px;
  137.     height:50px;
  138.     margin: 20px 0 30px 0;
  139.     padding: 0px 20px 0px 20px;
  140.     background: #e6e6e6;
  141.     border-radius:5px;
  142.     border: 1px solid #ccc;
  143.     font-family: OpenSans, sans-serif;
  144.     font-size:16pt;
  145.     color:#444;
  146. }
  147. .Addons label{
  148.     font-size:12px !important;
  149.     font-family: 'roboto';
  150.     font-weight: 500;
  151.     border: 1px solid #80808024;
  152.     margin: 2px;
  153.     padding: 0px 5px 0px 5px;
  154.     border-radius: 5px;
  155. }
  156. .multistep-container .active-button li:not(:first-child) .round-btn:before {
  157.     position: absolute;
  158.     content: '';
  159.     width: 141px;
  160.     height: 3px;
  161.     background-color: #E9F2FA;
  162.     left: -120px;
  163. }
  164. .multistep-container .active-button li {
  165.     display: inline-block;
  166.     width: 140px;
  167. }
  168. .form-check {
  169.     line-height: 22px;
  170. }   
  171. .col-md-12.col-lg-12.col-sm-12.d-flex.justify-content-end.align-items-end.mb-3{
  172.         flex: 0 0 86%;
  173. }
  174.  p.badge.badge-light {
  175.     background-color: black;
  176. }
  177.     
  178.      li.etape1:before {
  179.     background: #7ED670 !important; /* Change the background color */
  180.     color: white !important;
  181. }
  182.   .titre-page{
  183. margin-top:10px;
  184. font-size: 20px;
  185. line-height:45.29px;
  186. color: #000000;
  187. .radio-buttons {
  188.   display: flex;
  189. }
  190. .radio-buttons input[type="radio"] {
  191.   display: none;
  192. }
  193. .radio-buttons label {
  194.   display: block;
  195.   margin-right: 40px;
  196.   cursor: pointer;
  197. }
  198. .radio-buttons label img {
  199.   border-radius: 10px;
  200.   width: 100px;  
  201.   height: 110px;  
  202.   box-shadow: rgba(17, 17, 26, 0.05) 0px 1px 0px, rgba(17, 17, 26, 0.1) 0px 0px 8px;
  203. }
  204. .radio-buttons input[type="radio"]:checked + label img {
  205.   border: 2px solid #FFCB00 ; /* Style pour indiquer la sélection, vous pouvez personnaliser */
  206. }
  207.  
  208.   .form-select{
  209.     width: 100% !important;
  210.   }
  211.    .custom-radio {
  212.       padding-right: 20px; /* Ajoutez le padding ici */
  213.     }
  214.  
  215. </style>
  216.   
  217.   
  218. {% endblock  %}
  219. {% block body %}
  220.  
  221.  
  222.  
  223.  
  224.   <img src="{{asset('themes/coworking/front/images/sallereunion.jpg')}}" style="width: 100%;height: 520px;" class="img-fluid" />
  225.   <div class="container">
  226.     <div class="row justify-content-between">
  227.       <div class="col-sm-8 reservation-steeps">
  228.        
  229.        <div class="row">
  230.           <div class="col-sm-8">
  231.             <h6 class="titre-page">Réservation 
  232.                 
  233.             </h6>
  234.           </div>
  235.           <div class="col-sm-4" style="margin-top:10px;">
  236.             <a href="/themes/coworking/front/images/prixSalles.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>
  237.           </div>
  238.         </div>
  239.        
  240.        
  241.         <div class="container">
  242.          
  243.               
  244.                    
  245.   <div class="container d-flex justify-content-center align-items-center">
  246.          
  247.          
  248.           <ul id="progressbar">
  249.          <li class="etape1"> <span> Type</span>  </li>
  250.         <li class="active" > Formule + extra </li>
  251.         <li> Dates</li>
  252.         <li> Confirmation</li>
  253.            
  254.           
  255.                 </ul>
  256.         </div>
  257.             
  258.             <div class="col-xl-12" style="top: 20px;">
  259.               
  260.               <div class="multistep-container">
  261.                 <div class="mutistep-form-area">
  262.                     
  263.                  
  264.                   <div class="form-box">
  265.                 
  266.                     
  267.                  
  268.                        
  269.                             <div class="container" >
  270.                   
  271.               
  272.                
  273.                  <div id="form-attribue" style="line-height: 20px;" class="mt-4"> 
  274.              
  275.           <div class="form-check">
  276.         <input class="form-check-input" type="radio" name="choix" id="repas_demande" value="repas">
  277.         <label class="form-check-label" for="repas_demande">
  278.          <h5 style="font-weight:bold; margin-top: 2px;" >Voulez-vous choisir un extra ?</h5>
  279.          
  280.         </label>
  281.       </div>
  282.    <div class="container">
  283.   <div class="row">
  284.       <div class="col-md-4">
  285.          
  286.       <div class="card">
  287.           {% for break in breakfast %}
  288.          {%if break.photo is not empty %}
  289.         <img style="widh:100%"  src="{{asset('/uploads/coworking/' ~ break.photo )}}" class="card-img-top" alt="Breakfast Image">
  290.             {% endif %}
  291.                  {% endfor %}
  292.                 <div  >
  293.        
  294.           <ul class="list-group">
  295.             {% for break in breakfast %}
  296.             <li class="list-group-item" data-placement="top" data-toggle="tooltip" title="<b>{{ break.type }}</b><br>{{ break.description|raw|nl2br }}"> {{ break.name }}</li>
  297.              {% endfor %}
  298.           </ul>
  299.         </div>
  300.       </div>
  301.     </div>
  302.     <div class="col-md-4">
  303.        <div class="card">
  304.              {% for lun in lunch %}
  305.          {%if lun.photo is not empty %}
  306.         <img style="widh:100%" src="{{asset('/uploads/coworking/' ~ lun.photo )}}" class="card-img-top" alt="Lunch Image">
  307.          {% endif %}
  308.                  {% endfor %}
  309.  
  310.           <ul class="list-group">
  311.             {% for lun in lunch %}
  312.             <li class="list-group-item" data-placement="top" data-toggle="tooltip" title="<b>{{ lun.type }}</b><br> {{lun.description|raw|nl2br}}">{{ lun.name }}</li>
  313.             {% endfor %}
  314.           </ul>
  315.        
  316.       </div>
  317.     </div>
  318.      
  319.     <div class="col-md-4">
  320.       <div class="card">
  321.            {% for after in afternoonBreak %}
  322.          {%if after.photo is not empty %}
  323.           <img style="widh:100%" src="{{asset('/uploads/coworking/' ~ after.photo )}}" class="card-img-top" alt="Lunch Image">
  324.          {% endif %}
  325.                  {% endfor %}
  326.         <ul class="list-group">
  327.           {% for after in afternoonBreak %}
  328.           <li class="list-group-item" data-placement="top" data-toggle="tooltip" title="<b>{{ after.type }}</b> <br> {{ after.description|raw|nl2br }}">{{ after.name }}</li>
  329.           {% endfor %}
  330.         </ul>
  331.       </div>
  332.     </div>
  333.   </div>
  334. </div>
  335.           
  336.         
  337.     <div class="form-group" style="margin-top: 10px;">
  338.      
  339.         <div id="repas" style="padding: 0 20px !important;">
  340.            <div class="row">
  341.            <div class="col-md-6">
  342.                 <div class="form-group">
  343.                     <label for="select_repas_matin">Pause matin</label>
  344.                     <select class="form-select" id="select_repas_matin" name="select_repas_matin" disabled>
  345.                         <option value="">Choisissez un repas pour le matin</option>
  346.                        {% for break in  breakfast %}
  347.                         <option data-id="{{break.id}}"  value="{{break.price}}">{{break.name}} ({{break.price}} DH)</option>
  348.                         
  349.                         {% endfor  %}
  350.                     </select>
  351.                 </div>
  352.             </div>
  353.             <div class="col-md-6">
  354.                 <div class="form-group" id="quantity_input" style="display: none;">
  355.                     <label for="quantity"><small>Quantité </small></label>
  356.                     <input type="number" class="form-control" id="quantity" name="quantity" min="0" style="width: 50px;">
  357.                 </div>
  358.                 <div id="total_price" style="display: none;">
  359.                    <span class="badge badge-light">Total : <span id="total_amount" class="total-amount"></span> DH</span> 
  360.                 </div>
  361.             </div>
  362.         </div>
  363.       
  364.       <div class="row">
  365.            <div class="col-md-6">
  366.       <div class="form-group">
  367.         <label for="select_repas_dejeuner"> Déjeuner </label>
  368.         <select class="form-select" id="select_repas_dejeuner" name="select_repas_dejeuner" disabled>
  369.              <option value="">Choisissez un repas pour le déjeuner </option>
  370.             {% for lun in  lunch %}
  371.             <option data-id="{{lun.id}}" value="{{lun.price}}">{{lun.name}} ({{lun.price}} DH)</option>
  372.             {% endfor  %}
  373.         </select>
  374.       </div>
  375.         </div>
  376.          <div class="col-md-6">
  377.                 <div class="form-group" id="quantity_dejeune" style="display: none;" >
  378.                     <label for="quantity"><small>Quantité </small></label>
  379.                     <input type="number" class="form-control" id="quantity_input_dejeuner" name="quantity_input_dejeuner" min="0" style="width: 50px;">
  380.                 </div>
  381.                 <div id="total_price_dejeune" style="display: none;">
  382.                    <span class="badge badge-light">Total : <span id="total_amount_dejeune" class="total-amount"></span> DH</span> 
  383.                 </div>
  384.                 
  385.             </div>
  386.         </div>
  387.         
  388.       
  389.       <div class="row">
  390.            <div class="col-md-6">
  391.       <div class="form-group">
  392.         <label for="select_repas_apres_midi">  Pause après-midi  </label>
  393.         <select class="form-select" id="select_repas_apres_midi" name="select_repas_apres_midi" disabled>
  394.             <option value="">Choisissez un repas pour la pause après-midi </option>
  395.              {% for after in  afternoonBreak %}
  396.             <option data-id="{{after.id}}" value="{{after.price}}">{{after.name}} ({{after.price}} DH)</option>
  397.             {% endfor  %}
  398.         </select>
  399.       </div>
  400.       </div>
  401.  <div class="col-md-6">
  402.                 <div class="form-group" id="quantity_input_apres" style="display: none;" >
  403.                     <label for="quantity"><small>Quantité</small></label>
  404.                     <input type="number" class="form-control" id="quantity_apres" name="quantity_apres" min="0" style="width: 50px;">
  405.                 </div>
  406.                 <div id="total_price_apres" style="display: none;">
  407.                    <span class="badge badge-light">Total : <span id="total_amount_apres" class="total-amount"></span> DH</span> 
  408.                 </div>
  409.                 
  410.             </div>
  411. <div class="col-md-6">
  412.    
  413. </div>
  414. <div id="total_sum_section"  class="col-md-6">
  415.     <p class="badge badge-light">Total : <span id="total_sum"></span> DH</p>
  416. </div>
  417.         
  418.         </div>
  419.  
  420.       </div>
  421.       <div class="form-check mt-4">
  422.         <input class="form-check-input" type="radio" name="choix"  value="demande">
  423.         <label class="form-check-label" for="repas_demande">
  424.          <h5 style="font-weight:bold; " >Non merci </h5>
  425.         </label>
  426.       </div>
  427.         
  428.     </div>
  429.  
  430.     
  431.   
  432.   </form>
  433.                    
  434.  
  435.                   
  436.                   </div>
  437.               
  438.                                
  439.                     
  440.               
  441.                  </div>
  442.                     <div class="button-row">
  443.         <form action="{{path('reservationstep2',{id:id})}}" id="myForm"   method="GET" data-turbo="false">          
  444.             <input type="hidden" name="days"  id="formule_" value="{{ days }}"/>
  445.               <input type="hidden" name="Plage"  id="horaire_" value="{{ Plage }}"/>
  446.               <input type="hidden" name="amount_extra"  id="amount_extra" value=""/>
  447.               <input type="hidden" name="id_extra"  id="id_extra" value=""/>
  448.               <input type="hidden" name="time"  id="time_" value="{{ time }}"/>
  449.               <input type="hidden" name="device"  id="device_" value="{{ device }}"/>
  450.               <input type="hidden" name="nbrApproximatif" id="nbrApproximatif" value="{{ nbrApproximatif }}"/>
  451.            
  452.             <a href="javascript:void(0)" onclick="history.back()" 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>
  453.             &nbsp;&nbsp;
  454.              <button type="submit" class="btn-res text-center text-light text-uppercase bg-dark ReserveNext__" style="background: #FFCB00 !important;padding:5px;    border: none; text-decoration:none; width:177px; font-size:12px; font-family:'PT Sans', sans-serif; letter-spacing:2px;">
  455.               Étape suivante
  456.                     </button>
  457.              </form>
  458.                       </div> 
  459.                             
  460.                             
  461.                            
  462.                      
  463.            
  464.                     
  465.                    
  466.                   </div>
  467.                    
  468.                 
  469.                 </div>
  470.               </div>
  471.             </div>
  472.           
  473.         </div>
  474.          
  475.       
  476.       </div>
  477.          <div class="col-sm-4 reservation-steeps-panier" style="overflow-y: auto;">
  478.       
  479.         {{render(path("ajax_cart"))}}
  480.     </div>
  481.     </div>
  482.   </div>
  483.   
  484.   
  485. {% endblock %}
  486. {% block javascripts %}
  487.   <!-- MAIN CONTENT -->
  488.  
  489. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  490. <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
  491. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
  492.  
  493.  
  494. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  495. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> 
  496.  
  497. <script>
  498.   $(document).ready(function(){
  499.       
  500.          $('#myForm').on('submit', function(event) {
  501.             if (!$('input[name="choix"]:checked').length) {
  502.                 alert('Veuillez sélectionner une option.');
  503.                 event.preventDefault();
  504.             }
  505.         });
  506.         
  507.   
  508.    $('[data-toggle="tooltip"]').tooltip({
  509.       placement: 'top', // Position de l'info-bulle
  510.       trigger: 'hover', // Déclencheur de l'info-bulle
  511.       delay: { "show": 500, "hide": 100 }, // Délai d'affichage et de masquage en millisecondes
  512.       html: true, // Autoriser le contenu HTML dans l'info-bulle
  513.       template: '<div class="tooltip custom-tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>' // Utilisation d'un modèle personnalisé pour l'info-bulle
  514.     });
  515. $('body').on("click",".delete-cart-item",function() {
  516.           
  517.     var idProduct = $(this).attr("data-id");
  518.     var price = $(this).attr("data-price");
  519.     var name = $(this).attr("data-name");
  520.     var actionType = "remove";
  521.     $.ajax({
  522.       url:"{{path('ajax_cart')}}",
  523.       data:{
  524.         idProduct:idProduct,
  525.         price:price,
  526.         name:name,
  527.         actionType:actionType
  528.       },
  529.       success:function(result){
  530.         console.log(result);
  531.           $(".reservation-steeps-panier").html(result);
  532.       }
  533.     });
  534.     });
  535.      // Fonction de mise à jour du prix total pour le repas du matin
  536.     $('#select_repas_matin, #quantity').change(function() {
  537.       if ($(this).val() === "0") {
  538.         $('#select_repas_matin').val(""); 
  539.     }
  540.         updateTotalPrice('#select_repas_matin', '#quantity', '#total_amount', '#total_price');
  541.         calculateTotalSum();
  542.         updateIdExtra(); // Mettre à jour l'ID extra
  543.     });
  544.     // Fonction de mise à jour du prix total pour le repas du déjeuner
  545.     $('#select_repas_dejeuner, #quantity_input_dejeuner').change(function() {
  546.       if ($(this).val() === "0") {
  547.         $('#select_repas_dejeuner').val(""); // Réinitialiser la sélection si la quantité est 0
  548.     }
  549.      updateTotalPrice('#select_repas_dejeuner', '#quantity_input_dejeuner', '#total_amount_dejeune', '#total_price_dejeune');
  550.         calculateTotalSum();
  551.         updateIdExtra(); // Mettre à jour l'ID extra
  552.     });
  553.     // Fonction de mise à jour du prix total pour la pause de l'après-midi
  554.     $('#select_repas_apres_midi, #quantity_apres').change(function() {
  555.         updateTotalPrice('#select_repas_apres_midi', '#quantity_apres', '#total_amount_apres', '#total_price_apres');
  556.         calculateTotalSum();
  557.          updateIdExtra(); // Mettre à jour l'ID extra
  558.     });
  559.     
  560. function updateIdExtra() {
  561.     var selectedIds = [];
  562.     $('#select_repas_dejeuner, #select_repas_matin , #select_repas_apres_midi').each(function() {
  563.         var selectedOption = $(this).find(':selected');
  564.         if (selectedOption.length > 0) {
  565.             var dataId = selectedOption.data('id');
  566.             selectedIds.push(dataId);
  567.         }
  568.     });
  569.     $('#id_extra').val(selectedIds.join(',')); // Mettre à jour la valeur de l'input caché avec les data-ids séparés par une virgule
  570. }
  571.  // Fonction de mise à jour du prix total
  572.     function updateTotalPrice(selectElement, quantityElement, totalAmountElement, totalPriceElement) {
  573.         var selectedOptionValue = parseInt($(selectElement).val());
  574.         var quantity = parseInt($(quantityElement).val());
  575.         if (!isNaN(selectedOptionValue) && !isNaN(quantity)) {
  576.             var totalPrice = selectedOptionValue * quantity;
  577.             $(totalAmountElement).text(totalPrice);
  578.             $(totalPriceElement).show();
  579.         } else {
  580.             $(totalPriceElement).hide();
  581.         }
  582.     }
  583.      // Fonction de calcul de la somme totale
  584.     function calculateTotalSum() {
  585.         var totalSum = 0;
  586.         $('.total-amount').each(function() {
  587.             var amount = parseInt($(this).text());
  588.             if (!isNaN(amount)) {
  589.                 totalSum += amount;
  590.             }
  591.         });
  592.         $('#total_sum').text(totalSum);
  593.         $('#amount_extra').val(totalSum);
  594.     }
  595.  // Écouter le changement de la sélection pour le repas du matin
  596.     $('#repas_demande').change(function() {
  597.         if ($(this).is(':checked')) {
  598.             $('#quantity_input').show();
  599.             $('#select_repas_matin').prop('disabled', false);
  600.         } else {
  601.             $('#quantity_input').hide();
  602.             $('#select_repas_matin').prop('disabled', true);
  603.             $('#total_price').hide();
  604.         }
  605.     });
  606.         // Écouter le changement de la sélection pour le déjeuner
  607.     $('#repas_demande').change(function() {
  608.         if ($(this).is(':checked')) {
  609.             $('#quantity_dejeune').show();
  610.             $('#select_repas_dejeuner').prop('disabled', false);
  611.         } else {
  612.             $('#quantity_input_dejeuner').hide();
  613.             $('#select_repas_dejeuner').prop('disabled', true);
  614.             $('#total_price_dejeune').hide();
  615.         }
  616.     });
  617.       // Écouter le changement de la sélection pour l'après-midi
  618.     $('#repas_demande').change(function() {
  619.         if ($(this).is(':checked')) {
  620.             $('#quantity_input_apres').show();
  621.             $('#select_repas_apres_midi').prop('disabled', false);
  622.         } else {
  623.             $('#quantity_input_apres').hide();
  624.             $('#select_repas_apres_midi').prop('disabled', true);
  625.             $('#total_price_apres').hide();
  626.         }
  627.     });
  628.  
  629.   
  630.      $('input[name="choix"]').change(function(){ 
  631.       if($(this).val() == "demande"){
  632.           
  633.            $('#select_repas_apres_midi').prop('selectedIndex', 0);
  634.            $('#select_repas_dejeuner').prop('selectedIndex', 0);
  635.            $('#select_repas_matin').prop('selectedIndex', 0);
  636.            $('#quantity').val(0);
  637.            $('#quantity_input_dejeuner').val(0);
  638.            $("#quantity_apres").val(0);
  639.             $("#total_amount").text(0);
  640.             $("#total_amount_dejeune").text(0);
  641.             $("#total_amount_apres").text(0);
  642.             $("#total_sum").text(0);
  643.             $("#amount_extra").val(0);
  644.            $("#select_repas_matin").prop('disabled', true);
  645.             $("#select_repas_dejeuner").prop('disabled', true);
  646.                 $("#select_repas_apres_midi").prop('disabled', true);  
  647.          
  648.       }else if($(this).val() == "non"){
  649.          
  650.         $('#select_repas_apres_midi').prop('selectedIndex', 0);
  651.         $('#select_repas_dejeuner').prop('selectedIndex', 0);
  652.         $('#select_repas_matin').prop('selectedIndex', 0);
  653.          $('#quantity').val(0);
  654.           $('#quantity_input_dejeuner').val(0);
  655.            $("#quantity_apres").val(0);
  656.            $("#total_amount").text(0);
  657.            $("#total_amount_dejeune").text(0);
  658.            $("#total_amount_apres").text(0);
  659.            $("#total_sum").text(0);
  660.            $("#amount_extra").val(0);
  661.         
  662.          $("#select_repas_matin").prop('disabled', true);
  663.          $("#select_repas_dejeuner").prop('disabled', true);
  664.          $("#select_repas_apres_midi").prop('disabled', true); 
  665.       }else if($(this).val() == "repas"){
  666.           
  667.             $("#select_repas_matin").prop('disabled', false);
  668.                $("#select_repas_dejeuner").prop('disabled', false);
  669.                 $("#select_repas_apres_midi").prop('disabled', false);
  670.       }
  671.    
  672.         
  673.         });
  674.   /*$('input[name="repas"]').change(function(){
  675.  
  676.       
  677.     if($(this).val() === 'pause_matin') {
  678.       
  679.        // $("#select_repas_matin").val($('option:nth-child(1)').prop('selected', true));
  680.       $("#select_repas_matin").prop('disabled', false);
  681.       $("#select_repas_dejeuner").prop('disabled', true);
  682.        $("#select_repas_apres_midi").prop('disabled', true);
  683.       
  684.       
  685.     } else if($(this).val() == 'dejeuner') {
  686.       
  687.        // $("#select_repas_dejeuner").val($('option:nth-child(1)').prop('selected', true));
  688.         
  689.          $("#select_repas_dejeuner").prop('disabled', false);
  690.           $("#select_repas_matin").prop('disabled', true);
  691.           $("#select_repas_apres_midi").prop('disabled', true);
  692.       
  693.     } else if($(this).val() == 'pause_apres_midi') {
  694.        // $("#select_repas_apres_midi").val($('option:nth-child(1)').prop('selected', true));
  695.           
  696.       $("#select_repas_apres_midi").prop('disabled', false);
  697.          $("#select_repas_dejeuner").prop('disabled', true);
  698.           $("#select_repas_matin").prop('disabled', true);
  699.          
  700.     }
  701.   });*/
  702.   
  703.   function updateSession() {
  704.         let meals = {
  705.             breakfast: {
  706.                 name: $("#select_repas_matin option:selected").text(),
  707.                 price: $("#select_repas_matin").val(),
  708.                 quantity: $("#quantity").val() || 0
  709.             },
  710.             lunch: {
  711.                 name: $("#select_repas_dejeuner option:selected").text(),
  712.                 price: $("#select_repas_dejeuner").val(),
  713.                 quantity: $("#quantity_input_dejeuner").val() || 0
  714.             },
  715.             afternoonBreak: {
  716.                 name: $("#select_repas_apres_midi option:selected").text(),
  717.                 price: $("#select_repas_apres_midi").val(),
  718.                 quantity: $("#quantity_apres").val() || 0
  719.             }
  720.         };
  721.         // Envoi des données à Symfony via AJAX
  722.         $.ajax({
  723.             url: "{{path('save_meals_session')}}",
  724.             type: "POST",
  725.             contentType: "application/json",
  726.             data: JSON.stringify(meals),
  727.             success: function (response) {
  728.                 console.log("Session updated", response);
  729.             },
  730.             error: function (xhr, status, error) {
  731.                 console.error("Error:", error);
  732.             }
  733.         });
  734.     }
  735.     // Écoute des changements sur les sélections de repas
  736.    
  737.     $("#select_repas_matin, #quantity, #select_repas_dejeuner, #quantity_input_dejeuner, #select_repas_apres_midi, #quantity_apres").on("change", updateSession);
  738.  
  739.     });
  740.  
  741. </script>
  742.  
  743. {% endblock %}