<?php

use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;

/* clients/contrat/_popup_resilier_contrat.html.twig */
class __TwigTemplate_7673ea46929422bec4832298e9292537f3227c4acfd2f832a1a4a65e0a07adb1 extends Template
{
    private $source;
    private $macros = [];

    public function __construct(Environment $env)
    {
        parent::__construct($env);

        $this->source = $this->getSourceContext();

        $this->parent = false;

        $this->blocks = [
        ];
    }

    protected function doDisplay(array $context, array $blocks = [])
    {
        $macros = $this->macros;
        $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
        $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "clients/contrat/_popup_resilier_contrat.html.twig"));

        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "clients/contrat/_popup_resilier_contrat.html.twig"));

        // line 1
        $context["contratResilie"] = ((((isset($context["contrat"]) || array_key_exists("contrat", $context) ? $context["contrat"] : (function () { throw new RuntimeError('Variable "contrat" does not exist.', 1, $this->source); })()) && CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, ($context["contrat"] ?? null), "contratResiliations", [], "any", false, true, false, 1), 0, [], "array", true, true, false, 1))) ? (CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["contrat"]) || array_key_exists("contrat", $context) ? $context["contrat"] : (function () { throw new RuntimeError('Variable "contrat" does not exist.', 1, $this->source); })()), "contratResiliations", [], "any", false, false, false, 1), 0, [], "array", false, false, false, 1)) : (""));
        // line 2
        yield "<div id=\"popup-resilier-";
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["equipement"]) || array_key_exists("equipement", $context) ? $context["equipement"] : (function () { throw new RuntimeError('Variable "equipement" does not exist.', 2, $this->source); })()), "id", [], "any", false, false, false, 2), "html", null, true);
        yield "\" style=\"display:none\" class=\"popup-resilier-contrat\" >
    ";
        // line 3
        if ((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 3, $this->source); })())) {
            // line 4
            yield "        <div class=\"d-flex\">
            <button  class=\"btn  btn-outline-danger me-1 ms-auto\" data-confirm=\"1\" data-href=\"";
            // line 5
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("equipement_cancel_resiliation_contrat", ["id" => CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["contrat"]) || array_key_exists("contrat", $context) ? $context["contrat"] : (function () { throw new RuntimeError('Variable "contrat" does not exist.', 5, $this->source); })()), "contratResiliations", [], "any", false, false, false, 5), 0, [], "array", false, false, false, 5), "id", [], "any", false, false, false, 5)]), "html", null, true);
            yield "\" >Annuler la résiliation</button>
        </div>
    ";
        }
        // line 8
        yield "    <form class=\"px-0 form_resilier_contrat\" action=\"";
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("post_equipement_resilier_contrat", ["id" => CoreExtension::getAttribute($this->env, $this->source, (isset($context["equipement"]) || array_key_exists("equipement", $context) ? $context["equipement"] : (function () { throw new RuntimeError('Variable "equipement" does not exist.', 8, $this->source); })()), "id", [], "any", false, false, false, 8)]), "html", null, true);
        yield "\" method=\"post\">
        <input type=\"hidden\" data-formchanged=\"no\" name=\"id_contrat_resiliation\" value=\"";
        // line 9
        (((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 9, $this->source); })())) ? (yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 9, $this->source); })()), "id", [], "any", false, false, false, 9), "html", null, true)) : (yield ""));
        yield "\">
        <div class=\"d-flex mb-3 flex-column\">
            <div class=\"form-check-inline\">Mode de résiliation </div>
            <div class=\"d-flex\" style=\"margin-left: 58px;\">
                <div class=\"form-check form-check-inline ms-0\">
                    <input class=\"form-check-input check-input-fill\" data-formchanged=\"no\" type=\"radio\" name=\"mode_resilisation_client\" value=\"Email\"
                           ";
        // line 15
        if (( !(isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 15, $this->source); })()) || (CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 15, $this->source); })()), "typeEnvoi", [], "any", false, false, false, 15) && (0 === CoreExtension::compare(CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 15, $this->source); })()), "typeEnvoi", [], "any", false, false, false, 15), "libelle", [], "any", false, false, false, 15), "Email"))))) {
            yield "checked";
        }
        yield ">
                    <label class=\"form-check-label\">E-mail</label>
                </div>
                <div class=\"form-check form-check-inline \" style=\"margin-left: 153px;\">
                    <input class=\"form-check-input check-input-fill\" data-formchanged=\"no\" type=\"radio\" name=\"mode_resilisation_client\" value=\"Courrier\"
                           ";
        // line 20
        if ((((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 20, $this->source); })()) && CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 20, $this->source); })()), "typeEnvoi", [], "any", false, false, false, 20)) && (0 === CoreExtension::compare(CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 20, $this->source); })()), "typeEnvoi", [], "any", false, false, false, 20), "libelle", [], "any", false, false, false, 20), "Courrier")))) {
            yield "checked";
        }
        yield ">
                    <label class=\"form-check-label\" >Courrier</label>
                </div>
            </div>
        </div>
        <div class=\"d-flex mb-3 flex-column\">
            <div class=\"form-check-inline\">Date de résiliation souhaitée: </div>
            <div class=\"d-flex\" style=\"margin-left: 58px;\">
                <div class=\"form-check form-check-inline ms-0\">
                    <input class=\"form-check-input check-input-fill\" data-formchanged=\"no\" type=\"radio\" name=\"type_date_resiliation\" value=\"contrat\"
                           data-change-target=\"#date-resiliation-";
        // line 30
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["equipement"]) || array_key_exists("equipement", $context) ? $context["equipement"] : (function () { throw new RuntimeError('Variable "equipement" does not exist.', 30, $this->source); })()), "id", [], "any", false, false, false, 30), "html", null, true);
        yield "\" 
                           ";
        // line 31
        if (( !(isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 31, $this->source); })()) || ((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 31, $this->source); })()) && (0 === CoreExtension::compare(CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 31, $this->source); })()), "date", [], "any", false, false, false, 31), CoreExtension::getAttribute($this->env, $this->source, (isset($context["contrat"]) || array_key_exists("contrat", $context) ? $context["contrat"] : (function () { throw new RuntimeError('Variable "contrat" does not exist.', 31, $this->source); })()), "dateFinContrat", [], "any", false, false, false, 31)))))) {
            yield "checked";
        }
        yield ">
                    <label class=\"form-check-label\" >Date de fin du contrat</label>
                </div>
                <div class=\"form-check form-check-inline\" style=\"margin-left: 58px;\">
                    <input class=\"form-check-input check-input-fill\" data-formchanged=\"no\" type=\"radio\" name=\"type_date_resiliation\" id=\"type_date_resiliation_choice\" value=\"date\"
                           data-change-target=\"#date-resiliation-";
        // line 36
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["equipement"]) || array_key_exists("equipement", $context) ? $context["equipement"] : (function () { throw new RuntimeError('Variable "equipement" does not exist.', 36, $this->source); })()), "id", [], "any", false, false, false, 36), "html", null, true);
        yield "\"
                           ";
        // line 37
        if (((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 37, $this->source); })()) && (0 !== CoreExtension::compare(CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 37, $this->source); })()), "date", [], "any", false, false, false, 37), CoreExtension::getAttribute($this->env, $this->source, (isset($context["contrat"]) || array_key_exists("contrat", $context) ? $context["contrat"] : (function () { throw new RuntimeError('Variable "contrat" does not exist.', 37, $this->source); })()), "dateFinContrat", [], "any", false, false, false, 37))))) {
            yield "checked";
        }
        yield ">
                    <label class=\"form-check-label\" >Date de la demande de résiliation</label>
                </div>
                <div class=\"form-check form-check-inline\" id=\"date-resiliation-";
        // line 40
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["equipement"]) || array_key_exists("equipement", $context) ? $context["equipement"] : (function () { throw new RuntimeError('Variable "equipement" does not exist.', 40, $this->source); })()), "id", [], "any", false, false, false, 40), "html", null, true);
        yield "\" 
                     style=\"";
        // line 41
        if (((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 41, $this->source); })()) && (0 !== CoreExtension::compare(CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 41, $this->source); })()), "date", [], "any", false, false, false, 41), CoreExtension::getAttribute($this->env, $this->source, (isset($context["contrat"]) || array_key_exists("contrat", $context) ? $context["contrat"] : (function () { throw new RuntimeError('Variable "contrat" does not exist.', 41, $this->source); })()), "dateFinContrat", [], "any", false, false, false, 41))))) {
            yield "display:block";
        } else {
            yield "display:none";
        }
        yield "\">
                    <input class=\"form-control\" type=\"date\" name=\"date_resiliation\"  data-formchanged=\"no\"
                           value=\"";
        // line 43
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape((((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 43, $this->source); })())) ? ($this->extensions['Twig\Extension\CoreExtension']->formatDate(CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 43, $this->source); })()), "date", [], "any", false, false, false, 43), "Y-m-d")) : ($this->extensions['Twig\Extension\CoreExtension']->formatDate("now", "Y-m-d"))), "html", null, true);
        yield "\" 
                           min=\"";
        // line 44
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Twig\Extension\CoreExtension']->formatDate("now", "Y-m-d"), "html", null, true);
        yield "\">
                </div>
            </div>
        </div>
        <div class=\"d-flex mb-3 flex-column\">
            <div class=\"form-check-inline\">Le client a t'il donné un motif de résiliation ?</div>
            <div class=\"d-flex\" style=\"margin-left: 58px;\">
                <div class=\"form-check form-check-inline ms-0\">
                    <input class=\"form-check-input check-input-fill\" data-formchanged=\"no\" type=\"radio\" name=\"motif_resiliation_donne\" value=\"oui\"
                           data-change-target=\"#container-motif-";
        // line 53
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["equipement"]) || array_key_exists("equipement", $context) ? $context["equipement"] : (function () { throw new RuntimeError('Variable "equipement" does not exist.', 53, $this->source); })()), "id", [], "any", false, false, false, 53), "html", null, true);
        yield "\"
                           ";
        // line 54
        if (((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 54, $this->source); })()) && CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 54, $this->source); })()), "contratMotifResiliation", [], "any", false, false, false, 54))) {
            yield "checked";
        }
        yield ">
                    <label class=\"form-check-label\" for=\"inlineRadio1\">Oui</label>
                </div>
                <div class=\"form-check form-check-inline\" style=\"margin-left: 174px;\">
                    <input class=\"form-check-input check-input-fill\" data-formchanged=\"no\" type=\"radio\" name=\"motif_resiliation_donne\" value=\"non\"
                           data-change-target=\"#container-motif-";
        // line 59
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["equipement"]) || array_key_exists("equipement", $context) ? $context["equipement"] : (function () { throw new RuntimeError('Variable "equipement" does not exist.', 59, $this->source); })()), "id", [], "any", false, false, false, 59), "html", null, true);
        yield "\"
                           ";
        // line 60
        if ((((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 60, $this->source); })()) &&  !CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 60, $this->source); })()), "contratMotifResiliation", [], "any", false, false, false, 60)) ||  !(isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 60, $this->source); })()))) {
            yield "checked";
        }
        yield ">
                    <label class=\"form-check-label\" for=\"inlineRadio2\">Non</label>
                </div>
            </div>
        </div>
        <div id=\"container-motif-";
        // line 65
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["equipement"]) || array_key_exists("equipement", $context) ? $context["equipement"] : (function () { throw new RuntimeError('Variable "equipement" does not exist.', 65, $this->source); })()), "id", [], "any", false, false, false, 65), "html", null, true);
        yield "\" style=\"";
        if (((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 65, $this->source); })()) && CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 65, $this->source); })()), "contratMotifResiliation", [], "any", false, false, false, 65))) {
            yield "display: block";
        } else {
            yield "display: none";
        }
        yield "\">
            <div class=\"d-flex align-items-center mb-2\">
                <div style=\"width:39px;\">Motif</div>
                <div class=\"d-flex flex-grow-1\">
                    <select name=\"motif\" class=\"form-control\" id=\"resiliation_motif\" data-formchanged=\"no\">
                        ";
        // line 70
        $context['_parent'] = $context;
        $context['_seq'] = CoreExtension::ensureTraversable((isset($context["contratMotifsResiliation"]) || array_key_exists("contratMotifsResiliation", $context) ? $context["contratMotifsResiliation"] : (function () { throw new RuntimeError('Variable "contratMotifsResiliation" does not exist.', 70, $this->source); })()));
        foreach ($context['_seq'] as $context["_key"] => $context["motif"]) {
            // line 71
            yield "                            <option value=\"";
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["motif"], "id", [], "any", false, false, false, 71), "html", null, true);
            yield "\" 
                                ";
            // line 72
            if ((((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 72, $this->source); })()) && CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 72, $this->source); })()), "contratMotifResiliation", [], "any", false, false, false, 72)) && (0 === CoreExtension::compare(CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 72, $this->source); })()), "contratMotifResiliation", [], "any", false, false, false, 72), "id", [], "any", false, false, false, 72), CoreExtension::getAttribute($this->env, $this->source, $context["motif"], "id", [], "any", false, false, false, 72))))) {
                yield "selected";
            }
            yield ">
                                ";
            // line 73
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["motif"], "libelle", [], "any", false, false, false, 73), "html", null, true);
            yield "
                            </option>
                        ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['motif'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 76
        yield "                    </select>
                </div>
            </div>
            <div class=\"d-flex flex-column\" style=\"margin-left: 39px;\">
                <select name=\"marque_change\" class=\"form-control form-control-sm me-4 hide resiliation_block\" id=\"resiliation_autre_marque\" data-formchanged=\"no\">
                    <option value=\"\" checked style=\"color: #95a5a6;opacity: 1;\">Marque si connue</option>
                    ";
        // line 82
        $context['_parent'] = $context;
        $context['_seq'] = CoreExtension::ensureTraversable((isset($context["equipementMarques"]) || array_key_exists("equipementMarques", $context) ? $context["equipementMarques"] : (function () { throw new RuntimeError('Variable "equipementMarques" does not exist.', 82, $this->source); })()));
        foreach ($context['_seq'] as $context["_key"] => $context["marque"]) {
            // line 83
            yield "                        <option value=\"";
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["marque"], "id", [], "any", false, false, false, 83), "html", null, true);
            yield "\"
                            ";
            // line 84
            if ((((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 84, $this->source); })()) && CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 84, $this->source); })()), "equipementMarque", [], "any", false, false, false, 84)) && (0 === CoreExtension::compare(CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 84, $this->source); })()), "equipementMarque", [], "any", false, false, false, 84), "id", [], "any", false, false, false, 84), CoreExtension::getAttribute($this->env, $this->source, $context["marque"], "id", [], "any", false, false, false, 84))))) {
                yield "selected";
            }
            yield ">
                            ";
            // line 85
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["marque"], "libelle", [], "any", false, false, false, 85), "html", null, true);
            yield "
                        </option>
                    ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['marque'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 88
        yield "                </select>
                <select name=\"resiliation_intervention_insatisfait\" class=\"form-control form-control-sm me-4 hide resiliation_block\" data-formchanged=\"no\" id=\"resiliation_intervention\">
                    <option value=\"\" checked style=\"color: #95a5a6;opacity: 1;\">Choix de l'intervention si connue</option>
                    ";
        // line 91
        $context['_parent'] = $context;
        $context['_seq'] = CoreExtension::ensureTraversable(CoreExtension::getAttribute($this->env, $this->source, (isset($context["equipement"]) || array_key_exists("equipement", $context) ? $context["equipement"] : (function () { throw new RuntimeError('Variable "equipement" does not exist.', 91, $this->source); })()), "interventions", [], "any", false, false, false, 91));
        foreach ($context['_seq'] as $context["_key"] => $context["intervention"]) {
            // line 92
            yield "                        <option value=\"";
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["intervention"], "id", [], "any", false, false, false, 92), "html", null, true);
            yield "\"
                            ";
            // line 93
            if ((((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 93, $this->source); })()) && CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 93, $this->source); })()), "intervention", [], "any", false, false, false, 93)) && (0 === CoreExtension::compare(CoreExtension::getAttribute($this->env, $this->source, CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 93, $this->source); })()), "intervention", [], "any", false, false, false, 93), "id", [], "any", false, false, false, 93), CoreExtension::getAttribute($this->env, $this->source, $context["intervention"], "id", [], "any", false, false, false, 93))))) {
                yield "selected";
            }
            yield ">
                            ";
            // line 94
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["intervention"], "getFormattedInterventionForResiliation", [], "any", false, false, false, 94), "html", null, true);
            yield "
                        </option>
                    ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['intervention'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 97
        yield "                </select>
                <input type=\"text\" name=\"resiliation_autre_input\" class=\"form-control form-control-sm hide resiliation_block\"  data-formchanged=\"no\"
                       placeholder=\"Précision si connue\" id=\"resiliation_autre\"
                       value=\"";
        // line 100
        (((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 100, $this->source); })())) ? (yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 100, $this->source); })()), "motifSiAutre", [], "any", false, false, false, 100), "html", null, true)) : (yield ""));
        yield "\">
            </div>
        </div>
        <div class=\"form-group d-flex justify-content-center mt-4\">
            <div class=\"form-actions-row\">
                <button class=\"btn btn-outline-danger btn-close-popup\" data-dxpopup-id=\"popup-resilier-";
        // line 105
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["equipement"]) || array_key_exists("equipement", $context) ? $context["equipement"] : (function () { throw new RuntimeError('Variable "equipement" does not exist.', 105, $this->source); })()), "id", [], "any", false, false, false, 105), "html", null, true);
        yield "\" type=\"button\">Annuler</button>
                <button class=\"btn btn-outline-success me-3\" type=\"submit\">";
        // line 106
        yield (((isset($context["contratResilie"]) || array_key_exists("contratResilie", $context) ? $context["contratResilie"] : (function () { throw new RuntimeError('Variable "contratResilie" does not exist.', 106, $this->source); })())) ? ("Modifier") : ("Valider"));
        yield "</button>
            </div>
        </div>
    </form>
