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

/* processing/format_form.html.twig */
class __TwigTemplate_a31e23d19499dc9a90e68d487bc5e519 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 2
        return "@AdminLTE/layout/mesodd-layout.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        // line 1
        $this->env->getRuntime("Symfony\\Component\\Form\\FormRenderer")->setTheme(($context["form"] ?? null), ["form/my_horizontal_layout.html.twig"], true);
        // line 2
        $this->parent = $this->load("@AdminLTE/layout/mesodd-layout.html.twig", 2);
        yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks));
    }

    // line 4
    /**
     * @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("upload.title", [], "messages");
        yield from [];
    }

    // line 7
    /**
     * @return iterable<null|scalar|\Stringable>
     */
    public function block_page_content(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        // line 8
        yield "    <div class=\"alert alert-info alert-dismissible text-white\">
                <h5><i class=\"icon fas fa-info\"></i> Information!</h5>
                <div>
                Cet espace vous permet de mettre votre PTA au format requis. Vous devez extraire ce fichier du PTA depuis la plateforme du BAI et ceci, programme par programme. Un autre fichier autre que celui extraire de la plateforme du BAI ne sera pas prise en compte.
                </div>
            </div>

    ";
        // line 15
        yield from $this->load("processing/format_form.html.twig", 15, "19275366")->unwrap()->yield($context);
        // line 81
        yield "    
";
        yield from [];
    }

    // line 84
    /**
     * @return iterable<null|scalar|\Stringable>
     */
    public function block_javascripts(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        // line 85
        yield "    <script>
        let \$cout = \$('#format_cout');
        let \$code = \$('#format_code');
        let \$start = \$('#format_start');
        let \$direction = \$('#format_direction');
        let \$libelle = \$('#format_libelle');
        let \$year = \$('#format_year');
        let \$entite = \$('#format_entite');
        let \$type = \$('#format_type');
        let \$attachment = \$('#format_attachment');

        \$(document).on('change', '#format_type, #format_entite', function () {
            let \$form = \$(this).closest('form')
            
            let data = {}
            data[\$cout.attr('name')] = \$cout.val()
            data[\$code.attr('name')] = \$code.val()
            data[\$start.attr('name')] = \$start.val()
            data[\$direction.attr('name')] = \$direction.val()
            data[\$libelle.attr('name')] = \$libelle.val()
            data[\$year.attr('name')] = \$year.val()
            data[\$type.attr('name')] = \$type.val()
            data[\$entite.attr('name')] = \$entite.val()
            data[\$attachment.attr('name')] = \$attachment.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 == 'format_type') {
                        \$('#format_entite').replaceWith(
                            \$(html).find('#format_entite')
                        )

                        \$('#format_programm').replaceWith(
                            \$(html).find('#format_programm')
                        )
                    }
                    if (\$field == 'format_entite') {
                        \$('#format_programm').replaceWith(
                            \$(html).find('#format_programm')
                        )
                    }
                }
            });
        });

    </script>

    <script>
document.addEventListener('DOMContentLoaded', function() {
    // Pour tous les inputs de type file
    document.querySelectorAll('input[type=\"file\"]').forEach(function(input) {
        input.addEventListener('change', function(e) {
            var fileName = e.target.files[0] ? e.target.files[0].name : 'Aucun fichier choisi';
            
            // Cherche le label ou crée un élément pour afficher le nom
            var label = e.target.nextElementSibling;
            if (label && label.classList.contains('custom-file-label')) {
                label.textContent = fileName;
            } else {
                // Crée un élément pour afficher le nom du fichier
                var fileNameDisplay = document.createElement('small');
                fileNameDisplay.className = 'form-text text-muted file-name-display';
                fileNameDisplay.textContent = fileName;
                
                // Supprime l'ancien affichage s'il existe
                var oldDisplay = e.target.parentNode.querySelector('.file-name-display');
                if (oldDisplay) {
                    oldDisplay.remove();
                }
                
                // Ajoute le nouvel affichage
                e.target.parentNode.appendChild(fileNameDisplay);
            }
        });
    });
});
</script>
";
        yield from [];
    }

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

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo(): array
    {
        return array (  98 => 85,  91 => 84,  85 => 81,  83 => 15,  74 => 8,  67 => 7,  56 => 4,  51 => 2,  49 => 1,  42 => 2,);
    }

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


