<?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_b6285c7352b6ff79dbf53ece962af5a4 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;
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "plan/activity_form.html.twig"));

        $this->parent = $this->load("@AdminLTE/layout/mesodd-layout.html.twig", 1);
        yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks));
        
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);

    }

    // line 3
    /**
     * @return iterable<null|scalar|\Stringable>
     */
    public function block_page_title(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "page_title"));

        yield $this->env->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->trans("activity.title", [], "messages");
        
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);

        yield from [];
    }

    // line 6
    /**
     * @return iterable<null|scalar|\Stringable>
     */
    public function block_page_content(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "page_content"));

        // line 7
        yield "
    ";
        // line 8
        yield from $this->load("plan/activity_form.html.twig", 8, "1755731631")->unwrap()->yield($context);
        // line 32
        yield "
";
        
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);

        yield from [];
    }

    // line 35
    /**
     * @return iterable<null|scalar|\Stringable>
     */
    public function block_javascripts(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "javascripts"));

        // 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>
";
        
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);

        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 (  110 => 36,  100 => 35,  91 => 32,  89 => 8,  86 => 7,  76 => 6,  59 => 3,  42 => 1,);
    }

    public function getSourceContext(): Source
    {
        return new Source("{% extends '@AdminLTE/layout/mesodd-layout.html.twig' %}

{% block page_title %}{% trans %}activity.title{% endtrans %}{% endblock %}


{% block page_content %}

    {% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
        {% block box_body %}
            {{ form_start(form) }}
                {% if is_granted('ROLE_MANAGER') %}
                    {{ form_row(form.type) }}
                {% endif %}
               {% if is_granted('ROLE_MANAGER') %}
                    {{ form_row(form.entite) }}
                {% endif %}
                {{ form_row(form.direction) }}
                {{ form_row(form.programm) }}
                {{ form_row(form.action) }}
                {{ form_row(form.code) }}
               {{ form_row(form.name) }}
                {{ form_row(form.amount) }}
                <div class=\"form-group row\">
                    <div class=\"col-sm-2\"><a href=\"{{ path('app_activities') }}\" class=\"btn btn-block btn-default\">{% trans %}basics.cancel{% endtrans %}</a></div>
                    <div class=\"col-sm-offset-2 col-sm-10\">
                        <button type=\"submit\" class=\"btn btn-block btn-primary\">{% trans %}basics.save{% endtrans %}</button>
                    </div>
                </div>
            {{ form_end(form) }}
        {% endblock %}
    {% endembed %}

{% endblock %}

{% block javascripts %}
    <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>
{% endblock %}", "plan/activity_form.html.twig", "/var/www/vhosts/sigodd.gouv.bj/httpdocs/templates/plan/activity_form.html.twig");
    }
}


/* plan/activity_form.html.twig */
class __TwigTemplate_b6285c7352b6ff79dbf53ece962af5a4___1755731631 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;
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "plan/activity_form.html.twig"));

        $this->parent = $this->load("@AdminLTE/Widgets/box-widget.html.twig", 8);
        yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks));
        
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);

    }

    // line 9
    /**
     * @return iterable<null|scalar|\Stringable>
     */
    public function block_box_body(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "box_body"));

        // line 10
        yield "            ";
        yield         $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->renderBlock((isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 10, $this->source); })()), '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, (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 12, $this->source); })()), "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, (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 15, $this->source); })()), "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, (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 17, $this->source); })()), "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, (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 18, $this->source); })()), "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, (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 19, $this->source); })()), "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, (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 20, $this->source); })()), "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, (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 21, $this->source); })()), "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, (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 22, $this->source); })()), "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((isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 29, $this->source); })()), 'form_end');
        yield "
        ";
        
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);

        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 (  412 => 29,  406 => 26,  399 => 24,  394 => 22,  390 => 21,  386 => 20,  382 => 19,  378 => 18,  373 => 17,  367 => 15,  364 => 14,  358 => 12,  356 => 11,  351 => 10,  341 => 9,  324 => 8,  110 => 36,  100 => 35,  91 => 32,  89 => 8,  86 => 7,  76 => 6,  59 => 3,  42 => 1,);
    }

    public function getSourceContext(): Source
    {
        return new Source("{% extends '@AdminLTE/layout/mesodd-layout.html.twig' %}

{% block page_title %}{% trans %}activity.title{% endtrans %}{% endblock %}


{% block page_content %}

    {% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
        {% block box_body %}
            {{ form_start(form) }}
                {% if is_granted('ROLE_MANAGER') %}
                    {{ form_row(form.type) }}
                {% endif %}
               {% if is_granted('ROLE_MANAGER') %}
                    {{ form_row(form.entite) }}
                {% endif %}
                {{ form_row(form.direction) }}
                {{ form_row(form.programm) }}
                {{ form_row(form.action) }}
                {{ form_row(form.code) }}
               {{ form_row(form.name) }}
                {{ form_row(form.amount) }}
                <div class=\"form-group row\">
                    <div class=\"col-sm-2\"><a href=\"{{ path('app_activities') }}\" class=\"btn btn-block btn-default\">{% trans %}basics.cancel{% endtrans %}</a></div>
                    <div class=\"col-sm-offset-2 col-sm-10\">
                        <button type=\"submit\" class=\"btn btn-block btn-primary\">{% trans %}basics.save{% endtrans %}</button>
                    </div>
                </div>
            {{ form_end(form) }}
        {% endblock %}
    {% endembed %}

{% endblock %}

{% block javascripts %}
    <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>
{% endblock %}", "plan/activity_form.html.twig", "/var/www/vhosts/sigodd.gouv.bj/httpdocs/templates/plan/activity_form.html.twig");
    }
}
