<?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;
use Twig\TemplateWrapper;

/* admin/user_form.html.twig */
class __TwigTemplate_0d8f67d1ad617093f795f833b1d8ca9e extends Template
{
    private Source $source;
    /**
     * @var array<string, Template>
     */
    private array $macros = [];

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

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

        $this->blocks = [
            'page_title' => [$this, 'block_page_title'],
            'page_content' => [$this, 'block_page_content'],
            'javascripts' => [$this, 'block_javascripts'],
        ];
    }

    protected function doGetParent(array $context): bool|string|Template|TemplateWrapper
    {
        // line 1
        return "@AdminLTE/layout/cfgodd-layout.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        $this->parent = $this->load("@AdminLTE/layout/cfgodd-layout.html.twig", 1);
        yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks));
    }

    // line 3
    /**
     * @return iterable<null|scalar|\Stringable>
     */
    public function block_page_title(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        yield $this->env->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->trans("admin.user.title", [], "messages");
        yield from [];
    }

    // line 6
    /**
     * @return iterable<null|scalar|\Stringable>
     */
    public function block_page_content(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        // line 7
        yield "
    ";
        // line 8
        yield from $this->load("admin/user_form.html.twig", 8, 1903004231)->unwrap()->yield($context);
        // line 58
        yield "
";
        yield from [];
    }

    // line 62
    /**
     * @return iterable<null|scalar|\Stringable>
     */
    public function block_javascripts(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        // line 63
        yield "
    <script type=\"text/javascript\">
        if(";
        // line 65
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["type"] ?? null), "html", null, true);
        yield "==0){
           enabled.style.display = \"block\";
            ministere.style.display = \"block\";
            commune.style.display = \"none\";
            departement.style.display = \"none\";
        }
        if(";
        // line 71
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["type"] ?? null), "html", null, true);
        yield "==1){
                enabled.style.display = \"block\";
                ministere.style.display = \"none\";
                commune.style.display = \"block\";
                departement.style.display = \"block\";
            }
        if(";
        // line 77
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["type"] ?? null), "html", null, true);
        yield "==2){
                enabled.style.display = \"block\";
                ministere.style.display = \"none\";
                commune.style.display = \"none\";
                departement.style.display = \"block\";
            }
        function typestructure(type){
            var enabled = document.getElementById(\"enabled\");
            var ministere = document.getElementById(\"ministere\");
            var commune = document.getElementById(\"commune\");
            var departement = document.getElementById(\"departement\");
            if(!type){
                enabled.style.display = \"none\";
                ministere.style.display = \"none\";
                commune.style.display = \"none\";
                departement.style.display = \"none\";
            }else if(type==0){
                enabled.style.display = \"block\";
                ministere.style.display = \"block\";
                commune.style.display = \"none\";
                departement.style.display = \"none\";
            }else if(type==1){
                enabled.style.display = \"block\";
                ministere.style.display = \"none\";
                commune.style.display = \"block\";
                departement.style.display = \"block\";
            }else if(type==2){
                enabled.style.display = \"block\";
                ministere.style.display = \"none\";
                departement.style.display = \"block\";
                commune.style.display = \"none\";
            }
        }
    </script>

    <script>
        let \$username = \$('#user_username');
        let \$email = \$('#user_email');
        let \$firstname = \$('#user_firstname');
        let \$lastname = \$('#user_lastname');
        let \$ministry = \$('#user_ministry');
        let \$department = \$('#user_department');

        \$ministry.change(function () {
            let \$form = \$ministry.closest('form')

            let data = {}
            data[\$username.attr('name')] = \$username.val();
            data[\$email.attr('name')] = \$email.val();
            data[\$firstname.attr('name')] = \$firstname.val();
            data[\$lastname.attr('name')] = \$lastname.val();
            data[\$ministry.attr('name')] = \$ministry.val()

            \$.ajax({
                url: \$form.attr('action'),
                type: \$form.attr('method'),
                data: data,
                success: function(html) {
                    \$('#user_direction').replaceWith(
                        \$(html).find('#user_direction')
                    )
                }
            });
        });

        \$department.change(function() {
            let \$form = \$department.closest('form');

            let data = {};
            data[\$username.attr('name')] = \$username.val();
            data[\$email.attr('name')] = \$email.val();
            data[\$firstname.attr('name')] = \$firstname.val();
            data[\$lastname.attr('name')] = \$lastname.val();
            data[\$department.attr('name')] = \$department.val();

            \$.ajax({
                url: \$form.attr('action'),
                type: \$form.attr('method'),
                data: data,
                success: function(html) {
                    \$('#user_commune').replaceWith(
                        \$(html).find('#user_commune')
                    );
                }
            });
        });
    </script>
";
        yield from [];
    }

    /**
     * @codeCoverageIgnore
     */
    public function getTemplateName(): string
    {
        return "admin/user_form.html.twig";
    }

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo(): array
    {
        return array (  111 => 77,  102 => 71,  93 => 65,  89 => 63,  82 => 62,  76 => 58,  74 => 8,  71 => 7,  64 => 6,  53 => 3,  42 => 1,);
    }

    public function getSourceContext(): Source
    {
        return new Source("", "admin/user_form.html.twig", "/var/www/html/templates/admin/user_form.html.twig");
    }
}


/* admin/user_form.html.twig */
class __TwigTemplate_0d8f67d1ad617093f795f833b1d8ca9e___1903004231 extends Template
{
    private Source $source;
    /**
     * @var array<string, Template>
     */
    private array $macros = [];

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

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

        $this->blocks = [
            'box_body' => [$this, 'block_box_body'],
        ];
    }

    protected function doGetParent(array $context): bool|string|Template|TemplateWrapper
    {
        // line 8
        return "@AdminLTE/Widgets/box-widget.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        $this->parent = $this->load("@AdminLTE/Widgets/box-widget.html.twig", 8);
        yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks));
    }

    // line 9
    /**
     * @return iterable<null|scalar|\Stringable>
     */
    public function block_box_body(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        // line 10
        yield "            ";
        yield         $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->renderBlock(($context["form"] ?? null), 'form_start');
        yield "
                ";
        // line 11
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "familyName", [], "any", false, false, false, 11), 'row');
        yield "
                ";
        // line 12
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "givenName", [], "any", false, false, false, 12), 'row');
        yield "
                ";
        // line 13
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "email", [], "any", false, false, false, 13), 'row');
        yield "
                ";
        // line 14
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "telephone", [], "any", false, false, false, 14), 'row');
        yield "
                ";
        // line 15
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "typestructure", [], "any", false, false, false, 15), 'row');
        yield "

                

                <div id=\"ministere\" style=\"display: none;\">
                ";
        // line 20
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "ministry", [], "any", false, false, false, 20), 'row');
        yield "
                ";
        // line 21
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "direction", [], "any", false, false, false, 21), 'row');
        yield "
                </div>

                <div id=\"departement\" style=\"display: none;\">
                ";
        // line 25
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "department", [], "any", false, false, false, 25), 'row');
        yield "
                </div>
                <div id=\"commune\" style=\"display: none;\">
                ";
        // line 28
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "commune", [], "any", false, false, false, 28), 'row');
        yield "
                </div>

                <div id=\"enabled\" style=\"display: none;\">
                ";
        // line 32
        if (CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "enabled", [], "any", true, true, false, 32)) {
            // line 33
            yield "                    ";
            yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "enabled", [], "any", false, false, false, 33), 'row');
            yield "
                ";
        }
        // line 35
        yield "                </div>
                
                ";
        // line 37
        if ((($tmp = ($context["show"] ?? null)) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
            // line 38
            yield "                    ";
            yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "role", [], "any", false, false, false, 38), 'row');
            yield "
                ";
        }
        // line 40
        yield "                
                ";
        // line 41
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "office", [], "any", false, false, false, 41), 'row');
        yield "

                ";
        // line 43
        if (CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "roles", [], "any", true, true, false, 43)) {
            // line 44
            yield "                    <div class=\"form-group row\">
                        <label class=\"col-form-label col-sm-2\" for=\"user_roles\">";
            // line 45
            yield $this->env->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->trans("basics.roles", [], "messages");
            yield "</label>
                        <div class=\"col-sm-offset-2 col-sm-10\">";
            // line 46
            yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "roles", [], "any", false, false, false, 46), 'widget');
            yield "</div>
                    </div>
                ";
        }
        // line 49
        yield "                <div class=\"form-group row\">
                    <div class=\"col-sm-2\"><a href=\"";
        // line 50
        yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("app_users");
        yield "\" class=\"btn btn-block btn-default\">";
        yield $this->env->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->trans("basics.cancel", [], "messages");
        yield "</a></div>
                    <div class=\"col-sm-offset-2 col-sm-10\">
                        <button type=\"submit\" class=\"btn btn-block btn-primary\">";
        // line 52
        yield $this->env->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->trans("basics.save", [], "messages");
        yield "</button>
                    </div>
                </div>
            ";
        // line 55
        yield         $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->renderBlock(($context["form"] ?? null), 'form_end');
        yield "
        ";
        yield from [];
    }

    /**
     * @codeCoverageIgnore
     */
    public function getTemplateName(): string
    {
        return "admin/user_form.html.twig";
    }

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo(): array
    {
        return array (  387 => 55,  381 => 52,  374 => 50,  371 => 49,  365 => 46,  361 => 45,  358 => 44,  356 => 43,  351 => 41,  348 => 40,  342 => 38,  340 => 37,  336 => 35,  330 => 33,  328 => 32,  321 => 28,  315 => 25,  308 => 21,  304 => 20,  296 => 15,  292 => 14,  288 => 13,  284 => 12,  280 => 11,  275 => 10,  268 => 9,  257 => 8,  111 => 77,  102 => 71,  93 => 65,  89 => 63,  82 => 62,  76 => 58,  74 => 8,  71 => 7,  64 => 6,  53 => 3,  42 => 1,);
    }

    public function getSourceContext(): Source
    {
        return new Source("", "admin/user_form.html.twig", "/var/www/html/templates/admin/user_form.html.twig");
    }
}
