templates/dashboard.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {# ============================================ #}
  3. {% set selectedclub = app.session.get('club-selected') %}
  4. {% block title %}
  5.     {% if selectedclub is defined and selectedclub.uuid is defined %}
  6.         {{ selectedclub.name }} - 
  7.     {%  endif %}
  8.     Cénacle Rémi Mollet
  9. {% endblock %}
  10. {# ============================================ #}
  11. {% block stylesheets %}
  12.     <link rel="stylesheet" href="{{ app.request.baseUrl }}/assets/dashboard/dashboard.css">
  13.     <link rel="stylesheet" href="{{ app.request.baseUrl }}/assets/menu/menu.css">
  14.     <link rel="stylesheet" href="{{ app.request.baseUrl }}/assets/footer/footer.css">
  15.     <link rel="preconnect" href="https://fonts.gstatic.com">
  16.     <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;1,400;1,500;1,600&display=swap" rel="stylesheet">
  17.     <link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@600;700&display=swap" rel="stylesheet">
  18.     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
  19.     <link rel="stylesheet" href="{{ app.request.baseUrl }}/assets/home/search-city.css">
  20.     
  21.     {% block stylesheets2 %}{% endblock %}
  22. {% endblock %}
  23. {# ============================================ #}
  24. {% block javascripts %}{% endblock %}
  25. {# ============================================ #}
  26. {% block betweenheadandbody %}
  27.      <script id="search-city-item-template" type="text/x-handlebars-template">
  28.         <div>{{ '{{ name }} ({{ zipcode }})' }}</div>
  29.     </script>
  30. {% endblock %}
  31. {# ============================================ #}
  32. {% block switchLanguageButton %}
  33.    <div class="language">
  34.         <label class="toggle">
  35.             <input type="checkbox" id="language" {% if app.request.locale == 'en' %}checked{% endif %}>
  36.             <span class="toggle-switch"></span>
  37.             <div class="fr"></div>
  38.             <div class="en"></div>
  39.         </label>
  40.     </div> 
  41. {% endblock %}
  42. {% block searchclub %}
  43.    {# Barre de recherche club #}
  44.    <div class="search-club">
  45.        <div class="first-line" id="gotoclubsearchbtn">
  46.             <h4>rechercher un club</h4>
  47.             <div class="toggle-btn">
  48.                 <i class="fas fa-arrow-circle-right"></i>
  49.                 <i class="fas fa-times"></i>
  50.             </div>
  51.         </div>
  52.         <div class="second-line">
  53.             {# search country / city #}
  54.             <label for="country"></label>
  55.             <select name="pays" id="pays">
  56.                 <option label="France Métropolitaine" value="France"></option>
  57.                 {#<option label="Guyane" value="guyane"></option>
  58.                 <option label="Suisse" value="suisse"></option>
  59.                 <option label="Hollande" value="hollande"></option>
  60.                 <option label="Canada" value="Canada"></option>#}
  61.             </select>
  62.             <label for="ville"></label>
  63.             <div>
  64.                 <input type="text" class="form-control typeahead" name="ville" id="ville" placeholder="Renseigner une ville" autocomplete="off">
  65.             </div>
  66.             {# rayon city #}
  67.             <p>Rayon</p>
  68.             <div class="rayon">
  69.                 <input type="range" min="1" max="25" step="1" value="5" id="slider">
  70.                 <div id="selector">
  71.                     <div id="selectValue"></div>
  72.                 </div>
  73.             </div>
  74.             <div class="btn" id="clubsearchbtn"><a href="#">rechercher</a></div>
  75.         </div>
  76.    </div>
  77. {% endblock %}
  78.  
  79. {% block searchclubjs %}
  80.     <script src="{{ app.request.baseUrl }}/vendor/typeahead/typeahead.bundle.js"></script>
  81.     <script src="{{ app.request.baseUrl }}/vendor/handlebars/handlebars.min-v4.7.7.js"></script>
  82.     {# JS rayon km + autocompletion ville #}
  83.     <script>
  84.         var slider = document.getElementById("slider");
  85.         var selector = document.getElementById("selector");
  86.         var selectValue = document.getElementById("selectValue");
  87.         var zipcodeSelected;
  88.         selectValue.innerHTML = slider.value;
  89.         slider.oninput = function(){
  90.             selectValue.innerHTML = slider.value;
  91.             selector.style.left = this.value + " km";
  92.         }
  93.         var searchCityItemTemplate = Handlebars.compile($("#search-city-item-template").html());
  94.         $(document).ready(function() {
  95.             function getDisplayName(result) {
  96.                 //console.log("getDisplayName", result);
  97.                 return result.name + ' (' + result.zipcode + ')';
  98.             }
  99.             var bloodhound = new Bloodhound({
  100.                 datumTokenizer: Bloodhound.tokenizers.whitespace,
  101.                 queryTokenizer: Bloodhound.tokenizers.whitespace,
  102.                 remote: {
  103.                     url: "{{ app.request.baseUrl }}/api/city?q=%QUERY",
  104.                     prepare: function (query, settings) {
  105.                         settings.url = settings.url.replace('%QUERY', query);
  106.                         //console.log("Search url: " + settings.url);
  107.                         return settings;
  108.                     }
  109.                 }
  110.             });
  111.             
  112.             bloodhound.initialize();
  113.             $('#ville').typeahead({
  114.                 hint: true,
  115.                 highlight: true,
  116.                 minLength: 1
  117.             },
  118.             {
  119.                 limit: 20,
  120.                 source: bloodhound,
  121.                 display: getDisplayName,
  122.                 templates: {
  123.                     suggestion: function(result) {
  124.                         return searchCityItemTemplate(result);
  125.                     }
  126.                 }
  127.             });
  128.             $('#ville').focus();
  129.             $('#ville').bind('typeahead:select', function(ev, result) {
  130.                 var element = result.element;
  131.                 console.log("search select", result.zipcode, slider.value);
  132.                 zipcodeSelected = result.zipcode;
  133.                 // window.location = '{{ app.request.baseUrl }}/v2/view-grid/' + element.name;
  134.             });
  135.             $('#ville').on('keypress',function(e) {
  136.                 if(e.which == 13) {
  137.                     goToSearchClub();
  138.                 }
  139.             });
  140.             $('#clubsearchbtn').click(function() {
  141.                 goToSearchClub();
  142.             });
  143.             $('#gotoclubsearchbtn').click(function() {
  144.                 window.location = '{{ app.request.baseUrl }}/club';
  145.             });
  146.             
  147.         });
  148.         
  149.         function goToSearchClub() {
  150.             if(zipcodeSelected && zipcodeSelected != '') {
  151.                 window.location = '{{ app.request.baseUrl }}/club?zc=' + zipcodeSelected + '&d=' + slider.value;
  152.             }
  153.         }
  154.     </script>
  155. {% endblock %}
  156.  
  157. {# ============================================ #}
  158. {% block body %}
  159.     
  160.     {{ render(controller('App\\Controller\\MenuController::viewMenu')) }}
  161.     <!-- Button top -->
  162.     <div class="top-button">
  163.         <i class="fas fa-arrow-up"></i>
  164.     </div>
  165.        {% block dashboardcontent %}{% endblock %}
  166.     {{ render(controller('App\\Controller\\FooterController::viewFooter')) }}
  167.     {# JS Bootstrap #}
  168.     <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
  169.     <script src="https://unpkg.com/@popperjs/core@2"></script>
  170.     <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns" crossorigin="anonymous"></script>
  171.     {# Link for icons #}
  172.     <script src="https://kit.fontawesome.com/297127ae03.js" crossorigin="anonymous"></script>
  173.     {# JS for menu & scroll #}
  174.     <script src="{{ app.request.baseUrl }}/assets/menu/menu.js"></script>
  175.     <script src="{{ app.request.baseUrl }}/assets/search-club/search-club.js"></script>
  176.     <script src="{{ app.request.baseUrl }}/assets/topbutton.js"></script>
  177.     <script src="{{ app.request.baseUrl }}/assets/dashboard/dashboard.js"></script>
  178.     
  179.     {% block javascripts_end_body %}{% endblock %}
  180.     
  181. {% endblock %}