src/Flexy/FrontBundle/templates/_javascripts.html.twig line 1

Open in your IDE?
  1.         <!-- jQuery-V1.12.4 -->
  2.         <script src="{{asset('bundles/flexyfront/assets/js/vendor/jquery-1.12.4.min.js')}}"></script>
  3.         <!-- Popper js -->
  4.         <script src="{{asset('bundles/flexyfront/assets/js/vendor/popper.min.js')}}"></script>
  5.         <!-- Bootstrap V4.1.3 Fremwork js -->
  6.         <script src="{{asset('bundles/flexyfront/assets/js/bootstrap.min.js')}}"></script>
  7.         <!-- Ajax Mail js -->
  8.         <script src="{{asset('bundles/flexyfront/assets/js/ajax-mail.js')}}"></script>
  9.         <!-- Meanmenu js -->
  10.         <script src="{{asset('bundles/flexyfront/assets/js/jquery.meanmenu.min.js')}}"></script>
  11.         <!-- Wow.min js -->
  12.         <script src="{{asset('bundles/flexyfront/assets/js/wow.min.js')}}"></script>
  13.         <!-- Slick Carousel js -->
  14.         <script src="{{asset('bundles/flexyfront/assets/js/slick.min.js')}}"></script>
  15.         <!-- Owl Carousel-2 js -->
  16.         <script src="{{asset('bundles/flexyfront/assets/js/owl.carousel.min.js')}}"></script>
  17.         <!-- Magnific popup js -->
  18.         <script src="{{asset('bundles/flexyfront/assets/js/jquery.magnific-popup.min.js')}}"></script>
  19.         <!-- Isotope js -->
  20.         <script src="{{asset('bundles/flexyfront/assets/js/isotope.pkgd.min.js')}}"></script>
  21.         <!-- Imagesloaded js -->
  22.         <script src="{{asset('bundles/flexyfront/assets/js/imagesloaded.pkgd.min.js')}}"></script>
  23.         <!-- Mixitup js -->
  24.         <script src="{{asset('bundles/flexyfront/assets/js/jquery.mixitup.min.js')}}"></script>
  25.         <!-- Countdown -->
  26.         <script src="{{asset('bundles/flexyfront/assets/js/jquery.countdown.min.js')}}"></script>
  27.         <!-- Counterup -->
  28.         <script src="{{asset('bundles/flexyfront/assets/js/jquery.counterup.min.js')}}"></script>
  29.         <!-- Waypoints -->
  30.         <script src="{{asset('bundles/flexyfront/assets/js/waypoints.min.js')}}"></script>
  31.         <!-- Barrating -->
  32.         <script src="{{asset('bundles/flexyfront/assets/js/jquery.barrating.min.js')}}"></script>
  33.         <!-- Jquery-ui -->
  34.         <script src="{{asset('bundles/flexyfront/assets/js/jquery-ui.min.js')}}"></script>
  35.         <!-- Venobox -->
  36.         <script src="{{asset('bundles/flexyfront/assets/js/venobox.min.js')}}"></script>
  37.         <!-- Nice Select js -->
  38.         <script src="{{asset('bundles/flexyfront/assets/js/jquery.nice-select.min.js')}}"></script>
  39.         <!-- ScrollUp js -->
  40.         <script src="{{asset('bundles/flexyfront/assets/js/scrollUp.min.js')}}"></script>
  41.         <script src="{{asset('bundles/flexyfront/assets/js/price-range/price_range_script.js')}}" type="text/javascript"></script>
  42.         <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
  43.         <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
  44.         <!-- LocalStorage cart -->
  45.         <script src="{{asset('flexy/js/cart-localstorage.js')}}" defer></script>
  46.         <!-- Main/Activator js -->
  47.         <script src="{{asset('bundles/flexyfront/assets/js/main.js')}}"></script>
  48.   
  49.         <script src="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.4.2/chosen.jquery.js"></script>
  50.         <script>
  51.             $(document).ready(function(){
  52.                           $(".searchBrand").chosen({no_results_text: "Oops, Aucun resultat!"});        
  53.                            
  54.                       $('.chosen-single').on('click', function() {
  55.                                 $('.chosen-single span').text('Choisir une marque ...');
  56.                             }); 
  57.                           
  58.                             $(".sidebar-categores-box input[type='checkbox']").change(function(){
  59.                                 $(".form-filter-sidebar").submit();
  60.                             });
  61.                             $.extend($.validator.messages, {
  62.                                 required: "Ce champs est obligatoire",
  63.                             });
  64.                            
  65.                // $("a").not(".menu-item a,.li-product-menu a").attr("href","#");// Disable Links temporary
  66.                 $(".menu_level_1").hide();
  67.                 $(".menu-item").hover(function(){
  68.                     $(this).find(".menu_level_1").show();
  69.                 },
  70.                 function(){
  71.                     $(this).find(".menu_level_1").hide();
  72.                 });
  73.             });
  74.         </script>
  75. <script>
  76. $(document).ready(function(){
  77.     var frais=0;
  78.     $(".livraison-service").hide();
  79. function renderCart(items) {
  80.       
  81.       const $cart = document.querySelector(".cart")
  82.       const $total = document.querySelector(".total")
  83.       const $weight = document.querySelector(".weight")
  84.         const $cartCheckout = document.querySelector(".cart-checkout")
  85.         const $totalCheckout = document.querySelector(" .total-checkout")
  86.         const $totalWeight = document.querySelector(" .weight-total")
  87.         const $couponCode = document.querySelector(" .coupon_valeur")
  88.         const $cartDevis = document.querySelector(".cart-devis")
  89.         const $totalDevis = document.querySelector(" .total-devis")
  90.                                             
  91.     const $miniCart = document.querySelector(".minicart-product-list");
  92.     const $miniCartTotal = document.querySelector(".minicart-total span");
  93.     const $singleProductArea = document.querySelector(".single-product-area");
  94.         
  95.         
  96.             var prefixUrl = "{{urlSite}}";
  97.   $miniCart.innerHTML = items.map((item) => `
  98.                                                         <li data-id="${item.id}">
  99.                                                         <a href="${item.url}" class="minicart-product-image">
  100.                                                             <img src="`+prefixUrl+`${item.image}" alt="cart products">
  101.                                                         </a>
  102.                                                         <div class="minicart-product-details">
  103.                                                             <h6><a href="#">${item.name}</a></h6>
  104.                                                             <span> ${item.quantity} x ${item.price} MAD</span>
  105.                                                         </div>
  106.                                                         <button data-id="${item.id}" class="close delete-product-from-cart " title="Supprimer">
  107.                                                             <i class="fa fa-close"></i>
  108.                                                         </button>
  109.                                                     </li>
  110. `).join("");
  111.   $miniCartTotal.innerHTML =  cartLS.total() + "MAD";
  112.  
  113.   $("#orderItems").val(cartLS.list());
  114. /*
  115.   const $cart = document.querySelector(".cart")
  116.   const $total = document.querySelector(".total")
  117.   $cart.innerHTML = items.map((item) => `
  118.       <tr data-id="${item.id}">
  119.         <td>${item.name}</td>
  120.         <td style="width: 60px;"> 
  121.           <button data-id="${item.id}" type="button" class="btn   btn-block btn-sm  decrease-quantite-to-cart"
  122.             ><i class="fas fa-minus"></i></button>
  123.         </td>
  124.         <td style="width: 60px;"> 
  125.           <button data-id="${item.id}" type="button" class="btn   btn-block btn-sm  increase-quantite-to-cart"
  126.             ><i class="fas fa-plus"></i></button>
  127.         </td>
  128.         <td style="white-space:nowrap;" class="text-right">${item.quantity} x ${item.price} MAD</td>
  129.         <td  class="text-right">${item.price * item.quantity}  MAD</td>
  130.         <td class="text-right"><Button data-id="${item.id}" class="btn btn-danger  delete-product-from-cart" ><i class="fas fa-trash-alt"></i></Button></td>
  131.       </tr>`).join("");
  132.   $total.innerHTML =  cartLS.total() + "MAD";
  133. */
  134. if($cart){
  135.     var check=false;
  136.     var valeur_coupon= 0;
  137. var result = items.filter(function (o1) {
  138.     return items.some(function (o2) {
  139.         if (o1.vendor != o2.vendor){
  140.             check=true
  141.         }
  142.    });
  143. });
  144. valeur_coupon = $("#coupon_valeur").val();
  145. //alert($("#coupon_valeur").val());
  146. localStorage.setItem("valueCoupon", valeur_coupon);
  147.  $cart.innerHTML = items.map((item) => `
  148.                                             <tr data-id="${item.id}" >
  149.                                                 <td data-id="${item.id}" class="li-product-remove delete-product-from-cart"><a onclick="return false;" href="#"><i class="fa fa-times"></i></a></td>
  150.                                                 <td class="li-product-thumbnail"><a href="#"><img height="50" src="../../${item.image}" alt="${item.name}"></a></td>
  151.                                                 <td class="li-product-name"><a href="#">${item.name}</a></td>
  152.                                                 <td class="li-product-price">
  153.                                                     <span class="amount">  MAD ${item.price} <br> 
  154.                                                     ${valeur_coupon ? "MAD "+ -valeur_coupon+"<br><p style='color: green;font-size: 8px;font-weight: bold;'>Réduction coupon</p>" :''}  </span>
  155.                                                  
  156.                                                 </td>
  157.                                                 <td class="quantity">
  158.                                                     <label>Quantité</label>
  159.                                                     <div class="cart-plus-minus">
  160.                                                         <input class="cart-plus-minus-box" value="${item.quantity}" type="text">
  161.                                                         <div data-id="${item.id}" class="dec qtybutton decrease-quantite-to-cart"><i class="fa fa-angle-down"></i></div>
  162.                                                         <div data-id="${item.id}" class="inc qtybutton increase-quantite-to-cart"><i class="fa fa-angle-up"></i></div>
  163.                                                     </div>
  164.                                                 </td>
  165.                                                 <td class="product-subtotal"><span class="amount">MAD ${(item.price * item.quantity) - valeur_coupon} </span></td>
  166.                                             </tr>
  167. `).join("");
  168. var weightTotal = 0;
  169. var limited = 0;
  170. var collecte_adresse = "";
  171. var type_product="";
  172. var vendor="";
  173. cartLS.list().forEach(function(item){
  174.      if( !isNaN(parseFloat(item.weight))){
  175.     weightTotal = weightTotal + parseFloat(item.weight) * item.quantity;
  176.     limited = parseFloat(item.limitedamount)
  177.     collecte_adresse +=item.collecte+" / " ;
  178.       }
  179.       if(item.type == "offer") {
  180.         $(".livraison-vendor").hide();
  181.         $(".livraison-chronodyali").hide();
  182.         frais=0;
  183.          // alert("contient");
  184.          vendor +=item.vendor+",";
  185.          console.log(vendor);
  186.            $("#vendeur").val(vendor);
  187.           }
  188.          
  189.           
  190. });
  191.  var data = collecte_adresse.slice(0,-3);
  192.   var arr =  $.unique(data.split(' / '));
  193.  data = arr.join("|"); //get unique string back with 
  194.  $("#adressColletes").val(data);
  195. $total.innerHTML =  (cartLS.total() - valeur_coupon) + "MAD";
  196.  $(".weight").text(weightTotal.toFixed(2) + " KG");
  197.  if(check== true){
  198.  $(".check").text("Attention vous achetez dans des boutiques différentes");
  199.  }else{
  200. $(".check").text("");
  201. }
  202. }
  203. if($cartDevis){
  204.  $cartDevis.innerHTML = items.map((item) => `
  205.   <tr>
  206.                             <td data-id="${item.id}" class="no">${item.id}</td>
  207.                             <td class="text-left">
  208.                             <p>
  209.                                ${item.name}
  210.                             </p>
  211.                             </td>
  212.                             <td class="unit"> ${item.price} MAD</td>
  213.                             <td class="qty">${item.quantity} </td>
  214.                             <td class="total">${item.price * item.quantity} MAD</td>
  215.                         </tr>
  216.                                            
  217. `).join("");
  218. $totalDevis.innerHTML =  cartLS.total() + "MAD";
  219. }
  220. if($cartCheckout){
  221.  
  222. var check=false;
  223. console.log("coupon" + localStorage.getItem("valueCoupon"));
  224. valeur_coupon = localStorage.getItem("valueCoupon");
  225.  
  226. var result = items.filter(function (o1) {
  227.     return items.some(function (o2) {
  228.         if (o1.vendor != o2.vendor){
  229.             check=true
  230.         }
  231.        
  232.    });
  233. });
  234.  
  235.  
  236.  $cartCheckout.innerHTML = items.map((item) => `
  237.                                               <tr class="cart_item">
  238.                                               <td class="cart-product-name"> ${item.name}    <strong class="product-quantity"> × ${item.quantity}</strong></td>
  239.                                               <td class="cart-product-total"><span class="amount">${item.price * item.quantity} MAD</span></td> 
  240.                                            <td style="display:none;"> ${item.vendor} ${item.limitedamount} </td>
  241.                                            <td style="display:none;"> ${item.weight * item.quantity } </td>
  242.                                             </tr>
  243.                                           
  244. `).join("");
  245. $totalCheckout.innerHTML =  cartLS.total() + "MAD";
  246. $totalWeight.innerHTML =  cartLS.total() + "KG";
  247.  
  248. }
  249. var weightTotal = 0;
  250. var limited = 0;
  251. var collecte_adresse = "";
  252.  
  253. cartLS.list().forEach(function(item){
  254.     if( !isNaN(parseFloat(item.weight))){
  255.     weightTotal = weightTotal + parseFloat(item.weight) * item.quantity;
  256.     }
  257.     limited = parseFloat(item.limitedamount)
  258.      collecte_adresse +=item.collecte+" / " ;
  259.   
  260. });
  261.  var data = collecte_adresse.slice(0,-3);
  262.   var arr =  $.unique(data.split(' / '));
  263.  data = arr.join("|"); //get unique string back with 
  264.  $("#adressColletes").val(data);
  265.   
  266. //alert(limited);
  267.  var value = weightTotal.toFixed(2) ;
  268.  var a = 'chronodyali'; 
  269.       
  270. //alert($("#city option:selected").text());
  271.   var ville="Casablanca-Settat";
  272.  $('select').on('change', function() {
  273.   ville =this.value;
  274.   //$("#city option:selected" ).text(this.value);
  275. });
  276.      {% if transport is defined %}
  277.   
  278.   {% for singletransport in transport %}
  279.      if(ville == "Casablanca-Settat"){
  280.      {% if(singletransport.intra == true)  %}
  281.                                                     
  282.               if(({{singletransport.minPoids}} <= value) && ({{singletransport.maxPoids}} >= value)){
  283.              frais={{singletransport.priceIntra}} + {{singletransport.collecte}};
  284.              $(".check-poids").text("");
  285.              $("input[type=radio][value=" + a + "]").attr("disabled",false);
  286.              }else if(value > 15 ){
  287.                  
  288.               $(".check-poids").text("Nous avez depassé 15 Kg dans votre commande vous pouvez pas etre livré pas Chronodyal " );
  289.               $("input[type=radio][value=" + a + "]").attr("disabled",true);
  290.                 } 
  291.        {% endif %}  
  292.             }else{
  293.  {% if(singletransport.inter == true)  %}
  294.                                          
  295.               if(({{singletransport.minPoids}} <= value) && ({{singletransport.maxPoids}} >= value)){
  296.               frais={{singletransport.priceInter}} + {{singletransport.collecte}};
  297.               $(".check-poids").text("");
  298.                $("input[type=radio][value=" + a + "]").attr("disabled",false);
  299.                
  300.       }else if(value > 15 ){
  301.              $(".check-poids").text("Nous avons dépassé 15 Kg dans votre commande vous pouvez pas être livré par Chronodyali " );
  302.                   
  303.               $(".check-poids").text("Nous avez depassé 15 Kg dans votre commande vous pouvez pas etre livré pas Chronodyal " );
  304.               $("input[type=radio][value=" + a + "]").attr("disabled",true);
  305.                 } 
  306.        {% endif %} 
  307.                  }
  308.       {% endfor %}
  309.        
  310.       
  311.      
  312.     {% endif %}  
  313.    
  314.  
  315.  
  316.  if(check== true){
  317.  $(".check-vendor").text("Attention vous achetez dans des boutiques différentes");
  318.  $(".limited-vendor").text("");
  319.  $(".livraison-vendor").hide();
  320.  $(".livraison-chronodyali").show();
  321.  frais=frais*2;
  322.  }else{
  323.      
  324.  $(".check-vendor").text("");
  325.  if( !isNaN(limited)  ){
  326.  $(".limited-vendor").text("Livraison gratuite à partir de " +limited+ " MAD chez ce fournisseur" );
  327.  
  328.  
  329.   
  330.   if(cartLS.total() >= limited){
  331.        $(".livraison-chronodyali").hide();
  332.       
  333.        $(".price-Line-through").text(frais.toFixed(2) +" MAD");
  334.        
  335.        frais=0;
  336.    }else {
  337.        $(".price-Line-through").text("");
  338.        }
  339.    
  340.  }
  341.  $(".livraison-vendor").show();
  342. }
  343. /* test sur existance des produits de type offre ca veux dire sur les services*/
  344. var  type=false
  345. var vendor="";
  346. cartLS.list().forEach(function(item){
  347.            
  348.      if(item.type == "offer") {
  349.          frais=0;
  350.         $(".livraison-vendor").hide();
  351.         $(".livraison-chronodyali").hide();
  352.          $(".livraison-service").show();
  353.         $(".limited-vendor").hide();
  354.         $(".card").hide();
  355.           //alert("contient");
  356.           vendor +=item.vendor+",";
  357.            console.log(vendor);  
  358.           $("#vendeur").val(vendor);
  359.           }
  360.            var result = items.filter(function (o1) { 
  361.             return items.some(function (o2) {
  362.                 if (o1.type != o2.type){
  363.                     //alert("type diff");
  364.                    
  365.                      $('.livraison-erreur').text("Oops ! On peux pas effectuez les achats des produits et des services au même temps");
  366.                      $('.order-button-payment').hide();
  367.                     
  368.                      
  369.                 } 
  370.               });
  371.            });     
  372.            
  373. });
  374. /*fin de test existance des produits de type offre  */
  375.  $(".hm-minicart-trigger .item-text span").text(cartLS.total() + " MAD");
  376.  $(".total-checkout").text((cartLS.total()+ frais - valeur_coupon) + " MAD");
  377.  if(valeur_coupon) { 
  378.  $(".value-coupon").text(-valeur_coupon + " MAD réduction coupon");
  379.  }else{
  380.     $(".value-coupon").text("");
  381.     }
  382.  $(".weight-total").text(weightTotal.toFixed(2) + " KG");
  383.  $(".weight-value").text(weightTotal.toFixed(2));
  384.  
  385.  
  386.  $("#weight").val(weightTotal.toFixed(2));
  387. console.log(cartLS.list());
  388.  $("#weight").val(weightTotal.toFixed(2));
  389.  $(".delivery-total").text(frais.toFixed(2)+ " MAD");
  390.  $("#frais_livraison").val(frais.toFixed(2));
  391.  $(".hm-minicart .cart-item-count").text(cartLS.list().length);
  392.  
  393.   
  394. }
  395. renderCart(cartLS.list());
  396. valeur_coupon = localStorage.getItem("valueCoupon");
  397.  $("#amount-to-pay").val(cartLS.total()+frais - valeur_coupon) ;
  398. cartLS.onChange(renderCart);
  399. $(".add-product-to-cart").click(function(){
  400. var id = $(this).attr("data-id");
  401. var name = $(this).attr("data-name");
  402. var price = $(this).attr("data-price");
  403. var image = $(this).attr("data-image");
  404. var url = $(this).attr("data-url");
  405. var vendor = $(this).attr("data-vendor");
  406. var weight = $(this).attr("data-weight");
  407. var limitedamount = $(this).attr("data-limitedamount");
  408. var collecte = $(this).attr("data-collecte"); 
  409. var type = $(this).attr("data-type"); 
  410. cartLS.add({
  411.   id: id, 
  412.   image:image,
  413.   name: name, 
  414.   price: price,
  415.   vendor:vendor,
  416.   weight:weight, 
  417.   limitedamount:limitedamount,
  418.   collecte:collecte,
  419.   type:type,
  420.   client:{
  421.       name:"Adil",
  422.       type:"Client Fidele",
  423.   }
  424. });
  425. cartLS.onChange(renderCart);
  426. console.log(cartLS.list());
  427. });
  428. $(".cart, .minicart-product-list,.Shopping-cart-area").on("click",".increase-quantite-to-cart",function(){
  429.     var id = $(this).attr("data-id");
  430.     cartLS.quantity(id, 1);
  431.     cartLS.onChange(renderCart);
  432. });
  433. $(".cart,.minicart-product-list,.Shopping-cart-area").on("click",".decrease-quantite-to-cart",function(){
  434.     var id = $(this).attr("data-id");
  435.     cartLS.quantity(id, -1);
  436.     cartLS.onChange(renderCart);
  437.    
  438. });
  439. $(".cart, .minicart-product-list,.Shopping-cart-area").on("click",".delete-product-from-cart",function(){
  440.     var id = $(this).attr("data-id");
  441.     cartLS.remove(id);
  442.     cartLS.onChange(renderCart);
  443.     if(cartLS.list().length == 0){
  444.         $(".checkout-area").html($(".cart-is-empty").html());
  445.     }
  446. });
  447. $(".destroy-cart").click(function(){
  448.     cartLS.destroy();
  449. });
  450. $("#cash").keyup(function(){
  451.     var total = cartLS.total();
  452.     var cash = $(this).val();
  453.     var difference = cash-total;
  454.     $(".difference-cash").html(difference+ " MAD");
  455. });
  456. });
  457.  
  458.  $(document).ready(function() {
  459.    
  460.  
  461.     $(".alert-success").fadeTo(2000, 500).slideUp(500, function() {
  462.      $(".alert-success").hide();
  463.     });
  464.   
  465. });
  466.     
  467. </script>