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

  1.         
  2.         {{ encore_entry_script_tags('frontend') }}
  3.         <!-- jQuery-V1.12.4 -->
  4.         <script src="{{asset('themes/ilaveu/js/vendor/jquery-1.12.4.min.js')}}"></script>
  5.         <!-- Popper js -->
  6.         <script src="{{asset('themes/ilaveu/js/vendor/popper.min.js')}}"></script>
  7.         <!-- Bootstrap V4.1.3 Fremwork js -->
  8.         <script src="{{asset('themes/ilaveu/js/bootstrap.min.js')}}"></script>
  9.         <!-- Ajax Mail js -->
  10.         <script src="{{asset('themes/ilaveu/js/ajax-mail.js')}}"></script>
  11.         <!-- Meanmenu js -->
  12.         <script src="{{asset('themes/ilaveu/js/jquery.meanmenu.min.js')}}"></script>
  13.         <!-- Wow.min js -->
  14.         <script src="{{asset('themes/ilaveu/js/wow.min.js')}}"></script>
  15.         <!-- Slick Carousel js -->
  16.         <script src="{{asset('themes/ilaveu/js/slick.min.js')}}"></script>
  17.         <!-- Owl Carousel-2 js -->
  18.         <script src="{{asset('themes/ilaveu/js/owl.carousel.min.js')}}"></script>
  19.         <!-- Magnific popup js -->
  20.         <script src="{{asset('themes/ilaveu/js/jquery.magnific-popup.min.js')}}"></script>
  21.         <!-- Isotope js -->
  22.         <script src="{{asset('themes/ilaveu/js/isotope.pkgd.min.js')}}"></script>
  23.         <!-- Imagesloaded js -->
  24.         <script src="{{asset('themes/ilaveu/js/imagesloaded.pkgd.min.js')}}"></script>
  25.         <!-- Mixitup js -->
  26.         <script src="{{asset('themes/ilaveu/js/jquery.mixitup.min.js')}}"></script>
  27.         <!-- Countdown -->
  28.         <script src="{{asset('themes/ilaveu/js/jquery.countdown.min.js')}}"></script>
  29.         <!-- Counterup -->
  30.         <script src="{{asset('themes/ilaveu/js/jquery.counterup.min.js')}}"></script>
  31.         <!-- Waypoints -->
  32.         <script src="{{asset('themes/ilaveu/js/waypoints.min.js')}}"></script>
  33.         <!-- Barrating -->
  34.         <script src="{{asset('themes/ilaveu/js/jquery.barrating.min.js')}}"></script>
  35.         <!-- Jquery-ui -->
  36.         <script src="{{asset('themes/ilaveu/js/jquery-ui.min.js')}}"></script>
  37.         <!-- Venobox -->
  38.         <script src="{{asset('themes/ilaveu/js/venobox.min.js')}}"></script>
  39.         <!-- Nice Select js -->
  40.         <script src="{{asset('themes/ilaveu/js/jquery.nice-select.min.js')}}"></script>
  41.         
  42.         <script src="{{asset('themes/ilaveu/js/price-range/price_range_script.js')}}" type="text/javascript"></script>
  43.         <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
  44.         <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
  45.         <!-- LocalStorage cart -->
  46.         <script src="{{asset('flexy/js/cart-localstorage.js')}}" defer></script>
  47.         <!-- Main/Activator js -->
  48.    
  49.     
  50.     <script async src="{{asset('themes/ilaveu/laundry/js/bundle.js')}}"></script>
  51.         <script src="{{asset('themes/ilaveu/js/main.js')}}"></script>
  52.         <script>
  53.             document.addEventListener("turbo:load",function(){
  54.             
  55.             $(document).ready(function(){
  56.                 
  57.                             $(".sidebar-categores-box input[type='checkbox']").change(function(){
  58.                                 $(".form-filter-sidebar").submit();
  59.                             });
  60.                             $.extend($.validator.messages, {
  61.                                 required: "Ce champs est obligatoire",
  62.                             });
  63.                            
  64.                 //$("a").not(".menu-item a,.li-product-menu a").attr("href","#");// Disable Links temporary
  65.                
  66.             });
  67.             });
  68.         </script>
  69. <script>
  70.     var total= 0;
  71.     var difference= 0;
  72.     var amount=0;
  73.     var reduction=0;
  74.     var reductionCoupon=0;
  75.     var cash = 0;
  76.     var shippingFees = 0;
  77.     var shippingTips = 0
  78.     var walletPayment = 0;
  79. document.addEventListener("turbo:load",function(){
  80. $(document).ready(function(){
  81.     
  82.     difference= cartLS.total()+ shippingFees + shippingTips;
  83.     total= cartLS.total();
  84. function renderCart(items) {
  85.       const $cart = document.querySelector(".cart")
  86.       const $total = document.querySelector(".total")
  87.         const $cartCheckout = document.querySelector(".cart-checkout")
  88.         const $totalCheckout = document.querySelector(" .total-checkout")
  89.         const $cartDevis = document.querySelector(".cart-devis")
  90.         const $totalDevis = document.querySelector(" .total-devis")
  91.                                             
  92.     const $miniCart = document.querySelector(".minicart-product-list");
  93.     const $miniCartTotal = document.querySelector(".minicart-total span");
  94.     const $singleProductArea = document.querySelector(".single-product-area");
  95.         
  96.         
  97.             var prefixUrl = "{{settings.get.rootUrl}}";
  98.   $miniCart.innerHTML = items.map((item) => `
  99.                                                         <li data-id="${item.id}">
  100.                                                         <a href="${item.url}" class="minicart-product-image">
  101.                                                             <img src="${item.image}" alt="cart products">
  102.                                                         </a>
  103.                                                         <div class="minicart-product-details">
  104.                                                             <h6><a href="#">${item.name}</a></h6>
  105.                                                             <button data-id="${item.id}" type="button" class="btn   btn-block btn-sm  decrease-quantite-to-cart"
  106.             ><i class="fas fa-minus"></i></button>
  107.                                                             <span class="pl-3 pr-3" > ${item.quantity} x ${item.price} MAD</span>
  108.                                                             
  109.           
  110.         
  111.         
  112.           <button data-id="${item.id}" type="button" class="btn   btn-block btn-sm  increase-quantite-to-cart"
  113.             ><i class="fas fa-plus"></i></button>
  114.         
  115.                                                         </div>
  116.                                                         <button data-id="${item.id}" class="close delete-product-from-cart " title="Supprimer">
  117.                                                             <i class="fa fa-close"></i>
  118.                                                         </button>
  119.                                                     </li>
  120. `).join("");
  121.   $miniCartTotal.innerHTML =  cartLS.total() + " MAD";
  122. /*
  123.   const $cart = document.querySelector(".cart")
  124.   const $total = document.querySelector(".total")
  125.   $cart.innerHTML = items.map((item) => `
  126.       <tr data-id="${item.id}">
  127.         <td>${item.name}</td>
  128.         <td style="width: 60px;"> 
  129.           <button data-id="${item.id}" type="button" class="btn   btn-block btn-sm  decrease-quantite-to-cart"
  130.             ><i class="fas fa-minus"></i></button>
  131.         </td>
  132.         <td style="width: 60px;"> 
  133.           <button data-id="${item.id}" type="button" class="btn   btn-block btn-sm  increase-quantite-to-cart"
  134.             ><i class="fas fa-plus"></i></button>
  135.         </td>
  136.         <td style="white-space:nowrap;" class="text-right">${item.quantity} x ${item.price} MAD</td>
  137.         <td  class="text-right">${item.price * item.quantity}  MAD</td>
  138.         <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>
  139.       </tr>`).join("");
  140.   $total.innerHTML =  cartLS.total() + "MAD";
  141. */
  142. if($cart){
  143.  $cart.innerHTML = items.map((item) => `
  144.                                             <tr data-id="${item.id}" >
  145.                                                 <td data-id="${item.id}" class="li-product-remove delete-product-from-cart"><a onclick="return false;" href="#">x</a></td>
  146.                                                 <td class="li-product-thumbnail"><img height="50" src="../../${item.image}" alt="${item.name}"></td>
  147.                                                 <td class="li-product-name">${item.name}</td>
  148.                                                 <td class="li-product-price"><span class="amount">MAD ${item.price}</span></td>
  149.                                                 <td class="quantity">
  150.                                                     <label>Quantité</label>
  151.                                                     <div class="cart-plus-minus">
  152.                                                         <input readonly class="cart-plus-minus-box" value="${item.quantity}" type="text">
  153.                                                         <div data-id="${item.id}" class="dec qtybutton decrease-quantite-to-cart"><i class="fa fa-angle-down"></i></div>
  154.                                                         <div data-id="${item.id}" class="inc qtybutton increase-quantite-to-cart"><i class="fa fa-angle-up"></i></div>
  155.                                                     </div>
  156.                                                 </td>
  157.                                                 <td class="product-subtotal"><span class="amount">MAD ${item.price * item.quantity}</span></td>
  158.                                             </tr>
  159. `).join("");
  160. $total.innerHTML =  cartLS.total() + "MAD";
  161. }
  162. if($cartDevis){
  163.  $cartDevis.innerHTML = items.map((item) => `
  164.   <tr>
  165.                             <td data-id="${item.id}" class="no">${item.id}</td>
  166.                             <td class="text-left">
  167.                             <p>
  168.                                ${item.name}
  169.                             </p>
  170.                             </td>
  171.                             <td class="unit"> ${item.price} MAD</td>
  172.                             <td class="qty">${item.quantity} </td>
  173.                             <td class="total">${item.price * item.quantity} MAD</td>
  174.                         </tr>
  175.                                            
  176. `).join("");
  177. $totalDevis.innerHTML =  cartLS.total() + "MAD";
  178. }
  179. if($cartCheckout){
  180.  $cartCheckout.innerHTML = items.map((item) => `
  181.                                               <tr class="cart_item">
  182.                                               <td class="cart-product-name"> ${item.name}<strong class="product-quantity"> Ã— ${item.quantity}</strong></td>
  183.                                               <td class="cart-product-total"><span class="amount">${item.price * item.quantity} MAD</span></td>  
  184.                                             </tr>
  185. `).join("");
  186. $totalCheckout.innerHTML =  cartLS.total() + "MAD";
  187. }
  188.  $(".hm-minicart-trigger .item-text span").text(cartLS.total() + " MAD");
  189.  $(".total-checkout").text(cartLS.total() + " MAD");
  190. $(".hm-minicart .cart-item-count").text(cartLS.list().length);
  191.   
  192.                                             
  193. }
  194. renderCart(cartLS.list());
  195. cartLS.onChange(renderCart);
  196. $(".add-product-to-cart").click(function(){
  197. var id = "p-"+$(this).attr("data-id");
  198. var idProduct = $(this).attr("data-id");
  199. var name = $(this).attr("data-name");
  200. var price = $(this).attr("data-price");
  201. var image = $(this).attr("data-image");
  202. var productType = $(this).attr("data-product-type");
  203. var url = $(this).attr("data-url");
  204. var attributes = $(this).attr("data-attribute");
  205. var quantity = 1;
  206. if(attributes == "true"){
  207.     var quantityAttribut = $($(this).attr("data-container-id")).find("input[name='quantity-attribut']").val();
  208.     var dimensionAttribut = $($(this).attr("data-container-id")).find("input[name='dimension-attribut']").val();
  209.     var pricePerAttribut = $($(this).attr("data-container-id")).find("select[name='attribute-option-price'] option:selected").val();
  210.     
  211.     
  212.     var attributName = $($(this).attr("data-container-id")).find("select[name='attribute-option-price'] option:selected").text();
  213.     price = (parseFloat(pricePerAttribut) * parseFloat(dimensionAttribut) );
  214.     quantity = parseFloat(quantityAttribut);
  215.     var replacedStrDimensionAttribut = dimensionAttribut.replace(/,/g, "-");
  216.     id = "pv-" + $(this).attr("data-id")+replacedStrDimensionAttribut;
  217.     name = name + "("+dimensionAttribut+" "+  attributName +" )";
  218. }
  219. //To Review
  220.  if(productType == "pack"){
  221.     cartLS.destroy();
  222. cartLS.add({
  223.   id: id,
  224.   idProduct: idProduct,
  225.   image:image,
  226.   name: name, 
  227.   price: price,
  228.   productType:productType,
  229.   quantity:quantity,
  230.   notes:[
  231.     {
  232.     id:id,
  233.     noteId:1,
  234.     note:"",
  235.   }
  236.   ],
  237.   attributes:[],
  238.   client:{
  239.       name:"Adil",
  240.       type:"Client Fidele",
  241.   }
  242. });
  243. cartLS.onChange(renderCart);
  244. console.log(cartLS.list());
  245. if(cartLS.exists(id)){
  246. $("#qty-"+id).text(cartLS.get(id).quantity);
  247. }else{
  248.         $("#qty-"+id).text(0);
  249.     }
  250. });
  251. function updateCartNotes(id,updateMethod="add"){
  252.     var currentLigneCart =  cartLS.get(id);
  253.     
  254.         // this will be executed at the end of the loop
  255.             if(updateMethod=="add"){
  256.                     
  257.                         cartLS.quantity(id, 1);
  258.                         cartLS.onChange(renderCart);
  259.                 }
  260.                 else if(updateMethod=="remove") {
  261.                     
  262.                         cartLS.quantity(id, -1);
  263.                     
  264.                         cartLS.onChange(renderCart);
  265.                 }
  266.                 
  267.                 
  268.              
  269.             
  270.     
  271.     
  272.     
  273.     
  274.     
  275.    
  276.     
  277. }
  278. $("body").on("click",".increase-quantite-to-cart",function(){
  279.     console.log(cartLS.list());
  280.    var id = $(this).attr("data-id");
  281.     updateCartNotes(id,"add");
  282.     cartLS.onChange(renderCart);
  283.     if(cartLS.exists(id)){
  284.         $("#qty-"+id).text(cartLS.get(id).quantity);
  285.     }else{
  286.         $("#qty-"+id).text(0);
  287.     }
  288. });
  289. $("body").on("click",".decrease-quantite-to-cart",function(){
  290.     var id = $(this).attr("data-id");
  291.     
  292.     updateCartNotes(id,"remove");
  293.     cartLS.onChange(renderCart);
  294.     if(cartLS.exists(id)){
  295.         $("#qty-"+id).text(cartLS.get(id).quantity);
  296.     }else{
  297.         $("#qty-"+id).text(0);
  298.     }
  299.    
  300. });
  301. $(".decrease-product-from-cart").click(function(){
  302.     var id = $(this).attr("data-id");
  303.     cartLS.quantity(id, -1);
  304.     cartLS.onChange(renderCart);
  305.    
  306. });
  307. $(".cart, .minicart-product-list,.Shopping-cart-area").on("click",".delete-product-from-cart",function(){
  308.     var id = $(this).attr("data-id");
  309.     cartLS.remove(id);
  310.     cartLS.onChange(renderCart);
  311.     if(cartLS.list().length == 0){
  312.         $(".checkout-area").html($(".cart-is-empty").html());
  313.     }
  314. });
  315. $(".destroy-cart").click(function(){
  316.     cartLS.destroy();
  317. });
  318. $("#cash").keyup(function(){
  319.     var total = cartLS.total();
  320.     var cash = $(this).val();
  321.     var difference = cash-total;
  322.     $(".difference-cash").html(difference+ " MAD");
  323. });
  324. });
  325.  $(document).ready(function() {
  326.    
  327.  
  328.     $(".alert-success").fadeTo(2000, 500).slideUp(500, function() {
  329.      $(".alert-success").hide();
  330.     });
  331.     $(".copy-minicart").html($(".minicart").html())
  332.   
  333. });
  334.     
  335. $(function() {
  336.     /**
  337.     * Smooth scrolling to page anchor on click
  338.     **/
  339.     $("a.smoothlink[href*='#']:not([href='#'])").click(function() {
  340.         if (
  341.             location.hostname == this.hostname
  342.             && this.pathname.replace(/^\//,"") == location.pathname.replace(/^\//,"")
  343.         ) {
  344.             var anchor = $(this.hash);
  345.             anchor = anchor.length ? anchor : $("[name=" + this.hash.slice(1) +"]");
  346.             if ( anchor.length ) {
  347.                 $("html, body").animate( { scrollTop: anchor.offset().top - 200 }, 1000);
  348.             }
  349.         }
  350.     });
  351.     
  352. });
  353. });
  354. </script>
  355.     <script>
  356.       ;(function ($) {
  357.         var targetOffset = 150;
  358.         var $w = $(window).scroll(function(){
  359.             if ( $w.scrollTop() > targetOffset ) {   
  360.                 $('.tt-logo ').css({"width":"100px"});
  361.                 $("#tt-header").css({
  362.                     "position":"fixed",
  363.                     "top":0,
  364.                     "right":0,
  365.                     "width": "100%",
  366.                     "box-shadow":" 0px 2px 6px #00000016"
  367.                     });
  368.             } else {
  369.                 $('.tt-logo ').css({
  370.                     "width":"130px"
  371.                     });
  372.                 $("#tt-header").css({"position":"relative","box-shadow":"none"});
  373.             }
  374.         });
  375.         $('.tt-colorswatch-btn').on('click', function (e) {
  376.           $(this).closest('.tt-colorswatch').toggleClass('tt-open-swatch')
  377.           return false
  378.         })
  379.         $('.js-swatch-color').on('click', function (e) {
  380.           var color = $(this).attr('data-color'),
  381.             imgSrc = $(this).attr('data-img'),
  382.             objImg = $('#js-stepbox__nav .stepbox-dots__line02')
  383.           objImg.css('background-image', 'url(images/' + imgSrc + ')')
  384.           if (color != undefined) {
  385.             $('link[href*="css/style"]').attr(
  386.               'href',
  387.               'css/style-color-0' + color + '.css',
  388.             )
  389.           } else {
  390.             $('link[href*="css/style"]').attr('href', 'css/style.css')
  391.           }
  392.           $('.js-swatch-color').removeClass('active')
  393.           $(this).toggleClass('active')
  394.           e.preventDefault()
  395.         })
  396.       })(jQuery)
  397.     </script>
  398.