<?php

use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
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;

/* user/permissions.html.twig */
class __TwigTemplate_bd6f990d1fbecd56a5c201548ed9fa0bb7a84698b06ecbf475826615d2787b9b extends Template
{
    private $source;
    private $macros = [];

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

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

        $this->blocks = [
            'page_title' => [$this, 'block_page_title'],
            'page_actions' => [$this, 'block_page_actions'],
            'main' => [$this, 'block_main'],
            'javascripts' => [$this, 'block_javascripts'],
        ];
    }

    protected function doGetParent(array $context)
    {
        // line 1
        return "base.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = [])
    {
        $macros = $this->macros;
        // line 2
        $macros["tables"] = $this->macros["tables"] = $this->loadTemplate("macros/datatables.html.twig", "user/permissions.html.twig", 2)->unwrap();
        // line 3
        $macros["widgets"] = $this->macros["widgets"] = $this->loadTemplate("macros/widgets.html.twig", "user/permissions.html.twig", 3)->unwrap();
        // line 4
        $macros["toolbar"] = $this->macros["toolbar"] = $this->loadTemplate("macros/toolbar.html.twig", "user/permissions.html.twig", 4)->unwrap();
        // line 5
        $macros["actions"] = $this->macros["actions"] = $this->loadTemplate("user/actions.html.twig", "user/permissions.html.twig", 5)->unwrap();
        // line 7
        $context["columns"] = ["label.name" => "alwaysVisible"];
        // line 10
        $context["canEditPermissions"] = $this->extensions['Symfony\Bridge\Twig\Extension\SecurityExtension']->isGranted("role_permissions");
        // line 11
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["roles"] ?? null));
        foreach ($context['_seq'] as $context["_key"] => $context["role"]) {
            // line 12
            $context["options"] = ["class" => "alwaysVisible text-center"];
            // line 13
            if ((($context["canEditPermissions"] ?? null) && !twig_in_filter(twig_get_attribute($this->env, $this->source, $context["role"], "name", [], "any", false, false, false, 13), twig_get_array_keys_filter(($context["system_roles"] ?? null))))) {
                // line 14
                ob_start(function () { return ''; });
                // line 15
                echo "        &nbsp;<a href=\"";
                echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("admin_user_role_delete", ["id" => twig_get_attribute($this->env, $this->source, $context["role"], "id", [], "any", false, false, false, 15)]), "html", null, true);
                echo "\" class=\"confirmation-link\" data-question=\"confirm.delete\">";
                echo twig_call_macro($macros["widgets"], "macro_icon", ["trash"], 15, $context, $this->getSourceContext());
                echo "</a>
        ";
                $context["widget"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset());
                // line 17
                $context["options"] = twig_array_merge(($context["options"] ?? null), ["html_after" => ($context["widget"] ?? null)]);
            }
            // line 19
            $context["columns"] = twig_array_merge(($context["columns"] ?? null), [$this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans(twig_get_attribute($this->env, $this->source,             // line 20
$context["role"], "name", [], "any", false, false, false, 20)) => ($context["options"] ?? null)]);
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['role'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 24
        $context["tableName"] = "user_admin_permissions";
        // line 1
        $this->parent = $this->loadTemplate("base.html.twig", "user/permissions.html.twig", 1);
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 26
    public function block_page_title($context, array $blocks = [])
    {
        $macros = $this->macros;
        echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("user_permissions.title"), "html", null, true);
    }

    // line 27
    public function block_page_actions($context, array $blocks = [])
    {
        $macros = $this->macros;
        echo twig_call_macro($macros["actions"], "macro_user_permissions", ["index"], 27, $context, $this->getSourceContext());
    }

    // line 29
    public function block_main($context, array $blocks = [])
    {
        $macros = $this->macros;
        // line 30
        echo "    ";
        echo twig_call_macro($macros["tables"], "macro_datatable_header", [($context["tableName"] ?? null), ($context["columns"] ?? null), null, ["translationPrefix" => ""]], 30, $context, $this->getSourceContext());
        echo "
    
    ";
        // line 32
        $context["colspan"] = (1 + twig_length_filter($this->env, ($context["roles"] ?? null)));
        // line 33
        echo "
    ";
        // line 34
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["sorted"] ?? null));
        foreach ($context['_seq'] as $context["title"] => $context["perms"]) {
            // line 35
            echo "        ";
            if (1 === twig_compare(twig_length_filter($this->env, $context["perms"]), 0)) {
                // line 36
                echo "            <tr class=\"summary info\">
                <td colspan=\"";
                // line 37
                echo twig_escape_filter($this->env, ($context["colspan"] ?? null), "html", null, true);
                echo "\">";
                echo twig_escape_filter($this->env, $context["title"], "html", null, true);
                echo "</td>
            </tr>
            ";
                // line 39
                $context['_parent'] = $context;
                $context['_seq'] = twig_ensure_traversable(twig_sort_filter($context["perms"]));
                foreach ($context['_seq'] as $context["_key"] => $context["permission"]) {
                    // line 40
                    echo "                <tr>
                    <td>";
                    // line 41
                    echo twig_escape_filter($this->env, $context["permission"], "html", null, true);
                    echo "</td>
                    ";
                    // line 42
                    $context['_parent'] = $context;
                    $context['_seq'] = twig_ensure_traversable(($context["roles"] ?? null));
                    foreach ($context['_seq'] as $context["_key"] => $context["role"]) {
                        // line 43
                        echo "                        ";
                        $context["value"] = twig_get_attribute($this->env, $this->source, ($context["manager"] ?? null), "permission", [0 => twig_get_attribute($this->env, $this->source, $context["role"], "name", [], "any", false, false, false, 43), 1 => $context["permission"]], "method", false, false, false, 43);
                        // line 44
                        echo "                        <td class=\"text-center\">
                            ";
                        // line 46
                        echo "                            ";
                        if ((0 === twig_compare(twig_get_attribute($this->env, $this->source, $context["role"], "name", [], "any", false, false, false, 46), "ROLE_SUPER_ADMIN") && twig_in_filter($context["permission"], ($context["always_apply_superadmin"] ?? null)))) {
                            // line 47
                            echo "                                ";
                            if (($context["value"] ?? null)) {
                                // line 48
                                echo "                                    ";
                                echo twig_call_macro($macros["widgets"], "macro_label", [$this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("yes"), "warning"], 48, $context, $this->getSourceContext());
                                echo "
                                ";
                            } else {
                                // line 50
                                echo "                                    <a href=\"";
                                echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("admin_user_permission_save", ["id" => twig_get_attribute($this->env, $this->source, $context["role"], "id", [], "any", false, false, false, 50), "name" => $context["permission"], "value" => "1"]), "html", null, true);
                                echo "\">";
                                echo twig_call_macro($macros["widgets"], "macro_label", [$this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("no"), "danger"], 50, $context, $this->getSourceContext());
                                echo "</a>
                                ";
                            }
                            // line 52
                            echo "                            ";
                        } else {
                            // line 53
                            echo "                                <a href=\"";
                            echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("admin_user_permission_save", ["id" => twig_get_attribute($this->env, $this->source, $context["role"], "id", [], "any", false, false, false, 53), "name" => $context["permission"], "value" => ((($context["value"] ?? null)) ? ("0") : ("1"))]), "html", null, true);
                            echo "\">";
                            echo twig_call_macro($macros["widgets"], "macro_label_boolean", [($context["value"] ?? null)], 53, $context, $this->getSourceContext());
                            echo "</a>
                            ";
                        }
                        // line 55
                        echo "                        </td>
                    ";
                    }
                    $_parent = $context['_parent'];
                    unset($context['_seq'], $context['_iterated'], $context['_key'], $context['role'], $context['_parent'], $context['loop']);
                    $context = array_intersect_key($context, $_parent) + $_parent;
                    // line 57
                    echo "                </tr>
            ";
                }
                $_parent = $context['_parent'];
                unset($context['_seq'], $context['_iterated'], $context['_key'], $context['permission'], $context['_parent'], $context['loop']);
                $context = array_intersect_key($context, $_parent) + $_parent;
                // line 59
                echo "        ";
            }
            // line 60
            echo "    ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['title'], $context['perms'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 61
        echo "
    ";
        // line 62
        echo twig_call_macro($macros["tables"], "macro_data_table_footer", [], 62, $context, $this->getSourceContext());
        echo "

