templates/home/listing.html.twig line 1

  1. {% extends 'base2.html.twig' %}
  2. {% block body %}
  3.       <div class="font-inter dark:bg-background sticky-header-first-content">
  4.       <div class="container mx-auto lg:px-0 px-5 dark:bg-background">
  5.     {% for flashMessage in app.flashes('success') %}
  6.       <div class="alert alert-success flash-message bg-teal-100 border-t-4 border-teal-500 rounded-b text-teal-900 px-4 py-3 shadow-md" role="alert">
  7.         <div class="flex">
  8.           <div class="py-1"><svg class="fill-current h-6 w-6 text-teal-500 mr-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM9 11V9h2v6H9v-4zm0-6h2v2H9V5z"/></svg></div>
  9.           <div>
  10.             <p class="font-bold">{{ flashMessage }}</p>
  11.             <p class="text-sm">Vous pouvez dès à présent vous connecter à votre compte.</p>
  12.           </div>
  13.         </div>
  14.       </div>
  15.     {% endfor %}
  16.   
  17.  <!-- GOOGLE MAPS START --> 
  18.       <div class="pt-0">
  19.         <div class="mapouter mx-auto w-full h-96">
  20.           <div class="gmap_canvas w-full h-96 realtive">
  21.             <div id="map" class="map h-96 w-full"></div>
  22.           </div>
  23.         </div>
  24.     </div>
  25.  <!-- GOOGLE MAPS END --> 
  26.   <div
  27.     class="relative lg:hidden flex shadow-input p-4 dark:bg-foreground rounded-md mb-4"
  28.   >
  29.     <div class="flex items-center">
  30.       <p class="text-gray-700 text-lg dark:text-gray-100 font-semibold">
  31.         Filtrer
  32.       </p>
  33.       <svg
  34.         xmlns="http://www.w3.org/2000/svg"
  35.         class="h-6 w-6 -rotate-90 text-blue-500 listing-filter-btn"
  36.         fill="none"
  37.         viewBox="0 0 24 24"
  38.         stroke="currentColor"
  39.         stroke-width="2"
  40.       >
  41.         <path
  42.           stroke-linecap="round"
  43.           stroke-linejoin="round"
  44.           d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"
  45.         />
  46.       </svg>
  47.     </div>
  48.   </div>
  49.   <div class="relative flex items-start pt-10">
  50.     <div
  51.   class="listing-sidebar bg-white dark:bg-foreground shadow-front-2 z-50 lg:w-80 w-full lg:sticky fixed transition-all ease-in-out translate-x-0 lg:left-0 -left-full top-20 lg:h-full h-screen"
  52. >
  53.   <div
  54.     class="border-b lg:border-gray-200 border-transparent dark:border-foreground p-5"
  55.   >
  56.     <p
  57.       class="text-gray-700 text-lg dark:text-gray-300 font-semibold lg:block hidden"
  58.     >
  59.       Affiner la recherche
  60.     </p>
  61.     <div class="lg:hidden flex justify-between container mx-auto">
  62.       <svg
  63.         xmlns="http://www.w3.org/2000/svg"
  64.         class="h-6 w-6"
  65.         fill="none"
  66.         viewBox="0 0 24 24"
  67.         stroke="currentColor"
  68.         stroke-width="2"
  69.       >
  70.         <path
  71.           stroke-linecap="round"
  72.           stroke-linejoin="round"
  73.           d="M11 17l-5-5m0 0l5-5m-5 5h12"
  74.         />
  75.       </svg>
  76.       <svg
  77.         xmlns="http://www.w3.org/2000/svg"
  78.         class="h-6 w-6 close-left-sidebar"
  79.         fill="none"
  80.         viewBox="0 0 24 24"
  81.         stroke="currentColor"
  82.         stroke-width="2"
  83.       >
  84.         <path
  85.           stroke-linecap="round"
  86.           stroke-linejoin="round"
  87.           d="M6 18L18 6M6 6l12 12"
  88.         />
  89.       </svg>
  90.     </div>
  91.   </div>
  92.   <div class="p-5 h-5/6">
  93. {{ form_start(form) }}
  94.   <!-- Search bar Start-->
  95.       <div class="">
  96.         {{ form_row(form.q, { 'attr': {'class': 'border border-gray-200 dark:border-gray-800 dark:text-gray-300 rounded-lg px-4 dark:bg-foreground py-[11px] shadow-input hover:border hover:border-blue-200 focus:border-blue-200 focus:outline-none w-5/6 mb-4'} })}}
  97.       </div>
  98.   <!-- Search bar END-->
  99.   
  100.     <p
  101.       class="mb-1 text-gray-700 text-[17px] dark:text-gray-300 font-semibold lg:block hidden"
  102.     >
  103.       Les catégories
  104.     </p>
  105.   <!-- Category filter Start-->
  106.       {% block _category_widget %}
  107.           {% for child in form.Category %}
  108.               {{ form_widget(child) }}
  109.               {{ form_label(child) }}
  110.               <br>
  111.           {% endfor %}
  112.       {% endblock %}
  113.   <!-- Category filter END-->
  114.     <p
  115.       class="mb-1 mt-4 text-gray-700 text-[17px] dark:text-gray-300 font-semibold lg:block hidden"
  116.     >
  117.       Commerce véfifié
  118.     </p>
  119.     
  120.     <!-- Vefified filter Start-->
  121.       <label class="flex items-center mb-1 cursor-pointer">
  122.           {{ form_widget(form.verified) }}
  123.           <span class="ml-2 text-gray-700 text-[12px] dark:text-gray-300">
  124.               Vérifié par Best of Sarlat
  125.           </span>
  126.       </label>
  127.     <!-- Vefified filter END-->
  128.     <!-- Submit Start-->
  129.       <button
  130.       type="submit"
  131.       class="bg-blue-500 text-white hover:bg-blue-600 rounded-lg w-full p-3.5 mt-9 mb-4"
  132.     >
  133.       Lancer la recherche
  134.     </button>
  135.     <!-- Submit END-->
  136. {{ form_end(form) }}
  137.   </div>
  138. </div>
  139.     <div
  140.       class="listing-sidebar-overlay fixed w-full h-full inset-0 z-10 cursor-pointer bg-black opacity-70 hidden"
  141.     ></div>
  142.     <div class="flex-1">
  143.       <div class="shadow-inner-tabs dark:bg-foreground bg-white">
  144. </div>
  145.       <!-- content-start  -->
  146.       <div class="flex justify-between items-center flex-wrap mb-0 pl-5 pt-5">
  147.     {% set available_shops = shops|filter(shop => shop.available == true) %}
  148.     <p class="text-2xl font-semibold dark:text-gray-200">Commerces disponibles - <span class="text-gray-700">{{ available_shops|length }}</span> résultats</p>        <div class="flex items-center flex-wrap">
  149.         <select name="sortby"
  150.                 class="border dark:bg-foreground dark:text-gray-200 shadow-input hover:border hover:border-blue-200 focus:border-blue-200 focus:outline-none px-3 py-2 rounded-md mr-7 mb-4"
  151.                 onchange="location = this.value;">
  152.             <option value="{{ path('app_home_list', {'id': app.request.get('id'), 'sortby': ''}) }}">Trier par</option>
  153.             <option value="{{ path('app_home_list', {'id': app.request.get('id'), 'sortby': 'newest'}) }}">Les plus récents</option>
  154.             <option value="{{ path('app_home_list', {'id': app.request.get('id'), 'sortby': 'oldest'}) }}">Les plus anciens</option>
  155.         </select>
  156.           <a
  157.             href="{{ path('app_home_list') }}"
  158.             type="button"
  159.             class="border border-gray-200 dark:text-gray-200 dark:hover:text-blue-500 dark:hover:border-blue-500 p-[11px] mr-3 mb-4 rounded-full text-gray-500 hover:text-blue-500 hover:border-blue-500"
  160.           >
  161.             <svg
  162.               xmlns="http://www.w3.org/2000/svg"
  163.               class="h-6 w-6"
  164.               fill="none"
  165.               viewBox="0 0 24 24"
  166.               stroke="currentColor"
  167.               stroke-width="2"
  168.             >
  169.               <path
  170.                 stroke-linecap="round"
  171.                 stroke-linejoin="round"
  172.                 d="M4 6h16M4 12h16M4 18h16"
  173.               />
  174.             </svg>
  175.           </a>
  176.           <a
  177.             href="{{ path('app_home_list_grid') }}"
  178.             type="button"
  179.             class="border border-gray-200 dark:text-gray-200 dark:hover:text-blue-500 dark:hover:border-blue-500 p-[11px] mr-3 mb-4 rounded-full text-gray-500 hover:text-blue-500 hover:border-blue-500"
  180.           >
  181.             <svg
  182.               xmlns="http://www.w3.org/2000/svg"
  183.               class="h-5 w-5"
  184.               viewBox="0 0 20 20"
  185.               fill="currentColor"
  186.             >
  187.               <path
  188.                 d="M5 3a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2V5a2 2 0 00-2-2H5zM5 11a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2v-2a2 2 0 00-2-2H5zM11 5a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V5zM11 13a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"
  189.               />
  190.             </svg>
  191.           </a>
  192.         </div>
  193.       </div>
  194.       <div class="pl-5 pb-5 pt-5">
  195.         <div class="mb-12">
  196. <!-- start shop --> 
  197. {% for shop in shops %}
  198.   {% if shop.available %}
  199.     <div class="item js-marker hidden" data-item data-lat="{{ shop.latitude }}" data-lng="{{ shop.longitude }}">
  200.           <a
  201.             href="{{ path('app_home_show', {'slug' : shop.slug })}}"
  202.             class="slug flex lg:flex-row flex-col bg-white shadow-front-2 dark:bg-foreground mb-7"
  203.           >
  204.             <div class="relative w-80 lg:mr-9 mr-0 lg:mb-0 mb-4">
  205.               <img
  206.                 class="pictureName w-full h-56 object-cover rounded-lg"
  207.                 src="{{ vich_uploader_asset(shop, 'picture1') }}"
  208.                 alt=""
  209.               />
  210.               
  211.             </div>
  212.             <div class="flex flex-1 lg:px-0 px-5">
  213.               <div class="flex flex-col flex-1 justify-center">
  214.                 <div class="flex items-center mb-2">
  215.                   <h3
  216.                     class="ShopName text-xl text-gray-700 dark:text-gray-100 font-semibold mr-2"
  217.                   >
  218.                     {{ shop.name }}
  219.                   </h3>
  220.                   {% if shop.verified == true %}
  221.                   <svg
  222.                     xmlns="http://www.w3.org/2000/svg"
  223.                     class="h-5 w-5 text-green-600"
  224.                     viewBox="0 0 20 20"
  225.                     fill="currentColor"
  226.                   >
  227.                     <path
  228.                       fill-rule="evenodd"
  229.                       d="M6.267 3.455a3.066 3.066 0 001.745-.723 3.066 3.066 0 013.976 0 3.066 3.066 0 001.745.723 3.066 3.066 0 012.812 2.812c.051.643.304 1.254.723 1.745a3.066 3.066 0 010 3.976 3.066 3.066 0 00-.723 1.745 3.066 3.066 0 01-2.812 2.812 3.066 3.066 0 00-1.745.723 3.066 3.066 0 01-3.976 0 3.066 3.066 0 00-1.745-.723 3.066 3.066 0 01-2.812-2.812 3.066 3.066 0 00-.723-1.745 3.066 3.066 0 010-3.976 3.066 3.066 0 00.723-1.745 3.066 3.066 0 012.812-2.812zm7.44 5.252a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
  230.                       clip-rule="evenodd"
  231.                     />
  232.                   </svg>
  233.                   {% endif %}
  234.                 </div>
  235.                 <div class="shopSubtitle text-base dark:text-gray-400 mb-6">{{ shop.subtitle }}</div>
  236.                 <div class="shopCategories flex flex-wrap mb-2 items-center mt-5 mr-1">
  237.                   {% for category in shop.categories %}
  238.                   
  239.                   <div
  240.                     class="bg-gray-100 rounded-full mb-2 px-3 py-1 mr-2 flex items-center"
  241.                   >
  242.                         <span class="text-xs font-medium">
  243.                         {{ category.name }}
  244.                         </span>
  245.                     
  246.                   </div>
  247.                   {% endfor %}
  248.                   
  249.                 </div>
  250.               </div>
  251.             </div>
  252.           </a>
  253.         </div>
  254.   {% endif %}
  255.         {% endfor %}
  256.           <!-- end shop -->
  257.           <button 
  258.               id="voirPlusButton"
  259.               class="bg-blue-500 text-white hover:bg-blue-600 rounded-lg w-full p-3.5 mt-9 mb-4"
  260.               >
  261.               Voir plus de commerces
  262.               </button>
  263.         </div>       
  264.       </div>
  265.     </div>
  266.   </div>
  267. </div>
  268.       <div class="scroll-top-btn opacity-0 transition-all">
  269.   <button
  270.     type="button"
  271.     class="bg-blue-500 p-2 fixed z-50 bottom-0 hover:-translate-y-2 transition-all right-0 m-10 rounded-full"
  272.   >
  273.     <svg
  274.       xmlns="http://www.w3.org/2000/svg"
  275.       class="h-6 w-6 text-white"
  276.       fill="none"
  277.       viewBox="0 0 24 24"
  278.       stroke="currentColor"
  279.       stroke-width="2"
  280.     >
  281.       <path
  282.         stroke-linecap="round"
  283.         stroke-linejoin="round"
  284.         d="M7 11l5-5m0 0l5 5m-5-5v12"
  285.       />
  286.     </svg>
  287.   </button>
  288. </div>
  289.  
  290. <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  291. <script>
  292.   $(document).ready(function() {
  293.     var itemsPerPage = 10;
  294.     var startIndex = 0;
  295.     var endIndex = itemsPerPage;
  296.     // Afficher les 10 premiers éléments au chargement de la page
  297.     $("[data-item]").slice(startIndex, endIndex).removeClass("hidden");
  298.     $("#voirPlusButton").on("click", function() {
  299.       // Afficher les 10 éléments suivants
  300.       $("[data-item]").slice(startIndex, endIndex + itemsPerPage).removeClass("hidden");
  301.       // Mettre à jour les index de début et de fin
  302.       startIndex += itemsPerPage;
  303.       endIndex += itemsPerPage;
  304.       // Cacher le bouton s'il n'y a plus d'éléments à afficher
  305.       if (endIndex >= $("[data-item]").length) {
  306.         $("#voirPlusButton").hide();
  307.       }
  308.     });
  309.   });
  310.   // Sélectionnez l'élément avec la classe "flash-message"
  311. var flashMessageElement = document.querySelector('.flash-message');
  312. // Masquez l'élément après 5 secondes
  313. setTimeout(function() {
  314.     flashMessageElement.style.display = 'none';
  315. }, 10000); // 5000 millisecondes = 5 secondes
  316. </script>
  317. {% endblock %}