</div>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        let previousMotif = document.getElementById('resiliation_motif').value;
        let dateResiliationInput = document.querySelector('input[name=\"date_resiliation\"]');
        let dateFinContrat = '";
        // line 115
        ((((isset($context["contrat"]) || array_key_exists("contrat", $context) ? $context["contrat"] : (function () { throw new RuntimeError('Variable "contrat" does not exist.', 115, $this->source); })()) && CoreExtension::getAttribute($this->env, $this->source, (isset($context["contrat"]) || array_key_exists("contrat", $context) ? $context["contrat"] : (function () { throw new RuntimeError('Variable "contrat" does not exist.', 115, $this->source); })()), "dateFinContrat", [], "any", false, false, false, 115))) ? (yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Twig\Extension\CoreExtension']->formatDate(CoreExtension::getAttribute($this->env, $this->source, (isset($context["contrat"]) || array_key_exists("contrat", $context) ? $context["contrat"] : (function () { throw new RuntimeError('Variable "contrat" does not exist.', 115, $this->source); })()), "dateFinContrat", [], "any", false, false, false, 115), "Y-m-d"), "html", null, true)) : (yield ""));
        yield "';

        // Fonction qui gère l'affichage des blocs selon la valeur sélectionnée
        function handleResiliationDisplay() {
            // Ajouter la classe hide à tous les blocs de résiliation
            document.querySelectorAll('.resiliation_block').forEach(block => {
                block.classList.add('hide');
            });

            // Récupérer la valeur sélectionnée
            const selectedValue = document.getElementById('resiliation_motif').value;

            // Ne réinitialiser les valeurs que si on change de motif
            if (selectedValue !== previousMotif) {
                // Réinitialiser les valeurs des champs
                document.getElementById('resiliation_autre_marque').selectedIndex = 0;
                document.getElementById('resiliation_intervention').selectedIndex = 0;
                document.getElementById('resiliation_autre').value = '';
            }

            // Gérer les différents cas
            if (selectedValue === '1') {
                document.getElementById('resiliation_autre_marque').classList.remove('hide');
            } else if (selectedValue === '7') {
                document.getElementById('resiliation_intervention').classList.remove('hide');
            } else if (selectedValue === '11') {
                document.getElementById('resiliation_autre').classList.remove('hide');
            }

            // Mettre à jour le motif précédent
            previousMotif = selectedValue;
        }

        // Fonction pour gérer le changement de date de résiliation
        function handleDateResiliationChange() {
            const typeDateChoice = document.getElementById('type_date_resiliation_choice');
            const currentDateValue = dateResiliationInput.value;
            
            if (typeDateChoice.checked) {
                // Si la valeur précédente était la date de fin de contrat ou si elle est vide/nulle
                if (currentDateValue === dateFinContrat || !currentDateValue) {
                    // Définir la valeur à aujourd'hui
                    const today = new Date().toISOString().split('T')[0];
                    dateResiliationInput.value = today;
                }
            }
        }

        // Appeler la fonction au chargement de la page
        handleResiliationDisplay();

        // Ajouter l'écouteur d'événement pour le changement de motif
        document.getElementById('resiliation_motif').addEventListener('change', handleResiliationDisplay);
        
        // Ajouter l'écouteur d'événement pour le changement de type de date
        document.getElementById('type_date_resiliation_choice').addEventListener('change', handleDateResiliationChange);
    });
