templates/fronts/list_projets.html.twig line 1

  1. {% extends 'base_front.html.twig' %}
  2. {% block title %}Hello DefaultController!{% endblock %}
  3.     {% block body %}
  4.         <!-- Content ============================================= -->
  5.         <section id="content">
  6.             <div class="col-mt-30">
  7.                 <div class="research-structures-section py-5">
  8.                     <div class="container">
  9.                         <!-- Titre -->
  10.                         <h2 class="section-title text-center mb-5">Nos Projets</h2>
  11.                         <!-- Filtres améliorés -->
  12.                         <div class="filter-container mb-5">
  13.                             <form id="filterForm" class="filter-form">
  14.                                 <div class="row g-3">
  15.                                     <div class="col-md-6">
  16.                                         <div class="filter-group">
  17.                                             <label for="filterStructure" class="filter-label">Structures</label>
  18.                                             <select name="filterStructure" id="filterStructure" class="form-select filter-select">
  19.                                                 <option value="">Toutes les structures</option>
  20.                                                 {% for structure in structures %}
  21.                                                     <option value="{{ structure.id }}">{{ structure.nomLong }}</option>
  22.                                                 {% endfor %}
  23.                                             </select>
  24.                                         </div>
  25.                                     </div>
  26.                                     <div class="col-md-6">
  27.                                         <div class="filter-group">
  28.                                             <label for="filterNom" class="filter-label">Nom du projet</label>
  29.                                             <div class="input-with-icon">
  30.                                                 <input type="text" id="filterNom" class="form-control" placeholder="Rechercher par nom">
  31.                                                 <i class="fas fa-search"></i>
  32.                                             </div>
  33.                                         </div>
  34.                                     </div>
  35.                                 </div>
  36.                             </form>
  37.                         </div>
  38.                         <!-- Cartes des structures -->
  39.                         <div id="structureLaboContainer" class="row g-4">
  40.                             {% for projet in projets %}
  41.                                 <div class="col-lg-4 col-md-6 mb-4 projet-card" data-structure="{{ projet.structure.id }} "
  42.                                 data-projet="{{ projet.nom }}"
  43.                                 >
  44.                                 <a href="{{ path('app_projet_details', {'id': projet.id}) }}">
  45.                                     <div class="structure-card-inner">
  46.                                         <div class="card-image">
  47.                                             {% if projet.image is not null %}
  48.                                                 <img src="/upload/projets/{{ projet.image }}" alt="{{ projet.nom }}" class="img-fluid"
  49.                                                 style="width: 180px; height: 180px;">
  50.                                             {% else %}
  51.                                                 <img src="/front/icons/projet.png" alt="{{ projet.image }}" class="img-fluid"
  52.                                                 style="width: 180px; height: 180px;">
  53.                                             {% endif %}
  54.                                         </div>
  55.                                         <div class="card-content">
  56.                                             <h3 class="card-title">{{ projet.nom }}</h3>
  57.                                             <div class="card-footer">
  58.                                                 <span class="institution">{{ projet.structure ? projet.structure.nomLong : '' }}</span>
  59.                                                 <span class="view-more">Voir plus <i class="fas fa-arrow-right"></i></span>
  60.                                             </div>
  61.                                         </div>
  62.                                     </div>
  63.                                 </a>
  64.                             </div>
  65.                         {% endfor %}
  66.                         <!-- ... -->
  67.                     </div>
  68.                 </div>
  69.             </div>
  70.         </div>
  71.     </section>
  72.     <!-- #content end -->
  73.     <script>
  74.         document.addEventListener('DOMContentLoaded', function() {
  75.             const filterForm = document.getElementById('filterForm');
  76.             const structureCards = document.querySelectorAll('.projet-card');
  77.             function filterStructures() {
  78.                 const filterStructure = document.getElementById('filterStructure').value;
  79.                  const filterNom = document.getElementById('filterNom').value.toLowerCase();
  80.                 structureCards.forEach(card => {
  81.                     const structure = card.getAttribute('data-structure');
  82.                     const nom = card.getAttribute('data-projet').toLowerCase();
  83.                     let isVisible = true;
  84.                     if (filterStructure && structure !== filterStructure) {
  85.                         isVisible = false;
  86.                     }
  87.                     if (filterNom && !nom.includes(filterNom)) {
  88.                     isVisible = false;
  89.                 }
  90.                     card.style.display = isVisible ? 'block' : 'none';
  91.                 });
  92.             }
  93.             filterForm.addEventListener('change', filterStructures);
  94.         });
  95.     </script>
  96. {% endblock %}