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

/* graph/graph_cost.html.twig */
class __TwigTemplate_83d933f978c45e236e254270bda0f87b 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", "graph/graph_cost.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("graph.cost.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("graph/graph_cost.html.twig", 8, "913959985")->unwrap()->yield($context);
        // line 15
        yield "
    ";
        // line 16
        if ((($tmp = (isset($context["type"]) || array_key_exists("type", $context) ? $context["type"] : (function () { throw new RuntimeError('Variable "type" does not exist.', 16, $this->source); })())) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
            // line 17
            yield "    ";
            yield from $this->load("graph/graph_cost.html.twig", 17, "902785593")->unwrap()->yield($context);
            // line 22
            yield "    ";
        }
        // line 23
        yield "
";
        
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);

        yield from [];
    }

    // line 26
    /**
     * @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 27
        yield "<script>
        let \$type = \$('#ministry_sel_type');

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

            let data = {};
            data[\$type.attr('name')] = \$type.val();

            \$.ajax({
                url: \$form.attr('action'),
                type: \$form.attr('method'),
                data: data,
                success: function(html) {
                    \$('#ministry_sel_entite').replaceWith(
                        \$(html).find('#ministry_sel_entite')
                    );
                }
            });
        });
    </script>
  ";
        // line 48
        if ((($tmp = (isset($context["type"]) || array_key_exists("type", $context) ? $context["type"] : (function () { throw new RuntimeError('Variable "type" does not exist.', 48, $this->source); })())) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
            // line 49
            yield "    <script>
        \$(function () {

            var donutChartCanvas = \$('#donutChart').get(0).getContext('2d')
            var donutData        = {
                labels: ";
            // line 54
            if ((($tmp = (isset($context["donutChart"]) || array_key_exists("donutChart", $context) ? $context["donutChart"] : (function () { throw new RuntimeError('Variable "donutChart" does not exist.', 54, $this->source); })())) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
                yield json_encode(CoreExtension::getAttribute($this->env, $this->source, (isset($context["donutChart"]) || array_key_exists("donutChart", $context) ? $context["donutChart"] : (function () { throw new RuntimeError('Variable "donutChart" does not exist.', 54, $this->source); })()), "labels", [], "array", false, false, false, 54));
            } else {
                yield " []";
            }
            yield ",
                datasets: [
                    {
                        data: ";
            // line 57
            if ((($tmp = (isset($context["donutChart"]) || array_key_exists("donutChart", $context) ? $context["donutChart"] : (function () { throw new RuntimeError('Variable "donutChart" does not exist.', 57, $this->source); })())) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
                yield json_encode(CoreExtension::getAttribute($this->env, $this->source, (isset($context["donutChart"]) || array_key_exists("donutChart", $context) ? $context["donutChart"] : (function () { throw new RuntimeError('Variable "donutChart" does not exist.', 57, $this->source); })()), "percents", [], "array", false, false, false, 57));
            } else {
                yield " []";
            }
            yield ",
                        backgroundColor: ";
            // line 58
            if ((($tmp = (isset($context["donutChart"]) || array_key_exists("donutChart", $context) ? $context["donutChart"] : (function () { throw new RuntimeError('Variable "donutChart" does not exist.', 58, $this->source); })())) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
                yield json_encode(CoreExtension::getAttribute($this->env, $this->source, (isset($context["donutChart"]) || array_key_exists("donutChart", $context) ? $context["donutChart"] : (function () { throw new RuntimeError('Variable "donutChart" does not exist.', 58, $this->source); })()), "bgColor", [], "array", false, false, false, 58));
            } else {
                yield " []";
            }
            yield ",
                    }
                ]
            }
            var donutOptions     = {
                maintainAspectRatio: false,
                responsive: true,
                plugins: {
                    datalabels: {
                        backgroundColor: ";
            // line 67
            if ((($tmp = (isset($context["donutChart"]) || array_key_exists("donutChart", $context) ? $context["donutChart"] : (function () { throw new RuntimeError('Variable "donutChart" does not exist.', 67, $this->source); })())) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
                yield json_encode(CoreExtension::getAttribute($this->env, $this->source, (isset($context["donutChart"]) || array_key_exists("donutChart", $context) ? $context["donutChart"] : (function () { throw new RuntimeError('Variable "donutChart" does not exist.', 67, $this->source); })()), "bgColor", [], "array", false, false, false, 67));
            } else {
                yield " []";
            }
            yield ",
\t\t\t\t\t\tborderColor: 'white',
\t\t\t\t\t\tborderRadius: 25,
\t\t\t\t\t\tborderWidth: 2,
                        color: 'white',
                        font: {
                            weight: 'bold',
                            size: 12,
                        },
                        align: 'center',
                        anchor: 'end',
                    }
                }
            }

            var donutChart = new Chart(donutChartCanvas, {
                type: 'doughnut',
                data: donutData,
                options: donutOptions      
            })
              
        })
    </script>
";
        }
        // line 91
        yield "
    <script src=\"";
        // line 92
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("plugins/chart.js/Chart.min.js"), "html", null, true);
        yield "\"></script>
    <script src=\"";
        // line 93
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("plugins/chartjs-plugin-datalabels/chartjs-plugin-datalabels.min.js"), "html", null, true);
        yield "\"></script>
    
";
        
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);

        yield from [];
    }

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

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo(): array
    {
        return array (  225 => 93,  221 => 92,  218 => 91,  187 => 67,  171 => 58,  163 => 57,  153 => 54,  146 => 49,  144 => 48,  121 => 27,  111 => 26,  102 => 23,  99 => 22,  96 => 17,  94 => 16,  91 => 15,  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 %}graph.cost.title{% endtrans %}{% endblock %}


{% block page_content %}

    {% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
        {% block box_body %}
            {{ form_start(form) }}
                {{ form_widget(form) }}
            {{ form_end(form) }}    
        {% endblock %}
    {% endembed %}

    {% if type %}
    {% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
        {% block box_body %}
            <canvas id=\"donutChart\" style=\"height:70vh\"></canvas>
        {% endblock %}
    {% endembed %}
    {% endif %}

{% endblock %}

{% block javascripts %}
<script>
        let \$type = \$('#ministry_sel_type');

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

            let data = {};
            data[\$type.attr('name')] = \$type.val();

            \$.ajax({
                url: \$form.attr('action'),
                type: \$form.attr('method'),
                data: data,
                success: function(html) {
                    \$('#ministry_sel_entite').replaceWith(
                        \$(html).find('#ministry_sel_entite')
                    );
                }
            });
        });
    </script>
  {% if type %}
    <script>
        \$(function () {

            var donutChartCanvas = \$('#donutChart').get(0).getContext('2d')
            var donutData        = {
                labels: {% if donutChart %}{{ donutChart['labels']|json_encode()|raw }}{% else %} []{% endif %},
                datasets: [
                    {
                        data: {% if donutChart %}{{ donutChart['percents']|json_encode()|raw }}{% else %} []{% endif %},
                        backgroundColor: {% if donutChart %}{{ donutChart['bgColor']|json_encode()|raw }}{% else %} []{% endif %},
                    }
                ]
            }
            var donutOptions     = {
                maintainAspectRatio: false,
                responsive: true,
                plugins: {
                    datalabels: {
                        backgroundColor: {% if donutChart %}{{ donutChart['bgColor']|json_encode()|raw }}{% else %} []{% endif %},
\t\t\t\t\t\tborderColor: 'white',
\t\t\t\t\t\tborderRadius: 25,
\t\t\t\t\t\tborderWidth: 2,
                        color: 'white',
                        font: {
                            weight: 'bold',
                            size: 12,
                        },
                        align: 'center',
                        anchor: 'end',
                    }
                }
            }

            var donutChart = new Chart(donutChartCanvas, {
                type: 'doughnut',
                data: donutData,
                options: donutOptions      
            })
              
        })
    </script>
{% endif %}

    <script src=\"{{ asset('plugins/chart.js/Chart.min.js') }}\"></script>
    <script src=\"{{ asset('plugins/chartjs-plugin-datalabels/chartjs-plugin-datalabels.min.js') }}\"></script>
    
{% endblock %}", "graph/graph_cost.html.twig", "/var/www/vhosts/sigodd.gouv.bj/httpdocs/templates/graph/graph_cost.html.twig");
    }
}


/* graph/graph_cost.html.twig */
class __TwigTemplate_83d933f978c45e236e254270bda0f87b___913959985 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", "graph/graph_cost.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
        yield $this->env->getRuntime('Symfony\Component\Form\FormRenderer')->searchAndRenderBlock((isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 11, $this->source); })()), 'widget');
        yield "
            ";
        // line 12
        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.', 12, $this->source); })()), 'form_end');
        yield "    
        ";
        
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);

        yield from [];
    }

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

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo(): array
    {
        return array (  419 => 12,  415 => 11,  410 => 10,  400 => 9,  383 => 8,  225 => 93,  221 => 92,  218 => 91,  187 => 67,  171 => 58,  163 => 57,  153 => 54,  146 => 49,  144 => 48,  121 => 27,  111 => 26,  102 => 23,  99 => 22,  96 => 17,  94 => 16,  91 => 15,  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 %}graph.cost.title{% endtrans %}{% endblock %}


{% block page_content %}

    {% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
        {% block box_body %}
            {{ form_start(form) }}
                {{ form_widget(form) }}
            {{ form_end(form) }}    
        {% endblock %}
    {% endembed %}

    {% if type %}
    {% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
        {% block box_body %}
            <canvas id=\"donutChart\" style=\"height:70vh\"></canvas>
        {% endblock %}
    {% endembed %}
    {% endif %}

{% endblock %}

{% block javascripts %}
<script>
        let \$type = \$('#ministry_sel_type');

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

            let data = {};
            data[\$type.attr('name')] = \$type.val();

            \$.ajax({
                url: \$form.attr('action'),
                type: \$form.attr('method'),
                data: data,
                success: function(html) {
                    \$('#ministry_sel_entite').replaceWith(
                        \$(html).find('#ministry_sel_entite')
                    );
                }
            });
        });
    </script>
  {% if type %}
    <script>
        \$(function () {

            var donutChartCanvas = \$('#donutChart').get(0).getContext('2d')
            var donutData        = {
                labels: {% if donutChart %}{{ donutChart['labels']|json_encode()|raw }}{% else %} []{% endif %},
                datasets: [
                    {
                        data: {% if donutChart %}{{ donutChart['percents']|json_encode()|raw }}{% else %} []{% endif %},
                        backgroundColor: {% if donutChart %}{{ donutChart['bgColor']|json_encode()|raw }}{% else %} []{% endif %},
                    }
                ]
            }
            var donutOptions     = {
                maintainAspectRatio: false,
                responsive: true,
                plugins: {
                    datalabels: {
                        backgroundColor: {% if donutChart %}{{ donutChart['bgColor']|json_encode()|raw }}{% else %} []{% endif %},
\t\t\t\t\t\tborderColor: 'white',
\t\t\t\t\t\tborderRadius: 25,
\t\t\t\t\t\tborderWidth: 2,
                        color: 'white',
                        font: {
                            weight: 'bold',
                            size: 12,
                        },
                        align: 'center',
                        anchor: 'end',
                    }
                }
            }

            var donutChart = new Chart(donutChartCanvas, {
                type: 'doughnut',
                data: donutData,
                options: donutOptions      
            })
              
        })
    </script>
{% endif %}

    <script src=\"{{ asset('plugins/chart.js/Chart.min.js') }}\"></script>
    <script src=\"{{ asset('plugins/chartjs-plugin-datalabels/chartjs-plugin-datalabels.min.js') }}\"></script>
    
{% endblock %}", "graph/graph_cost.html.twig", "/var/www/vhosts/sigodd.gouv.bj/httpdocs/templates/graph/graph_cost.html.twig");
    }
}


