var/cache/dev/twig/70/703501f5209cc48a39302122d62559ce.php line 44

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. /* search/index.html.twig */
  16. class __TwigTemplate_e74048c2f13401371e281ac6edc63a6e 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. ];
  31. }
  32. protected function doGetParent(array $context): bool|string|Template|TemplateWrapper
  33. {
  34. // line 1
  35. return "base.html.twig";
  36. }
  37. protected function doDisplay(array $context, array $blocks = []): iterable
  38. {
  39. $macros = $this->macros;
  40. $__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  41. $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "search/index.html.twig"));
  42. $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  43. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "search/index.html.twig"));
  44. $this->parent = $this->load("base.html.twig", 1);
  45. yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks));
  46. $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  47. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  48. }
  49. // line 3
  50. /**
  51. * @return iterable<null|scalar|\Stringable>
  52. */
  53. public function block_title(array $context, array $blocks = []): iterable
  54. {
  55. $macros = $this->macros;
  56. $__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  57. $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "title"));
  58. $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  59. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "title"));
  60. yield "Munganyo - Recherche d'actes et publications";
  61. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  62. $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  63. yield from [];
  64. }
  65. // line 5
  66. /**
  67. * @return iterable<null|scalar|\Stringable>
  68. */
  69. public function block_body(array $context, array $blocks = []): iterable
  70. {
  71. $macros = $this->macros;
  72. $__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  73. $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "body"));
  74. $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  75. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "body"));
  76. // line 6
  77. yield "
  78. ";
  79. // line 13
  80. yield "
  81. <!-- Hero Section Munganyo -->
  82. <section class=\"relative bg-gradient-to-br from-[#004d26] via-[#006633] to-[#008040] text-white overflow-hidden\">
  83. <div class=\"absolute inset-0 opacity-10 pointer-events-none\">
  84. <div class=\"absolute top-10 left-0 w-80 h-80 bg-white rounded-full blur-3xl\"></div>
  85. <div class=\"absolute bottom-0 right-0 w-[30rem] h-[30rem] bg-[#00994d] rounded-full blur-3xl\"></div>
  86. <!-- Pattern géométrique subtil -->
  87. <svg class=\"absolute inset-0 w-full h-full opacity-20\" xmlns=\"http://www.w3.org/2000/svg\">
  88. <pattern id=\"hex\" x=\"0\" y=\"0\" width=\"40\" height=\"40\" patternUnits=\"userSpaceOnUse\">
  89. <path d=\"M20 2 L38 12 L38 28 L20 38 L2 28 L2 12 Z\" fill=\"none\" stroke=\"white\" stroke-width=\"0.5\"/>
  90. </pattern>
  91. <rect width=\"100%\" height=\"100%\" fill=\"url(#hex)\" />
  92. </svg>
  93. </div>
  94. <div class=\"container mx-auto px-4 py-16 relative z-10\">
  95. <div class=\"max-w-4xl mx-auto text-center\">
  96. <!-- Badge moteur -->
  97. <div class=\"inline-flex items-center bg-white/15 backdrop-blur-sm rounded-full px-5 py-2 mb-5 border border-white/25\">
  98. <span class=\"w-2 h-2 rounded-full bg-emerald-300 animate-pulse mr-2\"></span>
  99. <span class=\"text-sm font-semibold tracking-wide\">Moteur Ibunas.IA
  100. ";
  101. // line 35
  102. if ((array_key_exists("isPremium", $context) && (isset($context["isPremium"]) || array_key_exists("isPremium", $context) ? $context["isPremium"] : (function () { throw new RuntimeError('Variable "isPremium" does not exist.', 35, $this->source); })()))) {
  103. // line 36
  104. yield " <span class=\"ml-2 bg-amber-400 text-amber-900 text-xs font-bold px-2 py-0.5 rounded-full\">PREMIUM</span>
  105. ";
  106. }
  107. // line 38
  108. yield " </span>
  109. </div>
  110. <h1 class=\"text-5xl md:text-6xl font-black mb-4 tracking-tight\">
  111. Munganyo
  112. <span class=\"block text-2xl md:text-3xl font-light opacity-90 mt-2\">Recherche avancée · Journal Officiel des Comores</span>
  113. </h1>
  114. <p class=\"text-white/80 mb-8 max-w-2xl mx-auto text-base leading-relaxed\">
  115. Accédez à l'ensemble des textes juridiques, actes officiels et annonces légales publiés au Journal Officiel de l'Union des Comores.
  116. </p>
  117. <!-- Barre de recherche principale -->
  118. <div class=\"max-w-2xl mx-auto\" id=\"hero-search-wrapper\">
  119. <div class=\"relative\">
  120. <i class=\"fas fa-search absolute left-5 top-1/2 -translate-y-1/2 text-gray-400 text-lg z-10\"></i>
  121. <input
  122. type=\"text\"
  123. id=\"main-search-input\"
  124. name=\"q\"
  125. value=\"";
  126. // line 57
  127. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(((array_key_exists("query", $context)) ? (Twig\Extension\CoreExtension::default((isset($context["query"]) || array_key_exists("query", $context) ? $context["query"] : (function () { throw new RuntimeError('Variable "query" does not exist.', 57, $this->source); })()), "")) : ("")), "html", null, true);
  128. yield "\"
  129. placeholder=\"Rechercher un décret, un arrêté, une annonce légale...\"
  130. autocomplete=\"off\"
  131. class=\"w-full pl-14 pr-36 py-5 text-gray-800 text-base rounded-full border-none shadow-2xl focus:outline-none focus:ring-4 focus:ring-[#006633]/40 transition-all duration-300\"
  132. >
  133. <button id=\"hero-search-btn\"
  134. class=\"absolute right-2 top-1/2 -translate-y-1/2 bg-gradient-to-r from-[#006633] to-[#008040] text-white px-6 py-2.5 rounded-full font-semibold hover:from-[#004d26] hover:to-[#006633] transition-all duration-300 shadow-md hover:shadow-lg\">
  135. <span class=\"hidden md:inline\"><i class=\"fas fa-arrow-right mr-1\"></i> Rechercher</span>
  136. <span class=\"md:hidden\"><i class=\"fas fa-arrow-right\"></i></span>
  137. </button>
  138. <!-- Autocomplete dropdown -->
  139. <div id=\"autocomplete-dropdown\"
  140. class=\"absolute top-full left-0 right-0 mt-2 bg-white rounded-2xl shadow-2xl border border-gray-100 hidden z-50 overflow-hidden\">
  141. </div>
  142. </div>
  143. <!-- Suggestions rapides -->
  144. <div class=\"flex flex-wrap justify-center gap-2 mt-4\">
  145. <span class=\"text-white/50 text-xs\">Tendances :</span>
  146. ";
  147. // line 76
  148. $context['_parent'] = $context;
  149. $context['_seq'] = CoreExtension::ensureTraversable(["Loi de finances", "Décret nomination", "Marché public", "Acte foncier Moroni", "Récépissé association"]);
  150. foreach ($context['_seq'] as $context["_key"] => $context["suggestion"]) {
  151. // line 77
  152. yield " <button type=\"button\" class=\"quick-suggestion text-white/80 hover:text-white text-xs underline-offset-2 hover:underline transition\">";
  153. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["suggestion"], "html", null, true);
  154. yield "</button>
  155. ";
  156. }
  157. $_parent = $context['_parent'];
  158. unset($context['_seq'], $context['_key'], $context['suggestion'], $context['_parent']);
  159. $context = array_intersect_key($context, $_parent) + $_parent;
  160. // line 79
  161. yield " </div>
  162. </div>
  163. <!-- Filtres rapides par type -->
  164. <div class=\"mt-8 flex flex-wrap justify-center gap-2\" id=\"quick-type-filters\">
  165. ";
  166. // line 84
  167. $context["quickTypes"] = [["val" => "", "label" => "Tous", "icon" => "fa-layer-group"], ["val" => "loi", "label" => "Lois", "icon" => "fa-gavel"], ["val" => "decret", "label" => "Décrets", "icon" => "fa-file-signature"], ["val" => "arrete", "label" => "Arrêtés", "icon" => "fa-clipboard-list"], ["val" => "marche_public", "label" => "Marchés publics", "icon" => "fa-briefcase"], ["val" => "acte_foncier", "label" => "Foncier", "icon" => "fa-map-marker-alt"], ["val" => "enchere", "label" => "Enchères", "icon" => "fa-hammer"]];
  168. // line 93
  169. yield " ";
  170. $context['_parent'] = $context;
  171. $context['_seq'] = CoreExtension::ensureTraversable((isset($context["quickTypes"]) || array_key_exists("quickTypes", $context) ? $context["quickTypes"] : (function () { throw new RuntimeError('Variable "quickTypes" does not exist.', 93, $this->source); })()));
  172. foreach ($context['_seq'] as $context["_key"] => $context["qt"]) {
  173. // line 94
  174. yield " <button type=\"button\"
  175. data-type=\"";
  176. // line 95
  177. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["qt"], "val", [], "any", false, false, false, 95), "html", null, true);
  178. yield "\"
  179. class=\"quick-type-btn px-4 py-2 rounded-full text-sm font-medium transition-all duration-200
  180. ";
  181. // line 97
  182. if (((array_key_exists("typeFilter", $context) && ((isset($context["typeFilter"]) || array_key_exists("typeFilter", $context) ? $context["typeFilter"] : (function () { throw new RuntimeError('Variable "typeFilter" does not exist.', 97, $this->source); })()) == CoreExtension::getAttribute($this->env, $this->source, $context["qt"], "val", [], "any", false, false, false, 97))) || ((CoreExtension::getAttribute($this->env, $this->source, $context["qt"], "val", [], "any", false, false, false, 97) == "") && ( !array_key_exists("typeFilter", $context) || ((isset($context["typeFilter"]) || array_key_exists("typeFilter", $context) ? $context["typeFilter"] : (function () { throw new RuntimeError('Variable "typeFilter" does not exist.', 97, $this->source); })()) == ""))))) {
  183. // line 98
  184. yield " bg-white text-[#006633] shadow-lg
  185. ";
  186. } else {
  187. // line 100
  188. yield " bg-white/20 text-white hover:bg-white/30 border border-white/20
  189. ";
  190. }
  191. // line 101
  192. yield "\">
  193. <i class=\"fas ";
  194. // line 102
  195. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["qt"], "icon", [], "any", false, false, false, 102), "html", null, true);
  196. yield " mr-1 text-xs\"></i> ";
  197. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["qt"], "label", [], "any", false, false, false, 102), "html", null, true);
  198. yield "
  199. </button>
  200. ";
  201. }
  202. $_parent = $context['_parent'];
  203. unset($context['_seq'], $context['_key'], $context['qt'], $context['_parent']);
  204. $context = array_intersect_key($context, $_parent) + $_parent;
  205. // line 105
  206. yield " </div>
  207. </div>
  208. </div>
  209. <div class=\"absolute bottom-0 left-0 right-0\">
  210. <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1440 80\" class=\"w-full\">
  211. <path fill=\"#f3f4f6\" fill-opacity=\"1\" d=\"M0,40L60,45C120,50,240,60,360,62C480,64,600,58,720,52C840,46,960,40,1080,42C1200,44,1320,54,1380,58L1440,62L1440,80L0,80Z\"></path>
  212. </svg>
  213. </div>
  214. </section>
  215. <!-- ============================================================
  216. FILTRES AVANCÉS (CDC: 3 filtres officiels + 2 supplémentaires)
  217. ============================================================ -->
  218. <section class=\"py-8 bg-gray-50\" id=\"filters-section\">
  219. <div class=\"container mx-auto px-4\">
  220. <div class=\"max-w-6xl mx-auto\">
  221. <!-- Header filtres + toggle -->
  222. <div class=\"flex flex-wrap items-center justify-between gap-3 mb-4\">
  223. <div class=\"flex items-center gap-3\">
  224. <h2 class=\"text-sm font-bold text-gray-700 uppercase tracking-widest\">
  225. <i class=\"fas fa-sliders-h text-[#006633] mr-2\"></i> Affiner la recherche
  226. </h2>
  227. <!-- Compteur filtres actifs -->
  228. <span id=\"active-filters-count\"
  229. class=\"hidden bg-[#006633] text-white text-xs font-bold px-2.5 py-1 rounded-full\">
  230. 0
  231. </span>
  232. </div>
  233. <div class=\"flex items-center gap-3\">
  234. <button id=\"toggle-filters-btn\"
  235. class=\"flex items-center gap-2 text-sm text-gray-600 hover:text-[#006633] transition font-medium\">
  236. <i class=\"fas fa-chevron-down transition-transform duration-300\" id=\"toggle-filters-icon\"></i>
  237. <span id=\"toggle-filters-label\">Masquer les filtres</span>
  238. </button>
  239. <button id=\"reset-filters-btn\"
  240. class=\"hidden text-sm text-red-500 hover:text-red-700 transition font-medium\">
  241. <i class=\"fas fa-times-circle mr-1\"></i> Réinitialiser
  242. </button>
  243. </div>
  244. </div>
  245. <!-- Chips des filtres actifs -->
  246. <div id=\"active-filter-chips\" class=\"flex flex-wrap gap-2 mb-4 empty:hidden\"></div>
  247. <!-- Panel des filtres -->
  248. <div id=\"filters-panel\" class=\"bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden transition-all duration-300\">
  249. <form id=\"advanced-search-form\" class=\"p-5\">
  250. <div class=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-4\">
  251. <!-- FILTRE 1 : Institution émettrice (CDC) -->
  252. <div class=\"xl:col-span-2\">
  253. <label class=\"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2\">
  254. <i class=\"fas fa-landmark text-[#006633] mr-1\"></i> Institution émettrice
  255. </label>
  256. <select name=\"institution\" id=\"filter-institution\"
  257. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40 bg-white\">
  258. <option value=\"\">Toutes les institutions</option>
  259. <optgroup label=\"🇰🇲 Union des Comores\">
  260. <option value=\"presidence\" ";
  261. // line 167
  262. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 167) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 167, $this->source); })()), "institution", [], "any", false, false, false, 167) == "presidence"))) {
  263. yield "selected";
  264. }
  265. yield ">Présidence de l'Union</option>
  266. <option value=\"assemblee_nationale\" ";
  267. // line 168
  268. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 168) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 168, $this->source); })()), "institution", [], "any", false, false, false, 168) == "assemblee_nationale"))) {
  269. yield "selected";
  270. }
  271. yield ">Assemblée Nationale</option>
  272. <option value=\"sgg\" ";
  273. // line 169
  274. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 169) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 169, $this->source); })()), "institution", [], "any", false, false, false, 169) == "sgg"))) {
  275. yield "selected";
  276. }
  277. yield ">Secrétariat Général du Gouvernement</option>
  278. <option value=\"vice_presidence\" ";
  279. // line 170
  280. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 170) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 170, $this->source); })()), "institution", [], "any", false, false, false, 170) == "vice_presidence"))) {
  281. yield "selected";
  282. }
  283. yield ">Vice-Présidence</option>
  284. <option value=\"finances\" ";
  285. // line 171
  286. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 171) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 171, $this->source); })()), "institution", [], "any", false, false, false, 171) == "finances"))) {
  287. yield "selected";
  288. }
  289. yield ">Ministère des Finances</option>
  290. <option value=\"justice\" ";
  291. // line 172
  292. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 172) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 172, $this->source); })()), "institution", [], "any", false, false, false, 172) == "justice"))) {
  293. yield "selected";
  294. }
  295. yield ">Ministère de la Justice</option>
  296. <option value=\"interieur\" ";
  297. // line 173
  298. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 173) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 173, $this->source); })()), "institution", [], "any", false, false, false, 173) == "interieur"))) {
  299. yield "selected";
  300. }
  301. yield ">Ministère de l'Intérieur</option>
  302. <option value=\"sante\" ";
  303. // line 174
  304. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 174) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 174, $this->source); })()), "institution", [], "any", false, false, false, 174) == "sante"))) {
  305. yield "selected";
  306. }
  307. yield ">Ministère de la Santé</option>
  308. <option value=\"education\" ";
  309. // line 175
  310. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 175) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 175, $this->source); })()), "institution", [], "any", false, false, false, 175) == "education"))) {
  311. yield "selected";
  312. }
  313. yield ">Ministère de l'Éducation</option>
  314. <option value=\"transport\" ";
  315. // line 176
  316. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 176) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 176, $this->source); })()), "institution", [], "any", false, false, false, 176) == "transport"))) {
  317. yield "selected";
  318. }
  319. yield ">Ministère du Transport</option>
  320. <option value=\"agriculture\" ";
  321. // line 177
  322. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 177) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 177, $this->source); })()), "institution", [], "any", false, false, false, 177) == "agriculture"))) {
  323. yield "selected";
  324. }
  325. yield ">Ministère de l'Agriculture</option>
  326. <option value=\"travaux_publics\" ";
  327. // line 178
  328. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 178) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 178, $this->source); })()), "institution", [], "any", false, false, false, 178) == "travaux_publics"))) {
  329. yield "selected";
  330. }
  331. yield ">Ministère des Travaux Publics</option>
  332. <option value=\"autres_ministeres\" ";
  333. // line 179
  334. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 179) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 179, $this->source); })()), "institution", [], "any", false, false, false, 179) == "autres_ministeres"))) {
  335. yield "selected";
  336. }
  337. yield ">Autres ministères</option>
  338. </optgroup>
  339. <optgroup label=\"🏛 Gouvernorats\">
  340. <option value=\"gouvernorat_ngazidja\" ";
  341. // line 182
  342. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 182) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 182, $this->source); })()), "institution", [], "any", false, false, false, 182) == "gouvernorat_ngazidja"))) {
  343. yield "selected";
  344. }
  345. yield ">Gouvernorat de Ngazidja (Grande Comore)</option>
  346. <option value=\"gouvernorat_anjouan\" ";
  347. // line 183
  348. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 183) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 183, $this->source); })()), "institution", [], "any", false, false, false, 183) == "gouvernorat_anjouan"))) {
  349. yield "selected";
  350. }
  351. yield ">Gouvernorat d'Anjouan (Ndzuani)</option>
  352. <option value=\"gouvernorat_moheli\" ";
  353. // line 184
  354. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 184) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 184, $this->source); })()), "institution", [], "any", false, false, false, 184) == "gouvernorat_moheli"))) {
  355. yield "selected";
  356. }
  357. yield ">Gouvernorat de Mohéli (Mwali)</option>
  358. </optgroup>
  359. <optgroup label=\"⚖ Juridictions\">
  360. <option value=\"justice_cour_supreme\" ";
  361. // line 187
  362. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 187) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 187, $this->source); })()), "institution", [], "any", false, false, false, 187) == "justice_cour_supreme"))) {
  363. yield "selected";
  364. }
  365. yield ">Cour Suprême</option>
  366. <option value=\"justice_cour_appel\" ";
  367. // line 188
  368. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "institution", [], "any", true, true, false, 188) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 188, $this->source); })()), "institution", [], "any", false, false, false, 188) == "justice_cour_appel"))) {
  369. yield "selected";
  370. }
  371. yield ">Cour d'Appel</option>
  372. </optgroup>
  373. </select>
  374. </div>
  375. <!-- FILTRE 2 : Chronologique (CDC) -->
  376. <div>
  377. <label class=\"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2\">
  378. <i class=\"fas fa-calendar-alt text-[#006633] mr-1\"></i> Période
  379. </label>
  380. <select name=\"period\" id=\"filter-period\"
  381. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40 bg-white\">
  382. <option value=\"\">Toutes périodes</option>
  383. ";
  384. // line 201
  385. $context['_parent'] = $context;
  386. $context['_seq'] = CoreExtension::ensureTraversable(range(2026, 2018));
  387. foreach ($context['_seq'] as $context["_key"] => $context["yr"]) {
  388. // line 202
  389. yield " <option value=\"";
  390. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["yr"], "html", null, true);
  391. yield "\" ";
  392. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "period", [], "any", true, true, false, 202) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 202, $this->source); })()), "period", [], "any", false, false, false, 202) == ($context["yr"] . "")))) {
  393. yield "selected";
  394. }
  395. yield ">";
  396. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["yr"], "html", null, true);
  397. yield "</option>
  398. ";
  399. }
  400. $_parent = $context['_parent'];
  401. unset($context['_seq'], $context['_key'], $context['yr'], $context['_parent']);
  402. $context = array_intersect_key($context, $_parent) + $_parent;
  403. // line 204
  404. yield " <option value=\"custom\" ";
  405. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "period", [], "any", true, true, false, 204) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 204, $this->source); })()), "period", [], "any", false, false, false, 204) == "custom"))) {
  406. yield "selected";
  407. }
  408. yield ">Période personnalisée</option>
  409. </select>
  410. <!-- Dates personnalisées -->
  411. <div id=\"custom-dates-panel\" class=\"mt-2 space-y-1.5 ";
  412. // line 207
  413. if (( !CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "period", [], "any", true, true, false, 207) || (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 207, $this->source); })()), "period", [], "any", false, false, false, 207) != "custom"))) {
  414. yield "hidden";
  415. }
  416. yield "\">
  417. <input type=\"date\" name=\"date_debut\" id=\"filter-date-debut\"
  418. value=\"";
  419. // line 209
  420. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "date_debut", [], "any", true, true, false, 209)) ? (Twig\Extension\CoreExtension::default(CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 209, $this->source); })()), "date_debut", [], "any", false, false, false, 209), "")) : ("")), "html", null, true);
  421. yield "\"
  422. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40\">
  423. <input type=\"date\" name=\"date_fin\" id=\"filter-date-fin\"
  424. value=\"";
  425. // line 212
  426. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "date_fin", [], "any", true, true, false, 212)) ? (Twig\Extension\CoreExtension::default(CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 212, $this->source); })()), "date_fin", [], "any", false, false, false, 212), "")) : ("")), "html", null, true);
  427. yield "\"
  428. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40\">
  429. </div>
  430. </div>
  431. <!-- FILTRE 3 : Type d'acte / annonces (CDC) -->
  432. <div>
  433. <label class=\"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2\">
  434. <i class=\"fas fa-file-alt text-[#006633] mr-1\"></i> Type d'acte
  435. </label>
  436. <select name=\"type\" id=\"filter-type\"
  437. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40 bg-white\">
  438. <option value=\"\">Tous les types</option>
  439. <optgroup label=\"📋 Actes officiels\">
  440. <option value=\"loi\" ";
  441. // line 226
  442. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "type", [], "any", true, true, false, 226) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 226, $this->source); })()), "type", [], "any", false, false, false, 226) == "loi"))) {
  443. yield "selected";
  444. }
  445. yield ">Lois</option>
  446. <option value=\"decret\" ";
  447. // line 227
  448. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "type", [], "any", true, true, false, 227) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 227, $this->source); })()), "type", [], "any", false, false, false, 227) == "decret"))) {
  449. yield "selected";
  450. }
  451. yield ">Décrets</option>
  452. <option value=\"arrete\" ";
  453. // line 228
  454. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "type", [], "any", true, true, false, 228) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 228, $this->source); })()), "type", [], "any", false, false, false, 228) == "arrete"))) {
  455. yield "selected";
  456. }
  457. yield ">Arrêtés</option>
  458. <option value=\"circulaire\" ";
  459. // line 229
  460. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "type", [], "any", true, true, false, 229) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 229, $this->source); })()), "type", [], "any", false, false, false, 229) == "circulaire"))) {
  461. yield "selected";
  462. }
  463. yield ">Circulaires</option>
  464. <option value=\"avis\" ";
  465. // line 230
  466. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "type", [], "any", true, true, false, 230) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 230, $this->source); })()), "type", [], "any", false, false, false, 230) == "avis"))) {
  467. yield "selected";
  468. }
  469. yield ">Avis officiels</option>
  470. </optgroup>
  471. <optgroup label=\"📢 Annonces légales\">
  472. <option value=\"marche_public\" ";
  473. // line 233
  474. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "type", [], "any", true, true, false, 233) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 233, $this->source); })()), "type", [], "any", false, false, false, 233) == "marche_public"))) {
  475. yield "selected";
  476. }
  477. yield ">Marchés publics & DSP</option>
  478. <option value=\"acte_foncier\" ";
  479. // line 234
  480. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "type", [], "any", true, true, false, 234) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 234, $this->source); })()), "type", [], "any", false, false, false, 234) == "acte_foncier"))) {
  481. yield "selected";
  482. }
  483. yield ">Réquisitions & actes fonciers</option>
  484. <option value=\"societe_rccm\" ";
  485. // line 235
  486. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "type", [], "any", true, true, false, 235) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 235, $this->source); })()), "type", [], "any", false, false, false, 235) == "societe_rccm"))) {
  487. yield "selected";
  488. }
  489. yield ">Actes RCCM/OHADA (sociétés)</option>
  490. <option value=\"enchere\" ";
  491. // line 236
  492. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "type", [], "any", true, true, false, 236) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 236, $this->source); })()), "type", [], "any", false, false, false, 236) == "enchere"))) {
  493. yield "selected";
  494. }
  495. yield ">Ventes aux enchères publiques</option>
  496. <option value=\"association\" ";
  497. // line 237
  498. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "type", [], "any", true, true, false, 237) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 237, $this->source); })()), "type", [], "any", false, false, false, 237) == "association"))) {
  499. yield "selected";
  500. }
  501. yield ">Récépissés associations</option>
  502. </optgroup>
  503. </select>
  504. </div>
  505. <!-- FILTRE 4 : Statut juridique (CDC: En vigueur / Abrogé…) -->
  506. <div>
  507. <label class=\"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2\">
  508. <i class=\"fas fa-balance-scale text-[#006633] mr-1\"></i> Statut juridique
  509. </label>
  510. <select name=\"statut\" id=\"filter-statut\"
  511. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40 bg-white\">
  512. <option value=\"\">Tous statuts</option>
  513. <option value=\"en_vigueur\" ";
  514. // line 250
  515. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "statut", [], "any", true, true, false, 250) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 250, $this->source); })()), "statut", [], "any", false, false, false, 250) == "en_vigueur"))) {
  516. yield "selected";
  517. }
  518. yield ">✅ En vigueur</option>
  519. <option value=\"modifie\" ";
  520. // line 251
  521. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "statut", [], "any", true, true, false, 251) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 251, $this->source); })()), "statut", [], "any", false, false, false, 251) == "modifie"))) {
  522. yield "selected";
  523. }
  524. yield ">✏️ Modifié</option>
  525. <option value=\"abroge\" ";
  526. // line 252
  527. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "statut", [], "any", true, true, false, 252) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 252, $this->source); })()), "statut", [], "any", false, false, false, 252) == "abroge"))) {
  528. yield "selected";
  529. }
  530. yield ">❌ Abrogé</option>
  531. <option value=\"suspendu\" ";
  532. // line 253
  533. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "statut", [], "any", true, true, false, 253) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 253, $this->source); })()), "statut", [], "any", false, false, false, 253) == "suspendu"))) {
  534. yield "selected";
  535. }
  536. yield ">⏸️ Suspendu</option>
  537. <option value=\"remplace\" ";
  538. // line 254
  539. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "statut", [], "any", true, true, false, 254) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 254, $this->source); })()), "statut", [], "any", false, false, false, 254) == "remplace"))) {
  540. yield "selected";
  541. }
  542. yield ">🔄 Remplacé</option>
  543. <option value=\"archive\" ";
  544. // line 255
  545. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "statut", [], "any", true, true, false, 255) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 255, $this->source); })()), "statut", [], "any", false, false, false, 255) == "archive"))) {
  546. yield "selected";
  547. }
  548. yield ">📦 Archivé</option>
  549. </select>
  550. </div>
  551. </div>
  552. <!-- Ligne 2 : Territoire + tri + submit -->
  553. <div class=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mt-4 pt-4 border-t border-gray-100\">
  554. <!-- Territoire applicable (CDC) -->
  555. <div>
  556. <label class=\"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2\">
  557. <i class=\"fas fa-map-marker-alt text-[#006633] mr-1\"></i> Territoire applicable
  558. </label>
  559. <select name=\"territoire\" id=\"filter-territoire\"
  560. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40 bg-white\">
  561. <option value=\"\">Toute l'Union</option>
  562. <option value=\"union\" ";
  563. // line 271
  564. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "territoire", [], "any", true, true, false, 271) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 271, $this->source); })()), "territoire", [], "any", false, false, false, 271) == "union"))) {
  565. yield "selected";
  566. }
  567. yield ">Union des Comores</option>
  568. <option value=\"ngazidja\" ";
  569. // line 272
  570. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "territoire", [], "any", true, true, false, 272) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 272, $this->source); })()), "territoire", [], "any", false, false, false, 272) == "ngazidja"))) {
  571. yield "selected";
  572. }
  573. yield ">Grande Comore (Ngazidja)</option>
  574. <option value=\"anjouan\" ";
  575. // line 273
  576. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "territoire", [], "any", true, true, false, 273) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 273, $this->source); })()), "territoire", [], "any", false, false, false, 273) == "anjouan"))) {
  577. yield "selected";
  578. }
  579. yield ">Anjouan (Ndzuani)</option>
  580. <option value=\"moheli\" ";
  581. // line 274
  582. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "territoire", [], "any", true, true, false, 274) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 274, $this->source); })()), "territoire", [], "any", false, false, false, 274) == "moheli"))) {
  583. yield "selected";
  584. }
  585. yield ">Mohéli (Mwali)</option>
  586. <option value=\"moroni\" ";
  587. // line 275
  588. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "territoire", [], "any", true, true, false, 275) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 275, $this->source); })()), "territoire", [], "any", false, false, false, 275) == "moroni"))) {
  589. yield "selected";
  590. }
  591. yield ">Moroni</option>
  592. <option value=\"mutsamudu\" ";
  593. // line 276
  594. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "territoire", [], "any", true, true, false, 276) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 276, $this->source); })()), "territoire", [], "any", false, false, false, 276) == "mutsamudu"))) {
  595. yield "selected";
  596. }
  597. yield ">Mutsamudu</option>
  598. <option value=\"fomboni\" ";
  599. // line 277
  600. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "territoire", [], "any", true, true, false, 277) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 277, $this->source); })()), "territoire", [], "any", false, false, false, 277) == "fomboni"))) {
  601. yield "selected";
  602. }
  603. yield ">Fomboni</option>
  604. </select>
  605. </div>
  606. <!-- Tri -->
  607. <div>
  608. <label class=\"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2\">
  609. <i class=\"fas fa-sort text-[#006633] mr-1\"></i> Trier par
  610. </label>
  611. <select name=\"sort\" id=\"filter-sort\"
  612. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40 bg-white\">
  613. <option value=\"date_desc\" ";
  614. // line 288
  615. if (( !CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "sort", [], "any", true, true, false, 288) || (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 288, $this->source); })()), "sort", [], "any", false, false, false, 288) == "date_desc"))) {
  616. yield "selected";
  617. }
  618. yield ">Date (récent → ancien)</option>
  619. <option value=\"date_asc\" ";
  620. // line 289
  621. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "sort", [], "any", true, true, false, 289) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 289, $this->source); })()), "sort", [], "any", false, false, false, 289) == "date_asc"))) {
  622. yield "selected";
  623. }
  624. yield ">Date (ancien → récent)</option>
  625. <option value=\"pertinence\" ";
  626. // line 290
  627. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "sort", [], "any", true, true, false, 290) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 290, $this->source); })()), "sort", [], "any", false, false, false, 290) == "pertinence"))) {
  628. yield "selected";
  629. }
  630. yield ">Pertinence</option>
  631. <option value=\"titre_asc\" ";
  632. // line 291
  633. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["filters"] ?? null), "sort", [], "any", true, true, false, 291) && (CoreExtension::getAttribute($this->env, $this->source, (isset($context["filters"]) || array_key_exists("filters", $context) ? $context["filters"] : (function () { throw new RuntimeError('Variable "filters" does not exist.', 291, $this->source); })()), "sort", [], "any", false, false, false, 291) == "titre_asc"))) {
  634. yield "selected";
  635. }
  636. yield ">Titre A → Z</option>
  637. </select>
  638. </div>
  639. <!-- Actions -->
  640. <div class=\"flex items-end gap-3\">
  641. <button type=\"submit\" id=\"apply-filters-btn\"
  642. class=\"flex-1 bg-gradient-to-r from-[#006633] to-[#008040] text-white px-5 py-2.5 rounded-xl hover:from-[#004d26] hover:to-[#006633] transition shadow-md font-semibold text-sm\">
  643. <i class=\"fas fa-search mr-2\"></i> Appliquer
  644. </button>
  645. <a href=\"";
  646. // line 301
  647. yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("app_search");
  648. yield "\"
  649. class=\"px-4 py-2.5 border border-gray-200 rounded-xl text-gray-500 hover:text-gray-700 hover:border-gray-300 transition text-sm font-medium\">
  650. <i class=\"fas fa-undo-alt\"></i>
  651. </a>
  652. </div>
  653. </div>
  654. </form>
  655. </div>
  656. </div>
  657. </div>
  658. </section>
  659. <!-- ============================================================
  660. ZONE DE RÉSULTATS
  661. ============================================================ -->
  662. <section class=\"py-10 bg-white min-h-[40vh]\" id=\"results-section\">
  663. <div class=\"container mx-auto px-4\">
  664. <div class=\"max-w-6xl mx-auto\">
  665. <!-- Barre de statut résultats -->
  666. <div id=\"results-status-bar\" class=\"flex flex-wrap items-center justify-between gap-3 mb-6 ";
  667. // line 322
  668. if (( !array_key_exists("query", $context) || Twig\Extension\CoreExtension::testEmpty((isset($context["query"]) || array_key_exists("query", $context) ? $context["query"] : (function () { throw new RuntimeError('Variable "query" does not exist.', 322, $this->source); })())))) {
  669. yield "hidden";
  670. }
  671. yield "\">
  672. <div class=\"flex items-center gap-3\">
  673. <!-- Spinner loading (caché par défaut) -->
  674. <div id=\"search-spinner\" class=\"hidden\">
  675. <svg class=\"animate-spin w-5 h-5 text-[#006633]\" fill=\"none\" viewBox=\"0 0 24 24\">
  676. <circle class=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" stroke-width=\"4\"></circle>
  677. <path class=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z\"></path>
  678. </svg>
  679. </div>
  680. <h2 class=\"text-base font-bold text-gray-800\" id=\"results-count-label\">
  681. ";
  682. // line 332
  683. if ((array_key_exists("query", $context) && !Twig\Extension\CoreExtension::testEmpty((isset($context["query"]) || array_key_exists("query", $context) ? $context["query"] : (function () { throw new RuntimeError('Variable "query" does not exist.', 332, $this->source); })())))) {
  684. // line 333
  685. yield " <span id=\"count-number\">";
  686. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(Twig\Extension\CoreExtension::length($this->env->getCharset(), (isset($context["results"]) || array_key_exists("results", $context) ? $context["results"] : (function () { throw new RuntimeError('Variable "results" does not exist.', 333, $this->source); })())), "html", null, true);
  687. yield "</span> résultat(s) pour
  688. <em class=\"text-[#006633] not-italic font-black\">\"";
  689. // line 334
  690. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape((isset($context["query"]) || array_key_exists("query", $context) ? $context["query"] : (function () { throw new RuntimeError('Variable "query" does not exist.', 334, $this->source); })()), "html", null, true);
  691. yield "\"</em>
  692. ";
  693. }
  694. // line 336
  695. yield " </h2>
  696. </div>
  697. <!-- Badge IA -->
  698. <div>
  699. ";
  700. // line 341
  701. if ((array_key_exists("isPremium", $context) && (isset($context["isPremium"]) || array_key_exists("isPremium", $context) ? $context["isPremium"] : (function () { throw new RuntimeError('Variable "isPremium" does not exist.', 341, $this->source); })()))) {
  702. // line 342
  703. yield " <div class=\"flex items-center gap-2 bg-gradient-to-r from-amber-50 to-yellow-50 border border-amber-200 text-amber-800 px-4 py-1.5 rounded-full text-sm font-semibold\">
  704. <i class=\"fas fa-microchip text-amber-500\"></i>
  705. Recherche enrichie Ibunas.IA activée
  706. </div>
  707. ";
  708. } else {
  709. // line 347
  710. yield " <a href=\"";
  711. yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("app_abonn");
  712. yield "\"
  713. class=\"flex items-center gap-2 bg-gray-50 border border-gray-200 text-gray-600 hover:border-[#006633] hover:text-[#006633] px-4 py-1.5 rounded-full text-sm font-medium transition\">
  714. <i class=\"fas fa-lock text-xs\"></i>
  715. Activer Ibunas.IA Premium
  716. </a>
  717. ";
  718. }
  719. // line 353
  720. yield " </div>
  721. </div>
  722. <!-- Liste des résultats (rendu SSR initial + remplacement AJAX) -->
  723. <div id=\"results-container\">
  724. ";
  725. // line 358
  726. if ((array_key_exists("query", $context) && !Twig\Extension\CoreExtension::testEmpty((isset($context["query"]) || array_key_exists("query", $context) ? $context["query"] : (function () { throw new RuntimeError('Variable "query" does not exist.', 358, $this->source); })())))) {
  727. // line 359
  728. yield " ";
  729. if ((array_key_exists("results", $context) && (Twig\Extension\CoreExtension::length($this->env->getCharset(), (isset($context["results"]) || array_key_exists("results", $context) ? $context["results"] : (function () { throw new RuntimeError('Variable "results" does not exist.', 359, $this->source); })())) > 0))) {
  730. // line 360
  731. yield " ";
  732. yield from $this->load("_partials/search_results_list.html.twig", 360)->unwrap()->yield(CoreExtension::merge($context, ["results" => (isset($context["results"]) || array_key_exists("results", $context) ? $context["results"] : (function () { throw new RuntimeError('Variable "results" does not exist.', 360, $this->source); })()), "isPremium" => (isset($context["isPremium"]) || array_key_exists("isPremium", $context) ? $context["isPremium"] : (function () { throw new RuntimeError('Variable "isPremium" does not exist.', 360, $this->source); })())]));
  733. // line 361
  734. yield " ";
  735. } else {
  736. // line 362
  737. yield " ";
  738. yield from $this->load("_partials/search_no_results.html.twig", 362)->unwrap()->yield(CoreExtension::merge($context, ["query" => (isset($context["query"]) || array_key_exists("query", $context) ? $context["query"] : (function () { throw new RuntimeError('Variable "query" does not exist.', 362, $this->source); })())]));
  739. // line 363
  740. yield " ";
  741. }
  742. // line 364
  743. yield " ";
  744. } else {
  745. // line 365
  746. yield " <!-- État d'accueil -->
  747. <div class=\"text-center py-16 bg-gradient-to-br from-gray-50 to-emerald-50/30 rounded-2xl border border-gray-100\" id=\"welcome-state\">
  748. <div class=\"w-20 h-20 bg-gradient-to-br from-[#006633] to-[#008040] rounded-2xl flex items-center justify-center mx-auto mb-5 shadow-lg\">
  749. <i class=\"fas fa-search text-2xl text-white\"></i>
  750. </div>
  751. <h2 class=\"text-2xl font-bold text-gray-800 mb-2\">Que recherchez-vous ?</h2>
  752. <p class=\"text-gray-500 max-w-md mx-auto mb-6 text-sm\">
  753. Textes législatifs, décrets présidentiels, arrêtés ministériels,
  754. marchés publics, actes fonciers… tout le Journal Officiel des Comores en un clic.
  755. </p>
  756. <div class=\"flex flex-wrap justify-center gap-3 text-xs text-gray-500\">
  757. <span class=\"px-3 py-1.5 bg-white rounded-full shadow-sm border border-gray-100\">
  758. <i class=\"fas fa-gavel text-purple-500 mr-1\"></i> \"Loi n°2026-…\"
  759. </span>
  760. <span class=\"px-3 py-1.5 bg-white rounded-full shadow-sm border border-gray-100\">
  761. <i class=\"fas fa-file-signature text-blue-500 mr-1\"></i> \"Décret nomination ministre\"
  762. </span>
  763. <span class=\"px-3 py-1.5 bg-white rounded-full shadow-sm border border-gray-100\">
  764. <i class=\"fas fa-map-marker-alt text-teal-500 mr-1\"></i> \"Actes fonciers Moroni\"
  765. </span>
  766. <span class=\"px-3 py-1.5 bg-white rounded-full shadow-sm border border-gray-100\">
  767. <i class=\"fas fa-briefcase text-emerald-500 mr-1\"></i> \"Appel d'offres travaux routiers\"
  768. </span>
  769. </div>
  770. </div>
  771. ";
  772. }
  773. // line 391
  774. yield " </div>
  775. <!-- Pagination (rendu SSR + remplacé par AJAX) -->
  776. <div id=\"pagination-container\">
  777. ";
  778. // line 395
  779. if ((array_key_exists("totalPages", $context) && ((isset($context["totalPages"]) || array_key_exists("totalPages", $context) ? $context["totalPages"] : (function () { throw new RuntimeError('Variable "totalPages" does not exist.', 395, $this->source); })()) > 1))) {
  780. // line 396
  781. yield " <nav class=\"flex justify-center mt-8\" aria-label=\"Pagination\">
  782. <ul class=\"flex items-center gap-1\">
  783. <li>
  784. <a href=\"";
  785. // line 399
  786. yield ((((isset($context["currentPage"]) || array_key_exists("currentPage", $context) ? $context["currentPage"] : (function () { throw new RuntimeError('Variable "currentPage" does not exist.', 399, $this->source); })()) > 1)) ? ($this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("app_search", ["page" => ((isset($context["currentPage"]) || array_key_exists("currentPage", $context) ? $context["currentPage"] : (function () { throw new RuntimeError('Variable "currentPage" does not exist.', 399, $this->source); })()) - 1), "q" => (isset($context["query"]) || array_key_exists("query", $context) ? $context["query"] : (function () { throw new RuntimeError('Variable "query" does not exist.', 399, $this->source); })())]), "html", null, true)) : ("#"));
  787. yield "\"
  788. class=\"flex items-center justify-center w-9 h-9 rounded-lg border border-gray-200 text-gray-500 hover:border-[#006633] hover:text-[#006633] transition text-sm ";
  789. // line 400
  790. if (((isset($context["currentPage"]) || array_key_exists("currentPage", $context) ? $context["currentPage"] : (function () { throw new RuntimeError('Variable "currentPage" does not exist.', 400, $this->source); })()) <= 1)) {
  791. yield "opacity-40 pointer-events-none";
  792. }
  793. yield "\">
  794. <i class=\"fas fa-chevron-left text-xs\"></i>
  795. </a>
  796. </li>
  797. ";
  798. // line 404
  799. $context['_parent'] = $context;
  800. $context['_seq'] = CoreExtension::ensureTraversable(range(1, (isset($context["totalPages"]) || array_key_exists("totalPages", $context) ? $context["totalPages"] : (function () { throw new RuntimeError('Variable "totalPages" does not exist.', 404, $this->source); })())));
  801. foreach ($context['_seq'] as $context["_key"] => $context["page"]) {
  802. // line 405
  803. yield " ";
  804. if (($context["page"] == (isset($context["currentPage"]) || array_key_exists("currentPage", $context) ? $context["currentPage"] : (function () { throw new RuntimeError('Variable "currentPage" does not exist.', 405, $this->source); })()))) {
  805. // line 406
  806. yield " <li><span class=\"flex items-center justify-center w-9 h-9 rounded-lg bg-[#006633] text-white font-bold text-sm\">";
  807. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["page"], "html", null, true);
  808. yield "</span></li>
  809. ";
  810. } elseif (((( // line 407
  811. $context["page"] <= 3) || ($context["page"] >= ((isset($context["totalPages"]) || array_key_exists("totalPages", $context) ? $context["totalPages"] : (function () { throw new RuntimeError('Variable "totalPages" does not exist.', 407, $this->source); })()) - 2))) || (($context["page"] >= ((isset($context["currentPage"]) || array_key_exists("currentPage", $context) ? $context["currentPage"] : (function () { throw new RuntimeError('Variable "currentPage" does not exist.', 407, $this->source); })()) - 2)) && ($context["page"] <= ((isset($context["currentPage"]) || array_key_exists("currentPage", $context) ? $context["currentPage"] : (function () { throw new RuntimeError('Variable "currentPage" does not exist.', 407, $this->source); })()) + 2))))) {
  812. // line 408
  813. yield " <li>
  814. <a href=\"";
  815. // line 409
  816. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("app_search", ["page" => $context["page"], "q" => (isset($context["query"]) || array_key_exists("query", $context) ? $context["query"] : (function () { throw new RuntimeError('Variable "query" does not exist.', 409, $this->source); })())]), "html", null, true);
  817. yield "\"
  818. class=\"flex items-center justify-center w-9 h-9 rounded-lg border border-gray-200 text-gray-600 hover:border-[#006633] hover:text-[#006633] transition text-sm\">
  819. ";
  820. // line 411
  821. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["page"], "html", null, true);
  822. yield "
  823. </a>
  824. </li>
  825. ";
  826. } elseif ((( // line 414
  827. $context["page"] == 4) && ((isset($context["currentPage"]) || array_key_exists("currentPage", $context) ? $context["currentPage"] : (function () { throw new RuntimeError('Variable "currentPage" does not exist.', 414, $this->source); })()) > 6))) {
  828. // line 415
  829. yield " <li><span class=\"px-2 text-gray-400\">…</span></li>
  830. ";
  831. } elseif ((( // line 416
  832. $context["page"] == ((isset($context["totalPages"]) || array_key_exists("totalPages", $context) ? $context["totalPages"] : (function () { throw new RuntimeError('Variable "totalPages" does not exist.', 416, $this->source); })()) - 3)) && ((isset($context["currentPage"]) || array_key_exists("currentPage", $context) ? $context["currentPage"] : (function () { throw new RuntimeError('Variable "currentPage" does not exist.', 416, $this->source); })()) < ((isset($context["totalPages"]) || array_key_exists("totalPages", $context) ? $context["totalPages"] : (function () { throw new RuntimeError('Variable "totalPages" does not exist.', 416, $this->source); })()) - 5)))) {
  833. // line 417
  834. yield " <li><span class=\"px-2 text-gray-400\">…</span></li>
  835. ";
  836. }
  837. // line 419
  838. yield " ";
  839. }
  840. $_parent = $context['_parent'];
  841. unset($context['_seq'], $context['_key'], $context['page'], $context['_parent']);
  842. $context = array_intersect_key($context, $_parent) + $_parent;
  843. // line 420
  844. yield " <li>
  845. <a href=\"";
  846. // line 421
  847. yield ((((isset($context["currentPage"]) || array_key_exists("currentPage", $context) ? $context["currentPage"] : (function () { throw new RuntimeError('Variable "currentPage" does not exist.', 421, $this->source); })()) < (isset($context["totalPages"]) || array_key_exists("totalPages", $context) ? $context["totalPages"] : (function () { throw new RuntimeError('Variable "totalPages" does not exist.', 421, $this->source); })()))) ? ($this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("app_search", ["page" => ((isset($context["currentPage"]) || array_key_exists("currentPage", $context) ? $context["currentPage"] : (function () { throw new RuntimeError('Variable "currentPage" does not exist.', 421, $this->source); })()) + 1), "q" => (isset($context["query"]) || array_key_exists("query", $context) ? $context["query"] : (function () { throw new RuntimeError('Variable "query" does not exist.', 421, $this->source); })())]), "html", null, true)) : ("#"));
  848. yield "\"
  849. class=\"flex items-center justify-center w-9 h-9 rounded-lg border border-gray-200 text-gray-500 hover:border-[#006633] hover:text-[#006633] transition text-sm ";
  850. // line 422
  851. if (((isset($context["currentPage"]) || array_key_exists("currentPage", $context) ? $context["currentPage"] : (function () { throw new RuntimeError('Variable "currentPage" does not exist.', 422, $this->source); })()) >= (isset($context["totalPages"]) || array_key_exists("totalPages", $context) ? $context["totalPages"] : (function () { throw new RuntimeError('Variable "totalPages" does not exist.', 422, $this->source); })()))) {
  852. yield "opacity-40 pointer-events-none";
  853. }
  854. yield "\">
  855. <i class=\"fas fa-chevron-right text-xs\"></i>
  856. </a>
  857. </li>
  858. </ul>
  859. </nav>
  860. ";
  861. }
  862. // line 429
  863. yield " </div>
  864. </div>
  865. </div>
  866. </section>
  867. <!-- ============================================================
  868. CONSEILS + STATS (bas de page)
  869. ============================================================ -->
  870. <section class=\"py-10 bg-gray-50 border-t border-gray-100\">
  871. <div class=\"container mx-auto px-4\">
  872. <div class=\"max-w-6xl mx-auto\">
  873. <div class=\"grid grid-cols-1 md:grid-cols-3 gap-5\">
  874. <div class=\"bg-white rounded-xl p-5 shadow-sm border border-gray-100 flex gap-4 items-start\">
  875. <div class=\"w-10 h-10 bg-emerald-100 rounded-xl flex items-center justify-center flex-shrink-0\">
  876. <i class=\"fas fa-lightbulb text-[#006633]\"></i>
  877. </div>
  878. <div>
  879. <h3 class=\"font-semibold text-gray-800 text-sm mb-1\">Recherche par mots-clés</h3>
  880. <p class=\"text-xs text-gray-500\">Termes précis : \"impôt\", \"nomination\", \"foncier\", \"appel d'offres bâtiment\"</p>
  881. </div>
  882. </div>
  883. <div class=\"bg-white rounded-xl p-5 shadow-sm border border-gray-100 flex gap-4 items-start\">
  884. <div class=\"w-10 h-10 bg-emerald-100 rounded-xl flex items-center justify-center flex-shrink-0\">
  885. <i class=\"fas fa-hashtag text-[#006633]\"></i>
  886. </div>
  887. <div>
  888. <h3 class=\"font-semibold text-gray-800 text-sm mb-1\">Référence exacte</h3>
  889. <p class=\"text-xs text-gray-500\">Numéro d'acte : \"LOI-2026-015\", \"Décret 2026-045/PR\"</p>
  890. </div>
  891. </div>
  892. <div class=\"bg-white rounded-xl p-5 shadow-sm border border-gray-100 flex gap-4 items-start\">
  893. <div class=\"w-10 h-10 bg-amber-100 rounded-xl flex items-center justify-center flex-shrink-0\">
  894. <i class=\"fas fa-microchip text-amber-600\"></i>
  895. </div>
  896. <div>
  897. <h3 class=\"font-semibold text-gray-800 text-sm mb-1\">Recherche Ibunas.IA <span class=\"text-amber-600 text-xs font-bold\">PREMIUM</span></h3>
  898. <p class=\"text-xs text-gray-500\">Recherche dans le contenu des actes via OCR et intelligence artificielle</p>
  899. </div>
  900. </div>
  901. </div>
  902. </div>
  903. </div>
  904. </section>
  905. ";
  906. // line 568
  907. yield "
  908. <!-- ============================================================
  909. JAVASCRIPT DYNAMIQUE
  910. ============================================================ -->
  911. <script>
  912. (function () {
  913. 'use strict';
  914. // ─── Config ───────────────────────────────────────────────────────────────
  915. const SEARCH_URL = '";
  916. // line 578
  917. yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("app_search");
  918. yield "';
  919. const SEARCH_API_URL = '";
  920. // line 579
  921. yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("app_search_ajax");
  922. yield "'; // endpoint JSON
  923. const DEBOUNCE_MS = 400;
  924. const MIN_CHARS = 2;
  925. // ─── Éléments DOM ─────────────────────────────────────────────────────────
  926. const mainInput = document.getElementById('main-search-input');
  927. const heroBtnSearch = document.getElementById('hero-search-btn');
  928. const autocompleteBox = document.getElementById('autocomplete-dropdown');
  929. const resultsContainer = document.getElementById('results-container');
  930. const paginationCont = document.getElementById('pagination-container');
  931. const statusBar = document.getElementById('results-status-bar');
  932. const countNumber = document.getElementById('count-number');
  933. const countLabel = document.getElementById('results-count-label');
  934. const spinner = document.getElementById('search-spinner');
  935. const filterForm = document.getElementById('advanced-search-form');
  936. const filterSelects = filterForm.querySelectorAll('.search-filter');
  937. const resetBtn = document.getElementById('reset-filters-btn');
  938. const applyBtn = document.getElementById('apply-filters-btn');
  939. const activeCountBadge = document.getElementById('active-filters-count');
  940. const filterChips = document.getElementById('active-filter-chips');
  941. const toggleFiltersBtn = document.getElementById('toggle-filters-btn');
  942. const toggleFiltersIcon= document.getElementById('toggle-filters-icon');
  943. const toggleFiltersLbl = document.getElementById('toggle-filters-label');
  944. const filtersPanel = document.getElementById('filters-panel');
  945. const periodSelect = document.getElementById('filter-period');
  946. const customDatesPanel = document.getElementById('custom-dates-panel');
  947. const quickTypeBtns = document.querySelectorAll('.quick-type-btn');
  948. const quickSuggestions = document.querySelectorAll('.quick-suggestion');
  949. // ─── État ─────────────────────────────────────────────────────────────────
  950. let debounceTimer = null;
  951. let currentPage = 1;
  952. let filtersVisible = true;
  953. let lastQuery = mainInput ? mainInput.value.trim() : '';
  954. let currentParams = {};
  955. // ─── Noms lisibles des filtres pour les chips ─────────────────────────────
  956. const filterLabels = {
  957. institution: {
  958. presidence: 'Présidence de l\\'Union',
  959. assemblee_nationale: 'Assemblée Nationale',
  960. sgg: 'SGG',
  961. finances: 'Min. Finances',
  962. justice: 'Min. Justice',
  963. interieur: 'Min. Intérieur',
  964. sante: 'Min. Santé',
  965. education: 'Min. Éducation',
  966. gouvernorat_ngazidja: 'Gouvernorat Ngazidja',
  967. gouvernorat_anjouan: 'Gouvernorat Anjouan',
  968. gouvernorat_moheli: 'Gouvernorat Mohéli',
  969. vice_presidence: 'Vice-Présidence',
  970. transport: 'Min. Transport',
  971. agriculture: 'Min. Agriculture',
  972. travaux_publics: 'Min. Travaux Publics',
  973. autres_ministeres: 'Autres ministères',
  974. justice_cour_supreme: 'Cour Suprême',
  975. justice_cour_appel: 'Cour d\\'Appel',
  976. },
  977. type: {
  978. loi: 'Lois', decret: 'Décrets', arrete: 'Arrêtés',
  979. circulaire: 'Circulaires', avis: 'Avis officiels',
  980. marche_public: 'Marchés publics & DSP',
  981. acte_foncier: 'Réquisitions & actes fonciers',
  982. societe_rccm: 'Actes RCCM/OHADA',
  983. enchere: 'Ventes aux enchères',
  984. association: 'Récépissés associations',
  985. },
  986. statut: {
  987. en_vigueur: 'En vigueur', modifie: 'Modifié',
  988. abroge: 'Abrogé', suspendu: 'Suspendu',
  989. remplace: 'Remplacé', archive: 'Archivé',
  990. },
  991. territoire: {
  992. union: 'Union des Comores', ngazidja: 'Grande Comore',
  993. anjouan: 'Anjouan', moheli: 'Mohéli',
  994. moroni: 'Moroni', mutsamudu: 'Mutsamudu', fomboni: 'Fomboni',
  995. },
  996. sort: {
  997. date_desc: 'Récent → Ancien', date_asc: 'Ancien → Récent',
  998. pertinence: 'Pertinence', titre_asc: 'Titre A→Z',
  999. },
  1000. };
  1001. // ─── Utilitaires ──────────────────────────────────────────────────────────
  1002. function debounce(fn, delay) {
  1003. return function (...args) {
  1004. clearTimeout(debounceTimer);
  1005. debounceTimer = setTimeout(() => fn.apply(this, args), delay);
  1006. };
  1007. }
  1008. function getFormParams() {
  1009. const params = {};
  1010. if (mainInput && mainInput.value.trim()) params.q = mainInput.value.trim();
  1011. filterSelects.forEach(el => {
  1012. if (el.value) params[el.name] = el.value;
  1013. });
  1014. return params;
  1015. }
  1016. function buildQueryString(params) {
  1017. return Object.entries(params)
  1018. .filter(([, v]) => v)
  1019. .map(([k, v]) => `\${encodeURIComponent(k)}=\${encodeURIComponent(v)}`)
  1020. .join('&');
  1021. }
  1022. // ─── Chips filtres actifs ──────────────────────────────────────────────────
  1023. function updateFilterChips() {
  1024. if (!filterChips) return;
  1025. filterChips.innerHTML = '';
  1026. let count = 0;
  1027. filterSelects.forEach(el => {
  1028. if (!el.value || el.name === 'sort') return;
  1029. count++;
  1030. const label = (filterLabels[el.name] || {})[el.value] || el.value;
  1031. const chip = document.createElement('span');
  1032. chip.className = 'inline-flex items-center gap-1.5 bg-[#006633]/10 text-[#006633] border border-[#006633]/20 text-xs font-semibold px-3 py-1 rounded-full';
  1033. chip.innerHTML = `\${label} <button type=\"button\" data-filter=\"\${el.name}\" class=\"remove-chip ml-0.5 hover:text-red-500 transition\"><i class=\"fas fa-times text-[10px]\"></i></button>`;
  1034. filterChips.appendChild(chip);
  1035. });
  1036. // Badge compteur
  1037. if (count > 0) {
  1038. activeCountBadge.textContent = count;
  1039. activeCountBadge.classList.remove('hidden');
  1040. resetBtn.classList.remove('hidden');
  1041. } else {
  1042. activeCountBadge.classList.add('hidden');
  1043. resetBtn.classList.add('hidden');
  1044. }
  1045. // Clics sur remove-chip
  1046. filterChips.querySelectorAll('.remove-chip').forEach(btn => {
  1047. btn.addEventListener('click', () => {
  1048. const filterName = btn.dataset.filter;
  1049. const el = filterForm.querySelector(`[name=\"\${filterName}\"]`);
  1050. if (el) { el.value = ''; }
  1051. updateFilterChips();
  1052. triggerSearch(1);
  1053. });
  1054. });
  1055. }
  1056. // ─── Toggle panel filtres ─────────────────────────────────────────────────
  1057. if (toggleFiltersBtn) {
  1058. toggleFiltersBtn.addEventListener('click', () => {
  1059. filtersVisible = !filtersVisible;
  1060. filtersPanel.style.maxHeight = filtersVisible ? filtersPanel.scrollHeight + 'px' : '0';
  1061. filtersPanel.style.overflow = filtersVisible ? 'visible' : 'hidden';
  1062. toggleFiltersIcon.style.transform = filtersVisible ? 'rotate(0deg)' : 'rotate(-90deg)';
  1063. toggleFiltersLbl.textContent = filtersVisible ? 'Masquer les filtres' : 'Afficher les filtres';
  1064. });
  1065. }
  1066. // ─── Période personnalisée ────────────────────────────────────────────────
  1067. if (periodSelect) {
  1068. periodSelect.addEventListener('change', function () {
  1069. customDatesPanel.classList.toggle('hidden', this.value !== 'custom');
  1070. });
  1071. }
  1072. // ─── Boutons filtres rapides (Hero) ───────────────────────────────────────
  1073. quickTypeBtns.forEach(btn => {
  1074. btn.addEventListener('click', () => {
  1075. // Update visuel
  1076. quickTypeBtns.forEach(b => {
  1077. b.className = b.className.replace('bg-white text-[#006633] shadow-lg', 'bg-white/20 text-white hover:bg-white/30 border border-white/20');
  1078. });
  1079. btn.className = btn.className.replace('bg-white/20 text-white hover:bg-white/30 border border-white/20', 'bg-white text-[#006633] shadow-lg');
  1080. // Synchro avec le select type
  1081. const typeFilter = document.getElementById('filter-type');
  1082. if (typeFilter) typeFilter.value = btn.dataset.type;
  1083. updateFilterChips();
  1084. triggerSearch(1);
  1085. });
  1086. });
  1087. // ─── Suggestions rapides ──────────────────────────────────────────────────
  1088. quickSuggestions.forEach(btn => {
  1089. btn.addEventListener('click', () => {
  1090. if (mainInput) mainInput.value = btn.textContent.trim();
  1091. triggerSearch(1);
  1092. });
  1093. });
  1094. // ─── Autocomplete ─────────────────────────────────────────────────────────
  1095. const debouncedAutocomplete = debounce(fetchAutocomplete, 300);
  1096. if (mainInput) {
  1097. mainInput.addEventListener('input', function () {
  1098. const q = this.value.trim();
  1099. if (q.length >= MIN_CHARS) {
  1100. debouncedAutocomplete(q);
  1101. } else {
  1102. hideAutocomplete();
  1103. }
  1104. // Live search
  1105. debouncedSearch();
  1106. });
  1107. mainInput.addEventListener('keydown', function (e) {
  1108. if (e.key === 'Enter') {
  1109. e.preventDefault();
  1110. hideAutocomplete();
  1111. triggerSearch(1);
  1112. }
  1113. if (e.key === 'Escape') hideAutocomplete();
  1114. });
  1115. }
  1116. if (heroBtnSearch) {
  1117. heroBtnSearch.addEventListener('click', () => {
  1118. hideAutocomplete();
  1119. triggerSearch(1);
  1120. });
  1121. }
  1122. function hideAutocomplete() {
  1123. if (autocompleteBox) autocompleteBox.classList.add('hidden');
  1124. }
  1125. async function fetchAutocomplete(q) {
  1126. try {
  1127. const res = await fetch(`\${SEARCH_API_URL}?q=\${encodeURIComponent(q)}&autocomplete=1&limit=6`);
  1128. if (!res.ok) return;
  1129. const data = await res.json();
  1130. renderAutocomplete(data.suggestions || []);
  1131. } catch (e) {
  1132. // silencieux
  1133. }
  1134. }
  1135. function renderAutocomplete(suggestions) {
  1136. if (!autocompleteBox || suggestions.length === 0) {
  1137. hideAutocomplete();
  1138. return;
  1139. }
  1140. autocompleteBox.innerHTML = suggestions.map(s => `
  1141. <button type=\"button\" class=\"autocomplete-item w-full text-left px-4 py-3 hover:bg-emerald-50 flex items-center gap-3 border-b border-gray-50 last:border-none transition-colors\">
  1142. <i class=\"fas fa-search text-gray-300 text-xs flex-shrink-0\"></i>
  1143. <span class=\"text-sm text-gray-700\">\${escapeHtml(s.titre || s)}</span>
  1144. \${s.type ? `<span class=\"ml-auto text-xs text-gray-400 font-mono\">\${escapeHtml(s.type)}</span>` : ''}
  1145. </button>
  1146. `).join('');
  1147. autocompleteBox.classList.remove('hidden');
  1148. autocompleteBox.querySelectorAll('.autocomplete-item').forEach((item, idx) => {
  1149. item.addEventListener('click', () => {
  1150. const s = suggestions[idx];
  1151. if (mainInput) mainInput.value = s.titre || s;
  1152. hideAutocomplete();
  1153. triggerSearch(1);
  1154. });
  1155. });
  1156. }
  1157. document.addEventListener('click', e => {
  1158. if (!autocompleteBox?.contains(e.target) && e.target !== mainInput) hideAutocomplete();
  1159. });
  1160. // ─── Changement de filtre → rechargement live ─────────────────────────────
  1161. filterSelects.forEach(el => {
  1162. el.addEventListener('change', () => {
  1163. updateFilterChips();
  1164. if (el.name !== 'date_debut' && el.name !== 'date_fin') triggerSearch(1);
  1165. });
  1166. });
  1167. // Dates personnalisées: déclencher à la perte de focus
  1168. ['filter-date-debut', 'filter-date-fin'].forEach(id => {
  1169. const el = document.getElementById(id);
  1170. if (el) el.addEventListener('change', () => triggerSearch(1));
  1171. });
  1172. // ─── Formulaire submit ────────────────────────────────────────────────────
  1173. if (filterForm) {
  1174. filterForm.addEventListener('submit', e => {
  1175. e.preventDefault();
  1176. triggerSearch(1);
  1177. });
  1178. }
  1179. // ─── Recherche principale (AJAX) ──────────────────────────────────────────
  1180. const debouncedSearch = debounce(() => triggerSearch(1), DEBOUNCE_MS);
  1181. async function triggerSearch(page = 1) {
  1182. currentPage = page;
  1183. const params = getFormParams();
  1184. params.page = page;
  1185. currentParams = { ...params };
  1186. // Mettre à jour l'URL sans rechargement
  1187. const qs = buildQueryString(params);
  1188. window.history.replaceState({}, '', `\${SEARCH_URL}\${qs ? '?' + qs : ''}`);
  1189. if (!params.q && Object.keys(params).filter(k => k !== 'sort' && k !== 'page').length === 0) {
  1190. // Aucun critère: afficher état accueil
  1191. showWelcomeState();
  1192. return;
  1193. }
  1194. showLoading();
  1195. try {
  1196. const res = await fetch(`\${SEARCH_API_URL}?\${qs}`, {
  1197. headers: { 'X-Requested-With': 'XMLHttpRequest', 'Accept': 'application/json' }
  1198. });
  1199. // Si la route API n'existe pas encore (404/405/500), fallback SSR silencieux
  1200. if (res.status === 404 || res.status === 405) {
  1201. window.location.href = `\${SEARCH_URL}?\${qs}`;
  1202. return;
  1203. }
  1204. if (!res.ok) throw new Error('HTTP ' + res.status);
  1205. const data = await res.json();
  1206. renderResults(data, params.q || '');
  1207. } catch (err) {
  1208. // Erreur réseau : fallback vers SSR plutôt qu'afficher un message d'erreur
  1209. console.warn('[Munganyo] API indisponible, fallback SSR:', err.message);
  1210. window.location.href = `\${SEARCH_URL}?\${qs}`;
  1211. }
  1212. }
  1213. function showLoading() {
  1214. if (spinner) spinner.classList.remove('hidden');
  1215. if (statusBar) statusBar.classList.remove('hidden');
  1216. if (resultsContainer) {
  1217. resultsContainer.style.opacity = '0.4';
  1218. resultsContainer.style.pointerEvents = 'none';
  1219. }
  1220. }
  1221. function hideLoading() {
  1222. if (spinner) spinner.classList.add('hidden');
  1223. if (resultsContainer) {
  1224. resultsContainer.style.opacity = '1';
  1225. resultsContainer.style.pointerEvents = '';
  1226. }
  1227. }
  1228. function showWelcomeState() {
  1229. hideLoading();
  1230. if (statusBar) statusBar.classList.add('hidden');
  1231. if (resultsContainer) {
  1232. resultsContainer.innerHTML = document.getElementById('welcome-state')
  1233. ? document.getElementById('welcome-state').outerHTML
  1234. : `<div class=\"text-center py-16 text-gray-500\"><i class=\"fas fa-search text-4xl mb-4 text-gray-300\"></i><p>Effectuez une recherche ci-dessus</p></div>`;
  1235. }
  1236. if (paginationCont) paginationCont.innerHTML = '';
  1237. }
  1238. function showErrorState() {
  1239. hideLoading();
  1240. if (statusBar) statusBar.classList.add('hidden');
  1241. if (paginationCont) paginationCont.innerHTML = '';
  1242. const q = mainInput ? mainInput.value.trim() : '';
  1243. if (resultsContainer) {
  1244. resultsContainer.innerHTML = `
  1245. <div class=\"text-center py-16 bg-orange-50 rounded-2xl border border-orange-100\">
  1246. <div class=\"w-16 h-16 bg-orange-100 rounded-full flex items-center justify-center mx-auto mb-5\">
  1247. <i class=\"fas fa-wifi text-2xl text-orange-400\"></i>
  1248. </div>
  1249. <h3 class=\"text-lg font-semibold text-orange-700 mb-2\">Connexion temporairement indisponible</h3>
  1250. <p class=\"text-sm text-gray-500 max-w-sm mx-auto mb-5\">
  1251. La recherche en temps réel est momentanément inaccessible.
  1252. Vous pouvez relancer manuellement votre recherche.
  1253. </p>
  1254. <a href=\"\${SEARCH_URL}\${q ? '?q=' + encodeURIComponent(q) : ''}\"
  1255. class=\"inline-flex items-center gap-2 bg-[#006633] text-white px-6 py-2.5 rounded-xl text-sm font-semibold hover:bg-[#004d26] transition shadow-md\">
  1256. <i class=\"fas fa-redo-alt\"></i> Relancer la recherche
  1257. </a>
  1258. </div>`;
  1259. }
  1260. }
  1261. function renderResults(data, query) {
  1262. hideLoading();
  1263. // Mise à jour compteur
  1264. if (statusBar) statusBar.classList.remove('hidden');
  1265. if (countLabel) {
  1266. const q = query ? `pour <em class=\"text-[#006633] not-italic font-black\">\"\${escapeHtml(query)}\"</em>` : '';
  1267. countLabel.innerHTML = `<span id=\"count-number\">\${data.total || 0}</span> résultat(s) \${q}`;
  1268. }
  1269. // Résultats
  1270. if (!resultsContainer) return;
  1271. if (!data.results || data.results.length === 0) {
  1272. resultsContainer.innerHTML = renderNoResults(query);
  1273. } else {
  1274. resultsContainer.innerHTML = `<div class=\"space-y-4\">\${data.results.map(r => renderResultCard(r, data.isPremium)).join('')}</div>`;
  1275. }
  1276. // Pagination
  1277. if (paginationCont) {
  1278. paginationCont.innerHTML = data.totalPages > 1
  1279. ? renderPagination(data.currentPage, data.totalPages, currentParams)
  1280. : '';
  1281. }
  1282. // Scroll doux vers résultats
  1283. document.getElementById('results-section')?.scrollIntoView({ behavior: 'smooth', block: 'start' });
  1284. }
  1285. // ─── Rendu côté client (fallback / AJAX) ─────────────────────────────────
  1286. const TYPE_COLORS = {
  1287. loi: 'bg-purple-100 text-purple-700 border-purple-200',
  1288. decret: 'bg-blue-100 text-blue-700 border-blue-200',
  1289. arrete: 'bg-green-100 text-green-700 border-green-200',
  1290. circulaire: 'bg-cyan-100 text-cyan-700 border-cyan-200',
  1291. avis: 'bg-sky-100 text-sky-700 border-sky-200',
  1292. marche_public: 'bg-emerald-100 text-emerald-700 border-emerald-200',
  1293. acte_foncier: 'bg-teal-100 text-teal-700 border-teal-200',
  1294. societe_rccm: 'bg-indigo-100 text-indigo-700 border-indigo-200',
  1295. association: 'bg-amber-100 text-amber-700 border-amber-200',
  1296. enchere: 'bg-orange-100 text-orange-700 border-orange-200',
  1297. };
  1298. const TYPE_ICONS = {
  1299. loi: 'fa-gavel', decret: 'fa-file-signature', arrete: 'fa-clipboard-list',
  1300. circulaire: 'fa-envelope', avis: 'fa-bell', marche_public: 'fa-briefcase',
  1301. acte_foncier: 'fa-map-marker-alt', societe_rccm: 'fa-building',
  1302. association: 'fa-handshake', enchere: 'fa-hammer',
  1303. };
  1304. const STATUT_COLORS = {
  1305. en_vigueur: 'bg-green-50 text-green-600',
  1306. abroge: 'bg-red-50 text-red-600',
  1307. modifie: 'bg-yellow-50 text-yellow-700',
  1308. suspendu: 'bg-orange-50 text-orange-600',
  1309. };
  1310. function renderResultCard(r, isPremium) {
  1311. const colorClass = TYPE_COLORS[r.type] || 'bg-gray-100 text-gray-700 border-gray-200';
  1312. const iconClass = TYPE_ICONS[r.type] || 'fa-file-alt';
  1313. const statutClr = STATUT_COLORS[r.statutJuridique] || 'bg-gray-50 text-gray-500';
  1314. const date = r.datePublication ? new Date(r.datePublication).toLocaleDateString('fr-FR') : 'N/A';
  1315. return `
  1316. <article class=\"bg-white border border-gray-100 rounded-2xl shadow-sm hover:shadow-md transition-all duration-200 p-5 group\">
  1317. <div class=\"flex flex-wrap justify-between items-start gap-2 mb-3\">
  1318. <div class=\"flex flex-wrap items-center gap-2\">
  1319. <span class=\"inline-flex items-center gap-1.5 px-3 py-1 text-xs font-bold rounded-full border \${colorClass}\">
  1320. <i class=\"fas \${iconClass} text-[10px]\"></i> \${escapeHtml(r.typeLabel || r.type)}
  1321. </span>
  1322. \${r.numero ? `<span class=\"text-xs text-gray-400 font-mono bg-gray-50 px-2 py-0.5 rounded\">\${escapeHtml(r.numero)}</span>` : ''}
  1323. \${r.statutJuridique ? `<span class=\"text-xs px-2 py-0.5 rounded \${statutClr}\">\${escapeHtml(r.statutJuridique.replace('_', ' '))}</span>` : ''}
  1324. </div>
  1325. <time class=\"text-xs text-gray-400 flex items-center gap-1 flex-shrink-0\">
  1326. <i class=\"far fa-calendar-alt\"></i> \${date}
  1327. </time>
  1328. </div>
  1329. <h3 class=\"text-base font-bold text-gray-800 mb-2 group-hover:text-[#006633] transition leading-snug\">
  1330. <a href=\"/acte/\${r.id}\">\${escapeHtml(r.titre)}</a>
  1331. </h3>
  1332. \${r.resume ? `<p class=\"text-gray-500 text-sm mb-3 line-clamp-2\">\${escapeHtml(r.resume)}</p>` : ''}
  1333. \${isPremium && r.extrait ? `
  1334. <div class=\"mb-3 px-3 py-2 bg-amber-50 border-l-4 border-amber-400 rounded-r-lg text-xs text-gray-700\">
  1335. <i class=\"fas fa-quote-left text-amber-400 mr-1\"></i>\${escapeHtml(r.extrait)}
  1336. </div>` : ''}
  1337. <div class=\"flex flex-wrap items-center justify-between gap-2 pt-3 border-t border-gray-50\">
  1338. <div class=\"flex items-center gap-3 text-xs text-gray-500\">
  1339. \${r.institution ? `<span><i class=\"fas fa-landmark text-[#006633] mr-1\"></i>\${escapeHtml(r.institution)}</span>` : ''}
  1340. \${r.territoire ? `<span><i class=\"fas fa-map-marker-alt text-gray-400 mr-1\"></i>\${escapeHtml(r.territoire)}</span>` : ''}
  1341. \${isPremium && r.relevance ? `<span class=\"text-[#006633] font-semibold\"><i class=\"fas fa-chart-line mr-1\"></i>\${Math.round(r.relevance * 100)}%</span>` : ''}
  1342. </div>
  1343. <div class=\"flex items-center gap-3\">
  1344. <a href=\"/acte/\${r.id}\" class=\"text-xs text-[#006633] hover:text-[#008040] font-semibold flex items-center gap-1 transition\">
  1345. <i class=\"fas fa-eye\"></i> Consulter
  1346. </a>
  1347. \${r.pdf_url ? `<a href=\"\${escapeHtml(r.pdf_url)}\" target=\"_blank\" rel=\"noopener\" class=\"text-xs text-gray-400 hover:text-gray-600 flex items-center gap-1 transition\"><i class=\"fas fa-file-pdf\"></i> PDF</a>` : ''}
  1348. </div>
  1349. </div>
  1350. </article>`;
  1351. }
  1352. function renderNoResults(query) {
  1353. const activeFilters = [];
  1354. const typeEl = document.getElementById('filter-type');
  1355. const instEl = document.getElementById('filter-institution');
  1356. const periodEl = document.getElementById('filter-period');
  1357. if (typeEl && typeEl.options[typeEl.selectedIndex]?.text && typeEl.value)
  1358. activeFilters.push(typeEl.options[typeEl.selectedIndex].text);
  1359. if (instEl && instEl.options[instEl.selectedIndex]?.text && instEl.value)
  1360. activeFilters.push(instEl.options[instEl.selectedIndex].text);
  1361. if (periodEl && periodEl.value && periodEl.value !== 'custom')
  1362. activeFilters.push('année ' + periodEl.value);
  1363. let searchDesc = '';
  1364. if (query) searchDesc += `<strong class=\"text-gray-800\">&laquo;&nbsp;\${escapeHtml(query)}&nbsp;&raquo;</strong>`;
  1365. if (activeFilters.length) {
  1366. searchDesc += (query ? ' avec les filtres ' : 'les critères ');
  1367. searchDesc += activeFilters.map(f => `<span class=\"inline-flex items-center gap-1 bg-[#006633]/10 text-[#006633] text-xs font-semibold px-2 py-0.5 rounded-full\">\${escapeHtml(f)}</span>`).join(' ');
  1368. }
  1369. if (!searchDesc) searchDesc = 'ces critères de recherche';
  1370. return `
  1371. <div class=\"text-center py-16 bg-gray-50 rounded-2xl border border-gray-100\">
  1372. <div class=\"w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-5\">
  1373. <i class=\"fas fa-file-search text-2xl text-gray-400\"></i>
  1374. </div>
  1375. <h3 class=\"text-xl font-bold text-gray-800 mb-3\">
  1376. Aucun acte trouvé pour \${searchDesc}
  1377. </h3>
  1378. <p class=\"text-gray-500 text-sm max-w-md mx-auto mb-6 leading-relaxed\">
  1379. Votre recherche \${query ? `avec <strong class=\"text-gray-700\">&laquo;&nbsp;\${escapeHtml(query)}&nbsp;&raquo;</strong>` : ''} ne correspond
  1380. à aucun acte publié au Journal Officiel de l'Union des Comores.
  1381. </p>
  1382. <div class=\"flex flex-wrap justify-center gap-3 text-xs text-gray-500 mb-6\">
  1383. <span class=\"flex items-center gap-1.5 bg-white border border-gray-200 px-3 py-1.5 rounded-full shadow-sm\">
  1384. <i class=\"fas fa-lightbulb text-amber-400\"></i> Vérifiez l'orthographe des mots-clés
  1385. </span>
  1386. <span class=\"flex items-center gap-1.5 bg-white border border-gray-200 px-3 py-1.5 rounded-full shadow-sm\">
  1387. <i class=\"fas fa-expand-alt text-blue-400\"></i> Élargissez ou supprimez les filtres
  1388. </span>
  1389. <span class=\"flex items-center gap-1.5 bg-white border border-gray-200 px-3 py-1.5 rounded-full shadow-sm\">
  1390. <i class=\"fas fa-hashtag text-[#006633]\"></i> Essayez la référence exacte de l'acte
  1391. </span>
  1392. </div>
  1393. <div class=\"flex flex-wrap justify-center gap-3\">
  1394. <button type=\"button\" onclick=\"document.getElementById('main-search-input').value='';document.getElementById('filter-type').value='';document.getElementById('filter-institution').value='';triggerSearch(1);\"
  1395. class=\"inline-flex items-center gap-2 border border-gray-200 text-gray-600 px-5 py-2 rounded-xl text-sm font-medium hover:border-gray-300 hover:bg-gray-50 transition\">
  1396. <i class=\"fas fa-undo-alt text-xs\"></i> Réinitialiser la recherche
  1397. </button>
  1398. <a href=\"/abonnement\"
  1399. class=\"inline-flex items-center gap-2 bg-gradient-to-r from-amber-500 to-amber-400 text-white px-5 py-2 rounded-xl text-sm font-semibold hover:from-amber-600 hover:to-amber-500 transition shadow-md\">
  1400. <i class=\"fas fa-microchip text-xs\"></i> Activer Ibunas.IA Premium
  1401. </a>
  1402. </div>
  1403. </div>`;
  1404. }
  1405. function renderPagination(current, total, params) {
  1406. let pages = '';
  1407. for (let p = 1; p <= total; p++) {
  1408. if (p === current) {
  1409. pages += `<li><span class=\"flex items-center justify-center w-9 h-9 rounded-lg bg-[#006633] text-white font-bold text-sm\">\${p}</span></li>`;
  1410. } else if (p <= 3 || p >= total - 2 || Math.abs(p - current) <= 2) {
  1411. const ps = buildQueryString({ ...params, page: p });
  1412. pages += `<li><button type=\"button\" data-page=\"\${p}\" class=\"pagination-btn flex items-center justify-center w-9 h-9 rounded-lg border border-gray-200 text-gray-600 hover:border-[#006633] hover:text-[#006633] transition text-sm\">\${p}</button></li>`;
  1413. } else if (p === 4 && current > 6) {
  1414. pages += `<li><span class=\"px-2 text-gray-400\">…</span></li>`;
  1415. } else if (p === total - 3 && current < total - 5) {
  1416. pages += `<li><span class=\"px-2 text-gray-400\">…</span></li>`;
  1417. }
  1418. }
  1419. const prevDisabled = current <= 1 ? 'opacity-40 pointer-events-none' : '';
  1420. const nextDisabled = current >= total ? 'opacity-40 pointer-events-none' : '';
  1421. return `
  1422. <nav class=\"flex justify-center mt-8\" aria-label=\"Pagination\">
  1423. <ul class=\"flex items-center gap-1\">
  1424. <li><button type=\"button\" data-page=\"\${current - 1}\" class=\"pagination-btn flex items-center justify-center w-9 h-9 rounded-lg border border-gray-200 text-gray-500 hover:border-[#006633] hover:text-[#006633] transition text-sm \${prevDisabled}\"><i class=\"fas fa-chevron-left text-xs\"></i></button></li>
  1425. \${pages}
  1426. <li><button type=\"button\" data-page=\"\${current + 1}\" class=\"pagination-btn flex items-center justify-center w-9 h-9 rounded-lg border border-gray-200 text-gray-500 hover:border-[#006633] hover:text-[#006633] transition text-sm \${nextDisabled}\"><i class=\"fas fa-chevron-right text-xs\"></i></button></li>
  1427. </ul>
  1428. </nav>`;
  1429. }
  1430. // Délégation pour les boutons de pagination générés dynamiquement
  1431. document.addEventListener('click', e => {
  1432. const btn = e.target.closest('.pagination-btn');
  1433. if (btn) {
  1434. const page = parseInt(btn.dataset.page);
  1435. if (page && page > 0) triggerSearch(page);
  1436. }
  1437. });
  1438. // ─── XSS helper ───────────────────────────────────────────────────────────
  1439. function escapeHtml(str) {
  1440. if (!str) return '';
  1441. return String(str)
  1442. .replace(/&/g, '&amp;')
  1443. .replace(/</g, '&lt;')
  1444. .replace(/>/g, '&gt;')
  1445. .replace(/\"/g, '&quot;')
  1446. .replace(/'/g, '&#39;');
  1447. }
  1448. // ─── Init ─────────────────────────────────────────────────────────────────
  1449. function init() {
  1450. updateFilterChips();
  1451. // Si query présente dans l'URL au chargement, on l'affiche sans re-fetch (SSR)
  1452. // Si via navigation arrière/avant, on re-fetch
  1453. window.addEventListener('popstate', () => {
  1454. const urlParams = new URLSearchParams(window.location.search);
  1455. if (mainInput) mainInput.value = urlParams.get('q') || '';
  1456. filterSelects.forEach(el => {
  1457. el.value = urlParams.get(el.name) || '';
  1458. });
  1459. updateFilterChips();
  1460. const q = urlParams.get('q');
  1461. if (q) triggerSearch(parseInt(urlParams.get('page') || '1'));
  1462. });
  1463. }
  1464. init();
  1465. })();
  1466. </script>
  1467. ";
  1468. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  1469. $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  1470. yield from [];
  1471. }
  1472. // line 479
  1473. public function macro_renderResultCard($result = null, $isPremium = null, ...$varargs): string|Markup
  1474. {
  1475. $macros = $this->macros;
  1476. $context = [
  1477. "result" => $result,
  1478. "isPremium" => $isPremium,
  1479. "varargs" => $varargs,
  1480. ] + $this->env->getGlobals();
  1481. $blocks = [];
  1482. return ('' === $tmp = \Twig\Extension\CoreExtension::captureOutput((function () use (&$context, $macros, $blocks) {
  1483. $__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  1484. $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "macro", "renderResultCard"));
  1485. $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  1486. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "macro", "renderResultCard"));
  1487. // line 480
  1488. yield " ";
  1489. $context["typeColors"] = ["loi" => "bg-purple-100 text-purple-700 border-purple-200", "decret" => "bg-blue-100 text-blue-700 border-blue-200", "arrete" => "bg-green-100 text-green-700 border-green-200", "circulaire" => "bg-cyan-100 text-cyan-700 border-cyan-200", "avis" => "bg-sky-100 text-sky-700 border-sky-200", "marche_public" => "bg-emerald-100 text-emerald-700 border-emerald-200", "acte_foncier" => "bg-teal-100 text-teal-700 border-teal-200", "societe_rccm" => "bg-indigo-100 text-indigo-700 border-indigo-200", "association" => "bg-amber-100 text-amber-700 border-amber-200", "enchere" => "bg-orange-100 text-orange-700 border-orange-200"];
  1490. // line 492
  1491. yield " ";
  1492. $context["typeIcons"] = ["loi" => "fa-gavel", "decret" => "fa-file-signature", "arrete" => "fa-clipboard-list", "circulaire" => "fa-envelope", "avis" => "fa-bell", "marche_public" => "fa-briefcase", "acte_foncier" => "fa-map-marker-alt", "societe_rccm" => "fa-building", "association" => "fa-handshake", "enchere" => "fa-hammer"];
  1493. // line 499
  1494. yield " <article class=\"bg-white border border-gray-100 rounded-2xl shadow-sm hover:shadow-md transition-all duration-200 p-5 group\">
  1495. <div class=\"flex flex-wrap justify-between items-start gap-2 mb-3\">
  1496. <div class=\"flex flex-wrap items-center gap-2\">
  1497. <span class=\"inline-flex items-center gap-1.5 px-3 py-1 text-xs font-bold rounded-full border ";
  1498. // line 502
  1499. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(((CoreExtension::getAttribute($this->env, $this->source, ($context["typeColors"] ?? null), CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 502, $this->source); })()), "type", [], "any", false, false, false, 502), [], "array", true, true, false, 502)) ? (Twig\Extension\CoreExtension::default(CoreExtension::getAttribute($this->env, $this->source, (isset($context["typeColors"]) || array_key_exists("typeColors", $context) ? $context["typeColors"] : (function () { throw new RuntimeError('Variable "typeColors" does not exist.', 502, $this->source); })()), CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 502, $this->source); })()), "type", [], "any", false, false, false, 502), [], "array", false, false, false, 502), "bg-gray-100 text-gray-700 border-gray-200")) : ("bg-gray-100 text-gray-700 border-gray-200")), "html", null, true);
  1500. yield "\">
  1501. <i class=\"fas ";
  1502. // line 503
  1503. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(((CoreExtension::getAttribute($this->env, $this->source, ($context["typeIcons"] ?? null), CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 503, $this->source); })()), "type", [], "any", false, false, false, 503), [], "array", true, true, false, 503)) ? (Twig\Extension\CoreExtension::default(CoreExtension::getAttribute($this->env, $this->source, (isset($context["typeIcons"]) || array_key_exists("typeIcons", $context) ? $context["typeIcons"] : (function () { throw new RuntimeError('Variable "typeIcons" does not exist.', 503, $this->source); })()), CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 503, $this->source); })()), "type", [], "any", false, false, false, 503), [], "array", false, false, false, 503), "fa-file-alt")) : ("fa-file-alt")), "html", null, true);
  1504. yield " text-[10px]\"></i>
  1505. ";
  1506. // line 504
  1507. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(((CoreExtension::getAttribute($this->env, $this->source, ($context["result"] ?? null), "typeLabel", [], "any", true, true, false, 504)) ? (Twig\Extension\CoreExtension::default(CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 504, $this->source); })()), "typeLabel", [], "any", false, false, false, 504), Twig\Extension\CoreExtension::upper($this->env->getCharset(), CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 504, $this->source); })()), "type", [], "any", false, false, false, 504)))) : (Twig\Extension\CoreExtension::upper($this->env->getCharset(), CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 504, $this->source); })()), "type", [], "any", false, false, false, 504)))), "html", null, true);
  1508. yield "
  1509. </span>
  1510. ";
  1511. // line 506
  1512. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["result"] ?? null), "numero", [], "any", true, true, false, 506) && CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 506, $this->source); })()), "numero", [], "any", false, false, false, 506))) {
  1513. // line 507
  1514. yield " <span class=\"text-xs text-gray-400 font-mono bg-gray-50 px-2 py-0.5 rounded\">";
  1515. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 507, $this->source); })()), "numero", [], "any", false, false, false, 507), "html", null, true);
  1516. yield "</span>
  1517. ";
  1518. }
  1519. // line 509
  1520. yield " ";
  1521. if (CoreExtension::getAttribute($this->env, $this->source, ($context["result"] ?? null), "statutJuridique", [], "any", true, true, false, 509)) {
  1522. // line 510
  1523. yield " <span class=\"text-xs px-2 py-0.5 rounded
  1524. ";
  1525. // line 511
  1526. if ((CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 511, $this->source); })()), "statutJuridique", [], "any", false, false, false, 511) == "en_vigueur")) {
  1527. yield "bg-green-50 text-green-600
  1528. ";
  1529. } elseif ((CoreExtension::getAttribute($this->env, $this->source, // line 512
  1530. (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 512, $this->source); })()), "statutJuridique", [], "any", false, false, false, 512) == "abroge")) {
  1531. yield "bg-red-50 text-red-600
  1532. ";
  1533. } else {
  1534. // line 513
  1535. yield "bg-gray-50 text-gray-500";
  1536. }
  1537. yield "\">
  1538. ";
  1539. // line 514
  1540. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(Twig\Extension\CoreExtension::titleCase($this->env->getCharset(), Twig\Extension\CoreExtension::replace(CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 514, $this->source); })()), "statutJuridique", [], "any", false, false, false, 514), ["_" => " "])), "html", null, true);
  1541. yield "
  1542. </span>
  1543. ";
  1544. }
  1545. // line 517
  1546. yield " </div>
  1547. <time class=\"text-xs text-gray-400 flex items-center gap-1 flex-shrink-0\">
  1548. <i class=\"far fa-calendar-alt\"></i>
  1549. ";
  1550. // line 520
  1551. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Twig\Extension\CoreExtension']->formatDate(CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 520, $this->source); })()), "datePublication", [], "any", false, false, false, 520), "d/m/Y"), "html", null, true);
  1552. yield "
  1553. </time>
  1554. </div>
  1555. <h3 class=\"text-base font-bold text-gray-800 mb-2 group-hover:text-[#006633] transition leading-snug\">
  1556. <a href=\"";
  1557. // line 525
  1558. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("app_acte_show", ["id" => CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 525, $this->source); })()), "id", [], "any", false, false, false, 525)]), "html", null, true);
  1559. yield "\">";
  1560. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 525, $this->source); })()), "titre", [], "any", false, false, false, 525), "html", null, true);
  1561. yield "</a>
  1562. </h3>
  1563. ";
  1564. // line 528
  1565. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["result"] ?? null), "resume", [], "any", true, true, false, 528) && CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 528, $this->source); })()), "resume", [], "any", false, false, false, 528))) {
  1566. // line 529
  1567. yield " <p class=\"text-gray-500 text-sm mb-3 line-clamp-2\">";
  1568. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 529, $this->source); })()), "resume", [], "any", false, false, false, 529), "html", null, true);
  1569. yield "</p>
  1570. ";
  1571. }
  1572. // line 531
  1573. yield "
  1574. ";
  1575. // line 532
  1576. if ((((isset($context["isPremium"]) || array_key_exists("isPremium", $context) ? $context["isPremium"] : (function () { throw new RuntimeError('Variable "isPremium" does not exist.', 532, $this->source); })()) && CoreExtension::getAttribute($this->env, $this->source, ($context["result"] ?? null), "extrait", [], "any", true, true, false, 532)) && CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 532, $this->source); })()), "extrait", [], "any", false, false, false, 532))) {
  1577. // line 533
  1578. yield " <div class=\"mb-3 px-3 py-2 bg-amber-50 border-l-3 border-amber-400 rounded-r-lg text-xs text-gray-700\">
  1579. <i class=\"fas fa-quote-left text-amber-400 mr-1\"></i>
  1580. <span>";
  1581. // line 535
  1582. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 535, $this->source); })()), "extrait", [], "any", false, false, false, 535), "html", null, true);
  1583. yield "</span>
  1584. </div>
  1585. ";
  1586. }
  1587. // line 538
  1588. yield "
  1589. <div class=\"flex flex-wrap items-center justify-between gap-2 pt-3 border-t border-gray-50\">
  1590. <div class=\"flex items-center gap-3 text-xs text-gray-500\">
  1591. ";
  1592. // line 541
  1593. if (CoreExtension::getAttribute($this->env, $this->source, ($context["result"] ?? null), "institution", [], "any", true, true, false, 541)) {
  1594. // line 542
  1595. yield " <span><i class=\"fas fa-landmark text-[#006633] mr-1\"></i>";
  1596. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 542, $this->source); })()), "institution", [], "any", false, false, false, 542), "html", null, true);
  1597. yield "</span>
  1598. ";
  1599. }
  1600. // line 544
  1601. yield " ";
  1602. if (CoreExtension::getAttribute($this->env, $this->source, ($context["result"] ?? null), "territoire", [], "any", true, true, false, 544)) {
  1603. // line 545
  1604. yield " <span><i class=\"fas fa-map-marker-alt text-gray-400 mr-1\"></i>";
  1605. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 545, $this->source); })()), "territoire", [], "any", false, false, false, 545), "html", null, true);
  1606. yield "</span>
  1607. ";
  1608. }
  1609. // line 547
  1610. yield " ";
  1611. if (((isset($context["isPremium"]) || array_key_exists("isPremium", $context) ? $context["isPremium"] : (function () { throw new RuntimeError('Variable "isPremium" does not exist.', 547, $this->source); })()) && CoreExtension::getAttribute($this->env, $this->source, ($context["result"] ?? null), "relevance", [], "any", true, true, false, 547))) {
  1612. // line 548
  1613. yield " <span class=\"text-[#006633] font-semibold\">
  1614. <i class=\"fas fa-chart-line mr-1\"></i>";
  1615. // line 549
  1616. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(Twig\Extension\CoreExtension::round((CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 549, $this->source); })()), "relevance", [], "any", false, false, false, 549) * 100)), "html", null, true);
  1617. yield "% pertinent
  1618. </span>
  1619. ";
  1620. }
  1621. // line 552
  1622. yield " </div>
  1623. <div class=\"flex items-center gap-3\">
  1624. <a href=\"";
  1625. // line 554
  1626. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("app_acte_show", ["id" => CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 554, $this->source); })()), "id", [], "any", false, false, false, 554)]), "html", null, true);
  1627. yield "\"
  1628. class=\"text-xs text-[#006633] hover:text-[#008040] font-semibold flex items-center gap-1 transition\">
  1629. <i class=\"fas fa-eye\"></i> Consulter
  1630. </a>
  1631. ";
  1632. // line 558
  1633. if ((CoreExtension::getAttribute($this->env, $this->source, ($context["result"] ?? null), "pdf_url", [], "any", true, true, false, 558) && CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 558, $this->source); })()), "pdf_url", [], "any", false, false, false, 558))) {
  1634. // line 559
  1635. yield " <a href=\"";
  1636. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["result"]) || array_key_exists("result", $context) ? $context["result"] : (function () { throw new RuntimeError('Variable "result" does not exist.', 559, $this->source); })()), "pdf_url", [], "any", false, false, false, 559), "html", null, true);
  1637. yield "\" target=\"_blank\" rel=\"noopener\"
  1638. class=\"text-xs text-gray-400 hover:text-gray-600 flex items-center gap-1 transition\">
  1639. <i class=\"fas fa-file-pdf\"></i> PDF
  1640. </a>
  1641. ";
  1642. }
  1643. // line 564
  1644. yield " </div>
  1645. </div>
  1646. </article>
  1647. ";
  1648. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  1649. $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  1650. yield from [];
  1651. })())) ? '' : new Markup($tmp, $this->env->getCharset());
  1652. }
  1653. /**
  1654. * @codeCoverageIgnore
  1655. */
  1656. public function getTemplateName(): string
  1657. {
  1658. return "search/index.html.twig";
  1659. }
  1660. /**
  1661. * @codeCoverageIgnore
  1662. */
  1663. public function isTraitable(): bool
  1664. {
  1665. return false;
  1666. }
  1667. /**
  1668. * @codeCoverageIgnore
  1669. */
  1670. public function getDebugInfo(): array
  1671. {
  1672. return array ( 1772 => 564, 1763 => 559, 1761 => 558, 1754 => 554, 1750 => 552, 1744 => 549, 1741 => 548, 1738 => 547, 1732 => 545, 1729 => 544, 1723 => 542, 1721 => 541, 1716 => 538, 1710 => 535, 1706 => 533, 1704 => 532, 1701 => 531, 1695 => 529, 1693 => 528, 1685 => 525, 1677 => 520, 1672 => 517, 1666 => 514, 1661 => 513, 1656 => 512, 1652 => 511, 1649 => 510, 1646 => 509, 1640 => 507, 1638 => 506, 1633 => 504, 1629 => 503, 1625 => 502, 1620 => 499, 1617 => 492, 1614 => 480, 1595 => 479, 977 => 579, 973 => 578, 961 => 568, 913 => 429, 901 => 422, 897 => 421, 894 => 420, 888 => 419, 884 => 417, 882 => 416, 879 => 415, 877 => 414, 871 => 411, 866 => 409, 863 => 408, 861 => 407, 856 => 406, 853 => 405, 849 => 404, 840 => 400, 836 => 399, 831 => 396, 829 => 395, 823 => 391, 795 => 365, 792 => 364, 789 => 363, 786 => 362, 783 => 361, 780 => 360, 777 => 359, 775 => 358, 768 => 353, 758 => 347, 751 => 342, 749 => 341, 742 => 336, 737 => 334, 732 => 333, 730 => 332, 715 => 322, 691 => 301, 676 => 291, 670 => 290, 664 => 289, 658 => 288, 642 => 277, 636 => 276, 630 => 275, 624 => 274, 618 => 273, 612 => 272, 606 => 271, 585 => 255, 579 => 254, 573 => 253, 567 => 252, 561 => 251, 555 => 250, 537 => 237, 531 => 236, 525 => 235, 519 => 234, 513 => 233, 505 => 230, 499 => 229, 493 => 228, 487 => 227, 481 => 226, 464 => 212, 458 => 209, 451 => 207, 442 => 204, 427 => 202, 423 => 201, 405 => 188, 399 => 187, 391 => 184, 385 => 183, 379 => 182, 371 => 179, 365 => 178, 359 => 177, 353 => 176, 347 => 175, 341 => 174, 335 => 173, 329 => 172, 323 => 171, 317 => 170, 311 => 169, 305 => 168, 299 => 167, 235 => 105, 224 => 102, 221 => 101, 217 => 100, 213 => 98, 211 => 97, 206 => 95, 203 => 94, 198 => 93, 196 => 84, 189 => 79, 180 => 77, 176 => 76, 154 => 57, 133 => 38, 129 => 36, 127 => 35, 103 => 13, 100 => 6, 87 => 5, 64 => 3, 41 => 1,);
  1673. }
  1674. public function getSourceContext(): Source
  1675. {
  1676. return new Source("{% extends 'base.html.twig' %}
  1677. {% block title %}Munganyo - Recherche d'actes et publications{% endblock %}
  1678. {% block body %}
  1679. {# ================================================================
  1680. MUNGANYO — Moteur Ibunas.IA
  1681. CDC: 3 filtres obligatoires + enrichissement IA (Premium)
  1682. Institutions, Chronologique, Type d'acte/annonces
  1683. JS dynamique: debounce, AJAX, filter chips, autocomplete
  1684. ================================================================ #}
  1685. <!-- Hero Section Munganyo -->
  1686. <section class=\"relative bg-gradient-to-br from-[#004d26] via-[#006633] to-[#008040] text-white overflow-hidden\">
  1687. <div class=\"absolute inset-0 opacity-10 pointer-events-none\">
  1688. <div class=\"absolute top-10 left-0 w-80 h-80 bg-white rounded-full blur-3xl\"></div>
  1689. <div class=\"absolute bottom-0 right-0 w-[30rem] h-[30rem] bg-[#00994d] rounded-full blur-3xl\"></div>
  1690. <!-- Pattern géométrique subtil -->
  1691. <svg class=\"absolute inset-0 w-full h-full opacity-20\" xmlns=\"http://www.w3.org/2000/svg\">
  1692. <pattern id=\"hex\" x=\"0\" y=\"0\" width=\"40\" height=\"40\" patternUnits=\"userSpaceOnUse\">
  1693. <path d=\"M20 2 L38 12 L38 28 L20 38 L2 28 L2 12 Z\" fill=\"none\" stroke=\"white\" stroke-width=\"0.5\"/>
  1694. </pattern>
  1695. <rect width=\"100%\" height=\"100%\" fill=\"url(#hex)\" />
  1696. </svg>
  1697. </div>
  1698. <div class=\"container mx-auto px-4 py-16 relative z-10\">
  1699. <div class=\"max-w-4xl mx-auto text-center\">
  1700. <!-- Badge moteur -->
  1701. <div class=\"inline-flex items-center bg-white/15 backdrop-blur-sm rounded-full px-5 py-2 mb-5 border border-white/25\">
  1702. <span class=\"w-2 h-2 rounded-full bg-emerald-300 animate-pulse mr-2\"></span>
  1703. <span class=\"text-sm font-semibold tracking-wide\">Moteur Ibunas.IA
  1704. {% if isPremium is defined and isPremium %}
  1705. <span class=\"ml-2 bg-amber-400 text-amber-900 text-xs font-bold px-2 py-0.5 rounded-full\">PREMIUM</span>
  1706. {% endif %}
  1707. </span>
  1708. </div>
  1709. <h1 class=\"text-5xl md:text-6xl font-black mb-4 tracking-tight\">
  1710. Munganyo
  1711. <span class=\"block text-2xl md:text-3xl font-light opacity-90 mt-2\">Recherche avancée · Journal Officiel des Comores</span>
  1712. </h1>
  1713. <p class=\"text-white/80 mb-8 max-w-2xl mx-auto text-base leading-relaxed\">
  1714. Accédez à l'ensemble des textes juridiques, actes officiels et annonces légales publiés au Journal Officiel de l'Union des Comores.
  1715. </p>
  1716. <!-- Barre de recherche principale -->
  1717. <div class=\"max-w-2xl mx-auto\" id=\"hero-search-wrapper\">
  1718. <div class=\"relative\">
  1719. <i class=\"fas fa-search absolute left-5 top-1/2 -translate-y-1/2 text-gray-400 text-lg z-10\"></i>
  1720. <input
  1721. type=\"text\"
  1722. id=\"main-search-input\"
  1723. name=\"q\"
  1724. value=\"{{ query|default('') }}\"
  1725. placeholder=\"Rechercher un décret, un arrêté, une annonce légale...\"
  1726. autocomplete=\"off\"
  1727. class=\"w-full pl-14 pr-36 py-5 text-gray-800 text-base rounded-full border-none shadow-2xl focus:outline-none focus:ring-4 focus:ring-[#006633]/40 transition-all duration-300\"
  1728. >
  1729. <button id=\"hero-search-btn\"
  1730. class=\"absolute right-2 top-1/2 -translate-y-1/2 bg-gradient-to-r from-[#006633] to-[#008040] text-white px-6 py-2.5 rounded-full font-semibold hover:from-[#004d26] hover:to-[#006633] transition-all duration-300 shadow-md hover:shadow-lg\">
  1731. <span class=\"hidden md:inline\"><i class=\"fas fa-arrow-right mr-1\"></i> Rechercher</span>
  1732. <span class=\"md:hidden\"><i class=\"fas fa-arrow-right\"></i></span>
  1733. </button>
  1734. <!-- Autocomplete dropdown -->
  1735. <div id=\"autocomplete-dropdown\"
  1736. class=\"absolute top-full left-0 right-0 mt-2 bg-white rounded-2xl shadow-2xl border border-gray-100 hidden z-50 overflow-hidden\">
  1737. </div>
  1738. </div>
  1739. <!-- Suggestions rapides -->
  1740. <div class=\"flex flex-wrap justify-center gap-2 mt-4\">
  1741. <span class=\"text-white/50 text-xs\">Tendances :</span>
  1742. {% for suggestion in ['Loi de finances', 'Décret nomination', 'Marché public', 'Acte foncier Moroni', 'Récépissé association'] %}
  1743. <button type=\"button\" class=\"quick-suggestion text-white/80 hover:text-white text-xs underline-offset-2 hover:underline transition\">{{ suggestion }}</button>
  1744. {% endfor %}
  1745. </div>
  1746. </div>
  1747. <!-- Filtres rapides par type -->
  1748. <div class=\"mt-8 flex flex-wrap justify-center gap-2\" id=\"quick-type-filters\">
  1749. {% set quickTypes = [
  1750. {val: '', label: 'Tous', icon: 'fa-layer-group'},
  1751. {val: 'loi', label: 'Lois', icon: 'fa-gavel'},
  1752. {val: 'decret', label: 'Décrets', icon: 'fa-file-signature'},
  1753. {val: 'arrete', label: 'Arrêtés', icon: 'fa-clipboard-list'},
  1754. {val: 'marche_public', label: 'Marchés publics', icon: 'fa-briefcase'},
  1755. {val: 'acte_foncier', label: 'Foncier', icon: 'fa-map-marker-alt'},
  1756. {val: 'enchere', label: 'Enchères', icon: 'fa-hammer'},
  1757. ] %}
  1758. {% for qt in quickTypes %}
  1759. <button type=\"button\"
  1760. data-type=\"{{ qt.val }}\"
  1761. class=\"quick-type-btn px-4 py-2 rounded-full text-sm font-medium transition-all duration-200
  1762. {% if (typeFilter is defined and typeFilter == qt.val) or (qt.val == '' and (typeFilter is not defined or typeFilter == '')) %}
  1763. bg-white text-[#006633] shadow-lg
  1764. {% else %}
  1765. bg-white/20 text-white hover:bg-white/30 border border-white/20
  1766. {% endif %}\">
  1767. <i class=\"fas {{ qt.icon }} mr-1 text-xs\"></i> {{ qt.label }}
  1768. </button>
  1769. {% endfor %}
  1770. </div>
  1771. </div>
  1772. </div>
  1773. <div class=\"absolute bottom-0 left-0 right-0\">
  1774. <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1440 80\" class=\"w-full\">
  1775. <path fill=\"#f3f4f6\" fill-opacity=\"1\" d=\"M0,40L60,45C120,50,240,60,360,62C480,64,600,58,720,52C840,46,960,40,1080,42C1200,44,1320,54,1380,58L1440,62L1440,80L0,80Z\"></path>
  1776. </svg>
  1777. </div>
  1778. </section>
  1779. <!-- ============================================================
  1780. FILTRES AVANCÉS (CDC: 3 filtres officiels + 2 supplémentaires)
  1781. ============================================================ -->
  1782. <section class=\"py-8 bg-gray-50\" id=\"filters-section\">
  1783. <div class=\"container mx-auto px-4\">
  1784. <div class=\"max-w-6xl mx-auto\">
  1785. <!-- Header filtres + toggle -->
  1786. <div class=\"flex flex-wrap items-center justify-between gap-3 mb-4\">
  1787. <div class=\"flex items-center gap-3\">
  1788. <h2 class=\"text-sm font-bold text-gray-700 uppercase tracking-widest\">
  1789. <i class=\"fas fa-sliders-h text-[#006633] mr-2\"></i> Affiner la recherche
  1790. </h2>
  1791. <!-- Compteur filtres actifs -->
  1792. <span id=\"active-filters-count\"
  1793. class=\"hidden bg-[#006633] text-white text-xs font-bold px-2.5 py-1 rounded-full\">
  1794. 0
  1795. </span>
  1796. </div>
  1797. <div class=\"flex items-center gap-3\">
  1798. <button id=\"toggle-filters-btn\"
  1799. class=\"flex items-center gap-2 text-sm text-gray-600 hover:text-[#006633] transition font-medium\">
  1800. <i class=\"fas fa-chevron-down transition-transform duration-300\" id=\"toggle-filters-icon\"></i>
  1801. <span id=\"toggle-filters-label\">Masquer les filtres</span>
  1802. </button>
  1803. <button id=\"reset-filters-btn\"
  1804. class=\"hidden text-sm text-red-500 hover:text-red-700 transition font-medium\">
  1805. <i class=\"fas fa-times-circle mr-1\"></i> Réinitialiser
  1806. </button>
  1807. </div>
  1808. </div>
  1809. <!-- Chips des filtres actifs -->
  1810. <div id=\"active-filter-chips\" class=\"flex flex-wrap gap-2 mb-4 empty:hidden\"></div>
  1811. <!-- Panel des filtres -->
  1812. <div id=\"filters-panel\" class=\"bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden transition-all duration-300\">
  1813. <form id=\"advanced-search-form\" class=\"p-5\">
  1814. <div class=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-4\">
  1815. <!-- FILTRE 1 : Institution émettrice (CDC) -->
  1816. <div class=\"xl:col-span-2\">
  1817. <label class=\"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2\">
  1818. <i class=\"fas fa-landmark text-[#006633] mr-1\"></i> Institution émettrice
  1819. </label>
  1820. <select name=\"institution\" id=\"filter-institution\"
  1821. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40 bg-white\">
  1822. <option value=\"\">Toutes les institutions</option>
  1823. <optgroup label=\"🇰🇲 Union des Comores\">
  1824. <option value=\"presidence\" {% if filters.institution is defined and filters.institution == 'presidence' %}selected{% endif %}>Présidence de l'Union</option>
  1825. <option value=\"assemblee_nationale\" {% if filters.institution is defined and filters.institution == 'assemblee_nationale' %}selected{% endif %}>Assemblée Nationale</option>
  1826. <option value=\"sgg\" {% if filters.institution is defined and filters.institution == 'sgg' %}selected{% endif %}>Secrétariat Général du Gouvernement</option>
  1827. <option value=\"vice_presidence\" {% if filters.institution is defined and filters.institution == 'vice_presidence' %}selected{% endif %}>Vice-Présidence</option>
  1828. <option value=\"finances\" {% if filters.institution is defined and filters.institution == 'finances' %}selected{% endif %}>Ministère des Finances</option>
  1829. <option value=\"justice\" {% if filters.institution is defined and filters.institution == 'justice' %}selected{% endif %}>Ministère de la Justice</option>
  1830. <option value=\"interieur\" {% if filters.institution is defined and filters.institution == 'interieur' %}selected{% endif %}>Ministère de l'Intérieur</option>
  1831. <option value=\"sante\" {% if filters.institution is defined and filters.institution == 'sante' %}selected{% endif %}>Ministère de la Santé</option>
  1832. <option value=\"education\" {% if filters.institution is defined and filters.institution == 'education' %}selected{% endif %}>Ministère de l'Éducation</option>
  1833. <option value=\"transport\" {% if filters.institution is defined and filters.institution == 'transport' %}selected{% endif %}>Ministère du Transport</option>
  1834. <option value=\"agriculture\" {% if filters.institution is defined and filters.institution == 'agriculture' %}selected{% endif %}>Ministère de l'Agriculture</option>
  1835. <option value=\"travaux_publics\" {% if filters.institution is defined and filters.institution == 'travaux_publics' %}selected{% endif %}>Ministère des Travaux Publics</option>
  1836. <option value=\"autres_ministeres\" {% if filters.institution is defined and filters.institution == 'autres_ministeres' %}selected{% endif %}>Autres ministères</option>
  1837. </optgroup>
  1838. <optgroup label=\"🏛 Gouvernorats\">
  1839. <option value=\"gouvernorat_ngazidja\" {% if filters.institution is defined and filters.institution == 'gouvernorat_ngazidja' %}selected{% endif %}>Gouvernorat de Ngazidja (Grande Comore)</option>
  1840. <option value=\"gouvernorat_anjouan\" {% if filters.institution is defined and filters.institution == 'gouvernorat_anjouan' %}selected{% endif %}>Gouvernorat d'Anjouan (Ndzuani)</option>
  1841. <option value=\"gouvernorat_moheli\" {% if filters.institution is defined and filters.institution == 'gouvernorat_moheli' %}selected{% endif %}>Gouvernorat de Mohéli (Mwali)</option>
  1842. </optgroup>
  1843. <optgroup label=\"⚖ Juridictions\">
  1844. <option value=\"justice_cour_supreme\" {% if filters.institution is defined and filters.institution == 'justice_cour_supreme' %}selected{% endif %}>Cour Suprême</option>
  1845. <option value=\"justice_cour_appel\" {% if filters.institution is defined and filters.institution == 'justice_cour_appel' %}selected{% endif %}>Cour d'Appel</option>
  1846. </optgroup>
  1847. </select>
  1848. </div>
  1849. <!-- FILTRE 2 : Chronologique (CDC) -->
  1850. <div>
  1851. <label class=\"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2\">
  1852. <i class=\"fas fa-calendar-alt text-[#006633] mr-1\"></i> Période
  1853. </label>
  1854. <select name=\"period\" id=\"filter-period\"
  1855. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40 bg-white\">
  1856. <option value=\"\">Toutes périodes</option>
  1857. {% for yr in 2026..2018 %}
  1858. <option value=\"{{ yr }}\" {% if filters.period is defined and filters.period == (yr~'') %}selected{% endif %}>{{ yr }}</option>
  1859. {% endfor %}
  1860. <option value=\"custom\" {% if filters.period is defined and filters.period == 'custom' %}selected{% endif %}>Période personnalisée</option>
  1861. </select>
  1862. <!-- Dates personnalisées -->
  1863. <div id=\"custom-dates-panel\" class=\"mt-2 space-y-1.5 {% if filters.period is not defined or filters.period != 'custom' %}hidden{% endif %}\">
  1864. <input type=\"date\" name=\"date_debut\" id=\"filter-date-debut\"
  1865. value=\"{{ filters.date_debut|default('') }}\"
  1866. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40\">
  1867. <input type=\"date\" name=\"date_fin\" id=\"filter-date-fin\"
  1868. value=\"{{ filters.date_fin|default('') }}\"
  1869. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40\">
  1870. </div>
  1871. </div>
  1872. <!-- FILTRE 3 : Type d'acte / annonces (CDC) -->
  1873. <div>
  1874. <label class=\"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2\">
  1875. <i class=\"fas fa-file-alt text-[#006633] mr-1\"></i> Type d'acte
  1876. </label>
  1877. <select name=\"type\" id=\"filter-type\"
  1878. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40 bg-white\">
  1879. <option value=\"\">Tous les types</option>
  1880. <optgroup label=\"📋 Actes officiels\">
  1881. <option value=\"loi\" {% if filters.type is defined and filters.type == 'loi' %}selected{% endif %}>Lois</option>
  1882. <option value=\"decret\" {% if filters.type is defined and filters.type == 'decret' %}selected{% endif %}>Décrets</option>
  1883. <option value=\"arrete\" {% if filters.type is defined and filters.type == 'arrete' %}selected{% endif %}>Arrêtés</option>
  1884. <option value=\"circulaire\" {% if filters.type is defined and filters.type == 'circulaire' %}selected{% endif %}>Circulaires</option>
  1885. <option value=\"avis\" {% if filters.type is defined and filters.type == 'avis' %}selected{% endif %}>Avis officiels</option>
  1886. </optgroup>
  1887. <optgroup label=\"📢 Annonces légales\">
  1888. <option value=\"marche_public\" {% if filters.type is defined and filters.type == 'marche_public' %}selected{% endif %}>Marchés publics & DSP</option>
  1889. <option value=\"acte_foncier\" {% if filters.type is defined and filters.type == 'acte_foncier' %}selected{% endif %}>Réquisitions & actes fonciers</option>
  1890. <option value=\"societe_rccm\" {% if filters.type is defined and filters.type == 'societe_rccm' %}selected{% endif %}>Actes RCCM/OHADA (sociétés)</option>
  1891. <option value=\"enchere\" {% if filters.type is defined and filters.type == 'enchere' %}selected{% endif %}>Ventes aux enchères publiques</option>
  1892. <option value=\"association\" {% if filters.type is defined and filters.type == 'association' %}selected{% endif %}>Récépissés associations</option>
  1893. </optgroup>
  1894. </select>
  1895. </div>
  1896. <!-- FILTRE 4 : Statut juridique (CDC: En vigueur / Abrogé…) -->
  1897. <div>
  1898. <label class=\"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2\">
  1899. <i class=\"fas fa-balance-scale text-[#006633] mr-1\"></i> Statut juridique
  1900. </label>
  1901. <select name=\"statut\" id=\"filter-statut\"
  1902. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40 bg-white\">
  1903. <option value=\"\">Tous statuts</option>
  1904. <option value=\"en_vigueur\" {% if filters.statut is defined and filters.statut == 'en_vigueur' %}selected{% endif %}>✅ En vigueur</option>
  1905. <option value=\"modifie\" {% if filters.statut is defined and filters.statut == 'modifie' %}selected{% endif %}>✏️ Modifié</option>
  1906. <option value=\"abroge\" {% if filters.statut is defined and filters.statut == 'abroge' %}selected{% endif %}>❌ Abrogé</option>
  1907. <option value=\"suspendu\" {% if filters.statut is defined and filters.statut == 'suspendu' %}selected{% endif %}>⏸️ Suspendu</option>
  1908. <option value=\"remplace\" {% if filters.statut is defined and filters.statut == 'remplace' %}selected{% endif %}>🔄 Remplacé</option>
  1909. <option value=\"archive\" {% if filters.statut is defined and filters.statut == 'archive' %}selected{% endif %}>📦 Archivé</option>
  1910. </select>
  1911. </div>
  1912. </div>
  1913. <!-- Ligne 2 : Territoire + tri + submit -->
  1914. <div class=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mt-4 pt-4 border-t border-gray-100\">
  1915. <!-- Territoire applicable (CDC) -->
  1916. <div>
  1917. <label class=\"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2\">
  1918. <i class=\"fas fa-map-marker-alt text-[#006633] mr-1\"></i> Territoire applicable
  1919. </label>
  1920. <select name=\"territoire\" id=\"filter-territoire\"
  1921. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40 bg-white\">
  1922. <option value=\"\">Toute l'Union</option>
  1923. <option value=\"union\" {% if filters.territoire is defined and filters.territoire == 'union' %}selected{% endif %}>Union des Comores</option>
  1924. <option value=\"ngazidja\" {% if filters.territoire is defined and filters.territoire == 'ngazidja' %}selected{% endif %}>Grande Comore (Ngazidja)</option>
  1925. <option value=\"anjouan\" {% if filters.territoire is defined and filters.territoire == 'anjouan' %}selected{% endif %}>Anjouan (Ndzuani)</option>
  1926. <option value=\"moheli\" {% if filters.territoire is defined and filters.territoire == 'moheli' %}selected{% endif %}>Mohéli (Mwali)</option>
  1927. <option value=\"moroni\" {% if filters.territoire is defined and filters.territoire == 'moroni' %}selected{% endif %}>Moroni</option>
  1928. <option value=\"mutsamudu\" {% if filters.territoire is defined and filters.territoire == 'mutsamudu' %}selected{% endif %}>Mutsamudu</option>
  1929. <option value=\"fomboni\" {% if filters.territoire is defined and filters.territoire == 'fomboni' %}selected{% endif %}>Fomboni</option>
  1930. </select>
  1931. </div>
  1932. <!-- Tri -->
  1933. <div>
  1934. <label class=\"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-2\">
  1935. <i class=\"fas fa-sort text-[#006633] mr-1\"></i> Trier par
  1936. </label>
  1937. <select name=\"sort\" id=\"filter-sort\"
  1938. class=\"search-filter w-full border border-gray-200 rounded-xl px-3 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-[#006633]/40 bg-white\">
  1939. <option value=\"date_desc\" {% if filters.sort is not defined or filters.sort == 'date_desc' %}selected{% endif %}>Date (récent → ancien)</option>
  1940. <option value=\"date_asc\" {% if filters.sort is defined and filters.sort == 'date_asc' %}selected{% endif %}>Date (ancien → récent)</option>
  1941. <option value=\"pertinence\" {% if filters.sort is defined and filters.sort == 'pertinence' %}selected{% endif %}>Pertinence</option>
  1942. <option value=\"titre_asc\" {% if filters.sort is defined and filters.sort == 'titre_asc' %}selected{% endif %}>Titre A → Z</option>
  1943. </select>
  1944. </div>
  1945. <!-- Actions -->
  1946. <div class=\"flex items-end gap-3\">
  1947. <button type=\"submit\" id=\"apply-filters-btn\"
  1948. class=\"flex-1 bg-gradient-to-r from-[#006633] to-[#008040] text-white px-5 py-2.5 rounded-xl hover:from-[#004d26] hover:to-[#006633] transition shadow-md font-semibold text-sm\">
  1949. <i class=\"fas fa-search mr-2\"></i> Appliquer
  1950. </button>
  1951. <a href=\"{{ path('app_search') }}\"
  1952. class=\"px-4 py-2.5 border border-gray-200 rounded-xl text-gray-500 hover:text-gray-700 hover:border-gray-300 transition text-sm font-medium\">
  1953. <i class=\"fas fa-undo-alt\"></i>
  1954. </a>
  1955. </div>
  1956. </div>
  1957. </form>
  1958. </div>
  1959. </div>
  1960. </div>
  1961. </section>
  1962. <!-- ============================================================
  1963. ZONE DE RÉSULTATS
  1964. ============================================================ -->
  1965. <section class=\"py-10 bg-white min-h-[40vh]\" id=\"results-section\">
  1966. <div class=\"container mx-auto px-4\">
  1967. <div class=\"max-w-6xl mx-auto\">
  1968. <!-- Barre de statut résultats -->
  1969. <div id=\"results-status-bar\" class=\"flex flex-wrap items-center justify-between gap-3 mb-6 {% if query is not defined or query is empty %}hidden{% endif %}\">
  1970. <div class=\"flex items-center gap-3\">
  1971. <!-- Spinner loading (caché par défaut) -->
  1972. <div id=\"search-spinner\" class=\"hidden\">
  1973. <svg class=\"animate-spin w-5 h-5 text-[#006633]\" fill=\"none\" viewBox=\"0 0 24 24\">
  1974. <circle class=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" stroke-width=\"4\"></circle>
  1975. <path class=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z\"></path>
  1976. </svg>
  1977. </div>
  1978. <h2 class=\"text-base font-bold text-gray-800\" id=\"results-count-label\">
  1979. {% if query is defined and query is not empty %}
  1980. <span id=\"count-number\">{{ results|length }}</span> résultat(s) pour
  1981. <em class=\"text-[#006633] not-italic font-black\">\"{{ query }}\"</em>
  1982. {% endif %}
  1983. </h2>
  1984. </div>
  1985. <!-- Badge IA -->
  1986. <div>
  1987. {% if isPremium is defined and isPremium %}
  1988. <div class=\"flex items-center gap-2 bg-gradient-to-r from-amber-50 to-yellow-50 border border-amber-200 text-amber-800 px-4 py-1.5 rounded-full text-sm font-semibold\">
  1989. <i class=\"fas fa-microchip text-amber-500\"></i>
  1990. Recherche enrichie Ibunas.IA activée
  1991. </div>
  1992. {% else %}
  1993. <a href=\"{{ path('app_abonn') }}\"
  1994. class=\"flex items-center gap-2 bg-gray-50 border border-gray-200 text-gray-600 hover:border-[#006633] hover:text-[#006633] px-4 py-1.5 rounded-full text-sm font-medium transition\">
  1995. <i class=\"fas fa-lock text-xs\"></i>
  1996. Activer Ibunas.IA Premium
  1997. </a>
  1998. {% endif %}
  1999. </div>
  2000. </div>
  2001. <!-- Liste des résultats (rendu SSR initial + remplacement AJAX) -->
  2002. <div id=\"results-container\">
  2003. {% if query is defined and query is not empty %}
  2004. {% if results is defined and results|length > 0 %}
  2005. {% include '_partials/search_results_list.html.twig' with {results: results, isPremium: isPremium} %}
  2006. {% else %}
  2007. {% include '_partials/search_no_results.html.twig' with {query: query} %}
  2008. {% endif %}
  2009. {% else %}
  2010. <!-- État d'accueil -->
  2011. <div class=\"text-center py-16 bg-gradient-to-br from-gray-50 to-emerald-50/30 rounded-2xl border border-gray-100\" id=\"welcome-state\">
  2012. <div class=\"w-20 h-20 bg-gradient-to-br from-[#006633] to-[#008040] rounded-2xl flex items-center justify-center mx-auto mb-5 shadow-lg\">
  2013. <i class=\"fas fa-search text-2xl text-white\"></i>
  2014. </div>
  2015. <h2 class=\"text-2xl font-bold text-gray-800 mb-2\">Que recherchez-vous ?</h2>
  2016. <p class=\"text-gray-500 max-w-md mx-auto mb-6 text-sm\">
  2017. Textes législatifs, décrets présidentiels, arrêtés ministériels,
  2018. marchés publics, actes fonciers… tout le Journal Officiel des Comores en un clic.
  2019. </p>
  2020. <div class=\"flex flex-wrap justify-center gap-3 text-xs text-gray-500\">
  2021. <span class=\"px-3 py-1.5 bg-white rounded-full shadow-sm border border-gray-100\">
  2022. <i class=\"fas fa-gavel text-purple-500 mr-1\"></i> \"Loi n°2026-…\"
  2023. </span>
  2024. <span class=\"px-3 py-1.5 bg-white rounded-full shadow-sm border border-gray-100\">
  2025. <i class=\"fas fa-file-signature text-blue-500 mr-1\"></i> \"Décret nomination ministre\"
  2026. </span>
  2027. <span class=\"px-3 py-1.5 bg-white rounded-full shadow-sm border border-gray-100\">
  2028. <i class=\"fas fa-map-marker-alt text-teal-500 mr-1\"></i> \"Actes fonciers Moroni\"
  2029. </span>
  2030. <span class=\"px-3 py-1.5 bg-white rounded-full shadow-sm border border-gray-100\">
  2031. <i class=\"fas fa-briefcase text-emerald-500 mr-1\"></i> \"Appel d'offres travaux routiers\"
  2032. </span>
  2033. </div>
  2034. </div>
  2035. {% endif %}
  2036. </div>
  2037. <!-- Pagination (rendu SSR + remplacé par AJAX) -->
  2038. <div id=\"pagination-container\">
  2039. {% if totalPages is defined and totalPages > 1 %}
  2040. <nav class=\"flex justify-center mt-8\" aria-label=\"Pagination\">
  2041. <ul class=\"flex items-center gap-1\">
  2042. <li>
  2043. <a href=\"{{ currentPage > 1 ? path('app_search', {page: currentPage - 1, q: query}) : '#' }}\"
  2044. class=\"flex items-center justify-center w-9 h-9 rounded-lg border border-gray-200 text-gray-500 hover:border-[#006633] hover:text-[#006633] transition text-sm {% if currentPage <= 1 %}opacity-40 pointer-events-none{% endif %}\">
  2045. <i class=\"fas fa-chevron-left text-xs\"></i>
  2046. </a>
  2047. </li>
  2048. {% for page in 1..totalPages %}
  2049. {% if page == currentPage %}
  2050. <li><span class=\"flex items-center justify-center w-9 h-9 rounded-lg bg-[#006633] text-white font-bold text-sm\">{{ page }}</span></li>
  2051. {% elseif page <= 3 or page >= totalPages - 2 or (page >= currentPage - 2 and page <= currentPage + 2) %}
  2052. <li>
  2053. <a href=\"{{ path('app_search', {page: page, q: query}) }}\"
  2054. class=\"flex items-center justify-center w-9 h-9 rounded-lg border border-gray-200 text-gray-600 hover:border-[#006633] hover:text-[#006633] transition text-sm\">
  2055. {{ page }}
  2056. </a>
  2057. </li>
  2058. {% elseif page == 4 and currentPage > 6 %}
  2059. <li><span class=\"px-2 text-gray-400\">…</span></li>
  2060. {% elseif page == totalPages - 3 and currentPage < totalPages - 5 %}
  2061. <li><span class=\"px-2 text-gray-400\">…</span></li>
  2062. {% endif %}
  2063. {% endfor %}
  2064. <li>
  2065. <a href=\"{{ currentPage < totalPages ? path('app_search', {page: currentPage + 1, q: query}) : '#' }}\"
  2066. class=\"flex items-center justify-center w-9 h-9 rounded-lg border border-gray-200 text-gray-500 hover:border-[#006633] hover:text-[#006633] transition text-sm {% if currentPage >= totalPages %}opacity-40 pointer-events-none{% endif %}\">
  2067. <i class=\"fas fa-chevron-right text-xs\"></i>
  2068. </a>
  2069. </li>
  2070. </ul>
  2071. </nav>
  2072. {% endif %}
  2073. </div>
  2074. </div>
  2075. </div>
  2076. </section>
  2077. <!-- ============================================================
  2078. CONSEILS + STATS (bas de page)
  2079. ============================================================ -->
  2080. <section class=\"py-10 bg-gray-50 border-t border-gray-100\">
  2081. <div class=\"container mx-auto px-4\">
  2082. <div class=\"max-w-6xl mx-auto\">
  2083. <div class=\"grid grid-cols-1 md:grid-cols-3 gap-5\">
  2084. <div class=\"bg-white rounded-xl p-5 shadow-sm border border-gray-100 flex gap-4 items-start\">
  2085. <div class=\"w-10 h-10 bg-emerald-100 rounded-xl flex items-center justify-center flex-shrink-0\">
  2086. <i class=\"fas fa-lightbulb text-[#006633]\"></i>
  2087. </div>
  2088. <div>
  2089. <h3 class=\"font-semibold text-gray-800 text-sm mb-1\">Recherche par mots-clés</h3>
  2090. <p class=\"text-xs text-gray-500\">Termes précis : \"impôt\", \"nomination\", \"foncier\", \"appel d'offres bâtiment\"</p>
  2091. </div>
  2092. </div>
  2093. <div class=\"bg-white rounded-xl p-5 shadow-sm border border-gray-100 flex gap-4 items-start\">
  2094. <div class=\"w-10 h-10 bg-emerald-100 rounded-xl flex items-center justify-center flex-shrink-0\">
  2095. <i class=\"fas fa-hashtag text-[#006633]\"></i>
  2096. </div>
  2097. <div>
  2098. <h3 class=\"font-semibold text-gray-800 text-sm mb-1\">Référence exacte</h3>
  2099. <p class=\"text-xs text-gray-500\">Numéro d'acte : \"LOI-2026-015\", \"Décret 2026-045/PR\"</p>
  2100. </div>
  2101. </div>
  2102. <div class=\"bg-white rounded-xl p-5 shadow-sm border border-gray-100 flex gap-4 items-start\">
  2103. <div class=\"w-10 h-10 bg-amber-100 rounded-xl flex items-center justify-center flex-shrink-0\">
  2104. <i class=\"fas fa-microchip text-amber-600\"></i>
  2105. </div>
  2106. <div>
  2107. <h3 class=\"font-semibold text-gray-800 text-sm mb-1\">Recherche Ibunas.IA <span class=\"text-amber-600 text-xs font-bold\">PREMIUM</span></h3>
  2108. <p class=\"text-xs text-gray-500\">Recherche dans le contenu des actes via OCR et intelligence artificielle</p>
  2109. </div>
  2110. </div>
  2111. </div>
  2112. </div>
  2113. </div>
  2114. </section>
  2115. {# ================================================================
  2116. RÉSULTATS PARTIELS (macros Twig inline pour éviter includes manquants)
  2117. En production, extraire dans _partials/
  2118. ================================================================ #}
  2119. {% macro renderResultCard(result, isPremium) %}
  2120. {% set typeColors = {
  2121. 'loi': 'bg-purple-100 text-purple-700 border-purple-200',
  2122. 'decret': 'bg-blue-100 text-blue-700 border-blue-200',
  2123. 'arrete': 'bg-green-100 text-green-700 border-green-200',
  2124. 'circulaire': 'bg-cyan-100 text-cyan-700 border-cyan-200',
  2125. 'avis': 'bg-sky-100 text-sky-700 border-sky-200',
  2126. 'marche_public':'bg-emerald-100 text-emerald-700 border-emerald-200',
  2127. 'acte_foncier': 'bg-teal-100 text-teal-700 border-teal-200',
  2128. 'societe_rccm': 'bg-indigo-100 text-indigo-700 border-indigo-200',
  2129. 'association': 'bg-amber-100 text-amber-700 border-amber-200',
  2130. 'enchere': 'bg-orange-100 text-orange-700 border-orange-200'
  2131. } %}
  2132. {% set typeIcons = {
  2133. 'loi': 'fa-gavel', 'decret': 'fa-file-signature',
  2134. 'arrete': 'fa-clipboard-list', 'circulaire': 'fa-envelope',
  2135. 'avis': 'fa-bell', 'marche_public': 'fa-briefcase',
  2136. 'acte_foncier': 'fa-map-marker-alt', 'societe_rccm': 'fa-building',
  2137. 'association': 'fa-handshake', 'enchere': 'fa-hammer'
  2138. } %}
  2139. <article class=\"bg-white border border-gray-100 rounded-2xl shadow-sm hover:shadow-md transition-all duration-200 p-5 group\">
  2140. <div class=\"flex flex-wrap justify-between items-start gap-2 mb-3\">
  2141. <div class=\"flex flex-wrap items-center gap-2\">
  2142. <span class=\"inline-flex items-center gap-1.5 px-3 py-1 text-xs font-bold rounded-full border {{ typeColors[result.type]|default('bg-gray-100 text-gray-700 border-gray-200') }}\">
  2143. <i class=\"fas {{ typeIcons[result.type]|default('fa-file-alt') }} text-[10px]\"></i>
  2144. {{ result.typeLabel|default(result.type|upper) }}
  2145. </span>
  2146. {% if result.numero is defined and result.numero %}
  2147. <span class=\"text-xs text-gray-400 font-mono bg-gray-50 px-2 py-0.5 rounded\">{{ result.numero }}</span>
  2148. {% endif %}
  2149. {% if result.statutJuridique is defined %}
  2150. <span class=\"text-xs px-2 py-0.5 rounded
  2151. {% if result.statutJuridique == 'en_vigueur' %}bg-green-50 text-green-600
  2152. {% elseif result.statutJuridique == 'abroge' %}bg-red-50 text-red-600
  2153. {% else %}bg-gray-50 text-gray-500{% endif %}\">
  2154. {{ result.statutJuridique|replace({'_': ' '})|title }}
  2155. </span>
  2156. {% endif %}
  2157. </div>
  2158. <time class=\"text-xs text-gray-400 flex items-center gap-1 flex-shrink-0\">
  2159. <i class=\"far fa-calendar-alt\"></i>
  2160. {{ result.datePublication|date('d/m/Y') }}
  2161. </time>
  2162. </div>
  2163. <h3 class=\"text-base font-bold text-gray-800 mb-2 group-hover:text-[#006633] transition leading-snug\">
  2164. <a href=\"{{ path('app_acte_show', {id: result.id}) }}\">{{ result.titre }}</a>
  2165. </h3>
  2166. {% if result.resume is defined and result.resume %}
  2167. <p class=\"text-gray-500 text-sm mb-3 line-clamp-2\">{{ result.resume }}</p>
  2168. {% endif %}
  2169. {% if isPremium and result.extrait is defined and result.extrait %}
  2170. <div class=\"mb-3 px-3 py-2 bg-amber-50 border-l-3 border-amber-400 rounded-r-lg text-xs text-gray-700\">
  2171. <i class=\"fas fa-quote-left text-amber-400 mr-1\"></i>
  2172. <span>{{ result.extrait }}</span>
  2173. </div>
  2174. {% endif %}
  2175. <div class=\"flex flex-wrap items-center justify-between gap-2 pt-3 border-t border-gray-50\">
  2176. <div class=\"flex items-center gap-3 text-xs text-gray-500\">
  2177. {% if result.institution is defined %}
  2178. <span><i class=\"fas fa-landmark text-[#006633] mr-1\"></i>{{ result.institution }}</span>
  2179. {% endif %}
  2180. {% if result.territoire is defined %}
  2181. <span><i class=\"fas fa-map-marker-alt text-gray-400 mr-1\"></i>{{ result.territoire }}</span>
  2182. {% endif %}
  2183. {% if isPremium and result.relevance is defined %}
  2184. <span class=\"text-[#006633] font-semibold\">
  2185. <i class=\"fas fa-chart-line mr-1\"></i>{{ (result.relevance * 100)|round }}% pertinent
  2186. </span>
  2187. {% endif %}
  2188. </div>
  2189. <div class=\"flex items-center gap-3\">
  2190. <a href=\"{{ path('app_acte_show', {id: result.id}) }}\"
  2191. class=\"text-xs text-[#006633] hover:text-[#008040] font-semibold flex items-center gap-1 transition\">
  2192. <i class=\"fas fa-eye\"></i> Consulter
  2193. </a>
  2194. {% if result.pdf_url is defined and result.pdf_url %}
  2195. <a href=\"{{ result.pdf_url }}\" target=\"_blank\" rel=\"noopener\"
  2196. class=\"text-xs text-gray-400 hover:text-gray-600 flex items-center gap-1 transition\">
  2197. <i class=\"fas fa-file-pdf\"></i> PDF
  2198. </a>
  2199. {% endif %}
  2200. </div>
  2201. </div>
  2202. </article>
  2203. {% endmacro %}
  2204. <!-- ============================================================
  2205. JAVASCRIPT DYNAMIQUE
  2206. ============================================================ -->
  2207. <script>
  2208. (function () {
  2209. 'use strict';
  2210. // ─── Config ───────────────────────────────────────────────────────────────
  2211. const SEARCH_URL = '{{ path(\"app_search\") }}';
  2212. const SEARCH_API_URL = '{{ path(\"app_search_ajax\") }}'; // endpoint JSON
  2213. const DEBOUNCE_MS = 400;
  2214. const MIN_CHARS = 2;
  2215. // ─── Éléments DOM ─────────────────────────────────────────────────────────
  2216. const mainInput = document.getElementById('main-search-input');
  2217. const heroBtnSearch = document.getElementById('hero-search-btn');
  2218. const autocompleteBox = document.getElementById('autocomplete-dropdown');
  2219. const resultsContainer = document.getElementById('results-container');
  2220. const paginationCont = document.getElementById('pagination-container');
  2221. const statusBar = document.getElementById('results-status-bar');
  2222. const countNumber = document.getElementById('count-number');
  2223. const countLabel = document.getElementById('results-count-label');
  2224. const spinner = document.getElementById('search-spinner');
  2225. const filterForm = document.getElementById('advanced-search-form');
  2226. const filterSelects = filterForm.querySelectorAll('.search-filter');
  2227. const resetBtn = document.getElementById('reset-filters-btn');
  2228. const applyBtn = document.getElementById('apply-filters-btn');
  2229. const activeCountBadge = document.getElementById('active-filters-count');
  2230. const filterChips = document.getElementById('active-filter-chips');
  2231. const toggleFiltersBtn = document.getElementById('toggle-filters-btn');
  2232. const toggleFiltersIcon= document.getElementById('toggle-filters-icon');
  2233. const toggleFiltersLbl = document.getElementById('toggle-filters-label');
  2234. const filtersPanel = document.getElementById('filters-panel');
  2235. const periodSelect = document.getElementById('filter-period');
  2236. const customDatesPanel = document.getElementById('custom-dates-panel');
  2237. const quickTypeBtns = document.querySelectorAll('.quick-type-btn');
  2238. const quickSuggestions = document.querySelectorAll('.quick-suggestion');
  2239. // ─── État ─────────────────────────────────────────────────────────────────
  2240. let debounceTimer = null;
  2241. let currentPage = 1;
  2242. let filtersVisible = true;
  2243. let lastQuery = mainInput ? mainInput.value.trim() : '';
  2244. let currentParams = {};
  2245. // ─── Noms lisibles des filtres pour les chips ─────────────────────────────
  2246. const filterLabels = {
  2247. institution: {
  2248. presidence: 'Présidence de l\\'Union',
  2249. assemblee_nationale: 'Assemblée Nationale',
  2250. sgg: 'SGG',
  2251. finances: 'Min. Finances',
  2252. justice: 'Min. Justice',
  2253. interieur: 'Min. Intérieur',
  2254. sante: 'Min. Santé',
  2255. education: 'Min. Éducation',
  2256. gouvernorat_ngazidja: 'Gouvernorat Ngazidja',
  2257. gouvernorat_anjouan: 'Gouvernorat Anjouan',
  2258. gouvernorat_moheli: 'Gouvernorat Mohéli',
  2259. vice_presidence: 'Vice-Présidence',
  2260. transport: 'Min. Transport',
  2261. agriculture: 'Min. Agriculture',
  2262. travaux_publics: 'Min. Travaux Publics',
  2263. autres_ministeres: 'Autres ministères',
  2264. justice_cour_supreme: 'Cour Suprême',
  2265. justice_cour_appel: 'Cour d\\'Appel',
  2266. },
  2267. type: {
  2268. loi: 'Lois', decret: 'Décrets', arrete: 'Arrêtés',
  2269. circulaire: 'Circulaires', avis: 'Avis officiels',
  2270. marche_public: 'Marchés publics & DSP',
  2271. acte_foncier: 'Réquisitions & actes fonciers',
  2272. societe_rccm: 'Actes RCCM/OHADA',
  2273. enchere: 'Ventes aux enchères',
  2274. association: 'Récépissés associations',
  2275. },
  2276. statut: {
  2277. en_vigueur: 'En vigueur', modifie: 'Modifié',
  2278. abroge: 'Abrogé', suspendu: 'Suspendu',
  2279. remplace: 'Remplacé', archive: 'Archivé',
  2280. },
  2281. territoire: {
  2282. union: 'Union des Comores', ngazidja: 'Grande Comore',
  2283. anjouan: 'Anjouan', moheli: 'Mohéli',
  2284. moroni: 'Moroni', mutsamudu: 'Mutsamudu', fomboni: 'Fomboni',
  2285. },
  2286. sort: {
  2287. date_desc: 'Récent → Ancien', date_asc: 'Ancien → Récent',
  2288. pertinence: 'Pertinence', titre_asc: 'Titre A→Z',
  2289. },
  2290. };
  2291. // ─── Utilitaires ──────────────────────────────────────────────────────────
  2292. function debounce(fn, delay) {
  2293. return function (...args) {
  2294. clearTimeout(debounceTimer);
  2295. debounceTimer = setTimeout(() => fn.apply(this, args), delay);
  2296. };
  2297. }
  2298. function getFormParams() {
  2299. const params = {};
  2300. if (mainInput && mainInput.value.trim()) params.q = mainInput.value.trim();
  2301. filterSelects.forEach(el => {
  2302. if (el.value) params[el.name] = el.value;
  2303. });
  2304. return params;
  2305. }
  2306. function buildQueryString(params) {
  2307. return Object.entries(params)
  2308. .filter(([, v]) => v)
  2309. .map(([k, v]) => `\${encodeURIComponent(k)}=\${encodeURIComponent(v)}`)
  2310. .join('&');
  2311. }
  2312. // ─── Chips filtres actifs ──────────────────────────────────────────────────
  2313. function updateFilterChips() {
  2314. if (!filterChips) return;
  2315. filterChips.innerHTML = '';
  2316. let count = 0;
  2317. filterSelects.forEach(el => {
  2318. if (!el.value || el.name === 'sort') return;
  2319. count++;
  2320. const label = (filterLabels[el.name] || {})[el.value] || el.value;
  2321. const chip = document.createElement('span');
  2322. chip.className = 'inline-flex items-center gap-1.5 bg-[#006633]/10 text-[#006633] border border-[#006633]/20 text-xs font-semibold px-3 py-1 rounded-full';
  2323. chip.innerHTML = `\${label} <button type=\"button\" data-filter=\"\${el.name}\" class=\"remove-chip ml-0.5 hover:text-red-500 transition\"><i class=\"fas fa-times text-[10px]\"></i></button>`;
  2324. filterChips.appendChild(chip);
  2325. });
  2326. // Badge compteur
  2327. if (count > 0) {
  2328. activeCountBadge.textContent = count;
  2329. activeCountBadge.classList.remove('hidden');
  2330. resetBtn.classList.remove('hidden');
  2331. } else {
  2332. activeCountBadge.classList.add('hidden');
  2333. resetBtn.classList.add('hidden');
  2334. }
  2335. // Clics sur remove-chip
  2336. filterChips.querySelectorAll('.remove-chip').forEach(btn => {
  2337. btn.addEventListener('click', () => {
  2338. const filterName = btn.dataset.filter;
  2339. const el = filterForm.querySelector(`[name=\"\${filterName}\"]`);
  2340. if (el) { el.value = ''; }
  2341. updateFilterChips();
  2342. triggerSearch(1);
  2343. });
  2344. });
  2345. }
  2346. // ─── Toggle panel filtres ─────────────────────────────────────────────────
  2347. if (toggleFiltersBtn) {
  2348. toggleFiltersBtn.addEventListener('click', () => {
  2349. filtersVisible = !filtersVisible;
  2350. filtersPanel.style.maxHeight = filtersVisible ? filtersPanel.scrollHeight + 'px' : '0';
  2351. filtersPanel.style.overflow = filtersVisible ? 'visible' : 'hidden';
  2352. toggleFiltersIcon.style.transform = filtersVisible ? 'rotate(0deg)' : 'rotate(-90deg)';
  2353. toggleFiltersLbl.textContent = filtersVisible ? 'Masquer les filtres' : 'Afficher les filtres';
  2354. });
  2355. }
  2356. // ─── Période personnalisée ────────────────────────────────────────────────
  2357. if (periodSelect) {
  2358. periodSelect.addEventListener('change', function () {
  2359. customDatesPanel.classList.toggle('hidden', this.value !== 'custom');
  2360. });
  2361. }
  2362. // ─── Boutons filtres rapides (Hero) ───────────────────────────────────────
  2363. quickTypeBtns.forEach(btn => {
  2364. btn.addEventListener('click', () => {
  2365. // Update visuel
  2366. quickTypeBtns.forEach(b => {
  2367. b.className = b.className.replace('bg-white text-[#006633] shadow-lg', 'bg-white/20 text-white hover:bg-white/30 border border-white/20');
  2368. });
  2369. btn.className = btn.className.replace('bg-white/20 text-white hover:bg-white/30 border border-white/20', 'bg-white text-[#006633] shadow-lg');
  2370. // Synchro avec le select type
  2371. const typeFilter = document.getElementById('filter-type');
  2372. if (typeFilter) typeFilter.value = btn.dataset.type;
  2373. updateFilterChips();
  2374. triggerSearch(1);
  2375. });
  2376. });
  2377. // ─── Suggestions rapides ──────────────────────────────────────────────────
  2378. quickSuggestions.forEach(btn => {
  2379. btn.addEventListener('click', () => {
  2380. if (mainInput) mainInput.value = btn.textContent.trim();
  2381. triggerSearch(1);
  2382. });
  2383. });
  2384. // ─── Autocomplete ─────────────────────────────────────────────────────────
  2385. const debouncedAutocomplete = debounce(fetchAutocomplete, 300);
  2386. if (mainInput) {
  2387. mainInput.addEventListener('input', function () {
  2388. const q = this.value.trim();
  2389. if (q.length >= MIN_CHARS) {
  2390. debouncedAutocomplete(q);
  2391. } else {
  2392. hideAutocomplete();
  2393. }
  2394. // Live search
  2395. debouncedSearch();
  2396. });
  2397. mainInput.addEventListener('keydown', function (e) {
  2398. if (e.key === 'Enter') {
  2399. e.preventDefault();
  2400. hideAutocomplete();
  2401. triggerSearch(1);
  2402. }
  2403. if (e.key === 'Escape') hideAutocomplete();
  2404. });
  2405. }
  2406. if (heroBtnSearch) {
  2407. heroBtnSearch.addEventListener('click', () => {
  2408. hideAutocomplete();
  2409. triggerSearch(1);
  2410. });
  2411. }
  2412. function hideAutocomplete() {
  2413. if (autocompleteBox) autocompleteBox.classList.add('hidden');
  2414. }
  2415. async function fetchAutocomplete(q) {
  2416. try {
  2417. const res = await fetch(`\${SEARCH_API_URL}?q=\${encodeURIComponent(q)}&autocomplete=1&limit=6`);
  2418. if (!res.ok) return;
  2419. const data = await res.json();
  2420. renderAutocomplete(data.suggestions || []);
  2421. } catch (e) {
  2422. // silencieux
  2423. }
  2424. }
  2425. function renderAutocomplete(suggestions) {
  2426. if (!autocompleteBox || suggestions.length === 0) {
  2427. hideAutocomplete();
  2428. return;
  2429. }
  2430. autocompleteBox.innerHTML = suggestions.map(s => `
  2431. <button type=\"button\" class=\"autocomplete-item w-full text-left px-4 py-3 hover:bg-emerald-50 flex items-center gap-3 border-b border-gray-50 last:border-none transition-colors\">
  2432. <i class=\"fas fa-search text-gray-300 text-xs flex-shrink-0\"></i>
  2433. <span class=\"text-sm text-gray-700\">\${escapeHtml(s.titre || s)}</span>
  2434. \${s.type ? `<span class=\"ml-auto text-xs text-gray-400 font-mono\">\${escapeHtml(s.type)}</span>` : ''}
  2435. </button>
  2436. `).join('');
  2437. autocompleteBox.classList.remove('hidden');
  2438. autocompleteBox.querySelectorAll('.autocomplete-item').forEach((item, idx) => {
  2439. item.addEventListener('click', () => {
  2440. const s = suggestions[idx];
  2441. if (mainInput) mainInput.value = s.titre || s;
  2442. hideAutocomplete();
  2443. triggerSearch(1);
  2444. });
  2445. });
  2446. }
  2447. document.addEventListener('click', e => {
  2448. if (!autocompleteBox?.contains(e.target) && e.target !== mainInput) hideAutocomplete();
  2449. });
  2450. // ─── Changement de filtre → rechargement live ─────────────────────────────
  2451. filterSelects.forEach(el => {
  2452. el.addEventListener('change', () => {
  2453. updateFilterChips();
  2454. if (el.name !== 'date_debut' && el.name !== 'date_fin') triggerSearch(1);
  2455. });
  2456. });
  2457. // Dates personnalisées: déclencher à la perte de focus
  2458. ['filter-date-debut', 'filter-date-fin'].forEach(id => {
  2459. const el = document.getElementById(id);
  2460. if (el) el.addEventListener('change', () => triggerSearch(1));
  2461. });
  2462. // ─── Formulaire submit ────────────────────────────────────────────────────
  2463. if (filterForm) {
  2464. filterForm.addEventListener('submit', e => {
  2465. e.preventDefault();
  2466. triggerSearch(1);
  2467. });
  2468. }
  2469. // ─── Recherche principale (AJAX) ──────────────────────────────────────────
  2470. const debouncedSearch = debounce(() => triggerSearch(1), DEBOUNCE_MS);
  2471. async function triggerSearch(page = 1) {
  2472. currentPage = page;
  2473. const params = getFormParams();
  2474. params.page = page;
  2475. currentParams = { ...params };
  2476. // Mettre à jour l'URL sans rechargement
  2477. const qs = buildQueryString(params);
  2478. window.history.replaceState({}, '', `\${SEARCH_URL}\${qs ? '?' + qs : ''}`);
  2479. if (!params.q && Object.keys(params).filter(k => k !== 'sort' && k !== 'page').length === 0) {
  2480. // Aucun critère: afficher état accueil
  2481. showWelcomeState();
  2482. return;
  2483. }
  2484. showLoading();
  2485. try {
  2486. const res = await fetch(`\${SEARCH_API_URL}?\${qs}`, {
  2487. headers: { 'X-Requested-With': 'XMLHttpRequest', 'Accept': 'application/json' }
  2488. });
  2489. // Si la route API n'existe pas encore (404/405/500), fallback SSR silencieux
  2490. if (res.status === 404 || res.status === 405) {
  2491. window.location.href = `\${SEARCH_URL}?\${qs}`;
  2492. return;
  2493. }
  2494. if (!res.ok) throw new Error('HTTP ' + res.status);
  2495. const data = await res.json();
  2496. renderResults(data, params.q || '');
  2497. } catch (err) {
  2498. // Erreur réseau : fallback vers SSR plutôt qu'afficher un message d'erreur
  2499. console.warn('[Munganyo] API indisponible, fallback SSR:', err.message);
  2500. window.location.href = `\${SEARCH_URL}?\${qs}`;
  2501. }
  2502. }
  2503. function showLoading() {
  2504. if (spinner) spinner.classList.remove('hidden');
  2505. if (statusBar) statusBar.classList.remove('hidden');
  2506. if (resultsContainer) {
  2507. resultsContainer.style.opacity = '0.4';
  2508. resultsContainer.style.pointerEvents = 'none';
  2509. }
  2510. }
  2511. function hideLoading() {
  2512. if (spinner) spinner.classList.add('hidden');
  2513. if (resultsContainer) {
  2514. resultsContainer.style.opacity = '1';
  2515. resultsContainer.style.pointerEvents = '';
  2516. }
  2517. }
  2518. function showWelcomeState() {
  2519. hideLoading();
  2520. if (statusBar) statusBar.classList.add('hidden');
  2521. if (resultsContainer) {
  2522. resultsContainer.innerHTML = document.getElementById('welcome-state')
  2523. ? document.getElementById('welcome-state').outerHTML
  2524. : `<div class=\"text-center py-16 text-gray-500\"><i class=\"fas fa-search text-4xl mb-4 text-gray-300\"></i><p>Effectuez une recherche ci-dessus</p></div>`;
  2525. }
  2526. if (paginationCont) paginationCont.innerHTML = '';
  2527. }
  2528. function showErrorState() {
  2529. hideLoading();
  2530. if (statusBar) statusBar.classList.add('hidden');
  2531. if (paginationCont) paginationCont.innerHTML = '';
  2532. const q = mainInput ? mainInput.value.trim() : '';
  2533. if (resultsContainer) {
  2534. resultsContainer.innerHTML = `
  2535. <div class=\"text-center py-16 bg-orange-50 rounded-2xl border border-orange-100\">
  2536. <div class=\"w-16 h-16 bg-orange-100 rounded-full flex items-center justify-center mx-auto mb-5\">
  2537. <i class=\"fas fa-wifi text-2xl text-orange-400\"></i>
  2538. </div>
  2539. <h3 class=\"text-lg font-semibold text-orange-700 mb-2\">Connexion temporairement indisponible</h3>
  2540. <p class=\"text-sm text-gray-500 max-w-sm mx-auto mb-5\">
  2541. La recherche en temps réel est momentanément inaccessible.
  2542. Vous pouvez relancer manuellement votre recherche.
  2543. </p>
  2544. <a href=\"\${SEARCH_URL}\${q ? '?q=' + encodeURIComponent(q) : ''}\"
  2545. class=\"inline-flex items-center gap-2 bg-[#006633] text-white px-6 py-2.5 rounded-xl text-sm font-semibold hover:bg-[#004d26] transition shadow-md\">
  2546. <i class=\"fas fa-redo-alt\"></i> Relancer la recherche
  2547. </a>
  2548. </div>`;
  2549. }
  2550. }
  2551. function renderResults(data, query) {
  2552. hideLoading();
  2553. // Mise à jour compteur
  2554. if (statusBar) statusBar.classList.remove('hidden');
  2555. if (countLabel) {
  2556. const q = query ? `pour <em class=\"text-[#006633] not-italic font-black\">\"\${escapeHtml(query)}\"</em>` : '';
  2557. countLabel.innerHTML = `<span id=\"count-number\">\${data.total || 0}</span> résultat(s) \${q}`;
  2558. }
  2559. // Résultats
  2560. if (!resultsContainer) return;
  2561. if (!data.results || data.results.length === 0) {
  2562. resultsContainer.innerHTML = renderNoResults(query);
  2563. } else {
  2564. resultsContainer.innerHTML = `<div class=\"space-y-4\">\${data.results.map(r => renderResultCard(r, data.isPremium)).join('')}</div>`;
  2565. }
  2566. // Pagination
  2567. if (paginationCont) {
  2568. paginationCont.innerHTML = data.totalPages > 1
  2569. ? renderPagination(data.currentPage, data.totalPages, currentParams)
  2570. : '';
  2571. }
  2572. // Scroll doux vers résultats
  2573. document.getElementById('results-section')?.scrollIntoView({ behavior: 'smooth', block: 'start' });
  2574. }
  2575. // ─── Rendu côté client (fallback / AJAX) ─────────────────────────────────
  2576. const TYPE_COLORS = {
  2577. loi: 'bg-purple-100 text-purple-700 border-purple-200',
  2578. decret: 'bg-blue-100 text-blue-700 border-blue-200',
  2579. arrete: 'bg-green-100 text-green-700 border-green-200',
  2580. circulaire: 'bg-cyan-100 text-cyan-700 border-cyan-200',
  2581. avis: 'bg-sky-100 text-sky-700 border-sky-200',
  2582. marche_public: 'bg-emerald-100 text-emerald-700 border-emerald-200',
  2583. acte_foncier: 'bg-teal-100 text-teal-700 border-teal-200',
  2584. societe_rccm: 'bg-indigo-100 text-indigo-700 border-indigo-200',
  2585. association: 'bg-amber-100 text-amber-700 border-amber-200',
  2586. enchere: 'bg-orange-100 text-orange-700 border-orange-200',
  2587. };
  2588. const TYPE_ICONS = {
  2589. loi: 'fa-gavel', decret: 'fa-file-signature', arrete: 'fa-clipboard-list',
  2590. circulaire: 'fa-envelope', avis: 'fa-bell', marche_public: 'fa-briefcase',
  2591. acte_foncier: 'fa-map-marker-alt', societe_rccm: 'fa-building',
  2592. association: 'fa-handshake', enchere: 'fa-hammer',
  2593. };
  2594. const STATUT_COLORS = {
  2595. en_vigueur: 'bg-green-50 text-green-600',
  2596. abroge: 'bg-red-50 text-red-600',
  2597. modifie: 'bg-yellow-50 text-yellow-700',
  2598. suspendu: 'bg-orange-50 text-orange-600',
  2599. };
  2600. function renderResultCard(r, isPremium) {
  2601. const colorClass = TYPE_COLORS[r.type] || 'bg-gray-100 text-gray-700 border-gray-200';
  2602. const iconClass = TYPE_ICONS[r.type] || 'fa-file-alt';
  2603. const statutClr = STATUT_COLORS[r.statutJuridique] || 'bg-gray-50 text-gray-500';
  2604. const date = r.datePublication ? new Date(r.datePublication).toLocaleDateString('fr-FR') : 'N/A';
  2605. return `
  2606. <article class=\"bg-white border border-gray-100 rounded-2xl shadow-sm hover:shadow-md transition-all duration-200 p-5 group\">
  2607. <div class=\"flex flex-wrap justify-between items-start gap-2 mb-3\">
  2608. <div class=\"flex flex-wrap items-center gap-2\">
  2609. <span class=\"inline-flex items-center gap-1.5 px-3 py-1 text-xs font-bold rounded-full border \${colorClass}\">
  2610. <i class=\"fas \${iconClass} text-[10px]\"></i> \${escapeHtml(r.typeLabel || r.type)}
  2611. </span>
  2612. \${r.numero ? `<span class=\"text-xs text-gray-400 font-mono bg-gray-50 px-2 py-0.5 rounded\">\${escapeHtml(r.numero)}</span>` : ''}
  2613. \${r.statutJuridique ? `<span class=\"text-xs px-2 py-0.5 rounded \${statutClr}\">\${escapeHtml(r.statutJuridique.replace('_', ' '))}</span>` : ''}
  2614. </div>
  2615. <time class=\"text-xs text-gray-400 flex items-center gap-1 flex-shrink-0\">
  2616. <i class=\"far fa-calendar-alt\"></i> \${date}
  2617. </time>
  2618. </div>
  2619. <h3 class=\"text-base font-bold text-gray-800 mb-2 group-hover:text-[#006633] transition leading-snug\">
  2620. <a href=\"/acte/\${r.id}\">\${escapeHtml(r.titre)}</a>
  2621. </h3>
  2622. \${r.resume ? `<p class=\"text-gray-500 text-sm mb-3 line-clamp-2\">\${escapeHtml(r.resume)}</p>` : ''}
  2623. \${isPremium && r.extrait ? `
  2624. <div class=\"mb-3 px-3 py-2 bg-amber-50 border-l-4 border-amber-400 rounded-r-lg text-xs text-gray-700\">
  2625. <i class=\"fas fa-quote-left text-amber-400 mr-1\"></i>\${escapeHtml(r.extrait)}
  2626. </div>` : ''}
  2627. <div class=\"flex flex-wrap items-center justify-between gap-2 pt-3 border-t border-gray-50\">
  2628. <div class=\"flex items-center gap-3 text-xs text-gray-500\">
  2629. \${r.institution ? `<span><i class=\"fas fa-landmark text-[#006633] mr-1\"></i>\${escapeHtml(r.institution)}</span>` : ''}
  2630. \${r.territoire ? `<span><i class=\"fas fa-map-marker-alt text-gray-400 mr-1\"></i>\${escapeHtml(r.territoire)}</span>` : ''}
  2631. \${isPremium && r.relevance ? `<span class=\"text-[#006633] font-semibold\"><i class=\"fas fa-chart-line mr-1\"></i>\${Math.round(r.relevance * 100)}%</span>` : ''}
  2632. </div>
  2633. <div class=\"flex items-center gap-3\">
  2634. <a href=\"/acte/\${r.id}\" class=\"text-xs text-[#006633] hover:text-[#008040] font-semibold flex items-center gap-1 transition\">
  2635. <i class=\"fas fa-eye\"></i> Consulter
  2636. </a>
  2637. \${r.pdf_url ? `<a href=\"\${escapeHtml(r.pdf_url)}\" target=\"_blank\" rel=\"noopener\" class=\"text-xs text-gray-400 hover:text-gray-600 flex items-center gap-1 transition\"><i class=\"fas fa-file-pdf\"></i> PDF</a>` : ''}
  2638. </div>
  2639. </div>
  2640. </article>`;
  2641. }
  2642. function renderNoResults(query) {
  2643. const activeFilters = [];
  2644. const typeEl = document.getElementById('filter-type');
  2645. const instEl = document.getElementById('filter-institution');
  2646. const periodEl = document.getElementById('filter-period');
  2647. if (typeEl && typeEl.options[typeEl.selectedIndex]?.text && typeEl.value)
  2648. activeFilters.push(typeEl.options[typeEl.selectedIndex].text);
  2649. if (instEl && instEl.options[instEl.selectedIndex]?.text && instEl.value)
  2650. activeFilters.push(instEl.options[instEl.selectedIndex].text);
  2651. if (periodEl && periodEl.value && periodEl.value !== 'custom')
  2652. activeFilters.push('année ' + periodEl.value);
  2653. let searchDesc = '';
  2654. if (query) searchDesc += `<strong class=\"text-gray-800\">&laquo;&nbsp;\${escapeHtml(query)}&nbsp;&raquo;</strong>`;
  2655. if (activeFilters.length) {
  2656. searchDesc += (query ? ' avec les filtres ' : 'les critères ');
  2657. searchDesc += activeFilters.map(f => `<span class=\"inline-flex items-center gap-1 bg-[#006633]/10 text-[#006633] text-xs font-semibold px-2 py-0.5 rounded-full\">\${escapeHtml(f)}</span>`).join(' ');
  2658. }
  2659. if (!searchDesc) searchDesc = 'ces critères de recherche';
  2660. return `
  2661. <div class=\"text-center py-16 bg-gray-50 rounded-2xl border border-gray-100\">
  2662. <div class=\"w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-5\">
  2663. <i class=\"fas fa-file-search text-2xl text-gray-400\"></i>
  2664. </div>
  2665. <h3 class=\"text-xl font-bold text-gray-800 mb-3\">
  2666. Aucun acte trouvé pour \${searchDesc}
  2667. </h3>
  2668. <p class=\"text-gray-500 text-sm max-w-md mx-auto mb-6 leading-relaxed\">
  2669. Votre recherche \${query ? `avec <strong class=\"text-gray-700\">&laquo;&nbsp;\${escapeHtml(query)}&nbsp;&raquo;</strong>` : ''} ne correspond
  2670. à aucun acte publié au Journal Officiel de l'Union des Comores.
  2671. </p>
  2672. <div class=\"flex flex-wrap justify-center gap-3 text-xs text-gray-500 mb-6\">
  2673. <span class=\"flex items-center gap-1.5 bg-white border border-gray-200 px-3 py-1.5 rounded-full shadow-sm\">
  2674. <i class=\"fas fa-lightbulb text-amber-400\"></i> Vérifiez l'orthographe des mots-clés
  2675. </span>
  2676. <span class=\"flex items-center gap-1.5 bg-white border border-gray-200 px-3 py-1.5 rounded-full shadow-sm\">
  2677. <i class=\"fas fa-expand-alt text-blue-400\"></i> Élargissez ou supprimez les filtres
  2678. </span>
  2679. <span class=\"flex items-center gap-1.5 bg-white border border-gray-200 px-3 py-1.5 rounded-full shadow-sm\">
  2680. <i class=\"fas fa-hashtag text-[#006633]\"></i> Essayez la référence exacte de l'acte
  2681. </span>
  2682. </div>
  2683. <div class=\"flex flex-wrap justify-center gap-3\">
  2684. <button type=\"button\" onclick=\"document.getElementById('main-search-input').value='';document.getElementById('filter-type').value='';document.getElementById('filter-institution').value='';triggerSearch(1);\"
  2685. class=\"inline-flex items-center gap-2 border border-gray-200 text-gray-600 px-5 py-2 rounded-xl text-sm font-medium hover:border-gray-300 hover:bg-gray-50 transition\">
  2686. <i class=\"fas fa-undo-alt text-xs\"></i> Réinitialiser la recherche
  2687. </button>
  2688. <a href=\"/abonnement\"
  2689. class=\"inline-flex items-center gap-2 bg-gradient-to-r from-amber-500 to-amber-400 text-white px-5 py-2 rounded-xl text-sm font-semibold hover:from-amber-600 hover:to-amber-500 transition shadow-md\">
  2690. <i class=\"fas fa-microchip text-xs\"></i> Activer Ibunas.IA Premium
  2691. </a>
  2692. </div>
  2693. </div>`;
  2694. }
  2695. function renderPagination(current, total, params) {
  2696. let pages = '';
  2697. for (let p = 1; p <= total; p++) {
  2698. if (p === current) {
  2699. pages += `<li><span class=\"flex items-center justify-center w-9 h-9 rounded-lg bg-[#006633] text-white font-bold text-sm\">\${p}</span></li>`;
  2700. } else if (p <= 3 || p >= total - 2 || Math.abs(p - current) <= 2) {
  2701. const ps = buildQueryString({ ...params, page: p });
  2702. pages += `<li><button type=\"button\" data-page=\"\${p}\" class=\"pagination-btn flex items-center justify-center w-9 h-9 rounded-lg border border-gray-200 text-gray-600 hover:border-[#006633] hover:text-[#006633] transition text-sm\">\${p}</button></li>`;
  2703. } else if (p === 4 && current > 6) {
  2704. pages += `<li><span class=\"px-2 text-gray-400\">…</span></li>`;
  2705. } else if (p === total - 3 && current < total - 5) {
  2706. pages += `<li><span class=\"px-2 text-gray-400\">…</span></li>`;
  2707. }
  2708. }
  2709. const prevDisabled = current <= 1 ? 'opacity-40 pointer-events-none' : '';
  2710. const nextDisabled = current >= total ? 'opacity-40 pointer-events-none' : '';
  2711. return `
  2712. <nav class=\"flex justify-center mt-8\" aria-label=\"Pagination\">
  2713. <ul class=\"flex items-center gap-1\">
  2714. <li><button type=\"button\" data-page=\"\${current - 1}\" class=\"pagination-btn flex items-center justify-center w-9 h-9 rounded-lg border border-gray-200 text-gray-500 hover:border-[#006633] hover:text-[#006633] transition text-sm \${prevDisabled}\"><i class=\"fas fa-chevron-left text-xs\"></i></button></li>
  2715. \${pages}
  2716. <li><button type=\"button\" data-page=\"\${current + 1}\" class=\"pagination-btn flex items-center justify-center w-9 h-9 rounded-lg border border-gray-200 text-gray-500 hover:border-[#006633] hover:text-[#006633] transition text-sm \${nextDisabled}\"><i class=\"fas fa-chevron-right text-xs\"></i></button></li>
  2717. </ul>
  2718. </nav>`;
  2719. }
  2720. // Délégation pour les boutons de pagination générés dynamiquement
  2721. document.addEventListener('click', e => {
  2722. const btn = e.target.closest('.pagination-btn');
  2723. if (btn) {
  2724. const page = parseInt(btn.dataset.page);
  2725. if (page && page > 0) triggerSearch(page);
  2726. }
  2727. });
  2728. // ─── XSS helper ───────────────────────────────────────────────────────────
  2729. function escapeHtml(str) {
  2730. if (!str) return '';
  2731. return String(str)
  2732. .replace(/&/g, '&amp;')
  2733. .replace(/</g, '&lt;')
  2734. .replace(/>/g, '&gt;')
  2735. .replace(/\"/g, '&quot;')
  2736. .replace(/'/g, '&#39;');
  2737. }
  2738. // ─── Init ─────────────────────────────────────────────────────────────────
  2739. function init() {
  2740. updateFilterChips();
  2741. // Si query présente dans l'URL au chargement, on l'affiche sans re-fetch (SSR)
  2742. // Si via navigation arrière/avant, on re-fetch
  2743. window.addEventListener('popstate', () => {
  2744. const urlParams = new URLSearchParams(window.location.search);
  2745. if (mainInput) mainInput.value = urlParams.get('q') || '';
  2746. filterSelects.forEach(el => {
  2747. el.value = urlParams.get(el.name) || '';
  2748. });
  2749. updateFilterChips();
  2750. const q = urlParams.get('q');
  2751. if (q) triggerSearch(parseInt(urlParams.get('page') || '1'));
  2752. });
  2753. }
  2754. init();
  2755. })();
  2756. </script>
  2757. {% endblock %}
  2758. ", "search/index.html.twig", "/htdocs/jo.technopole-km.com/templates/search/index.html.twig");
  2759. }
  2760. }