templates/frontend/market/index.html.twig line 1

  1. {% extends 'master.html.twig' %}
  2. {% block title %}Market
  3. {% endblock %}
  4. {% block stylesheets %}
  5.     {{ parent() }}
  6.     <link rel="stylesheet" href="{{ asset('assets/css/market.css') }}">
  7. {% endblock %}
  8. {% block body %}
  9.     <div class="" style="padding-top: 80px;">
  10.         {% include "_partials/market/hero-section.html.twig" with {
  11.         } %}
  12.         <section>
  13.             <div class="container">
  14.                 <div class="shop-clear-filter mb-4">
  15.                     {% include "frontend/market/_partials/scroll-category.html.twig" with {
  16.                         'categories': categories
  17.                     } %}
  18.                 </div>
  19.                 <div class="row">
  20.                     <div class="col-lg-4 col-xl-3">
  21.                         {% include "frontend/market/_partials/category.html.twig" with {
  22.                             'categories': categories
  23.                                     } %}
  24.                     </div>
  25.                     <div class="col-lg-8 col-xl-9">
  26.                         {% if products | length > 0 %}
  27.                             <div class="row">
  28.                                 {% include "frontend/market/_partials/products.html.twig" with {
  29.                                     'products': products
  30.                                 } %}
  31.                             </div>
  32.                             <div class="row">
  33.                                 <div class="col-md-4 offset-md-4" style="display: flex; justify-content: center;">
  34.                                     {{ knp_pagination_render(products, '_partials/widgets/pagination.html.twig') }}
  35.                                 </div>
  36.                             </div>
  37.                         {% else %}
  38.                             <div class="row">
  39.                                 <h1 class="text-center">Pas de produits disponible</h1>
  40.                             </div>
  41.                         {% endif %}
  42.                     </div>
  43.                 </div>
  44.             </div>
  45.         </section>
  46.     </div>
  47. {% endblock %}
  48. {% block javascripts %}
  49.     {{ parent() }}
  50.     <script>
  51.         var formId =   document.getElementById("searchFormInput");
  52.             formId.addEventListener("submit", function(event) {
  53.             event.preventDefault(); // EmpĂȘche l'envoi du formulaire par dĂ©faut
  54.             var title = document.querySelector('input[name="title"]').value;
  55.             var city = document.querySelector('input[name="city"]').value;
  56.             console.log(title, city);
  57.             if (title !== "" || city !== "") {
  58.                 // Construction de la nouvelle URL
  59.                 var newUrl = "{{ path('app_recherche') |escape('js') }}?title=" + encodeURIComponent(title) + "&city=" + encodeURIComponent(city);
  60.                 // Redirection vers la nouvelle URL
  61.                 window.location.replace(newUrl);
  62.                 // window.location.href = newUrl;
  63.             }
  64.         });
  65.     </script>
  66. {% endblock %}