/* processing/format_form.html.twig */
class __TwigTemplate_a31e23d19499dc9a90e68d487bc5e519___19275366 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 15
        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", 15);
        yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks));
    }

    // line 16
    /**
     * @return iterable<null|scalar|\Stringable>
     */
    public function block_box_body(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        // line 17
        yield "            ";
        yield         $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->renderBlock(($context["form"] ?? null), 'form_start');
        yield "
               ";
        // line 18
        if ((($tmp = $this->extensions['Symfony\Bridge\Twig\Extension\SecurityExtension']->isGranted("ROLE_MANAGER")) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
            // line 19
            yield "                    <div class=\"row\">
                        <div class=\"col-sm-6\">
                            <label for=\"ministry_commune_type\">Structure *</label>
                            ";
            // line 22
            yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "type", [], "any", false, false, false, 22), 'row');
            yield "
                        </div>
                        <div class=\"col-sm-6\">
                            <label for=\"ministry_commune_type\">Ministères/Communes *</label>
                            ";
            // line 26
            yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "entite", [], "any", false, false, false, 26), 'row');
            yield "
                        </div>
                    </div>   
                ";
        }
        // line 30
        yield "                ";
        if ((($tmp = $this->extensions['Symfony\Bridge\Twig\Extension\SecurityExtension']->isGranted("ROLE_DDD")) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
            // line 31
            yield "                    <div class=\"col-sm-12\">
                            <label for=\"ministry_commune_type\">Ministères/Communes *</label>
                            ";
            // line 33
            yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "entite", [], "any", false, false, false, 33), 'row');
            yield "
                    </div>
                ";
        }
        // line 35
        yield " 
               <div class=\"row\">
                    <div class=\"col-sm-12\">
                        <label for=\"ministry_commune_type\">Fichier Excel du PTA (programme par programme) *</label>
                        ";
        // line 39
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "attachment", [], "any", false, false, false, 39), 'row');
        yield "
                    </div>
                </div>
                <div class=\"row\">
                    <div class=\"col-sm-12\">
                        <label for=\"ministry_commune_type\">Programme *</label>
                        ";
        // line 45
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "programm", [], "any", false, false, false, 45), 'row');
        yield "
                    </div>
                </div>
               <div class=\"row\">
                    <div class=\"col-sm-12\">
                        <label for=\"ministry_commune_type\">Les données commencent à la ligne *</label>
                        ";
        // line 51
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "start", [], "any", false, false, false, 51), 'row');
        yield "
                    </div>
                </div>
                <div class=\"row\">
                    <div class=\"col-sm-3\">
                        <label for=\"ministry_commune_type\">Colonne des codes *</label>
                        ";
        // line 57
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "code", [], "any", false, false, false, 57), 'row');
        yield "
                    </div>
                    <div class=\"col-sm-3\">
                        <label for=\"ministry_commune_type\">Colonne des libellés *</label>
                        ";
        // line 61
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "libelle", [], "any", false, false, false, 61), 'row');
        yield "
                    </div>
                    <div class=\"col-sm-3\">
                        <label for=\"ministry_commune_type\">Colonne des directions *</label>
                        ";
        // line 65
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "direction", [], "any", false, false, false, 65), 'row');
        yield "
                    </div>
                    <div class=\"col-sm-3\">
                        <label for=\"ministry_commune_type\">Colonne des montants *</label>
                        ";
        // line 69
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock(CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "cout", [], "any", false, false, false, 69), 'row');
        yield "
                    </div>
                </div>
                <div class=\"row\">
                        <div class=\"col-sm-2\"></div>
                        <div class=\"col-sm-12\">
                            <button type=\"submit\" class=\"btn btn-block btn-primary\">Mettre le PTA au format</button>
                        </div>
                    </div>
            ";
        // line 78
        yield         $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->renderBlock(($context["form"] ?? null), 'form_end');
        yield "
        ";
        yield from [];
    }

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

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo(): array
    {
        return array (  360 => 78,  348 => 69,  341 => 65,  334 => 61,  327 => 57,  318 => 51,  309 => 45,  300 => 39,  294 => 35,  288 => 33,  284 => 31,  281 => 30,  274 => 26,  267 => 22,  262 => 19,  260 => 18,  255 => 17,  248 => 16,  237 => 15,  98 => 85,  91 => 84,  85 => 81,  83 => 15,  74 => 8,  67 => 7,  56 => 4,  51 => 2,  49 => 1,  42 => 2,);
    }

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