templates/template.html.twig line 1

Open in your IDE?
  1. <!DOCTYPE html>
  2. <html prefix="fb: http://www.facebook.com/2008/fbml og: http://ogp.me/ns# content: http://purl.org/rss/1.0/modules/content/ dc: http://purl.org/dc/terms/ foaf: http://xmlns.com/foaf/0.1/ rdfs: http://www.w3.org/2000/01/rdf-schema# sioc: http://rdfs.org/sioc/ns# sioct: http://rdfs.org/sioc/types# skos: http://www.w3.org/2004/02/skos/core# xsd: http://www.w3.org/2001/XMLSchema# schema: http://schema.org/">
  3.     <head>
  4.         <meta charset="UTF-8">
  5.         <title>CoastToCorner{% block title %}{% endblock %}</title>
  6.         {% block stylesheets %}{% endblock %}
  7.         {% block meta %}{% endblock %}
  8.         <meta name="google-site-verification" content="Nswynwe3HL8LgG2PUWhWNp92OmvAAT0he6oQfrqXFzc" />
  9.         <meta name="robots" content="all" />
  10.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11.         <script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
  12.         <link rel="shortcut icon" href="{{asset('images/jobinyana-150x150.png')}}">
  13.         <link href="https://fonts.googleapis.com/css?family=Arimo&display=swap" rel="stylesheet">
  14.         <script src="https://www.gstatic.com/firebasejs/8.0.1/firebase-app.js"></script>
  15.         <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
  16.         <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
  17.         <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
  18.         <script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
  19.         <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
  20.         <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/svg-with-js.css">
  21.         <script src="https://kit.fontawesome.com/4734763b43.js"></script>
  22.         <link rel="stylesheet" type="text/css" href="{{asset('css/style.css')}}">
  23.         <script src="https://kit.fontawesome.com/2cdfc10214.js" crossorigin="anonymous"></script>
  24.         <script src="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.5.6/cropper.js" integrity="sha256-CgvH7sz3tHhkiVKh05kSUgG97YtzYNnWt6OXcmYzqHY=" crossorigin="anonymous"></script>
  25.             {% if app.request.get('_route') != 'Accueil' and app.request.get('_route') != 'categorystorelist' %}
  26.             <style>
  27.                     .PopUp-Geo{
  28.                         display: none;
  29.                     }
  30.                 </style>
  31.             {% endif %}
  32.         <script src="{{asset('js/app.js')}}"></script>
  33.         {% block javascript %}    
  34.         {% endblock %}
  35.     </head>
  36.     <style type="text/css">
  37.         #image{
  38.             max-width: 100%;
  39.         }
  40.         .seeMore{
  41.             margin: auto;
  42.         }
  43.         .container_spinner{
  44.             text-align: center;
  45.         }
  46.         
  47.         img.spinner {
  48.             width: 100px;
  49.             height: 100px;
  50.             background-image: url('/images/logo-ctc.png');
  51.             animation: mymove 2s infinite;
  52.             background-size: contain;
  53.             border: 2px solid #305d42;
  54.             border-radius: 100px;;
  55.             margin-bottom: 10%;
  56.           }
  57.           
  58.           @keyframes mymove {
  59.             from {transform: scale(0.5)}
  60.             to {transform: scale(1)}
  61.           }
  62.     </style>
  63.     <body>
  64.         <header>
  65.             <nav class="navbar navbar-expand-md navbar-dark nav-munngano nav-top">
  66.             <ul class="navbar-nav nav-top-fixed col-sm-12">
  67.                   <li class="nav-item col-lg-4">
  68.                     <a class="nav-link nav-link-cta" href="{{path('user.register')}}">Référencer votre activité</a>
  69.                 </li>      
  70.                 <a class="navbar-brand col-lg-4 logo-ctc" href="/" >
  71.                   <img src="{{asset('/images/jobinyana-150x150.png')}}" width="100px" class="img-munngano">
  72.                   </a>
  73.                   <li class="nav-item col-lg-4 d-flex justify-content-center">
  74.                         <a class="nav-link col-lg-2" href="">
  75.                             <i class="far fa-heart" style="font-size: xx-large;color: #0f69d9"></i>
  76.                         </a>
  77.                     {%if app.user is not null %}
  78.                         <a class="nav-link nav-link-cta" href="{{path('security.logout')}}">Se Déconnecter</a>
  79.                     {%else%}
  80.                         <a class="nav-link nav-link-cta" href="{{path('security.login')}}">Se Connecter</a>
  81.                     {%endif%}
  82.                     {%if (app.user is not null) and  (app.user.imageProfil is not null )%}
  83.                       <!--<span class="col-lg-6 welcome-user">Bonjour, {{app.user.firstname | capitalize }}</span>-->
  84.                           <a class="nav-link" href="{{path('profil.user')}}"><img class=" welcome-user rounded-circle" src="{{asset('images/profils/'~app.user.email~'/'~app.user.imageProfil.urlImage)}}"></img></a>
  85.                     {%else%}
  86.                         <a class="nav-link" href="{{path('profil.user')}}"><i class="far fa-user-circle" style="font-size: xx-large;color: #0f69d9"></i></a>
  87.                       {%endif%}
  88.                       <a class="nav-link col-lg-2 toggle-cart-sidebar">
  89.                            <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#305d42" class="bi bi-cart-check" viewBox="0 0 16 16">
  90.                             <path d="M11.354 6.354a.5.5 0 0 0-.708-.708L8 8.293 6.854 7.146a.5.5 0 1 0-.708.708l1.5 1.5a.5.5 0 0 0 .708 0l3-3z"/>
  91.                             <path d="M.5 1a.5.5 0 0 0 0 1h1.11l.401 1.607 1.498 7.985A.5.5 0 0 0 4 12h1a2 2 0 1 0 0 4 2 2 0 0 0 0-4h7a2 2 0 1 0 0 4 2 2 0 0 0 0-4h1a.5.5 0 0 0 .491-.408l1.5-8A.5.5 0 0 0 14.5 3H2.89l-.405-1.621A.5.5 0 0 0 2 1H.5zm3.915 10L3.102 4h10.796l-1.313 7h-8.17zM6 14a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm7 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>
  92.                             </svg>
  93.                             <span id="counter_order_cart"></span>
  94.                         </a>
  95.             </li>
  96.             </li>
  97.             </ul> 
  98.            
  99.     </nav>
  100.     {% include 'cart.html.twig' %}
  101.     <nav class="navbar navbar-expand-sm bg-dark navbar-dark orange-munngano">
  102.          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
  103.         <span class="menu-hamburger" style="background-image: url('{{asset("images/menu-hamburger.svg")}}')"></span>
  104.           </button>
  105.     <a class="navbar-brand brand-mobil" href="/" >
  106.         <img src="/images/jobinyana-150x150.png" width="60px" class="img-munngano"/>
  107.     </a>
  108.     {%if app.user.accountform[0] is defined %}
  109.         <a class="nav-link navlink-icon-mobil" href="{{path('profil.user')}}">
  110.             <img class=" welcome-user rounded-circle" src="{{asset('images1/categories/'~app.user.accountform[0].Category~'/store_' ~app.user.accountform[0].mail~'/'~app.user.accountform[0].url)}}"/>
  111.         </a>
  112.     {%else%}
  113.         <a class="nav-link navlink-icon-mobil" href="{{path('profil.user')}}"><i class="far fa-user-circle" style="font-size: xx-large;color:#0f69d9"></i></a>
  114.     {%endif%}
  115.   <div class="collapse navbar-collapse" id="navbarTogglerDemo01">
  116.       <ul class="navbar-nav container-nav-color">
  117.         <li class="nav-item">
  118.           <a class="nav-link nav-color" href="{{path('categorystorelist', {category:'Jardinage'} )}}">Jardinage</a>
  119.         </li>
  120.         <li class="nav-item">
  121.           <a class="nav-link nav-color" href="{{path('categorystorelist', {category:'Ménage'} )}}">Ménage</a>
  122.         </li>
  123.         <li class="nav-item">
  124.           <a class="nav-link nav-color" href="{{path('categorystorelist', {category:'GardeAnimaux'} )}}">Garde d'animaux</a>
  125.         </li>
  126.         <li class="nav-item">
  127.                 <a class="nav-link nav-color" href="{{path('categorystorelist', {category:'Bricolage'} )}}">Bricolage</a>
  128.         </li>
  129.         <li class="nav-item">
  130.                 <a class="nav-link nav-color" href="{{path('categorystorelist', {category:'BabySitting'} )}}">Baby-Sitting</a>
  131.         </li>
  132.         <li class="nav-item">
  133.                 <a class="nav-link nav-color" href="{{path('categorystorelist', {category:'NettoyageVoiture'} )}}">Nettoyage Voiture</a>
  134.         </li>
  135.         <li class="nav-item">
  136.                 <a class="nav-link nav-color" href="{{path('categorystorelist', {category:'Coiffure'} )}}">Coiffure</a>
  137.         </li>
  138.       </ul>
  139.     </div>
  140.     </nav>
  141.     <!--<h2 class="title_h2_center col-sm-6 mx-auto" style="border: none;">Trouver votre professionnel / particulier</h2>
  142.     <div id="nav-expand" class="col-sm-12 mx-auto" style="text-align: center;">
  143.         <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="angle-down" class="svg-inline--fa fa-angle-down fa-w-10" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512">
  144.             <path fill="#305d42" d="M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z">
  145.             </path>
  146.         </svg>
  147.         <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="angle-down" class="svg-inline--fa fa-angle-down fa-w-10" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512">
  148.             <path fill="#305d42" d="M143 352.3L7 216.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.2 9.4-24.4 9.4-33.8 0z">
  149.             </path>
  150.         </svg>
  151.     </div>-->
  152.     <nav class="navbar navbar-expand-sm bg-light navbar-dark col-lg-4 search-nav" style="margin: auto;height:100%;display:none">
  153.         <form class="form-inline bg-white jumbotron form-research" action="" style="width: 100%" >
  154.             <input class="form-control input-form" id="searchByProperty" type="text" data-path="/" placeholder="Trouver par marque, ville, activité, #tag .." style="
  155.             margin: auto;border-radius:20px" name = 'property'> 
  156.             <span class="searchCategory col-sm-6 mx-auto">Ou par Catégories</span>
  157.             <div class="input-group mb-3 mx-auto">
  158.                     <div class="input-group-prepend">
  159.                       <label class="input-group-text inputGroupCategory" for="inputGroupCategory">Catégories</label>
  160.                     </div>
  161.                     <select class="selected-category custom-select" id="inputGroupCategory">
  162.                       <option value="empty">Sélectionner ...</option>
  163.                       <option value="/category/Restauration">Restauration</option>
  164.                       <option value="/category/Commerces">Commerces</option>
  165.                       <option value="/category/Services">Services</option>
  166.                       <option value="/category/Entre-particuliers">Entre Particuliers</option>
  167.                     </select>
  168.                   </div>
  169.                   <span class="text-center col-sm-12 mx-auto mt-3">Localisation</span>        
  170.                   <div class="col-sm-12 mx-auto mt-3 row " style="padding: 0;text-align: center;">
  171.                       <div class="col-sm-3" style="border:1px solid #305d42; padding-top:1% ">
  172.                           <i class="fas fa-crosshairs fa-2x"></i>
  173.                       </div>
  174.                       <div class="col-sm-9" style="background: #305d42;text-align: center;padding-top: 2%;">
  175.                             <span style="color: #fff;">À proximité</span>
  176.                       </div>
  177.                   </div>
  178.             <span class="searchCategory col-sm-12 mx-auto text-center">Ou entrez une adresse</span>
  179.             <input class="form-control input-form" type="text" data-path="searchbox" placeholder="Trouver par marque, ville, activité, #tag .." style="
  180.             margin: auto;border-radius:20px" name = 'searchHome'> 
  181.             <button type="submit" class=" mx-auto btn btn-primary mt-5" style="background: #305d42 !important;">
  182.                 <span>Let's Go</span>
  183.                 <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="search" class="svg-inline--fa fa-search fa-w-16" role="img" viewBox="0 0 512 512" style="
  184.                     font-size: x-large;">
  185.                 <path fill="#fffcfb" d="M505 442.7L405.3 343c-4.5-4.5-10.6-7 17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"></path></svg>
  186.             </button>
  187.         </form>
  188.     </nav>
  189.     <div class="PopUp-Geo alert alert-warning alert-dismissible fade show" role="alert">
  190.         <span>Pour bénéficier de l'ensemble des fonctionnalités qu'offre le site Munngano, veuillez activer le système de géolocalisation de votre appareil</span>
  191.         <button class="geo-enable">Activer la géolocalisation</button>
  192.     </div>
  193.     
  194. {% block header %}
  195. {% endblock %}
  196.         </header>
  197. <section class="container-body">
  198. <!--<div class="container-fluid">
  199.         <div class="row">    
  200.             <div class="col-md-10 col-md-offset-1">-->
  201.                 <div class="container-alert-info" style="display:none;top: 0px;left: 0px;width: 100%;height: 100%;position: absolute;overflow: hidden;background-color: rgb(238, 238, 240,0.5);z-index: 4000;/* opacity: 0.8; */">
  202.                     <div class="alert alert-info info-notif col-sm-6 alert-dismissible fade show" style="border-color: #f5a755;background-color:#fff" role="alert">
  203.                         <h4>Stay Tuned !!</h4>
  204.                         <p>
  205.                             Activez les notifications pour être averti lors de l'inscription de nouveaux restaurants près de chez vous 
  206.                         </p>
  207.                         <button class="btn-munngano btn-notif-active btn btn-light"> Activer les notifications</button>
  208.                         <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  209.                             <span aria-hidden="true">&times;</span>
  210.                         </button>
  211.                     </div>
  212.             </div>
  213.             <!--</div>
  214.         </div>
  215.     </div>-->
  216. {% block section %}     
  217. {% endblock %}
  218. <div class="separator row justify-content-around"></div>
  219. <div class="row justify-content-around col-sm-6 mx-auto" style="text-align: center;">
  220. <a href="https://www.facebook.com/Munngano-102198861127879/" class="link_social_network col-sm-4"><i class="fab fa-facebook-f"></i></a>
  221. <a href="https://twitter.com/munngano" class="link_social_network col-sm-4"><i class="fab fa-twitter"></i></a>
  222. <a href="https://www.instagram.com/munngano/" class="link_social_network col-sm-4"><i class="fab fa-instagram fa-7X"></i></a>
  223. </div>
  224. <div class="separator"></div>
  225. </div>
  226. </section>
  227. <footer class="col-sm-12" >
  228.     <nav class="row justify-content-around">
  229.       <div>
  230.           <h5 class="title_menu_cat">Catégories</h5>
  231.       <a class="nav-link" href="#">Restauration</a>
  232.       <a class="nav-link" href="#">Commerce</a>
  233.       <a class="nav-link" href="#">Artisanat</a>
  234.       <a class="nav-link" href="#">Services</a>
  235.       </div>
  236.       <div>
  237.           <h5 class="title_menu_cat">Comment ça marche ?</h5>
  238.       <a class="nav-link" href="#">Comment se référencer ?</a>
  239.       <a class="nav-link" href="#">Retrouver un magasin à proximité.</a>
  240.       <a class="nav-link" href="#"></a>
  241.       </div>
  242.       <div>
  243.           <h5 class="title_menu_cat">À propos de ..</h5>
  244.       <a class="nav-link" href="#">Recrutement</a>
  245.       <a class="nav-link" href="#">Mentions Légales</a>
  246.       <a class="nav-link" href="#">Conditions Générales d'Utilisation</a>
  247.       </div>
  248.     </nav>
  249.     <div class="cookies alert alert-light" role="alert">
  250.         <span>
  251.                 les cookies nous aide à améliorer votre expérience utilisateur.En utilisant notre service, vous acceptez l'utilisation des cookies.
  252.                 <a href="" class="alert-link" >En savoir plus</a>
  253.         </span>
  254.         <button id="cookie-granted">Accepter</button>
  255.     </div>
  256.     <!--<script>
  257.         jQuery('#cookie-granted').click(function(){
  258.             fetch("{{path('cookie.granted')}}").then()
  259.         })
  260.     </script>-->
  261.     <script src="{{asset('js/notification.js')}}"></script>
  262.     <script>
  263.         var cookie = document.querySelector('.cookies');
  264.         var btnCookie = document.querySelector('#cookie-granted');
  265.         jQuery('#cookie-granted').click(function(ev){
  266.             jQuery(ev.target).hide();
  267.             document.cookie = "munngano";
  268.         })
  269.         if( document.cookie.match("munngano") !== null )
  270.         {
  271.             jQuery('.cookies').hide();
  272.         }
  273.     </script>
  274.     
  275.     <script>
  276.     
  277.         jQuery(function(){
  278.             jQuery('.dropdown-submenu a').on("click", function(e){
  279.             jQuery(this).nextAll('ul').toggle();
  280.             e.stopPropagation();
  281.             e.preventDefault();
  282.             });
  283.         });
  284.     </script>
  285.     <script>
  286.         var ulArea = false;
  287.         jQuery(function(){
  288.             jQuery('.drop').click(function(e){ 
  289.                 e.preventDefault();
  290.                 e.stopPropagation();
  291.                 jQuery(this).children('ul').toggle('slow'), function(e){
  292.                 e.preventDefault();
  293.                 e.stopPropagation();
  294.             } });
  295.         })
  296.     </script>
  297.     <script>
  298.         jQuery('.geo-enable').click(function(){
  299.             if (navigator.geolocation !== undefined ) 
  300.             {
  301.                 location.reload();
  302.                 /*navigator.geolocation.getCurrentPosition(function(position)
  303.                 {
  304.                     latitudeUser = position.coords.latitude;
  305.                     longitudeUser = position.coords.longitude;
  306.                     if(latitudeUser !== undefined && longitudeUser !== undefined)
  307.                     {
  308.                         jQuery('.PopUp-Geo').hide();
  309.                         isGeo = true;
  310.                     }
  311.                     geolocation = {'latitudeUser':latitudeUser, 'longitudeUser':longitudeUser};
  312.                     requestAllStore = new searchComponent(geolocation, false, false);
  313.                     if(window.innerWidth < 750){
  314.                         document.querySelectorAll(".container_store_list_landing_page").forEach(function(containerStore){containerStore.classList.add('row', 'd-flex', 'flex-nowrap', 'store-row', 'align-items-center');containerStore.scrollIntoView({behavior: "smooth", block: "start", inline: "nearest"}) });
  315.                         document.querySelector('.prime_container_store_list').style.overflowX = 'auto';
  316.                         document.querySelector('.itemSearched_container_store_list').style.overflowX = 'auto';
  317.                         document.querySelector('.container_new_store_list').style.overflowX = 'auto';
  318.                     }
  319.                     seeMore = document.querySelector('.seeMore');
  320.                     jQuery('#geoDisabled').hide();
  321.                     // retrieve the category if it is set
  322.                     cat = initSearchComponent.category();
  323.                     if( cat !== false ){
  324.                         requestStoreByCategory = new searchComponent(geolocation,cat,false);
  325.                         requestStoreByCategory.requestStoreByCategory.init(requestStoreByCategory);
  326.                         // request the latest store by category
  327.                         requestLatestStore = new searchComponent(geolocation,cat,false);
  328.                         requestLatestStore.requestLatestStore.init(requestLatestStore);
  329.                     } else {
  330.                         // request all stores 
  331.                         requestAllStore = new searchComponent(geolocation, false, false);
  332.                         requestAllStore.requestAllStore.init(requestAllStore);
  333.                         // request all the latest store 
  334.                         requestLatestStore = new searchComponent(geolocation,false,false);
  335.                         requestLatestStore.requestLatestStore.init(requestLatestStore);
  336.                     } 
  337.                 })*/
  338.             } else{
  339.                 jQuery('#geoDisabled').show();
  340.                 geolocation = 'pas de géolocalisation';
  341.             }
  342.         })
  343.         jQuery('.cookies > button').click(function(){
  344.             jQuery('.cookies').hide();
  345.         })
  346.     </script>
  347.     <script>
  348.             jQuery(document).ready(function(){
  349.                 jQuery.post("{{ path('display_items_to_Cart')}}", 
  350.                 function(result){
  351.                     console.log(result);
  352.                             if(result){
  353.                                 total = 0;
  354.                                 if(result.init != undefined && result.init === 1)
  355.                                 {
  356.                                     jQuery('.restaurant_title').html(result.restaurant_title);
  357.                                     jQuery('.cart-container').append('<li><a href="'+result.urlRestaurant+'">'+ result.meal_title+' '+result.meal_price+'€ </a></li>');
  358.                                     total += parseInt(result.meal_price); 
  359.                                     jQuery('#counter_order_cart').html('1');
  360.                                     //console.log(multipleMealOrdered.get('meal'));
  361.                                 } else{
  362.                                     //console.log('list of meals ordered :'+result.meal_title);
  363.                                     multipleMealOrdered = new Map();
  364.                                     for( var i=0; i < result.meal_title.length;i++){
  365.                                         meal_referent = result.meal_title[i];
  366.                                         meal_price = result.meal_price[i];
  367.                                         //console.log('referent meal : '+meal_referent);
  368.                                         for(var y=0; y < result.meal_title.length; y++){
  369.                                             current_meal = result.meal_title[y];
  370.                                         //    console.log('current meal '+result.meal_title[y]);
  371.                                             if(meal_referent === current_meal){
  372.                                                 nb = multipleMealOrdered.get('meal');
  373.                                                 //        console.log(nb);
  374.                                                 if(nb === undefined){
  375.                                                     var nb = 0;
  376.                                                     multipleMealOrdered.set('meal',{ name : meal_referent, price : meal_price, nombre : nb});
  377.                                                 //    multipleMealOrdered.set(meal_referent+" : "+meal_price,nb);
  378.                                                 }
  379.                                                 multipleMealOrdered.set('meal',{ name : meal_referent, price : meal_price, nombre : nb++});
  380.                                                 //multipleMealOrdered.set(meal_referent+" : "+meal_price, ++nb);
  381.                                                 //console.log(result.meal_title[y]+' : '+multipleMeal);
  382.                                             }
  383.                                         }
  384.                                         var mealsOrdereds ="";
  385.                                         multipleMealOrdered.forEach(function(value,key){
  386.                                         //    console.log(key + "= "+ Math.sqrt(value));
  387.                                         })
  388.                                         //console.log(""+ meal_referent +" : " + multipleOrderArr[meal_referent]);
  389.                                         total += parseInt(result.meal_price[i]);
  390.                                         jQuery('.restaurant_title').html('<a href="'+result.urlRestaurant[i]+'">'+result.restaurant_title[i]+'</a>');
  391.                                         jQuery('#counter_order_cart').html(result.restaurant_title.length);
  392.                                     }
  393.                                     multipleMealOrdered.forEach(function(value,key){
  394.                                     //    console.log(key + "= "+ Math.sqrt(value));
  395.                                         jQuery('.cart-container').append('<li>'+key+' € '+ '( x' + Math.sqrt(value) +' )</li>');
  396.                                     })
  397.                                     //console.log("multipleMealOrdered : "+multipleMealOrdered.get('meal'));
  398.                                     jQuery('.total_cart').html(total+' €');
  399.                                 }    
  400.                         }else{
  401.                             jQuery('#counter_order_cart').hide();
  402.                         }
  403.             })
  404.         })
  405.             jQuery('.btn-add-cart').click(
  406.                 function(ev){
  407.                     let idRestaurant = jQuery(ev.target).data("id");
  408.                     let urlRestaurant = "{{ app.request.getSchemeAndHttpHost }}/products-store/"+idRestaurant;
  409.                     let restaurant = jQuery(ev.target).data("restaurant");
  410.                     let meal = jQuery(ev.target).data("meal");
  411.                     let price = jQuery(ev.target).data("price");
  412.                     let urlImage = jQuery(ev.target).data("urlImage");
  413.                     jQuery.post("{{ path('add_item_to_Cart')}}", 
  414.                         {'restaurantTitle':restaurant,'itemTitle':meal, 'itemPrice':price, 'urlImage' : urlImage, 'urlRestaurant':urlRestaurant, 'idRestaurant' : idRestaurant},
  415.                         function(result){
  416.                             console.log('auth : '+result.authentification);
  417.                             if(!result.authentification){
  418.                                 jQuery('.toast-inscription').show();
  419.                                 jQuery('body').animate({scrollTop:0}, 'fast');
  420.                                 jQuery('body').css('overflow','hidden');
  421.                             }
  422.                             if(result){
  423.                                 total = 0;
  424.                                 if(result.init != undefined && result.init === 1){
  425.                                     jQuery('.restaurant_title').html('<a href="'+urlRestaurant+'">'+result.restaurant_title+'</a>');
  426.                                     jQuery('.cart-container').append('<li><a href="'+urlRestaurant+'">'+ result.meal_title+' '+result.meal_price+'€ </a></li>');
  427.                                     total = parseInt(result.meal_price); 
  428.                                     jQuery('#counter_order_cart').html('1').show();
  429.                                 } else{
  430.                                 multipleMealOrdered = new Map();
  431.                                 for( var i=0; i < result.init;i++){
  432.                                     meal_referent = result.meal_title[i];
  433.                                     meal_price = result.meal_price[i];
  434.                                     for(var y=0; y < result.init; y++){
  435.                                         current_meal = result.meal_title[y];
  436.                                         console.log('test meal : '+result.meal_title[y]+ meal_referent);
  437.                                         if(meal_referent === current_meal){
  438.                                                 console.log("test meal : "+true);
  439.                                                 //nb = multipleMealOrdered.get('meal').nombre;
  440.                                                 //console.log(nb);
  441.                                                 if(nb === undefined){
  442.                                                     var nb = 1;
  443.                                                     multipleMealOrdered.set('meal',{ name : meal_referent, price : meal_price, nombre : nb});
  444.                                                     break;
  445.                                                 }
  446.                                                 nb = multipleMealOrdered.get('meal').nombre;
  447.                                                 multipleMealOrdered.set('meal',{ name : meal_referent, price : meal_price, nombre : nb++});
  448.                                                 //multipleMealOrdered.set(meal_referent+" : "+meal_price, ++nb);
  449.                                                 break;
  450.                                             }
  451.                                         }
  452.                                 console.log("Meal : "+multipleMealOrdered.get('meal').name);
  453.                                 var mealsOrdereds ="";
  454.                                 /*multipleMealOrdered.get('meal').forEach(function(value,key){
  455.                                     console.log(key + "= "+ Math.sqrt(value));
  456.                                 })*/
  457.                                 const name = multipleMealOrdered.get('meal').name;
  458.                                 const price = multipleMealOrdered.get('meal').price;
  459.                                 //console.log(""+ meal_referent +" : " + multipleOrderArr[meal_referent]);
  460.                                 total += parseInt(result.meal_price[i]);
  461.                                 jQuery('.restaurant_title').html(result.restaurant_title[i]);
  462.                                 jQuery('#counter_order_cart').html(result.restaurant_title.length);
  463.                             }
  464.                             jQuery('.cart-container').html('');
  465.                             multipleMealOrdered.forEach(function(value){
  466.                                 console.log(value);
  467.                             //    console.log(key + "= "+ Math.sqrt(value));
  468.                                 jQuery('.cart-container').append('<li>'+value.name +' : '+ value.price + ' € '+ '( x' + value.nombre +' )</li>');
  469.                             })
  470.                             for(var i = 0; i < multipleMealOrdered.size; i++ ){
  471.                             }
  472.                         //    console.log(multipleMealOrdered);
  473.                         }
  474.                         jQuery('.total_cart').html(total+' €');
  475.                         jQuery('#primary-ctc').attr("href", "{{ app.request.getSchemeAndHttpHost }}/payout/"+idRestaurant);
  476.                     
  477.                 };
  478.             })
  479.         });
  480.             jQuery('.btn-clear-cart').click(
  481.                 function(ev){
  482.                     let restaurant = jQuery(ev.target).data("restaurant");
  483.                     let meal = jQuery(ev.target).data("meal");
  484.                     let price = jQuery(ev.target).data("price");
  485.                     jQuery.post("{{ path('remove_item_to_Cart')}}", 
  486.                         {'restaurantTitle':restaurant,'itemTitle':meal, 'itemPrice':price},
  487.                         function(result){
  488.                             total = 0;
  489.                             jQuery('.cart-container').html('');
  490.                             jQuery('.restaurant_title').html('Votre panier est vide.');
  491.                             jQuery('.total_cart').html(total+' €');
  492.                             jQuery('#counter_order_cart').hide();                               
  493.                         }
  494.                         );
  495.                 }
  496.             );
  497.     </script>
  498.     <script>
  499.         
  500.     </script>
  501.     <script>
  502.         jQuery('.toggle-cart-sidebar').click(function(){
  503.             jQuery('.cart-container-sidebar').toggle();
  504.         })
  505.     </script>
  506.     {% block footer %}
  507.     {% endblock %}
  508. </footer>