</script>";
        
        $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);

        
        $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);

        return; yield '';
    }

    /**
     * @codeCoverageIgnore
     */
    public function getTemplateName()
    {
        return "clients/contrat/_popup_resilier_contrat.html.twig";
    }

    /**
     * @codeCoverageIgnore
     */
    public function isTraitable()
    {
        return false;
    }

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo()
    {
        return array (  312 => 115,  300 => 106,  296 => 105,  288 => 100,  283 => 97,  274 => 94,  268 => 93,  263 => 92,  259 => 91,  254 => 88,  245 => 85,  239 => 84,  234 => 83,  230 => 82,  222 => 76,  213 => 73,  207 => 72,  202 => 71,  198 => 70,  184 => 65,  174 => 60,  170 => 59,  160 => 54,  156 => 53,  144 => 44,  140 => 43,  131 => 41,  127 => 40,  119 => 37,  115 => 36,  105 => 31,  101 => 30,  86 => 20,  76 => 15,  67 => 9,  62 => 8,  56 => 5,  53 => 4,  51 => 3,  46 => 2,  44 => 1,);
    }

    public function getSourceContext()
    {
        return new Source("{% set contratResilie =  contrat  and  contrat.contratResiliations[0] is defined ? contrat.contratResiliations[0] %}
<div id=\"popup-resilier-{{ equipement.id }}\" style=\"display:none\" class=\"popup-resilier-contrat\" >
    {% if contratResilie %}
        <div class=\"d-flex\">
            <button  class=\"btn  btn-outline-danger me-1 ms-auto\" data-confirm=\"1\" data-href=\"{{ path('equipement_cancel_resiliation_contrat', {id: contrat.contratResiliations[0].id}) }}\" >Annuler la résiliation</button>
        </div>
    {% endif %}
    <form class=\"px-0 form_resilier_contrat\" action=\"{{ path('post_equipement_resilier_contrat', {id: equipement.id}) }}\" method=\"post\">
        <input type=\"hidden\" data-formchanged=\"no\" name=\"id_contrat_resiliation\" value=\"{{ contratResilie ? contratResilie.id : '' }}\">
        <div class=\"d-flex mb-3 flex-column\">
            <div class=\"form-check-inline\">Mode de résiliation </div>
            <div class=\"d-flex\" style=\"margin-left: 58px;\">
                <div class=\"form-check form-check-inline ms-0\">
                    <input class=\"form-check-input check-input-fill\" data-formchanged=\"no\" type=\"radio\" name=\"mode_resilisation_client\" value=\"Email\"
                           {% if not contratResilie or (contratResilie.typeEnvoi and contratResilie.typeEnvoi.libelle == 'Email') %}checked{% endif %}>
                    <label class=\"form-check-label\">E-mail</label>
                </div>
                <div class=\"form-check form-check-inline \" style=\"margin-left: 153px;\">
                    <input class=\"form-check-input check-input-fill\" data-formchanged=\"no\" type=\"radio\" name=\"mode_resilisation_client\" value=\"Courrier\"
                           {% if contratResilie and contratResilie.typeEnvoi and  contratResilie.typeEnvoi.libelle == 'Courrier' %}checked{% endif %}>
                    <label class=\"form-check-label\" >Courrier</label>
                </div>
            </div>
        </div>
        <div class=\"d-flex mb-3 flex-column\">
            <div class=\"form-check-inline\">Date de résiliation souhaitée: </div>
            <div class=\"d-flex\" style=\"margin-left: 58px;\">
                <div class=\"form-check form-check-inline ms-0\">
                    <input class=\"form-check-input check-input-fill\" data-formchanged=\"no\" type=\"radio\" name=\"type_date_resiliation\" value=\"contrat\"
                           data-change-target=\"#date-resiliation-{{ equipement.id }}\" 
                           {% if not contratResilie or (contratResilie and contratResilie.date == contrat.dateFinContrat) %}checked{% endif %}>
                    <label class=\"form-check-label\" >Date de fin du contrat</label>
                </div>
                <div class=\"form-check form-check-inline\" style=\"margin-left: 58px;\">
                    <input class=\"form-check-input check-input-fill\" data-formchanged=\"no\" type=\"radio\" name=\"type_date_resiliation\" id=\"type_date_resiliation_choice\" value=\"date\"
                           data-change-target=\"#date-resiliation-{{ equipement.id }}\"
                           {% if contratResilie and  contratResilie.date != contrat.dateFinContrat %}checked{% endif %}>
                    <label class=\"form-check-label\" >Date de la demande de résiliation</label>
                </div>
                <div class=\"form-check form-check-inline\" id=\"date-resiliation-{{ equipement.id }}\" 
                     style=\"{% if contratResilie and  contratResilie.date != contrat.dateFinContrat %}display:block{% else %}display:none{% endif %}\">
                    <input class=\"form-control\" type=\"date\" name=\"date_resiliation\"  data-formchanged=\"no\"
                           value=\"{{ contratResilie ? contratResilie.date|date('Y-m-d') : 'now'|date('Y-m-d') }}\" 
                           min=\"{{ 'now'|date('Y-m-d') }}\">
                </div>
            </div>
        </div>
        <div class=\"d-flex mb-3 flex-column\">
            <div class=\"form-check-inline\">Le client a t'il donné un motif de résiliation ?</div>
            <div class=\"d-flex\" style=\"margin-left: 58px;\">
                <div class=\"form-check form-check-inline ms-0\">
                    <input class=\"form-check-input check-input-fill\" data-formchanged=\"no\" type=\"radio\" name=\"motif_resiliation_donne\" value=\"oui\"
                           data-change-target=\"#container-motif-{{ equipement.id }}\"
                           {% if contratResilie and  contratResilie.contratMotifResiliation %}checked{% endif %}>
                    <label class=\"form-check-label\" for=\"inlineRadio1\">Oui</label>
                </div>
                <div class=\"form-check form-check-inline\" style=\"margin-left: 174px;\">
                    <input class=\"form-check-input check-input-fill\" data-formchanged=\"no\" type=\"radio\" name=\"motif_resiliation_donne\" value=\"non\"
                           data-change-target=\"#container-motif-{{ equipement.id }}\"
                           {% if (contratResilie and not contratResilie.contratMotifResiliation) or not contratResilie %}checked{% endif %}>
                    <label class=\"form-check-label\" for=\"inlineRadio2\">Non</label>
                </div>
            </div>
        </div>
        <div id=\"container-motif-{{ equipement.id }}\" style=\"{% if contratResilie and  contratResilie.contratMotifResiliation %}display: block{% else %}display: none{% endif %}\">
            <div class=\"d-flex align-items-center mb-2\">
                <div style=\"width:39px;\">Motif</div>
                <div class=\"d-flex flex-grow-1\">
                    <select name=\"motif\" class=\"form-control\" id=\"resiliation_motif\" data-formchanged=\"no\">
                        {% for motif in contratMotifsResiliation %}
                            <option value=\"{{ motif.id }}\" 
                                {% if contratResilie and contratResilie.contratMotifResiliation and contratResilie.contratMotifResiliation.id == motif.id %}selected{% endif %}>
                                {{ motif.libelle }}
                            </option>
                        {% endfor %}
                    </select>
                </div>
            </div>
            <div class=\"d-flex flex-column\" style=\"margin-left: 39px;\">
                <select name=\"marque_change\" class=\"form-control form-control-sm me-4 hide resiliation_block\" id=\"resiliation_autre_marque\" data-formchanged=\"no\">
                    <option value=\"\" checked style=\"color: #95a5a6;opacity: 1;\">Marque si connue</option>
                    {% for marque in equipementMarques %}
                        <option value=\"{{ marque.id }}\"
                            {% if contratResilie and contratResilie.equipementMarque and contratResilie.equipementMarque.id == marque.id %}selected{% endif %}>
                            {{ marque.libelle }}
                        </option>
                    {% endfor %}
                </select>
                <select name=\"resiliation_intervention_insatisfait\" class=\"form-control form-control-sm me-4 hide resiliation_block\" data-formchanged=\"no\" id=\"resiliation_intervention\">
                    <option value=\"\" checked style=\"color: #95a5a6;opacity: 1;\">Choix de l'intervention si connue</option>
                    {% for intervention in equipement.interventions %}
                        <option value=\"{{ intervention.id }}\"
                            {% if contratResilie and contratResilie.intervention and contratResilie.intervention.id == intervention.id %}selected{% endif %}>
                            {{ intervention.getFormattedInterventionForResiliation }}
                        </option>
                    {% endfor %}
                </select>
                <input type=\"text\" name=\"resiliation_autre_input\" class=\"form-control form-control-sm hide resiliation_block\"  data-formchanged=\"no\"
                       placeholder=\"Précision si connue\" id=\"resiliation_autre\"
                       value=\"{{ contratResilie ? contratResilie.motifSiAutre : '' }}\">
            </div>
        </div>
        <div class=\"form-group d-flex justify-content-center mt-4\">
            <div class=\"form-actions-row\">
                <button class=\"btn btn-outline-danger btn-close-popup\" data-dxpopup-id=\"popup-resilier-{{ equipement.id }}\" type=\"button\">Annuler</button>
                <button class=\"btn btn-outline-success me-3\" type=\"submit\">{{ contratResilie ? 'Modifier' : 'Valider' }}</button>
            </div>
        </div>
    </form>
</div>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        let previousMotif = document.getElementById('resiliation_motif').value;
        let dateResiliationInput = document.querySelector('input[name=\"date_resiliation\"]');
        let dateFinContrat = '{{ contrat and contrat.dateFinContrat ? contrat.dateFinContrat|date(\"Y-m-d\") : \"\" }}';

        // Fonction qui gère l'affichage des blocs selon la valeur sélectionnée
        function handleResiliationDisplay() {
            // Ajouter la classe hide à tous les blocs de résiliation
            document.querySelectorAll('.resiliation_block').forEach(block => {
                block.classList.add('hide');
            });

            // Récupérer la valeur sélectionnée
            const selectedValue = document.getElementById('resiliation_motif').value;

            // Ne réinitialiser les valeurs que si on change de motif
            if (selectedValue !== previousMotif) {
                // Réinitialiser les valeurs des champs
                document.getElementById('resiliation_autre_marque').selectedIndex = 0;
                document.getElementById('resiliation_intervention').selectedIndex = 0;
                document.getElementById('resiliation_autre').value = '';
            }

            // Gérer les différents cas
            if (selectedValue === '1') {
                document.getElementById('resiliation_autre_marque').classList.remove('hide');
            } else if (selectedValue === '7') {
                document.getElementById('resiliation_intervention').classList.remove('hide');
            } else if (selectedValue === '11') {
                document.getElementById('resiliation_autre').classList.remove('hide');
            }

            // Mettre à jour le motif précédent
            previousMotif = selectedValue;
        }

        // Fonction pour gérer le changement de date de résiliation
        function handleDateResiliationChange() {
            const typeDateChoice = document.getElementById('type_date_resiliation_choice');
            const currentDateValue = dateResiliationInput.value;
            
            if (typeDateChoice.checked) {
                // Si la valeur précédente était la date de fin de contrat ou si elle est vide/nulle
                if (currentDateValue === dateFinContrat || !currentDateValue) {
                    // Définir la valeur à aujourd'hui
                    const today = new Date().toISOString().split('T')[0];
                    dateResiliationInput.value = today;
                }
            }
        }

        // Appeler la fonction au chargement de la page
        handleResiliationDisplay();

        // Ajouter l'écouteur d'événement pour le changement de motif
        document.getElementById('resiliation_motif').addEventListener('change', handleResiliationDisplay);
        
        // Ajouter l'écouteur d'événement pour le changement de type de date
        document.getElementById('type_date_resiliation_choice').addEventListener('change', handleDateResiliationChange);
    });
</script>", "clients/contrat/_popup_resilier_contrat.html.twig", "/builds/dev/refonte_sav/templates/clients/contrat/_popup_resilier_contrat.html.twig");
    }
}
