var/cache/dev/twig/b8/b8db368eb812985d8395fb1e6584ece9.php line 117

Open in your IDE?
  1. <?php
  2. use Twig\Environment;
  3. use Twig\Error\LoaderError;
  4. use Twig\Error\RuntimeError;
  5. use Twig\Extension\CoreExtension;
  6. use Twig\Extension\SandboxExtension;
  7. use Twig\Markup;
  8. use Twig\Sandbox\SecurityError;
  9. use Twig\Sandbox\SecurityNotAllowedTagError;
  10. use Twig\Sandbox\SecurityNotAllowedFilterError;
  11. use Twig\Sandbox\SecurityNotAllowedFunctionError;
  12. use Twig\Source;
  13. use Twig\Template;
  14. use Twig\TemplateWrapper;
  15. /* model/collection.html.twig */
  16. class __TwigTemplate_cfcc8bd949cdd1fde237e5ee402e3a78 extends Template
  17. {
  18.     private Source $source;
  19.     /**
  20.      * @var array<string, Template>
  21.      */
  22.     private array $macros = [];
  23.     public function __construct(Environment $env)
  24.     {
  25.         parent::__construct($env);
  26.         $this->source $this->getSourceContext();
  27.         $this->blocks = [
  28.             'title' => [$this'block_title'],
  29.             'body' => [$this'block_body'],
  30.             'javascripts' => [$this'block_javascripts'],
  31.         ];
  32.     }
  33.     protected function doGetParent(array $context): bool|string|Template|TemplateWrapper
  34.     {
  35.         // line 1
  36.         return "base.html.twig";
  37.     }
  38.     protected function doDisplay(array $context, array $blocks = []): iterable
  39.     {
  40.         $macros $this->macros;
  41.         $__internal_5a27a8ba21ca79b61932376b2fa922d2 $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  42.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""model/collection.html.twig"));
  43.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  44.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""model/collection.html.twig"));
  45.         $this->parent $this->load("base.html.twig"1);
  46.         yield from $this->parent->unwrap()->yield($contextarray_merge($this->blocks$blocks));
  47.         
  48.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  49.         
  50.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  51.     }
  52.     // line 3
  53.     /**
  54.      * @return iterable<null|scalar|\Stringable>
  55.      */
  56.     public function block_title(array $context, array $blocks = []): iterable
  57.     {
  58.         $macros $this->macros;
  59.         $__internal_5a27a8ba21ca79b61932376b2fa922d2 $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  60.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""title"));
  61.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  62.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""title"));
  63.         yield "Collection complète";
  64.         
  65.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  66.         
  67.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  68.         yield from [];
  69.     }
  70.     // line 5
  71.     /**
  72.      * @return iterable<null|scalar|\Stringable>
  73.      */
  74.     public function block_body(array $context, array $blocks = []): iterable
  75.     {
  76.         $macros $this->macros;
  77.         $__internal_5a27a8ba21ca79b61932376b2fa922d2 $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  78.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""body"));
  79.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  80.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""body"));
  81.         // line 6
  82.         yield "    <div style=\"width: 100%;\">
  83.         <section class='topPageCollection'>
  84. ";
  85.         // line 11
  86.         yield "                <div class=\"subtitleCollection\">
  87.                     <span class=\"mt-5\">Le site est en cours de remplissage.<br>
  88.                     À venir, plus de 8 000 écussons. Merci de prendre contact pour plus d'informations.
  89.                     </span>
  90.                     <p>Nombre total d'écussons en base : ";
  91.         // line 15
  92.         yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape((isset($context["count"]) || array_key_exists("count"$context) ? $context["count"] : (function () { throw new RuntimeError('Variable "count" does not exist.'15$this->source); })()), "html"nulltrue);
  93.         yield "</p>
  94.                 </div>
  95.             ";
  96.         // line 18
  97.         yield         $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->renderBlock((isset($context["form2"]) || array_key_exists("form2"$context) ? $context["form2"] : (function () { throw new RuntimeError('Variable "form2" does not exist.'18$this->source); })()), 'form_start', ["method" => "GET"]);
  98.         yield "
  99.                 <span class=\"searchPart\">
  100.                     <i class=\"fa-solid fa-magnifying-glass\" style=\"color: #ffffff;\"></i>
  101.                         ";
  102.         // line 21
  103.         yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env$this->source, (isset($context["form2"]) || array_key_exists("form2"$context) ? $context["form2"] : (function () { throw new RuntimeError('Variable "form2" does not exist.'21$this->source); })()), "search", [], "any"falsefalsefalse21), 'row');
  104.         yield "
  105.                     <button type=\"submit\" class=\"btn btn-grad rounded-pill\">Rechercher</button>
  106.                 </span>
  107.             ";
  108.         // line 24
  109.         yield         $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->renderBlock((isset($context["form2"]) || array_key_exists("form2"$context) ? $context["form2"] : (function () { throw new RuntimeError('Variable "form2" does not exist.'24$this->source); })()), 'form_end');
  110.         yield "
  111.             <div class=\"converter-list\">
  112.                 <button id=\"list-button\">
  113.                     <i class=\"fa-solid fa-list\"></i>
  114.                 </button>
  115.                 <button id=\"grid-button\">
  116.                     <i class=\"fa-solid fa-table-cells-large\"></i>
  117.                 </button>
  118.             </div>
  119.             ";
  120.         // line 33
  121.         yield         $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->renderBlock((isset($context["form"]) || array_key_exists("form"$context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.'33$this->source); })()), 'form_start', ["method" => "GET"]);
  122.         yield "
  123.                 <div class=\"filterdiv\">
  124.                         ";
  125.         // line 35
  126.         yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env$this->source, (isset($context["form"]) || array_key_exists("form"$context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.'35$this->source); })()), "categorie", [], "any"falsefalsefalse35), 'row');
  127.         yield "
  128.                         ";
  129.         // line 36
  130.         yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env$this->source, (isset($context["form"]) || array_key_exists("form"$context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.'36$this->source); })()), "sousCategorie", [], "any"falsefalsefalse36), 'row');
  131.         yield "
  132.                         ";
  133.         // line 37
  134.         yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env$this->source, (isset($context["form"]) || array_key_exists("form"$context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.'37$this->source); })()), "p", [], "any"falsefalsefalse37), 'row');
  135.         yield "
  136.                         ";
  137.         // line 38
  138.         yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env$this->source, (isset($context["form"]) || array_key_exists("form"$context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.'38$this->source); })()), "tags", [], "any"falsefalsefalse38), 'row');
  139.         yield "
  140.                     ";
  141.         // line 39
  142.         if (CoreExtension::inFilter("ROLE_ADMIN"CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, (isset($context["app"]) || array_key_exists("app"$context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.'39$this->source); })()), "user", [], "any"falsefalsefalse39), "roles", [], "any"falsefalsefalse39))) {
  143.             // line 40
  144.             yield "                        ";
  145.             yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env$this->source, (isset($context["form"]) || array_key_exists("form"$context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.'40$this->source); })()), "ia", [], "any"falsefalsefalse40), 'row');
  146.             yield "
  147.                     ";
  148.         }
  149.         // line 42
  150.         yield "                    <button type=\"submit\" class=\"btn btn-grad rounded-pill\">Filtrer</button>
  151.                 </div>
  152.             ";
  153.         // line 44
  154.         yield         $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->renderBlock((isset($context["form"]) || array_key_exists("form"$context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.'44$this->source); })()), 'form_end');
  155.         yield "
  156.         </section>
  157.         <section>
  158.             <div class=\"results-filter\">
  159.                 <span>";
  160.         // line 49
  161.         yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape((isset($context["pageCount"]) || array_key_exists("pageCount"$context) ? $context["pageCount"] : (function () { throw new RuntimeError('Variable "pageCount" does not exist.'49$this->source); })()), "html"nulltrue);
  162.         yield " écussons pour cette recherche</span>
  163.             </div>
  164.             <div class=\"row block grid-collection\" id=\"content-collection\">
  165.                 ";
  166.         // line 52
  167.         $context['_parent'] = $context;
  168.         $context['_seq'] = CoreExtension::ensureTraversable((isset($context["models"]) || array_key_exists("models"$context) ? $context["models"] : (function () { throw new RuntimeError('Variable "models" does not exist.'52$this->source); })()));
  169.         foreach ($context['_seq'] as $context["_key"] => $context["model"]) {
  170.             // line 53
  171.             yield "                    <div class=\"card\">";
  172.             if (Twig\Extension\CoreExtension::testEmpty(CoreExtension::getAttribute($this->env$this->source$context["model"], "photos", [], "any"falsefalsefalse53))) {
  173.                 // line 54
  174.                 yield "                            <img src=\"/images/logo_ecusson_bleu_grand_format.png\" class=\"img-fluid rounded- \" alt=\"logo_ecusson_bleu_grand_format\">
  175.                         ";
  176.             } else {
  177.                 // line 56
  178.                 yield "                            <img style=\"height: 400px\" src=\"";
  179.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source$context["model"], "photos", [], "any"falsefalsefalse56), 0, [], "array"falsefalsefalse56), "chemin", [], "any"falsefalsefalse56), "html"nulltrue);
  180.                 yield "\" class=\"img-fluid rounded- \" alt=\"\">
  181.                         ";
  182.             }
  183.             // line 58
  184.             yield "                        ";
  185.             if ((($tmp CoreExtension::getAttribute($this->env$this->source$context["model"], "genereParIa", [], "any"falsefalsefalse58)) && $tmp instanceof Markup ? (string) $tmp $tmp)) {
  186.                 // line 59
  187.                 yield "                            <span class=\"btn-genere-ia ";
  188.                 if ((($tmp CoreExtension::getAttribute($this->env$this->source$context["model"], "iaValide", [], "any"falsefalsefalse59)) && $tmp instanceof Markup ? (string) $tmp $tmp)) {
  189.                     yield "ia-valide";
  190.                 }
  191.                 yield "\">inséré via IA</span>
  192.                         ";
  193.             }
  194.             // line 61
  195.             yield "                        <h5>";
  196.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["model"], "titre", [], "any"falsefalsefalse61), "html"nulltrue);
  197.             yield "</h5>
  198.                         ";
  199.             // line 62
  200.             if (CoreExtension::inFilter("ROLE_ADMIN"CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, (isset($context["app"]) || array_key_exists("app"$context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.'62$this->source); })()), "user", [], "any"falsefalsefalse62), "roles", [], "any"falsefalsefalse62))) {
  201.                 // line 63
  202.                 yield "                            <span class=\"qty\">x";
  203.                 yield (((CoreExtension::getAttribute($this->env$this->source$context["model"], "nb", [], "any"falsefalsefalse63) > 10)) ? ($this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["model"], "nb", [], "any"falsefalsefalse63), "html"nulltrue)) : ($this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(("0" CoreExtension::getAttribute($this->env$this->source$context["model"], "nb", [], "any"falsefalsefalse63)), "html"nulltrue)));
  204.                 yield "</span>
  205.                         ";
  206.             } else {
  207.                 // line 65
  208.                 yield "                            <br>
  209.                         ";
  210.             }
  211.             // line 67
  212.             yield "                        <div class=\"card-body\">
  213.                             <ul>
  214.                                 <li class=\"title-category\">Catégories :</li>
  215.                             ";
  216.             // line 70
  217.             $context['_parent'] = $context;
  218.             $context['_seq'] = CoreExtension::ensureTraversable(CoreExtension::getAttribute($this->env$this->source$context["model"], "categories", [], "any"falsefalsefalse70));
  219.             foreach ($context['_seq'] as $context["_key"] => $context["categorie"]) {
  220.                 // line 71
  221.                 yield "                                <li>
  222.                                     ";
  223.                 // line 72
  224.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["categorie"], "nom", [], "any"falsefalsefalse72), "html"nulltrue);
  225.                 yield "
  226.                                 </li>
  227.                             ";
  228.             }
  229.             $_parent $context['_parent'];
  230.             unset($context['_seq'], $context['_key'], $context['categorie'], $context['_parent']);
  231.             $context array_intersect_key($context$_parent) + $_parent;
  232.             // line 75
  233.             yield "                            </ul>
  234.                         </div>
  235.                         <div class=\"bottom-card\">
  236.                             <a href=\"";
  237.             // line 78
  238.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("app_model_show", ["id" => CoreExtension::getAttribute($this->env$this->source$context["model"], "id", [], "any"falsefalsefalse78)]), "html"nulltrue);
  239.             yield "\" class=\"link\" >En savoir plus</a>
  240.                         </div>
  241.                     </div>
  242.                 ";
  243.         }
  244.         $_parent $context['_parent'];
  245.         unset($context['_seq'], $context['_key'], $context['model'], $context['_parent']);
  246.         $context array_intersect_key($context$_parent) + $_parent;
  247.         // line 82
  248.         yield "            </div>
  249.             ";
  250.         // line 83
  251.         yield $this->extensions['Knp\Bundle\PaginatorBundle\Twig\Extension\PaginationExtension']->render($this->env, (isset($context["models"]) || array_key_exists("models"$context) ? $context["models"] : (function () { throw new RuntimeError('Variable "models" does not exist.'83$this->source); })()));
  252.         yield "
  253.         </div>
  254.     </section>
  255. ";
  256.         
  257.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  258.         
  259.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  260.         yield from [];
  261.     }
  262.     // line 89
  263.     /**
  264.      * @return iterable<null|scalar|\Stringable>
  265.      */
  266.     public function block_javascripts(array $context, array $blocks = []): iterable
  267.     {
  268.         $macros $this->macros;
  269.         $__internal_5a27a8ba21ca79b61932376b2fa922d2 $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  270.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""javascripts"));
  271.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  272.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""javascripts"));
  273.         // line 90
  274.         yield "    ";
  275.         yield $this->extensions['Symfony\WebpackEncoreBundle\Twig\EntryFilesTwigExtension']->renderWebpackScriptTags("app");
  276.         yield "
  277. ";
  278.         // line 92
  279.         yield "
  280. ";
  281.         // line 96
  282.         yield "
  283. ";
  284.         // line 98
  285.         yield "
  286. ";
  287.         // line 100
  288.         yield "
  289. ";
  290.         // line 106
  291.         yield "
  292. ";
  293.         // line 108
  294.         yield "
  295. ";
  296.         // line 114
  297.         yield "
  298. ";
  299.         // line 116
  300.         yield "
  301. ";
  302.         // line 118
  303.         yield "    <script type=\"text/javascript\">
  304.         // Fonction pour ajouter ou mettre à jour un paramètre d'URL
  305.         function updateURLParameter(url, param, value) {
  306.             var re = new RegExp(\"([?&])\" + param + \"=.*?(&|\$)\", \"i\");
  307.             var separator = url.indexOf('?') !== -1 ? \"&\" : \"?\";
  308.             if (url.match(re)) {
  309.                 return url.replace(re, '\$1' + param + \"=\" + value + '\$2');
  310.             } else {
  311.                 return url + separator + param + \"=\" + value;
  312.             }
  313.         }
  314.         let listButton = document.getElementById('list-button')
  315.         let gridButton = document.getElementById('grid-button')
  316.         let contentCollection = document.getElementById('content-collection')
  317.         // Récupérer le mode actuel depuis l'URL
  318.         const currentMode = new URLSearchParams(window.location.search).get('view');
  319.         if (currentMode === 'list') {
  320.             // Si le mode actuel est \"list\", activer le bouton \"list\" et appliquer la classe CSS
  321.             contentCollection.classList.remove('grid-collection');
  322.             contentCollection.classList.add('list-collection');
  323.             listButton.classList.add('active');
  324.             gridButton.classList.remove('active');
  325.         } else {
  326.             // Par défaut, activer le bouton \"grid\"
  327.             gridButton.classList.add('active');
  328.         }
  329.         listButton.addEventListener('click', () => {
  330.             // Lorsque l'utilisateur clique sur le bouton \"list\", mettre à jour l'URL avec le mode \"list\"
  331.             window.location.href = updateURLParameter(window.location.href, 'view', 'list');
  332.         })
  333.         gridButton.addEventListener('click', () => {
  334.             // Lorsque l'utilisateur clique sur le bouton \"grid\", mettre à jour l'URL avec le mode \"grid\"
  335.             window.location.href = updateURLParameter(window.location.href, 'view', 'grid');
  336.         })
  337.         \$('.select2').select2();
  338.     </script>
  339. ";
  340.         
  341.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  342.         
  343.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  344.         yield from [];
  345.     }
  346.     /**
  347.      * @codeCoverageIgnore
  348.      */
  349.     public function getTemplateName(): string
  350.     {
  351.         return "model/collection.html.twig";
  352.     }
  353.     /**
  354.      * @codeCoverageIgnore
  355.      */
  356.     public function isTraitable(): bool
  357.     {
  358.         return false;
  359.     }
  360.     /**
  361.      * @codeCoverageIgnore
  362.      */
  363.     public function getDebugInfo(): array
  364.     {
  365.         return array (  330 => 118,  327 => 116,  324 => 114,  321 => 108,  318 => 106,  315 => 100,  312 => 98,  309 => 96,  306 => 92,  301 => 90,  288 => 89,  272 => 83,  269 => 82,  259 => 78,  254 => 75,  245 => 72,  242 => 71,  238 => 70,  233 => 67,  229 => 65,  223 => 63,  221 => 62,  216 => 61,  208 => 59,  205 => 58,  199 => 56,  195 => 54,  192 => 53,  188 => 52,  182 => 49,  174 => 44,  170 => 42,  164 => 40,  162 => 39,  158 => 38,  154 => 37,  150 => 36,  146 => 35,  141 => 33,  129 => 24,  123 => 21,  117 => 18,  111 => 15,  105 => 11,  101 => 6,  88 => 5,  65 => 3,  42 => 1,);
  366.     }
  367.     public function getSourceContext(): Source
  368.     {
  369.         return new Source("{% extends 'base.html.twig' %}
  370. {% block title %}Collection complète{% endblock %}
  371. {% block body %}
  372.     <div style=\"width: 100%;\">
  373.         <section class='topPageCollection'>
  374. {#                <div class=\"firstPart\">#}
  375. {#                    <h3 class=\"lists-title\">Ecusson.</h3>#}
  376. {#                </div>#}
  377.                 <div class=\"subtitleCollection\">
  378.                     <span class=\"mt-5\">Le site est en cours de remplissage.<br>
  379.                     À venir, plus de 8 000 écussons. Merci de prendre contact pour plus d'informations.
  380.                     </span>
  381.                     <p>Nombre total d'écussons en base : {{ count }}</p>
  382.                 </div>
  383.             {{ form_start(form2, {'method': 'GET'}) }}
  384.                 <span class=\"searchPart\">
  385.                     <i class=\"fa-solid fa-magnifying-glass\" style=\"color: #ffffff;\"></i>
  386.                         {{ form_row(form2.search) }}
  387.                     <button type=\"submit\" class=\"btn btn-grad rounded-pill\">Rechercher</button>
  388.                 </span>
  389.             {{ form_end(form2) }}
  390.             <div class=\"converter-list\">
  391.                 <button id=\"list-button\">
  392.                     <i class=\"fa-solid fa-list\"></i>
  393.                 </button>
  394.                 <button id=\"grid-button\">
  395.                     <i class=\"fa-solid fa-table-cells-large\"></i>
  396.                 </button>
  397.             </div>
  398.             {{ form_start(form, {'method': 'GET'}) }}
  399.                 <div class=\"filterdiv\">
  400.                         {{ form_row(form.categorie) }}
  401.                         {{ form_row(form.sousCategorie) }}
  402.                         {{ form_row(form.p) }}
  403.                         {{ form_row(form.tags) }}
  404.                     {% if 'ROLE_ADMIN' in app.user.roles %}
  405.                         {{ form_row(form.ia) }}
  406.                     {% endif %}
  407.                     <button type=\"submit\" class=\"btn btn-grad rounded-pill\">Filtrer</button>
  408.                 </div>
  409.             {{ form_end(form) }}
  410.         </section>
  411.         <section>
  412.             <div class=\"results-filter\">
  413.                 <span>{{ pageCount }} écussons pour cette recherche</span>
  414.             </div>
  415.             <div class=\"row block grid-collection\" id=\"content-collection\">
  416.                 {% for model in models %}
  417.                     <div class=\"card\">{% if model.photos is empty %}
  418.                             <img src=\"/images/logo_ecusson_bleu_grand_format.png\" class=\"img-fluid rounded- \" alt=\"logo_ecusson_bleu_grand_format\">
  419.                         {% else %}
  420.                             <img style=\"height: 400px\" src=\"{{ model.photos[0].chemin }}\" class=\"img-fluid rounded- \" alt=\"\">
  421.                         {% endif %}
  422.                         {% if model.genereParIa %}
  423.                             <span class=\"btn-genere-ia {% if model.iaValide %}ia-valide{% endif %}\">inséré via IA</span>
  424.                         {% endif %}
  425.                         <h5>{{ model.titre }}</h5>
  426.                         {% if 'ROLE_ADMIN' in app.user.roles %}
  427.                             <span class=\"qty\">x{{ model.nb > 10 ? model.nb : '0'~model.nb }}</span>
  428.                         {% else %}
  429.                             <br>
  430.                         {% endif %}
  431.                         <div class=\"card-body\">
  432.                             <ul>
  433.                                 <li class=\"title-category\">Catégories :</li>
  434.                             {% for categorie in model.categories %}
  435.                                 <li>
  436.                                     {{ categorie.nom }}
  437.                                 </li>
  438.                             {% endfor %}
  439.                             </ul>
  440.                         </div>
  441.                         <div class=\"bottom-card\">
  442.                             <a href=\"{{ path('app_model_show', {'id':model.id}) }}\" class=\"link\" >En savoir plus</a>
  443.                         </div>
  444.                     </div>
  445.                 {% endfor %}
  446.             </div>
  447.             {{ knp_pagination_render(models) }}
  448.         </div>
  449.     </section>
  450. {% endblock %}
  451. {% block javascripts %}
  452.     {{ encore_entry_script_tags('app') }}
  453. {#    <script type=\"text/javascript\">#}
  454. {#        let listButton = document.getElementById('list-button')#}
  455. {#        let gridButton = document.getElementById('grid-button')#}
  456. {#        let contentCollection = document.getElementById('content-collection')#}
  457. {#        gridButton.classList.add('active')#}
  458. {#        listButton.addEventListener('click', () => {#}
  459. {#                contentCollection.classList.remove('grid-collection')#}
  460. {#                contentCollection.classList.add('list-collection')#}
  461. {#                listButton.classList.add('active')#}
  462. {#                gridButton.classList.remove('active')#}
  463. {#        })#}
  464. {#        gridButton.addEventListener('click', () => {#}
  465. {#            contentCollection.classList.remove('list-collection');#}
  466. {#            contentCollection.classList.add('grid-collection');#}
  467. {#            gridButton.classList.add('active');#}
  468. {#            listButton.classList.remove('active')#}
  469. {#        })#}
  470. {#        \$('.select2').select2();#}
  471. {#    </script>#}
  472.     <script type=\"text/javascript\">
  473.         // Fonction pour ajouter ou mettre à jour un paramètre d'URL
  474.         function updateURLParameter(url, param, value) {
  475.             var re = new RegExp(\"([?&])\" + param + \"=.*?(&|\$)\", \"i\");
  476.             var separator = url.indexOf('?') !== -1 ? \"&\" : \"?\";
  477.             if (url.match(re)) {
  478.                 return url.replace(re, '\$1' + param + \"=\" + value + '\$2');
  479.             } else {
  480.                 return url + separator + param + \"=\" + value;
  481.             }
  482.         }
  483.         let listButton = document.getElementById('list-button')
  484.         let gridButton = document.getElementById('grid-button')
  485.         let contentCollection = document.getElementById('content-collection')
  486.         // Récupérer le mode actuel depuis l'URL
  487.         const currentMode = new URLSearchParams(window.location.search).get('view');
  488.         if (currentMode === 'list') {
  489.             // Si le mode actuel est \"list\", activer le bouton \"list\" et appliquer la classe CSS
  490.             contentCollection.classList.remove('grid-collection');
  491.             contentCollection.classList.add('list-collection');
  492.             listButton.classList.add('active');
  493.             gridButton.classList.remove('active');
  494.         } else {
  495.             // Par défaut, activer le bouton \"grid\"
  496.             gridButton.classList.add('active');
  497.         }
  498.         listButton.addEventListener('click', () => {
  499.             // Lorsque l'utilisateur clique sur le bouton \"list\", mettre à jour l'URL avec le mode \"list\"
  500.             window.location.href = updateURLParameter(window.location.href, 'view', 'list');
  501.         })
  502.         gridButton.addEventListener('click', () => {
  503.             // Lorsque l'utilisateur clique sur le bouton \"grid\", mettre à jour l'URL avec le mode \"grid\"
  504.             window.location.href = updateURLParameter(window.location.href, 'view', 'grid');
  505.         })
  506.         \$('.select2').select2();
  507.     </script>
  508. {% endblock %}
  509. ""model/collection.html.twig""/var/www/php81/ecusson2026/templates/model/collection.html.twig");
  510.     }
  511. }