/* graph/graph_cost.html.twig */
class __TwigTemplate_83d933f978c45e236e254270bda0f87b___902785593 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 17
        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", "graph/graph_cost.html.twig"));

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

    }

    // line 18
    /**
     * @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 19
        yield "            <canvas id=\"donutChart\" style=\"height:70vh\"></canvas>
        ";
        
        $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);

        yield from [];
    }

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

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo(): array
    {
        return array (  603 => 19,  593 => 18,  576 => 17,  419 => 12,  415 => 11,  410 => 10,  400 => 9,  383 => 8,  225 => 93,  221 => 92,  218 => 91,  187 => 67,  171 => 58,  163 => 57,  153 => 54,  146 => 49,  144 => 48,  121 => 27,  111 => 26,  102 => 23,  99 => 22,  96 => 17,  94 => 16,  91 => 15,  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 %}graph.cost.title{% endtrans %}{% endblock %}


{% block page_content %}

    {% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
        {% block box_body %}
            {{ form_start(form) }}
                {{ form_widget(form) }}
            {{ form_end(form) }}    
        {% endblock %}
    {% endembed %}

    {% if type %}
    {% embed '@AdminLTE/Widgets/box-widget.html.twig' %}
        {% block box_body %}
            <canvas id=\"donutChart\" style=\"height:70vh\"></canvas>
        {% endblock %}
    {% endembed %}
    {% endif %}

{% endblock %}

{% block javascripts %}
<script>
        let \$type = \$('#ministry_sel_type');

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

            let data = {};
            data[\$type.attr('name')] = \$type.val();

            \$.ajax({
                url: \$form.attr('action'),
                type: \$form.attr('method'),
                data: data,
                success: function(html) {
                    \$('#ministry_sel_entite').replaceWith(
                        \$(html).find('#ministry_sel_entite')
                    );
                }
            });
        });
    </script>
  {% if type %}
    <script>
        \$(function () {

            var donutChartCanvas = \$('#donutChart').get(0).getContext('2d')
            var donutData        = {
                labels: {% if donutChart %}{{ donutChart['labels']|json_encode()|raw }}{% else %} []{% endif %},
                datasets: [
                    {
                        data: {% if donutChart %}{{ donutChart['percents']|json_encode()|raw }}{% else %} []{% endif %},
                        backgroundColor: {% if donutChart %}{{ donutChart['bgColor']|json_encode()|raw }}{% else %} []{% endif %},
                    }
                ]
            }
            var donutOptions     = {
                maintainAspectRatio: false,
                responsive: true,
                plugins: {
                    datalabels: {
                        backgroundColor: {% if donutChart %}{{ donutChart['bgColor']|json_encode()|raw }}{% else %} []{% endif %},
\t\t\t\t\t\tborderColor: 'white',
\t\t\t\t\t\tborderRadius: 25,
\t\t\t\t\t\tborderWidth: 2,
                        color: 'white',
                        font: {
                            weight: 'bold',
                            size: 12,
                        },
                        align: 'center',
                        anchor: 'end',
                    }
                }
            }

            var donutChart = new Chart(donutChartCanvas, {
                type: 'doughnut',
                data: donutData,
                options: donutOptions      
            })
              
        })
    </script>
{% endif %}

    <script src=\"{{ asset('plugins/chart.js/Chart.min.js') }}\"></script>
    <script src=\"{{ asset('plugins/chartjs-plugin-datalabels/chartjs-plugin-datalabels.min.js') }}\"></script>
    
{% endblock %}", "graph/graph_cost.html.twig", "/var/www/vhosts/sigodd.gouv.bj/httpdocs/templates/graph/graph_cost.html.twig");
    }
}
