var/cache/dev/twig/f0/f0645d3c38b125cd6bc01be85bc0fa5e.php line 91

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_0ff2c966f17d14af9e34a20de2ffc07e 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.                     <button type=\"submit\" class=\"btn btn-grad rounded-pill\">Filtrer</button>
  141.                 </div>
  142.             ";
  143.         // line 41
  144.         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.'41$this->source); })()), 'form_end');
  145.         yield "
  146.         </section>
  147.         <section>
  148.             <div class=\"results-filter\">
  149.                 <span>";
  150.         // line 46
  151.         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.'46$this->source); })()), "html"nulltrue);
  152.         yield " écussons pour cette recherche</span>
  153.             </div>
  154.             <div class=\"row block grid-collection\" id=\"content-collection\">
  155.                 ";
  156.         // line 49
  157.         $context['_parent'] = $context;
  158.         $context['_seq'] = CoreExtension::ensureTraversable((isset($context["models"]) || array_key_exists("models"$context) ? $context["models"] : (function () { throw new RuntimeError('Variable "models" does not exist.'49$this->source); })()));
  159.         foreach ($context['_seq'] as $context["_key"] => $context["model"]) {
  160.             // line 50
  161.             yield "                    <div class=\"card\">";
  162.             if (Twig\Extension\CoreExtension::testEmpty(CoreExtension::getAttribute($this->env$this->source$context["model"], "photos", [], "any"falsefalsefalse50))) {
  163.                 // line 51
  164.                 yield "                            <img src=\"/images/logo_ecusson_bleu_grand_format.png\" class=\"img-fluid rounded- \" alt=\"logo_ecusson_bleu_grand_format\">
  165.                         ";
  166.             } else {
  167.                 // line 53
  168.                 yield "                            <img src=\"";
  169.                 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"falsefalsefalse53), 0, [], "array"falsefalsefalse53), "chemin", [], "any"falsefalsefalse53), "html"nulltrue);
  170.                 yield "\" class=\"img-fluid rounded- \" alt=\"\">
  171.                         ";
  172.             }
  173.             // line 55
  174.             yield "                        <h5>";
  175.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["model"], "titre", [], "any"falsefalsefalse55), "html"nulltrue);
  176.             yield "</h5>
  177.                         ";
  178.             // line 56
  179.             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.'56$this->source); })()), "user", [], "any"falsefalsefalse56), "roles", [], "any"falsefalsefalse56))) {
  180.                 // line 57
  181.                 yield "                            <span class=\"qty\">x";
  182.                 yield (((CoreExtension::getAttribute($this->env$this->source$context["model"], "nb", [], "any"falsefalsefalse57) > 10)) ? ($this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["model"], "nb", [], "any"falsefalsefalse57), "html"nulltrue)) : ($this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(("0" CoreExtension::getAttribute($this->env$this->source$context["model"], "nb", [], "any"falsefalsefalse57)), "html"nulltrue)));
  183.                 yield "</span>
  184.                         ";
  185.             } else {
  186.                 // line 59
  187.                 yield "                            <br>
  188.                         ";
  189.             }
  190.             // line 61
  191.             yield "                        <div class=\"card-body\">
  192.                             <ul>
  193.                                 <li class=\"title-category\">Catégories :</li>
  194.                             ";
  195.             // line 64
  196.             $context['_parent'] = $context;
  197.             $context['_seq'] = CoreExtension::ensureTraversable(CoreExtension::getAttribute($this->env$this->source$context["model"], "categories", [], "any"falsefalsefalse64));
  198.             foreach ($context['_seq'] as $context["_key"] => $context["categorie"]) {
  199.                 // line 65
  200.                 yield "                                <li>
  201.                                     ";
  202.                 // line 66
  203.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["categorie"], "nom", [], "any"falsefalsefalse66), "html"nulltrue);
  204.                 yield "
  205.                                 </li>
  206.                             ";
  207.             }
  208.             $_parent $context['_parent'];
  209.             unset($context['_seq'], $context['_key'], $context['categorie'], $context['_parent']);
  210.             $context array_intersect_key($context$_parent) + $_parent;
  211.             // line 69
  212.             yield "                            </ul>
  213.                         </div>
  214.                         <div class=\"bottom-card\">
  215.                             <a href=\"";
  216.             // line 72
  217.             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"falsefalsefalse72)]), "html"nulltrue);
  218.             yield "\" class=\"link\" >En savoir plus</a>
  219.                         </div>
  220.                     </div>
  221.                 ";
  222.         }
  223.         $_parent $context['_parent'];
  224.         unset($context['_seq'], $context['_key'], $context['model'], $context['_parent']);
  225.         $context array_intersect_key($context$_parent) + $_parent;
  226.         // line 76
  227.         yield "            </div>
  228.             ";
  229.         // line 77
  230.         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.'77$this->source); })()));
  231.         yield "
  232.         </div>
  233.     </section>
  234. ";
  235.         
  236.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  237.         
  238.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  239.         yield from [];
  240.     }
  241.     // line 83
  242.     /**
  243.      * @return iterable<null|scalar|\Stringable>
  244.      */
  245.     public function block_javascripts(array $context, array $blocks = []): iterable
  246.     {
  247.         $macros $this->macros;
  248.         $__internal_5a27a8ba21ca79b61932376b2fa922d2 $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  249.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""javascripts"));
  250.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  251.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""javascripts"));
  252.         // line 84
  253.         yield "    ";
  254.         yield $this->extensions['Symfony\WebpackEncoreBundle\Twig\EntryFilesTwigExtension']->renderWebpackScriptTags("app");
  255.         yield "
  256. ";
  257.         // line 86
  258.         yield "
  259. ";
  260.         // line 90
  261.         yield "
  262. ";
  263.         // line 92
  264.         yield "
  265. ";
  266.         // line 94
  267.         yield "
  268. ";
  269.         // line 100
  270.         yield "
  271. ";
  272.         // line 102
  273.         yield "
  274. ";
  275.         // line 108
  276.         yield "
  277. ";
  278.         // line 110
  279.         yield "
  280. ";
  281.         // line 112
  282.         yield "    <script type=\"text/javascript\">
  283.         // Fonction pour ajouter ou mettre à jour un paramètre d'URL
  284.         function updateURLParameter(url, param, value) {
  285.             var re = new RegExp(\"([?&])\" + param + \"=.*?(&|\$)\", \"i\");
  286.             var separator = url.indexOf('?') !== -1 ? \"&\" : \"?\";
  287.             if (url.match(re)) {
  288.                 return url.replace(re, '\$1' + param + \"=\" + value + '\$2');
  289.             } else {
  290.                 return url + separator + param + \"=\" + value;
  291.             }
  292.         }
  293.         let listButton = document.getElementById('list-button')
  294.         let gridButton = document.getElementById('grid-button')
  295.         let contentCollection = document.getElementById('content-collection')
  296.         // Récupérer le mode actuel depuis l'URL
  297.         const currentMode = new URLSearchParams(window.location.search).get('view');
  298.         if (currentMode === 'list') {
  299.             // Si le mode actuel est \"list\", activer le bouton \"list\" et appliquer la classe CSS
  300.             contentCollection.classList.remove('grid-collection');
  301.             contentCollection.classList.add('list-collection');
  302.             listButton.classList.add('active');
  303.             gridButton.classList.remove('active');
  304.         } else {
  305.             // Par défaut, activer le bouton \"grid\"
  306.             gridButton.classList.add('active');
  307.         }
  308.         listButton.addEventListener('click', () => {
  309.             // Lorsque l'utilisateur clique sur le bouton \"list\", mettre à jour l'URL avec le mode \"list\"
  310.             window.location.href = updateURLParameter(window.location.href, 'view', 'list');
  311.         })
  312.         gridButton.addEventListener('click', () => {
  313.             // Lorsque l'utilisateur clique sur le bouton \"grid\", mettre à jour l'URL avec le mode \"grid\"
  314.             window.location.href = updateURLParameter(window.location.href, 'view', 'grid');
  315.         })
  316.         \$('.select2').select2();
  317.     </script>
  318. ";
  319.         
  320.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  321.         
  322.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  323.         yield from [];
  324.     }
  325.     /**
  326.      * @codeCoverageIgnore
  327.      */
  328.     public function getTemplateName(): string
  329.     {
  330.         return "model/collection.html.twig";
  331.     }
  332.     /**
  333.      * @codeCoverageIgnore
  334.      */
  335.     public function isTraitable(): bool
  336.     {
  337.         return false;
  338.     }
  339.     /**
  340.      * @codeCoverageIgnore
  341.      */
  342.     public function getDebugInfo(): array
  343.     {
  344.         return array (  309 => 112,  306 => 110,  303 => 108,  300 => 102,  297 => 100,  294 => 94,  291 => 92,  288 => 90,  285 => 86,  280 => 84,  267 => 83,  251 => 77,  248 => 76,  238 => 72,  233 => 69,  224 => 66,  221 => 65,  217 => 64,  212 => 61,  208 => 59,  202 => 57,  200 => 56,  195 => 55,  189 => 53,  185 => 51,  182 => 50,  178 => 49,  172 => 46,  164 => 41,  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,);
  345.     }
  346.     public function getSourceContext(): Source
  347.     {
  348.         return new Source("{% extends 'base.html.twig' %}
  349. {% block title %}Collection complète{% endblock %}
  350. {% block body %}
  351.     <div style=\"width: 100%;\">
  352.         <section class='topPageCollection'>
  353. {#                <div class=\"firstPart\">#}
  354. {#                    <h3 class=\"lists-title\">Ecusson.</h3>#}
  355. {#                </div>#}
  356.                 <div class=\"subtitleCollection\">
  357.                     <span class=\"mt-5\">Le site est en cours de remplissage.<br>
  358.                     À venir, plus de 8 000 écussons. Merci de prendre contact pour plus d'informations.
  359.                     </span>
  360.                     <p>Nombre total d'écussons en base : {{ count }}</p>
  361.                 </div>
  362.             {{ form_start(form2, {'method': 'GET'}) }}
  363.                 <span class=\"searchPart\">
  364.                     <i class=\"fa-solid fa-magnifying-glass\" style=\"color: #ffffff;\"></i>
  365.                         {{ form_row(form2.search) }}
  366.                     <button type=\"submit\" class=\"btn btn-grad rounded-pill\">Rechercher</button>
  367.                 </span>
  368.             {{ form_end(form2) }}
  369.             <div class=\"converter-list\">
  370.                 <button id=\"list-button\">
  371.                     <i class=\"fa-solid fa-list\"></i>
  372.                 </button>
  373.                 <button id=\"grid-button\">
  374.                     <i class=\"fa-solid fa-table-cells-large\"></i>
  375.                 </button>
  376.             </div>
  377.             {{ form_start(form, {'method': 'GET'}) }}
  378.                 <div class=\"filterdiv\">
  379.                         {{ form_row(form.categorie) }}
  380.                         {{ form_row(form.sousCategorie) }}
  381.                         {{ form_row(form.p) }}
  382.                         {{ form_row(form.tags) }}
  383.                     <button type=\"submit\" class=\"btn btn-grad rounded-pill\">Filtrer</button>
  384.                 </div>
  385.             {{ form_end(form) }}
  386.         </section>
  387.         <section>
  388.             <div class=\"results-filter\">
  389.                 <span>{{ pageCount }} écussons pour cette recherche</span>
  390.             </div>
  391.             <div class=\"row block grid-collection\" id=\"content-collection\">
  392.                 {% for model in models %}
  393.                     <div class=\"card\">{% if model.photos is empty %}
  394.                             <img src=\"/images/logo_ecusson_bleu_grand_format.png\" class=\"img-fluid rounded- \" alt=\"logo_ecusson_bleu_grand_format\">
  395.                         {% else %}
  396.                             <img src=\"{{ model.photos[0].chemin }}\" class=\"img-fluid rounded- \" alt=\"\">
  397.                         {% endif %}
  398.                         <h5>{{ model.titre }}</h5>
  399.                         {% if 'ROLE_ADMIN' in app.user.roles %}
  400.                             <span class=\"qty\">x{{ model.nb > 10 ? model.nb : '0'~model.nb }}</span>
  401.                         {% else %}
  402.                             <br>
  403.                         {% endif %}
  404.                         <div class=\"card-body\">
  405.                             <ul>
  406.                                 <li class=\"title-category\">Catégories :</li>
  407.                             {% for categorie in model.categories %}
  408.                                 <li>
  409.                                     {{ categorie.nom }}
  410.                                 </li>
  411.                             {% endfor %}
  412.                             </ul>
  413.                         </div>
  414.                         <div class=\"bottom-card\">
  415.                             <a href=\"{{ path('app_model_show', {'id':model.id}) }}\" class=\"link\" >En savoir plus</a>
  416.                         </div>
  417.                     </div>
  418.                 {% endfor %}
  419.             </div>
  420.             {{ knp_pagination_render(models) }}
  421.         </div>
  422.     </section>
  423. {% endblock %}
  424. {% block javascripts %}
  425.     {{ encore_entry_script_tags('app') }}
  426. {#    <script type=\"text/javascript\">#}
  427. {#        let listButton = document.getElementById('list-button')#}
  428. {#        let gridButton = document.getElementById('grid-button')#}
  429. {#        let contentCollection = document.getElementById('content-collection')#}
  430. {#        gridButton.classList.add('active')#}
  431. {#        listButton.addEventListener('click', () => {#}
  432. {#                contentCollection.classList.remove('grid-collection')#}
  433. {#                contentCollection.classList.add('list-collection')#}
  434. {#                listButton.classList.add('active')#}
  435. {#                gridButton.classList.remove('active')#}
  436. {#        })#}
  437. {#        gridButton.addEventListener('click', () => {#}
  438. {#            contentCollection.classList.remove('list-collection');#}
  439. {#            contentCollection.classList.add('grid-collection');#}
  440. {#            gridButton.classList.add('active');#}
  441. {#            listButton.classList.remove('active')#}
  442. {#        })#}
  443. {#        \$('.select2').select2();#}
  444. {#    </script>#}
  445.     <script type=\"text/javascript\">
  446.         // Fonction pour ajouter ou mettre à jour un paramètre d'URL
  447.         function updateURLParameter(url, param, value) {
  448.             var re = new RegExp(\"([?&])\" + param + \"=.*?(&|\$)\", \"i\");
  449.             var separator = url.indexOf('?') !== -1 ? \"&\" : \"?\";
  450.             if (url.match(re)) {
  451.                 return url.replace(re, '\$1' + param + \"=\" + value + '\$2');
  452.             } else {
  453.                 return url + separator + param + \"=\" + value;
  454.             }
  455.         }
  456.         let listButton = document.getElementById('list-button')
  457.         let gridButton = document.getElementById('grid-button')
  458.         let contentCollection = document.getElementById('content-collection')
  459.         // Récupérer le mode actuel depuis l'URL
  460.         const currentMode = new URLSearchParams(window.location.search).get('view');
  461.         if (currentMode === 'list') {
  462.             // Si le mode actuel est \"list\", activer le bouton \"list\" et appliquer la classe CSS
  463.             contentCollection.classList.remove('grid-collection');
  464.             contentCollection.classList.add('list-collection');
  465.             listButton.classList.add('active');
  466.             gridButton.classList.remove('active');
  467.         } else {
  468.             // Par défaut, activer le bouton \"grid\"
  469.             gridButton.classList.add('active');
  470.         }
  471.         listButton.addEventListener('click', () => {
  472.             // Lorsque l'utilisateur clique sur le bouton \"list\", mettre à jour l'URL avec le mode \"list\"
  473.             window.location.href = updateURLParameter(window.location.href, 'view', 'list');
  474.         })
  475.         gridButton.addEventListener('click', () => {
  476.             // Lorsque l'utilisateur clique sur le bouton \"grid\", mettre à jour l'URL avec le mode \"grid\"
  477.             window.location.href = updateURLParameter(window.location.href, 'view', 'grid');
  478.         })
  479.         \$('.select2').select2();
  480.     </script>
  481. {% endblock %}
  482. ""model/collection.html.twig""/var/www/php81/ecusson2026/templates/model/collection.html.twig");
  483.     }
  484. }