";
    }

    // line 66
    public function block_javascripts($context, array $blocks = [])
    {
        $macros = $this->macros;
        // line 67
        echo "    ";
        $this->displayParentBlock("javascripts", $context, $blocks);
        echo "
    <script type=\"text/javascript\">
        document.addEventListener('kimai.initialized', function() {
            KimaiReloadPageWidget.create('kimai.userRoleUpdate');
        });
    </script>
";
    }

    public function getTemplateName()
    {
        return "user/permissions.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  227 => 67,  223 => 66,  216 => 62,  213 => 61,  207 => 60,  204 => 59,  197 => 57,  190 => 55,  182 => 53,  179 => 52,  171 => 50,  165 => 48,  162 => 47,  159 => 46,  156 => 44,  153 => 43,  149 => 42,  145 => 41,  142 => 40,  138 => 39,  131 => 37,  128 => 36,  125 => 35,  121 => 34,  118 => 33,  116 => 32,  110 => 30,  106 => 29,  99 => 27,  92 => 26,  87 => 1,  85 => 24,  79 => 20,  78 => 19,  75 => 17,  67 => 15,  65 => 14,  63 => 13,  61 => 12,  57 => 11,  55 => 10,  53 => 7,  51 => 5,  49 => 4,  47 => 3,  45 => 2,  38 => 1,);
    }

    public function getSourceContext()
    {
        return new Source("", "user/permissions.html.twig", "/var/www/html/kimai2/templates/user/permissions.html.twig");
    }
}
