var/cache/website/dev/twig/13/13044380003db5b93cc8d2c1ed006607287e35d4c11d36d0e15ebf3165429f07.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. /* front/reserver.html.twig */
  16. class __TwigTemplate_5b4d641963e62041a7c043fa8e9fb89ba66d5adb6faa03f0168b54c27473c0cc 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.             'contentBody' => [$this'block_contentBody'],
  29.             'javascripts' => [$this'block_javascripts'],
  30.         ];
  31.     }
  32.     protected function doGetParent(array $context): bool|string|Template|TemplateWrapper
  33.     {
  34.         // line 1
  35.         return "layout.html.twig";
  36.     }
  37.     protected function doDisplay(array $context, array $blocks = []): iterable
  38.     {
  39.         $macros $this->macros;
  40.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  41.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""front/reserver.html.twig"));
  42.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  43.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""front/reserver.html.twig"));
  44.         $this->parent $this->loadTemplate("layout.html.twig""front/reserver.html.twig"1);
  45.         yield from $this->parent->unwrap()->yield($contextarray_merge($this->blocks$blocks));
  46.         
  47.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  48.         
  49.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  50.     }
  51.     // line 3
  52.     /**
  53.      * @return iterable<null|scalar|\Stringable>
  54.      */
  55.     public function block_contentBody(array $context, array $blocks = []): iterable
  56.     {
  57.         $macros $this->macros;
  58.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  59.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""contentBody"));
  60.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  61.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""contentBody"));
  62.         // line 4
  63.         yield "    ";
  64.         $context["title"] = CoreExtension::getAttribute($this->env$this->source, (isset($context["content"]) || array_key_exists("content"$context) ? $context["content"] : (function () { throw new RuntimeError('Variable "content" does not exist.'4$this->source); })()), "title", [], "any"falsefalsefalse4);
  65.         // line 5
  66.         yield "
  67.     ";
  68.         // line 6
  69.         if (((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'6$this->source); })()) != "annulation")) {
  70.             // line 7
  71.             yield "        <div class=\"bg-white kl-block-nav\">
  72.             <div class=\"kl-top-nav\">
  73.                 ";
  74.             // line 9
  75.             if (((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'9$this->source); })()) != "confirmation")) {
  76.                 // line 10
  77.                 yield "                    <a href=\"";
  78.                 yield (((((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'10$this->source); })()) == "choice") || ((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'10$this->source); })()) == ""))) ? ("/") : ((((array_key_exists("referer"$context) &&  !Twig\Extension\CoreExtension::testEmpty((isset($context["referer"]) || array_key_exists("referer"$context) ? $context["referer"] : (function () { throw new RuntimeError('Variable "referer" does not exist.'10$this->source); })())))) ? ($this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape((isset($context["referer"]) || array_key_exists("referer"$context) ? $context["referer"] : (function () { throw new RuntimeError('Variable "referer" does not exist.'10$this->source); })()), "html"nulltrue)) : ("/"))));
  79.                 yield "\" class=\"kl-step-return\"><i>&larr; Retour à l'étape précédente</i></a>
  80.                 ";
  81.             }
  82.             // line 12
  83.             yield "
  84.                 <ul class=\"kl-step-menu mb-0\">
  85.                     <li class=\"";
  86.             // line 14
  87.             yield (((((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'14$this->source); })()) == "choice") || ((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'14$this->source); })()) == ""))) ? ("active") : (""));
  88.             yield "\"><a href=\"";
  89.             yield ((((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'14$this->source); })()) == "recap")) ? ("?step=choice") : ("#choice"));
  90.             yield "\" ";
  91.             yield ((((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'14$this->source); })()) == "confirmation")) ? ("onclick=\"return false\"") : (""));
  92.             yield ">Choix de la formule</a></li>
  93.                     <li class=\"";
  94.             // line 15
  95.             yield (((((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'15$this->source); })()) == "recap") && CoreExtension::getAttribute($this->env$this->source, ($context["datas"] ?? null), "commandes", [], "any"truetruefalse15))) ? ("active") : (""));
  96.             yield "\"><a href=\"";
  97.             yield ((((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'15$this->source); })()) == "choice")) ? ("?step=recap") : ("#recap"));
  98.             yield "\" ";
  99.             yield (((((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'15$this->source); })()) == "choice") || ((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'15$this->source); })()) == "confirmation"))) ? ("onclick=\"return false\"") : (""));
  100.             yield ">Récapitulatif</a></li>
  101.                     <li class=\"\"><a href=\"#paiement\" onclick=\"return false\">Paiement</a></li>
  102.                     <li class=\"";
  103.             // line 17
  104.             yield ((((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'17$this->source); })()) == "confirmation")) ? ("active") : (""));
  105.             yield "\"><a href=\"#confirmation\" onclick=\"return false\">Confirmation</a></li>
  106.                 </ul>
  107.             </div>
  108.         </div>
  109.     ";
  110.         }
  111.         // line 22
  112.         yield "
  113.     <div class=\" max-container-3 block-texte mx-auto px-0 pb-lg-4\">
  114.         <div class=\"row titre-details mt-4\">
  115.             ";
  116.         // line 25
  117.         if ((((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'25$this->source); })()) != "confirmation") && ((isset($context["step"]) || array_key_exists("step"$context) ? $context["step"] : (function () { throw new RuntimeError('Variable "step" does not exist.'25$this->source); })()) != "annulation"))) {
  118.             // line 26
  119.             yield "                <div class=\"col-md-12\"><h2 class=\"mb-3\">";
  120.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape((isset($context["title"]) || array_key_exists("title"$context) ? $context["title"] : (function () { throw new RuntimeError('Variable "title" does not exist.'26$this->source); })()), "html"nulltrue);
  121.             yield " : </h2></div>
  122.             ";
  123.         }
  124.         // line 28
  125.         yield "
  126.             ";
  127.         // line 29
  128.         if (((CoreExtension::getAttribute($this->env$this->source, ($context["datas"] ?? null), "commandes", [], "any"truetruefalse29) &&  !Twig\Extension\CoreExtension::testEmpty(CoreExtension::getAttribute($this->env$this->source, (isset($context["datas"]) || array_key_exists("datas"$context) ? $context["datas"] : (function () { throw new RuntimeError('Variable "datas" does not exist.'29$this->source); })()), "commandes", [], "any"falsefalsefalse29))) && CoreExtension::getAttribute($this->env$this->source, ($context["datas"] ?? null), "paymentForm", [], "any"truetruefalse29))) {
  129.             // line 30
  130.             yield "                <div class=\"col-md-12\">
  131.                     <div class=\"card\">
  132.                         <div class=\"card-body\">
  133.                             <div class=\"row\">
  134.                                 <div class=\"col-md-12\" id=\"id_liste\">
  135.                                     <table class=\"table table-striped table-hover\">
  136.                                         <thead class=\"thead-dark\">
  137.                                         <tr>
  138.                                             <th>Désignation</th>
  139.                                             <th>Qté</th>
  140.                                             <th class=\"text-right\">PU</th>
  141.                                             <th class=\"text-right\">Montant</th>
  142.                                             <th></th>
  143.                                         </tr>
  144.                                         </thead>
  145.                                         <tbody>
  146.                                         ";
  147.             // line 46
  148.             $context["total"] = 0;
  149.             // line 47
  150.             yield "                                        ";
  151.             $context['_parent'] = $context;
  152.             $context['_seq'] = CoreExtension::ensureTraversable(CoreExtension::getAttribute($this->env$this->source, (isset($context["datas"]) || array_key_exists("datas"$context) ? $context["datas"] : (function () { throw new RuntimeError('Variable "datas" does not exist.'47$this->source); })()), "commandes", [], "any"falsefalsefalse47));
  153.             foreach ($context['_seq'] as $context["_key"] => $context["commandeItem"]) {
  154.                 // line 48
  155.                 yield "                                            ";
  156.                 $context["montant"] = (CoreExtension::getAttribute($this->env$this->source$context["commandeItem"], "qte", [], "any"falsefalsefalse48) * CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, (isset($context["tarifs"]) || array_key_exists("tarifs"$context) ? $context["tarifs"] : (function () { throw new RuntimeError('Variable "tarifs" does not exist.'48$this->source); })()), CoreExtension::getAttribute($this->env$this->source$context["commandeItem"], "tarif_id", [], "any"falsefalsefalse48), [], "array"falsefalsefalse48), "pu", [], "any"falsefalsefalse48));
  157.                 // line 49
  158.                 yield "                                            ";
  159.                 $context["total"] = ((isset($context["total"]) || array_key_exists("total"$context) ? $context["total"] : (function () { throw new RuntimeError('Variable "total" does not exist.'49$this->source); })()) + (isset($context["montant"]) || array_key_exists("montant"$context) ? $context["montant"] : (function () { throw new RuntimeError('Variable "montant" does not exist.'49$this->source); })()));
  160.                 // line 50
  161.                 yield "                                            <tr data-id=\"";
  162.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["commandeItem"], "getId", [], "method"falsefalsefalse50), "html"nulltrue);
  163.                 yield "\">
  164.                                                 <td>";
  165.                 // line 51
  166.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, (isset($context["tarifs"]) || array_key_exists("tarifs"$context) ? $context["tarifs"] : (function () { throw new RuntimeError('Variable "tarifs" does not exist.'51$this->source); })()), CoreExtension::getAttribute($this->env$this->source$context["commandeItem"], "tarif_id", [], "any"falsefalsefalse51), [], "array"falsefalsefalse51), "description", [], "any"falsefalsefalse51), "html"nulltrue);
  167.                 yield "</td>
  168.                                                 <td>";
  169.                 // line 52
  170.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["commandeItem"], "qte", [], "any"falsefalsefalse52), "html"nulltrue);
  171.                 yield (((CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, (isset($context["tarifs"]) || array_key_exists("tarifs"$context) ? $context["tarifs"] : (function () { throw new RuntimeError('Variable "tarifs" does not exist.'52$this->source); })()), CoreExtension::getAttribute($this->env$this->source$context["commandeItem"], "tarif_id", [], "any"falsefalsefalse52), [], "array"falsefalsefalse52), "titre", [], "any"falsefalsefalse52) == "SDR")) ? ("h") : (""));
  172.                 yield "</td>
  173.                                                 <td class=\"text-right\">";
  174.                 // line 53
  175.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, (isset($context["tarifs"]) || array_key_exists("tarifs"$context) ? $context["tarifs"] : (function () { throw new RuntimeError('Variable "tarifs" does not exist.'53$this->source); })()), CoreExtension::getAttribute($this->env$this->source$context["commandeItem"], "tarif_id", [], "any"falsefalsefalse53), [], "array"falsefalsefalse53), "pu", [], "any"falsefalsefalse53), "html"nulltrue);
  176.                 yield " €</td>
  177.                                                 <td class=\"text-right\"><span class=\"kl_montant\">";
  178.                 // line 54
  179.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape((isset($context["montant"]) || array_key_exists("montant"$context) ? $context["montant"] : (function () { throw new RuntimeError('Variable "montant" does not exist.'54$this->source); })()), "html"nulltrue);
  180.                 yield "</span> €</td>
  181.                                                 <td>
  182.                                                     <a href=\"#\" class=\"kl-delete-cmd text-danger\" title=\"Supprimer ce commande\">
  183.                                                         <i class=\"fa fa-trash\"></i>
  184.                                                     </a>
  185.                                                 </td>
  186.                                             </tr>
  187.                                         ";
  188.             }
  189.             $_parent $context['_parent'];
  190.             unset($context['_seq'], $context['_key'], $context['commandeItem'], $context['_parent']);
  191.             $context array_intersect_key($context$_parent) + $_parent;
  192.             // line 62
  193.             yield "                                        <tr class=\"bg-white\">
  194.                                             <th class=\"text-right\" colspan=3>Total HT</th>
  195.                                             <th class=\"text-right\"><span id=\"idTotalHt\">";
  196.             // line 64
  197.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape((isset($context["total"]) || array_key_exists("total"$context) ? $context["total"] : (function () { throw new RuntimeError('Variable "total" does not exist.'64$this->source); })()), "html"nulltrue);
  198.             yield "</span> €</th>
  199.                                             <th></th>
  200.                                         </tr>
  201.                                         <tr class=\"bg-white\">
  202.                                             <th class=\"text-right\" colspan=3>TVA</th>
  203.                                             <th class=\"text-right\"><span id=\"idTva\">";
  204.             // line 69
  205.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(((isset($context["total"]) || array_key_exists("total"$context) ? $context["total"] : (function () { throw new RuntimeError('Variable "total" does not exist.'69$this->source); })()) * 0.2), "html"nulltrue);
  206.             yield "</span> €</th>
  207.                                             <th></th>
  208.                                         </tr>
  209.                                         <tr class=\"bg-white\">
  210.                                             <th class=\"text-right\" colspan=3>TTC</th>
  211.                                             <th class=\"text-right\"><span id=\"idTotalTtc\">";
  212.             // line 74
  213.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(((isset($context["total"]) || array_key_exists("total"$context) ? $context["total"] : (function () { throw new RuntimeError('Variable "total" does not exist.'74$this->source); })()) + ((isset($context["total"]) || array_key_exists("total"$context) ? $context["total"] : (function () { throw new RuntimeError('Variable "total" does not exist.'74$this->source); })()) * 0.2)), "html"nulltrue);
  214.             yield "</span> €</th>
  215.                                             <th></th>
  216.                                         </tr>
  217.                                         </tbody>
  218.                                     </table>
  219.                                     <div class=\"text-center\">
  220.                                         ";
  221.             // line 80
  222.             yield CoreExtension::getAttribute($this->env$this->source, (isset($context["datas"]) || array_key_exists("datas"$context) ? $context["datas"] : (function () { throw new RuntimeError('Variable "datas" does not exist.'80$this->source); })()), "paymentForm", [], "any"falsefalsefalse80);
  223.             yield "
  224.                                     </div>
  225.                                 </div>
  226.                             </div>
  227.                         </div>
  228.                     </div>
  229.                 </div>
  230.             ";
  231.         } else {
  232.             // line 88
  233.             yield "                <div class=\"col-md-7\">
  234.                     <form method=\"POST\" id=\"idFormCmd\" action=\"";
  235.             // line 89
  236.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath(CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, (isset($context["app"]) || array_key_exists("app"$context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.'89$this->source); })()), "request", [], "any"falsefalsefalse89), "attributes", [], "any"falsefalsefalse89), "get", ["_route"], "method"falsefalsefalse89), CoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->sourceCoreExtension::getAttribute($this->env$this->source, (isset($context["app"]) || array_key_exists("app"$context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.'89$this->source); })()), "request", [], "any"falsefalsefalse89), "attributes", [], "any"falsefalsefalse89), "get", ["_route_params"], "method"falsefalsefalse89)), "html"nulltrue);
  237.             yield "\">
  238.                         ";
  239.             // line 90
  240.             $context['_parent'] = $context;
  241.             $context['_seq'] = CoreExtension::ensureTraversable((isset($context["tarifs"]) || array_key_exists("tarifs"$context) ? $context["tarifs"] : (function () { throw new RuntimeError('Variable "tarifs" does not exist.'90$this->source); })()));
  242.             foreach ($context['_seq'] as $context["_key"] => $context["item"]) {
  243.                 // line 91
  244.                 yield "                            <div class=\"card mb-3 kl-tarif\" data-id=\"";
  245.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["item"], "id", [], "any"falsefalsefalse91), "html"nulltrue);
  246.                 yield "\">
  247.                                 <div class=\"card-body d-flex\">
  248.                                     <figcaption class=\"kl-img-illustration\">
  249.                                         <img src=\"";
  250.                 // line 94
  251.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["item"], "logo", [], "any"falsefalsefalse94), "html"nulltrue);
  252.                 yield "\" alt=\"";
  253.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["item"], "titre", [], "any"falsefalsefalse94), "html"nulltrue);
  254.                 yield "\">
  255.                                     </figcaption>
  256.                                     <article class=\"mt-a mb-a\">
  257.                                         <h5 class=\"card-title\">";
  258.                 // line 97
  259.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["item"], "description", [], "any"falsefalsefalse97), "html"nulltrue);
  260.                 yield "</h5>
  261.                                         <p class=\"mb-0\">Quantité :
  262.                                             <input type=\"number\"
  263.                                                    inputmode=\"numeric\"
  264.                                                    pattern=\"[0-9]*\"
  265.                                                    name=\"data[";
  266.                 // line 103
  267.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["item"], "id", [], "any"falsefalsefalse103), "html"nulltrue);
  268.                 yield "]\"
  269.                                                    data-tp=\"";
  270.                 // line 104
  271.                 yield (((CoreExtension::getAttribute($this->env$this->source$context["item"], "titre", [], "any"falsefalsefalse104) == "SDR")) ? ("h") : (""));
  272.                 yield "\"
  273.                                                    data-id=\"";
  274.                 // line 105
  275.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["item"], "id", [], "any"falsefalsefalse105), "html"nulltrue);
  276.                 yield "\"
  277.                                                    data-price=\"";
  278.                 // line 106
  279.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["item"], "pu", [], "any"falsefalsefalse106), "html"nulltrue);
  280.                 yield "\"
  281.                                                    min=\"0\"
  282.                                                    value=\"\"
  283.                                                    placeholder=\"0\"
  284.                                                    class=\"kl-formInput form-control kl-inputReserve\">
  285.                                             <span class=\"ml-3\">Tarif :
  286.                                                 <strong>
  287.                                                     <span class=\"kl-price hide\">0</span>
  288.                                                     <span class=\"kl-prices\">";
  289.                 // line 114
  290.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["item"], "pu", [], "any"falsefalsefalse114), "html"nulltrue);
  291.                 yield "</span> €
  292.                                                 </strong>
  293.                                             </span>
  294.                                         </p>
  295.                                         ";
  296.                 // line 118
  297.                 if ((CoreExtension::getAttribute($this->env$this->source$context["item"], "id", [], "any"falsefalsefalse118) == "4")) {
  298.                     // line 119
  299.                     yield "                                            <p class=\"mb-2\">
  300.                                                 <a href=\"#\" data-bs-toggle=\"modal\" data-bs-target=\"#calendarModal\" class=\"kl-step-return\">
  301.                                                     <i>Voir les disponibilités</i>
  302.                                                 </a>
  303.                                             </p>
  304.                                         ";
  305.                 }
  306.                 // line 125
  307.                 yield "                                    </article>
  308.                                 </div>
  309.                             </div>
  310.                         ";
  311.             }
  312.             $_parent $context['_parent'];
  313.             unset($context['_seq'], $context['_key'], $context['item'], $context['_parent']);
  314.             $context array_intersect_key($context$_parent) + $_parent;
  315.             // line 129
  316.             yield "                    </form>
  317.                 </div>
  318.                 <div class=\"col-md-5\">
  319.                     <div class=\"card\">
  320.                         <div class=\"card-body\">
  321.                             <h5 class=\"text-center\">Résumé</h5>
  322.                             ";
  323.             // line 136
  324.             $context['_parent'] = $context;
  325.             $context['_seq'] = CoreExtension::ensureTraversable((isset($context["tarifs"]) || array_key_exists("tarifs"$context) ? $context["tarifs"] : (function () { throw new RuntimeError('Variable "tarifs" does not exist.'136$this->source); })()));
  326.             foreach ($context['_seq'] as $context["_key"] => $context["item"]) {
  327.                 // line 137
  328.                 yield "                                <p class=\"mb-0 txt-gris hide\" id=\"idResume";
  329.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["item"], "id", [], "any"falsefalsefalse137), "html"nulltrue);
  330.                 yield "\"><em><span class=\"kl_cmd\"></span> ";
  331.                 yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["item"], "description", [], "any"falsefalsefalse137), "html"nulltrue);
  332.                 yield " </em></p>
  333.                             ";
  334.             }
  335.             $_parent $context['_parent'];
  336.             unset($context['_seq'], $context['_key'], $context['item'], $context['_parent']);
  337.             $context array_intersect_key($context$_parent) + $_parent;
  338.             // line 139
  339.             yield "                            <hr class=\"mb-10 mt-10\">
  340.                             <p class=\"mb-0 clearfix\">Total HT : <strong class=\"float-right txt-green font-size-16\"><span id=\"totalHt\">0</span> €</strong></p>
  341.                             <hr class=\"mb-10 mt-10\">
  342.                             <p class=\"clearfix\">Total TTC : <strong class=\"float-right\"><span id=\"totalTtc\">0</span> €</strong></p>
  343.                             <p><em class=\"text-muted\">En commandant j'accepte les conditions générales de vente</em></p>
  344.                             <button type=\"button\" class=\"btn btn-link transition-bgcolor bg-green-s minw-sm btn-block disabled\" id=\"idButtonCmd\">COMMANDER</button>
  345.                             <p class=\"text-muted text-center mt-3 mb-0\">Paiement sécurisé</p>
  346.                         </div>
  347.                     </div>
  348.                     <div class=\"card mt-3 bg-green-avocate\">
  349.                         <div class=\"card-body\">
  350.                             <h5 class=\"txt-white\">Vous souhaitez<br/> un abonnement personnalisé ?</h5>
  351.                             <div class=\"row\">
  352.                                 <div class=\"col-md-6\">
  353.                                     <h4 class=\"txt-green mb-0\">04 51 58 08 05</h4>
  354.                                     <small class=\"fs-12 txt-white\">Du lundi au vendredi de 9h à 18h</small>
  355.                                 </div>
  356.                                 <div class=\"col-md-6 text-right m-a\">
  357.                                     <a class=\"btn btn-small-link\" href=\"/contact\">Contact</a>
  358.                                 </div>
  359.                             </div>
  360.                         </div>
  361.                     </div>
  362.                 </div>
  363.             ";
  364.         }
  365.         // line 164
  366.         yield "        </div>
  367.     </div>
  368.     <div class=\"modal fade\" id=\"calendarModal\" tabindex=\"-1\" aria-labelledby=\"calendarModalLabel\" aria-hidden=\"true\">
  369.         <div class=\"modal-dialog modal-xl modal-dialog-scrollable\">
  370.             <div class=\"modal-content\">
  371.                 <div class=\"modal-header\">
  372.                     <h5 class=\"modal-title\" id=\"calendarModalLabel\">Créneaux disponibles</h5>
  373.                     <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Fermer\"></button>
  374.                 </div>
  375.                 <div class=\"modal-body\" id=\"calendar-content\">
  376.                     ";
  377.         // line 175
  378.         yield from $this->loadTemplate("front/disponibilites_fragment.html.twig""front/reserver.html.twig"175)->unwrap()->yield($context);
  379.         // line 176
  380.         yield "                </div>
  381.             </div>
  382.         </div>
  383.     </div>
  384.     <script src=\"https://code.jquery.com/jquery-3.6.4.min.js\"></script>
  385.     <script src=\"";
  386.         // line 182
  387.         yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("/assets/js/custom.js?v1"), "html"nulltrue);
  388.         yield "\"></script>
  389.     <script src=\"";
  390.         // line 183
  391.         yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("/assets/js/client/commande.js?v9"), "html"nulltrue);
  392.         yield "\"></script>
  393.     <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js\"></script>
  394.     ";
  395.         // line 186
  396.         yield from $this->unwrap()->yieldBlock('javascripts'$context$blocks);
  397.         
  398.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  399.         
  400.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  401.         yield from [];
  402.     }
  403.     /**
  404.      * @return iterable<null|scalar|\Stringable>
  405.      */
  406.     public function block_javascripts(array $context, array $blocks = []): iterable
  407.     {
  408.         $macros $this->macros;
  409.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  410.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""javascripts"));
  411.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  412.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""javascripts"));
  413.         // line 187
  414.         yield "        ";
  415.         yield from $this->yieldParentBlock("javascripts"$context$blocks);
  416.         yield "
  417.         <script>
  418.             const days = ";
  419.         // line 190
  420.         yield json_encode((isset($context["dates"]) || array_key_exists("dates"$context) ? $context["dates"] : (function () { throw new RuntimeError('Variable "dates" does not exist.'190$this->source); })()));
  421.         yield ";
  422.             const reservations = ";
  423.         // line 191
  424.         yield json_encode((isset($context["reservations"]) || array_key_exists("reservations"$context) ? $context["reservations"] : (function () { throw new RuntimeError('Variable "reservations" does not exist.'191$this->source); })()));
  425.         yield ";
  426.             function generateCalendar(reservations, days) {
  427.                 const calendarBody = document.getElementById('calendar-body');
  428.                 if (!calendarBody) return;
  429.                 const hours = [\"08:00\", \"09:00\", \"10:00\", \"11:00\", \"12:00\", \"13:00\", \"14:00\", \"15:00\", \"16:00\", \"17:00\", \"18:00\", \"19:00\"];
  430.                 const now = new Date();
  431.                 const isMobile = window.innerWidth <= 768;
  432.                 calendarBody.innerHTML = \"\";
  433.                 hours.forEach(hour => {
  434.                     const row = document.createElement('tr');
  435.                     row.innerHTML = `<td>\${hour}</td>`;
  436.                     days.forEach(day => {
  437.                         const reservationForDay = reservations[day] || [];
  438.                         const reservation = reservationForDay.find(res => res.time === hour);
  439.                         const td = document.createElement('td');
  440.                         const reservationDateTime = new Date(`\${day}T\${hour}:00`);
  441.                         let text = \"\";
  442.                         if (reservationDateTime <= now) {
  443.                             if (reservation) {
  444.                                 td.className = \"past-reserved\";
  445.                                 text = \"Réservé\";
  446.                             } else {
  447.                                 td.className = \"past\";
  448.                                 text = \"Indisponible\";
  449.                             }
  450.                             td.style.pointerEvents = \"none\";
  451.                         } else if (reservation) {
  452.                             td.className = \"reserved alias\";
  453.                             text = \"Réservé\";
  454.                         } else {
  455.                             td.className = \"available\";
  456.                             text = \"Disponible\";
  457.                         }
  458.                         if (!isMobile) {
  459.                             td.textContent = text;
  460.                         }
  461.                         row.appendChild(td);
  462.                     });
  463.                     calendarBody.appendChild(row);
  464.                 });
  465.             }
  466.             // Appel initial
  467.             document.addEventListener(\"DOMContentLoaded\", function () {
  468.                 generateCalendar(reservations, days);
  469.             });
  470.             // Pagination calendrier (changer de semaine)
  471.             document.addEventListener(\"click\", function (e) {
  472.                 const target = e.target.closest(\".change-week\");
  473.                 if (target) {
  474.                     e.preventDefault();
  475.                     const date = target.dataset.date;
  476.                     fetch(`/reservation?d=\${date}&modal=1`)
  477.                         .then(res => res.text())
  478.                         .then(html => {
  479.                             document.getElementById(\"calendar-content\").innerHTML = html;
  480.                             const parser = new DOMParser();
  481.                             const doc = parser.parseFromString(html, \"text/html\");
  482.                             const newScript = doc.querySelector(\"script[data-calendar-json]\");
  483.                             if (newScript) {
  484.                                 const data = JSON.parse(newScript.textContent);
  485.                                 generateCalendar(data.reservations, data.dates);
  486.                             }
  487.                         });
  488.                 }
  489.             });
  490.         </script>
  491.     ";
  492.         
  493.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  494.         
  495.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  496.         yield from [];
  497.     }
  498.     /**
  499.      * @codeCoverageIgnore
  500.      */
  501.     public function getTemplateName(): string
  502.     {
  503.         return "front/reserver.html.twig";
  504.     }
  505.     /**
  506.      * @codeCoverageIgnore
  507.      */
  508.     public function isTraitable(): bool
  509.     {
  510.         return false;
  511.     }
  512.     /**
  513.      * @codeCoverageIgnore
  514.      */
  515.     public function getDebugInfo(): array
  516.     {
  517.         return array (  449 => 191,  445 => 190,  438 => 187,  415 => 186,  409 => 183,  405 => 182,  397 => 176,  395 => 175,  382 => 164,  355 => 139,  344 => 137,  340 => 136,  331 => 129,  322 => 125,  314 => 119,  312 => 118,  305 => 114,  294 => 106,  290 => 105,  286 => 104,  282 => 103,  273 => 97,  265 => 94,  258 => 91,  254 => 90,  250 => 89,  247 => 88,  236 => 80,  227 => 74,  219 => 69,  211 => 64,  207 => 62,  193 => 54,  189 => 53,  184 => 52,  180 => 51,  175 => 50,  172 => 49,  169 => 48,  164 => 47,  162 => 46,  144 => 30,  142 => 29,  139 => 28,  133 => 26,  131 => 25,  126 => 22,  118 => 17,  109 => 15,  101 => 14,  97 => 12,  91 => 10,  89 => 9,  85 => 7,  83 => 6,  80 => 5,  77 => 4,  64 => 3,  41 => 1,);
  518.     }
  519.     public function getSourceContext(): Source
  520.     {
  521.         return new Source("{% extends \"layout.html.twig\" %}
  522. {% block contentBody %}
  523.     {% set title = content.title %}
  524.     {% if step != \"annulation\" %}
  525.         <div class=\"bg-white kl-block-nav\">
  526.             <div class=\"kl-top-nav\">
  527.                 {% if step != \"confirmation\" %}
  528.                     <a href=\"{{ step == \"choice\" or step == \"\" ? '/' : (referer is defined and referer is not empty ? referer : '/')}}\" class=\"kl-step-return\"><i>&larr; Retour à l'étape précédente</i></a>
  529.                 {% endif %}
  530.                 <ul class=\"kl-step-menu mb-0\">
  531.                     <li class=\"{{ step == \"choice\" or step == \"\" ? 'active' : ''}}\"><a href=\"{{ step == 'recap' ? '?step=choice' : '#choice'}}\" {{ step == \"confirmation\" ? 'onclick=\"return false\"' : ''}}>Choix de la formule</a></li>
  532.                     <li class=\"{{ step == \"recap\" and datas.commandes is defined ? 'active' : ''}}\"><a href=\"{{ step == \"choice\" ? '?step=recap' : '#recap'}}\" {{ step == \"choice\" or step == \"confirmation\" ? 'onclick=\"return false\"' : ''}}>Récapitulatif</a></li>
  533.                     <li class=\"\"><a href=\"#paiement\" onclick=\"return false\">Paiement</a></li>
  534.                     <li class=\"{{ step == \"confirmation\" ? 'active' : ''}}\"><a href=\"#confirmation\" onclick=\"return false\">Confirmation</a></li>
  535.                 </ul>
  536.             </div>
  537.         </div>
  538.     {% endif %}
  539.     <div class=\" max-container-3 block-texte mx-auto px-0 pb-lg-4\">
  540.         <div class=\"row titre-details mt-4\">
  541.             {% if step != \"confirmation\" and step != \"annulation\" %}
  542.                 <div class=\"col-md-12\"><h2 class=\"mb-3\">{{ title }} : </h2></div>
  543.             {% endif %}
  544.             {% if datas.commandes is defined and datas.commandes is not empty and datas.paymentForm is defined %}
  545.                 <div class=\"col-md-12\">
  546.                     <div class=\"card\">
  547.                         <div class=\"card-body\">
  548.                             <div class=\"row\">
  549.                                 <div class=\"col-md-12\" id=\"id_liste\">
  550.                                     <table class=\"table table-striped table-hover\">
  551.                                         <thead class=\"thead-dark\">
  552.                                         <tr>
  553.                                             <th>Désignation</th>
  554.                                             <th>Qté</th>
  555.                                             <th class=\"text-right\">PU</th>
  556.                                             <th class=\"text-right\">Montant</th>
  557.                                             <th></th>
  558.                                         </tr>
  559.                                         </thead>
  560.                                         <tbody>
  561.                                         {% set total = 0 %}
  562.                                         {% for commandeItem in datas.commandes %}
  563.                                             {% set montant = commandeItem.qte * tarifs[commandeItem.tarif_id].pu %}
  564.                                             {% set total = total + montant %}
  565.                                             <tr data-id=\"{{commandeItem.getId()}}\">
  566.                                                 <td>{{ tarifs[commandeItem.tarif_id].description }}</td>
  567.                                                 <td>{{commandeItem.qte}}{{tarifs[commandeItem.tarif_id].titre == 'SDR' ? 'h' : ''}}</td>
  568.                                                 <td class=\"text-right\">{{tarifs[commandeItem.tarif_id].pu}} €</td>
  569.                                                 <td class=\"text-right\"><span class=\"kl_montant\">{{montant}}</span> €</td>
  570.                                                 <td>
  571.                                                     <a href=\"#\" class=\"kl-delete-cmd text-danger\" title=\"Supprimer ce commande\">
  572.                                                         <i class=\"fa fa-trash\"></i>
  573.                                                     </a>
  574.                                                 </td>
  575.                                             </tr>
  576.                                         {% endfor %}
  577.                                         <tr class=\"bg-white\">
  578.                                             <th class=\"text-right\" colspan=3>Total HT</th>
  579.                                             <th class=\"text-right\"><span id=\"idTotalHt\">{{total}}</span> €</th>
  580.                                             <th></th>
  581.                                         </tr>
  582.                                         <tr class=\"bg-white\">
  583.                                             <th class=\"text-right\" colspan=3>TVA</th>
  584.                                             <th class=\"text-right\"><span id=\"idTva\">{{total * 0.2}}</span> €</th>
  585.                                             <th></th>
  586.                                         </tr>
  587.                                         <tr class=\"bg-white\">
  588.                                             <th class=\"text-right\" colspan=3>TTC</th>
  589.                                             <th class=\"text-right\"><span id=\"idTotalTtc\">{{total + total * 0.2}}</span> €</th>
  590.                                             <th></th>
  591.                                         </tr>
  592.                                         </tbody>
  593.                                     </table>
  594.                                     <div class=\"text-center\">
  595.                                         {{ datas.paymentForm|raw }}
  596.                                     </div>
  597.                                 </div>
  598.                             </div>
  599.                         </div>
  600.                     </div>
  601.                 </div>
  602.             {% else %}
  603.                 <div class=\"col-md-7\">
  604.                     <form method=\"POST\" id=\"idFormCmd\" action=\"{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) }}\">
  605.                         {% for item in tarifs %}
  606.                             <div class=\"card mb-3 kl-tarif\" data-id=\"{{ item.id }}\">
  607.                                 <div class=\"card-body d-flex\">
  608.                                     <figcaption class=\"kl-img-illustration\">
  609.                                         <img src=\"{{ item.logo }}\" alt=\"{{ item.titre }}\">
  610.                                     </figcaption>
  611.                                     <article class=\"mt-a mb-a\">
  612.                                         <h5 class=\"card-title\">{{ item.description }}</h5>
  613.                                         <p class=\"mb-0\">Quantité :
  614.                                             <input type=\"number\"
  615.                                                    inputmode=\"numeric\"
  616.                                                    pattern=\"[0-9]*\"
  617.                                                    name=\"data[{{ item.id }}]\"
  618.                                                    data-tp=\"{{ item.titre == 'SDR' ? 'h' : ''}}\"
  619.                                                    data-id=\"{{ item.id }}\"
  620.                                                    data-price=\"{{ item.pu }}\"
  621.                                                    min=\"0\"
  622.                                                    value=\"\"
  623.                                                    placeholder=\"0\"
  624.                                                    class=\"kl-formInput form-control kl-inputReserve\">
  625.                                             <span class=\"ml-3\">Tarif :
  626.                                                 <strong>
  627.                                                     <span class=\"kl-price hide\">0</span>
  628.                                                     <span class=\"kl-prices\">{{ item.pu }}</span> €
  629.                                                 </strong>
  630.                                             </span>
  631.                                         </p>
  632.                                         {% if item.id == '4' %}
  633.                                             <p class=\"mb-2\">
  634.                                                 <a href=\"#\" data-bs-toggle=\"modal\" data-bs-target=\"#calendarModal\" class=\"kl-step-return\">
  635.                                                     <i>Voir les disponibilités</i>
  636.                                                 </a>
  637.                                             </p>
  638.                                         {% endif %}
  639.                                     </article>
  640.                                 </div>
  641.                             </div>
  642.                         {% endfor %}
  643.                     </form>
  644.                 </div>
  645.                 <div class=\"col-md-5\">
  646.                     <div class=\"card\">
  647.                         <div class=\"card-body\">
  648.                             <h5 class=\"text-center\">Résumé</h5>
  649.                             {% for item in tarifs %}
  650.                                 <p class=\"mb-0 txt-gris hide\" id=\"idResume{{ item.id }}\"><em><span class=\"kl_cmd\"></span> {{item.description}} </em></p>
  651.                             {% endfor %}
  652.                             <hr class=\"mb-10 mt-10\">
  653.                             <p class=\"mb-0 clearfix\">Total HT : <strong class=\"float-right txt-green font-size-16\"><span id=\"totalHt\">0</span> €</strong></p>
  654.                             <hr class=\"mb-10 mt-10\">
  655.                             <p class=\"clearfix\">Total TTC : <strong class=\"float-right\"><span id=\"totalTtc\">0</span> €</strong></p>
  656.                             <p><em class=\"text-muted\">En commandant j'accepte les conditions générales de vente</em></p>
  657.                             <button type=\"button\" class=\"btn btn-link transition-bgcolor bg-green-s minw-sm btn-block disabled\" id=\"idButtonCmd\">COMMANDER</button>
  658.                             <p class=\"text-muted text-center mt-3 mb-0\">Paiement sécurisé</p>
  659.                         </div>
  660.                     </div>
  661.                     <div class=\"card mt-3 bg-green-avocate\">
  662.                         <div class=\"card-body\">
  663.                             <h5 class=\"txt-white\">Vous souhaitez<br/> un abonnement personnalisé ?</h5>
  664.                             <div class=\"row\">
  665.                                 <div class=\"col-md-6\">
  666.                                     <h4 class=\"txt-green mb-0\">04 51 58 08 05</h4>
  667.                                     <small class=\"fs-12 txt-white\">Du lundi au vendredi de 9h à 18h</small>
  668.                                 </div>
  669.                                 <div class=\"col-md-6 text-right m-a\">
  670.                                     <a class=\"btn btn-small-link\" href=\"/contact\">Contact</a>
  671.                                 </div>
  672.                             </div>
  673.                         </div>
  674.                     </div>
  675.                 </div>
  676.             {% endif %}
  677.         </div>
  678.     </div>
  679.     <div class=\"modal fade\" id=\"calendarModal\" tabindex=\"-1\" aria-labelledby=\"calendarModalLabel\" aria-hidden=\"true\">
  680.         <div class=\"modal-dialog modal-xl modal-dialog-scrollable\">
  681.             <div class=\"modal-content\">
  682.                 <div class=\"modal-header\">
  683.                     <h5 class=\"modal-title\" id=\"calendarModalLabel\">Créneaux disponibles</h5>
  684.                     <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Fermer\"></button>
  685.                 </div>
  686.                 <div class=\"modal-body\" id=\"calendar-content\">
  687.                     {% include 'front/disponibilites_fragment.html.twig' %}
  688.                 </div>
  689.             </div>
  690.         </div>
  691.     </div>
  692.     <script src=\"https://code.jquery.com/jquery-3.6.4.min.js\"></script>
  693.     <script src=\"{{ asset('/assets/js/custom.js?v1') }}\"></script>
  694.     <script src=\"{{ asset('/assets/js/client/commande.js?v9') }}\"></script>
  695.     <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js\"></script>
  696.     {% block javascripts %}
  697.         {{ parent() }}
  698.         <script>
  699.             const days = {{ dates|json_encode|raw }};
  700.             const reservations = {{ reservations|json_encode|raw }};
  701.             function generateCalendar(reservations, days) {
  702.                 const calendarBody = document.getElementById('calendar-body');
  703.                 if (!calendarBody) return;
  704.                 const hours = [\"08:00\", \"09:00\", \"10:00\", \"11:00\", \"12:00\", \"13:00\", \"14:00\", \"15:00\", \"16:00\", \"17:00\", \"18:00\", \"19:00\"];
  705.                 const now = new Date();
  706.                 const isMobile = window.innerWidth <= 768;
  707.                 calendarBody.innerHTML = \"\";
  708.                 hours.forEach(hour => {
  709.                     const row = document.createElement('tr');
  710.                     row.innerHTML = `<td>\${hour}</td>`;
  711.                     days.forEach(day => {
  712.                         const reservationForDay = reservations[day] || [];
  713.                         const reservation = reservationForDay.find(res => res.time === hour);
  714.                         const td = document.createElement('td');
  715.                         const reservationDateTime = new Date(`\${day}T\${hour}:00`);
  716.                         let text = \"\";
  717.                         if (reservationDateTime <= now) {
  718.                             if (reservation) {
  719.                                 td.className = \"past-reserved\";
  720.                                 text = \"Réservé\";
  721.                             } else {
  722.                                 td.className = \"past\";
  723.                                 text = \"Indisponible\";
  724.                             }
  725.                             td.style.pointerEvents = \"none\";
  726.                         } else if (reservation) {
  727.                             td.className = \"reserved alias\";
  728.                             text = \"Réservé\";
  729.                         } else {
  730.                             td.className = \"available\";
  731.                             text = \"Disponible\";
  732.                         }
  733.                         if (!isMobile) {
  734.                             td.textContent = text;
  735.                         }
  736.                         row.appendChild(td);
  737.                     });
  738.                     calendarBody.appendChild(row);
  739.                 });
  740.             }
  741.             // Appel initial
  742.             document.addEventListener(\"DOMContentLoaded\", function () {
  743.                 generateCalendar(reservations, days);
  744.             });
  745.             // Pagination calendrier (changer de semaine)
  746.             document.addEventListener(\"click\", function (e) {
  747.                 const target = e.target.closest(\".change-week\");
  748.                 if (target) {
  749.                     e.preventDefault();
  750.                     const date = target.dataset.date;
  751.                     fetch(`/reservation?d=\${date}&modal=1`)
  752.                         .then(res => res.text())
  753.                         .then(html => {
  754.                             document.getElementById(\"calendar-content\").innerHTML = html;
  755.                             const parser = new DOMParser();
  756.                             const doc = parser.parseFromString(html, \"text/html\");
  757.                             const newScript = doc.querySelector(\"script[data-calendar-json]\");
  758.                             if (newScript) {
  759.                                 const data = JSON.parse(newScript.textContent);
  760.                                 generateCalendar(data.reservations, data.dates);
  761.                             }
  762.                         });
  763.                 }
  764.             });
  765.         </script>
  766.     {% endblock %}
  767. {% endblock %}
  768. ""front/reserver.html.twig""/home/coworking/www_preprod/templates/front/reserver.html.twig");
  769.     }
  770. }