<?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;

/* plan/activity_form.html.twig */
class __TwigTemplate_64aa348cf2841a8252e9b483af974cae 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/mesodd-layout.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        $this->parent = $this->load("@AdminLTE/layout/mesodd-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("activity.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("plan/activity_form.html.twig", 8, 1113120065)->unwrap()->yield($context);
        // line 32
        yield "
";
        yield from [];
    }

    // line 35
    /**
     * @return iterable<null|scalar|\Stringable>
     */
    public function block_javascripts(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        // line 36
        yield "    <script>
        let \$code = \$('#activity_code');
        let \$name = \$('#activity_name');
        let \$year = \$('#activity_year');
        let \$type = \$('#activity_type');
        let \$entite = \$('#activity_entite');
        let \$programm = \$('#activity_programm');

        \$(document).on('change', '#activity_type, #activity_entite, #activity_programm', function () {
            //let \$ministry = \$('#activity_ministry')
            let \$form = \$(this).closest('form')

            let data = {}
            data[\$code.attr('name')] = \$code.val()
            data[\$name.attr('name')] = \$name.val()
            data[\$year.attr('name')] = \$year.val()
            data[\$type.attr('name')] = \$type.val()
            data[\$entite.attr('name')] = \$entite.val()
            data[\$programm.attr('name')] = \$programm.val()
            data[\$(this).attr('name')] = \$(this).val()
            
            let \$field = \$(this).attr('id')
            \$.ajax({
                url: \$form.attr('action'),
                type: \$form.attr('method'),
                data: data,
                success: function(html) {
                    if (\$field == 'activity_type') {
                        \$('#activity_entite').replaceWith(
                            \$(html).find('#activity_entite')
                        )
                         \$('#activity_direction').replaceWith(
                            \$(html).find('#activity_direction')
                        )
                        \$('#activity_programm').replaceWith(
                            \$(html).find('#activity_programm')
                        )
                        \$('#activity_action').replaceWith(
                            \$(html).find('#activity_action')
                        )
                    }
                    if (\$field == 'activity_entite') {
                        \$('#activity_direction').replaceWith(
                            \$(html).find('#activity_direction')
                        )
                        \$('#activity_programm').replaceWith(
                            \$(html).find('#activity_programm')
                        )
                    }
                    if (\$field == 'activity_programm') {
                        \$('#activity_action').replaceWith(
                            \$(html).find('#activity_action')
                        )
                    }
                }
            });
        });

    </script>
";
        yield from [];
    }

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

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo(): array
    {
        return array (  89 => 36,  82 => 35,  76 => 32,  74 => 8,  71 => 7,  64 => 6,  53 => 3,  42 => 1,);
    }

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


/* plan/activity_form.html.twig */
class __TwigTemplate_64aa348cf2841a8252e9b483af974cae___1113120065 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
        if ((($tmp = $this->extensions['Symfony\Bridge\Twig\Extension\SecurityExtension']->isGranted("ROLE_MANAGER")) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
            // line 12
            yield "                    ";
            yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "type", [], "any", false, false, false, 12), 'row');
            yield "
                ";
        }
        // line 14
        yield "               ";
        if ((($tmp = $this->extensions['Symfony\Bridge\Twig\Extension\SecurityExtension']->isGranted("ROLE_MANAGER")) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
            // line 15
            yield "                    ";
            yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "entite", [], "any", false, false, false, 15), 'row');
            yield "
                ";
        }
        // line 17
        yield "                ";
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "direction", [], "any", false, false, false, 17), 'row');
        yield "
                ";
        // line 18
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "programm", [], "any", false, false, false, 18), 'row');
        yield "
                ";
        // line 19
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "action", [], "any", false, false, false, 19), 'row');
        yield "
                ";
        // line 20
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "code", [], "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), "name", [], "any", false, false, false, 21), 'row');
        yield "
                ";
        // line 22
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "amount", [], "any", false, false, false, 22), 'row');
        yield "
                <div class=\"form-group row\">
                    <div class=\"col-sm-2\"><a href=\"";
        // line 24
        yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("app_activities");
        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 26
        yield $this->env->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->trans("basics.save", [], "messages");
        yield "</button>
                    </div>
                </div>
            ";
        // line 29
        yield         $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->renderBlock(($context["form"] ?? null), 'form_end');
        yield "
        ";
        yield from [];
    }

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

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo(): array
    {
        return array (  285 => 29,  279 => 26,  272 => 24,  267 => 22,  263 => 21,  259 => 20,  255 => 19,  251 => 18,  246 => 17,  240 => 15,  237 => 14,  231 => 12,  229 => 11,  224 => 10,  217 => 9,  206 => 8,  89 => 36,  82 => 35,  76 => 32,  74 => 8,  71 => 7,  64 => 6,  53 => 3,  42 => 1,);
    }

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