templates/etablissement/list.html.twig line 1

  1. {% extends 'base.html.twig' %}
  2. {% block title %}Tous les établissements | DAIP{% endblock %}
  3. {% block body %}
  4. <section class="min-h-screen bg-gradient-to-br from-indigo-700 via-purple-700 to-blue-700 py-12 sm:py-20">
  5.     <div class="container mx-auto px-4 w-full max-w-full">
  6.         {#<a href="{{ path('app_home') }}" class="inline-flex items-center text-white/70 hover:text-white transition text-sm">#}
  7.                {# <i class="fas fa-arrow-left mr-2"></i> Retour à l'accueil#}
  8.         {#</a>#}
  9.         {# En-tête #}
  10.         <div class="text-center mb-8 sm:mb-12">
  11.             
  12.             <div class="inline-flex items-center rounded-full border border-white bg-white px-3 sm:px-4 py-1.5 text-xs sm:text-sm font-semibold text-purple-500 mb-4 shadow-lg">
  13.                 <i class="fas fa-building mr-2"></i>
  14.                 ÉTABLISSEMENTS DE FORMATION
  15.             </div>
  16.             <h1 class="text-2xl sm:text-3xl md:text-4xl font-bold text-white mb-4">
  17.                 {{ total }} établissements disponibles
  18.             </h1>
  19.         </div>
  20.         {# Filtres #}
  21.         <div class="max-w-4xl mx-auto mb-8 px-2">
  22.             <div class="flex flex-col sm:flex-row gap-3 sm:gap-4">
  23.                 <div class="flex-1">
  24.                     <div class="relative">
  25.                         <i class="fas fa-search absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400"></i>
  26.                         <input type="text" 
  27.                                id="recherche-input"
  28.                                placeholder="Rechercher un établissement..." 
  29.                                value="{{ recherche }}"
  30.                                class="w-full pl-10 pr-4 py-2 sm:py-3 rounded-lg border border-white/30 bg-white/10 backdrop-blur-sm text-white placeholder-white/70 text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-white">
  31.                     </div>
  32.                 </div>
  33.                 <div class="sm:w-64">
  34.                     <select id="direction-filter" class="w-full px-4 py-2 sm:py-3 rounded-lg border border-white/30 bg-white/10 backdrop-blur-sm text-white text-sm sm:text-base focus:outline-none focus:ring-2 focus:ring-white">
  35.                         <option value="">Toutes les directions</option>
  36.                         {% for direction in directions %}
  37.                             <option value="{{ direction.id }}" {{ directionSelectionnee == direction.id ? 'selected' : '' }}>
  38.                                 {{ direction.nom }}
  39.                             </option>
  40.                         {% endfor %}
  41.                     </select>
  42.                 </div>
  43.             </div>
  44.         </div>
  45.         {# Grille #}
  46.         <div id="etablissements-grid" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6">
  47.             {% include 'partials/_etablissements_cards.html.twig' with {'etablissements': etablissements} %}
  48.         </div>
  49.         {# Chargement #}
  50.         <div id="loading" class="hidden text-center py-8">
  51.             <div class="inline-block w-8 h-8 border-4 border-white/30 border-t-white rounded-full animate-spin"></div>
  52.         </div>
  53.     </div>
  54. </section>
  55. <script>
  56. document.addEventListener('DOMContentLoaded', function() {
  57.     const recherche = document.getElementById('recherche-input');
  58.     const direction = document.getElementById('direction-filter');
  59.     
  60.     function recharger() {
  61.         const url = new URL(window.location.href);
  62.         url.searchParams.set('page', '1');
  63.         url.searchParams.set('recherche', recherche.value);
  64.         url.searchParams.set('direction', direction.value);
  65.         window.location.href = url.toString();
  66.     }
  67.     
  68.     let timer;
  69.     recherche.addEventListener('input', () => {
  70.         clearTimeout(timer);
  71.         timer = setTimeout(recharger, 500);
  72.     });
  73.     
  74.     direction.addEventListener('change', recharger);
  75. });
  76. </script>
  77. {% endblock %}