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

/* pages/admin/form/form_destination.html.twig */
class __TwigTemplate_e68874f3e171afe37a66f397a51b99ab 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->parent = false;

        $this->blocks = [
        ];
    }

    protected function doDisplay(array $context, array $blocks = []): iterable
    {
        $macros = $this->macros;
        // line 32
        yield "
";
        // line 39
        yield "
<div class=\"py-2 px-3\">
    <h2 class=\"d-flex\">
        <i class=\"";
        // line 42
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["icon"] ?? null), "html", null, true);
        yield " me-2\"></i>
        ";
        // line 43
        yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(_n("Destination", "Destinations", Session::getPluralNumber()), "html", null, true);
        yield "
    </h2>

    ";
        // line 46
        $context['_parent'] = $context;
        $context['_seq'] = CoreExtension::ensureTraversable(($context["warnings"] ?? null));
        foreach ($context['_seq'] as $context["_key"] => $context["warning"]) {
            // line 47
            yield "        <div class=\"alert alert-warning d-flex align-items-center mb-3\" role=\"alert\">
            <i class=\"ti ti-alert-triangle me-2\"></i>
            ";
            // line 49
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["warning"], "html", null, true);
            yield "
        </div>
    ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_key'], $context['warning'], $context['_parent']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 52
        yield "
    <div class=\"d-flex\">
        ";
        // line 55
        yield "        ";
        $context['_parent'] = $context;
        $context['_seq'] = CoreExtension::ensureTraversable(($context["available_destinations_types"] ?? null));
        foreach ($context['_seq'] as $context["type"] => $context["label"]) {
            // line 56
            yield "            <form
                id=\"add_destination_";
            // line 57
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["type"], "html", null, true);
            yield "\"
                method=\"POST\"
                action=\"";
            // line 59
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Glpi\Application\View\Extension\RoutingExtension']->path(Twig\Extension\CoreExtension::sprintf("/Form/%d/Destination/Add", CoreExtension::getAttribute($this->env, $this->source, ($context["form"] ?? null), "getID", [], "method", false, false, false, 59))), "html", null, true);
            yield "\"
            >
                <input type=\"hidden\" name=\"name\" value=\"";
            // line 61
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["label"], "html", null, true);
            yield "\"/>
                <input type=\"hidden\" name=\"_glpi_csrf_token\" value=\"";
            // line 62
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(Session::getNewCSRFToken(), "html", null, true);
            yield "\"/>
                <input type=\"hidden\" name=\"add\" value=\"\"/>
            </form>
        ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['type'], $context['label'], $context['_parent']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 66
        yield "
        <div class=\"btn-group me-2\">
            ";
        // line 68
        $context['_parent'] = $context;
        $context['_seq'] = CoreExtension::ensureTraversable(($context["available_destinations_types"] ?? null));
        foreach ($context['_seq'] as $context["type"] => $context["label"]) {
            // line 69
            yield "                <button
                    form=\"add_destination_";
            // line 70
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["type"], "html", null, true);
            yield "\"
                    class=\"btn\"
                    name=\"itemtype\"
                    type=\"submit\"
                    value=\"";
            // line 74
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["type"], "html", null, true);
            yield "\"
                >
                    <i class=\"ti ti-plus me-1\"></i> ";
            // line 76
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(Twig\Extension\CoreExtension::sprintf(__("Add %s"), $context["label"]), "html", null, true);
            yield "
                </button>
            ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['type'], $context['label'], $context['_parent']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 79
        yield "        </div>
    </div>

    ";
        // line 82
        if ((Twig\Extension\CoreExtension::length($this->env->getCharset(), ($context["destinations"] ?? null)) == 0)) {
            // line 83
            yield "        <p class=\"empty-subtitle text-muted mt-3 ms-1\">
            ";
            // line 84
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(__("No items will be created for this form."), "html", null, true);
            yield "
        </p>
    ";
        } else {
            // line 87
            yield "        <section class=\"accordion mt-4\" id=\"glpi-destinations-accordion\" aria-label=\"";
            yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(__("Form destinations"), "html", null, true);
            yield "\">
            ";
            // line 88
            $context['_parent'] = $context;
            $context['_seq'] = CoreExtension::ensureTraversable(($context["destinations"] ?? null));
            $context['loop'] = [
              'parent' => $context['_parent'],
              'index0' => 0,
              'index'  => 1,
              'first'  => true,
            ];
            if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) {
                $length = count($context['_seq']);
                $context['loop']['revindex0'] = $length - 1;
                $context['loop']['revindex'] = $length;
                $context['loop']['length'] = $length;
                $context['loop']['last'] = 1 === $length;
            }
            foreach ($context['_seq'] as $context["_key"] => $context["destination"]) {
                // line 89
                yield "                ";
                $context["is_expanded"] = ((($context["active_destination"] ?? null) == CoreExtension::getAttribute($this->env, $this->source, $context["destination"], "getID", [], "method", false, false, false, 89)) || (Twig\Extension\CoreExtension::length($this->env->getCharset(), ($context["destinations"] ?? null)) == 1));
                // line 90
                yield "                ";
                $context["concrete_destination"] = CoreExtension::getAttribute($this->env, $this->source, $context["destination"], "getConcreteDestinationItem", [], "method", false, false, false, 90);
                // line 91
                yield "                ";
                $context["rand"] = Twig\Extension\CoreExtension::random($this->env->getCharset());
                // line 92
                yield "                <section
                    class=\"accordion-item\"
                    aria-label=\"";
                // line 94
                yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["destination"], "getName", [], "method", false, false, false, 94), "html", null, true);
                yield "\"
                >
                    <div class=\"accordion-header\">
                        <div
                            class=\"accordion-button ";
                // line 98
                yield (((($tmp = ($context["is_expanded"] ?? null)) && $tmp instanceof Markup ? (string) $tmp : $tmp)) ? ("") : ("collapsed"));
                yield "\"
                            role=\"button\"
                            tabindex=\"0\"
                            data-bs-toggle=\"collapse\"
                            data-bs-target=\"#glpi-destinations-accordion-collapse-";
                // line 102
                yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["rand"] ?? null), "html", null, true);
                yield "-";
                yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["loop"], "index", [], "any", false, false, false, 102), "html", null, true);
                yield "\"
                            aria-expanded=\"";
                // line 103
                yield (((($tmp = ($context["is_expanded"] ?? null)) && $tmp instanceof Markup ? (string) $tmp : $tmp)) ? ("true") : ("false"));
                yield "\"
                            data-glpi-destination-click-on-space ";
                // line 105
                yield "                        >
                            <i class=\"";
                // line 106
                yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, ($context["concrete_destination"] ?? null), "getIcon", [], "method", false, false, false, 106), "html", null, true);
                yield "\"></i>
                            <span
                                class=\"m-0 lh-base fw-normal glpi-form-destination-name\"
                            >
                                ";
                // line 110
                yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["destination"], "getName", [], "method", false, false, false, 110), "html", null, true);
                yield "
                            </span>
                            <div data-glpi-editor-destination-badges-container>
                                ";
                // line 113
                $context["selected_strategy"] = CoreExtension::getAttribute($this->env, $this->source, $context["destination"], "getConfiguredCreationStrategy", [], "method", false, false, false, 113);
                // line 114
                yield "                                ";
                $context['_parent'] = $context;
                $context['_seq'] = CoreExtension::ensureTraversable(Glpi\Form\Condition\CreationStrategy::cases());
                foreach ($context['_seq'] as $context["_key"] => $context["strategy"]) {
                    // line 115
                    yield "                                    ";
                    $context["is_visible"] = (($context["selected_strategy"] ?? null) == $context["strategy"]);
                    // line 116
                    yield "                                    ";
                    $context["display_class"] = (((($tmp = ($context["is_visible"] ?? null)) && $tmp instanceof Markup ? (string) $tmp : $tmp)) ? ("d-flex") : ("d-none"));
                    // line 117
                    yield "                                    <span
                                        class=\"";
                    // line 118
                    yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["display_class"] ?? null), "html", null, true);
                    yield " badge bg-secondary-lt d-flex align-items-center ms-2\"
                                        data-glpi-editor-condition-badge=\"";
                    // line 119
                    yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["strategy"], "value", [], "any", false, false, false, 119), "html", null, true);
                    yield "\"
                                    >
                                        <i class=\"";
                    // line 121
                    yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["strategy"], "getIcon", [], "method", false, false, false, 121), "html", null, true);
                    yield " me-1\"></i>
                                        <span>";
                    // line 122
                    yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["strategy"], "getLabel", [], "method", false, false, false, 122), "html", null, true);
                    yield "</span>
                                    </span>
                                ";
                }
                $_parent = $context['_parent'];
                unset($context['_seq'], $context['_key'], $context['strategy'], $context['_parent']);
                $context = array_intersect_key($context, $_parent) + $_parent;
                // line 125
                yield "                            </div>
                            <input
                                aria-label=\"";
                // line 127
                yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(__("Form destination name"), "html", null, true);
                yield "\"
                                type=\"text\"
                                name=\"name\"
                                form=\"form-destination-";
                // line 130
                yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["destination"], "getID", [], "method", false, false, false, 130), "html", null, true);
                yield "\"
                                value=\"";
                // line 131
                yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["destination"], "getName", [], "method", false, false, false, 131), "html", null, true);
                yield "\"
                                class=\"form-control me-4 fw-normal glpi-form-destination-name\"
                                style=\"font-weight: inherit;\"
                                ";
                // line 135
                yield "                                data-bs-toggle=\"collapse\"
                                data-bs-target=\"\"
                            />
                        </div>
                    </div>
                    <div
                        id=\"glpi-destinations-accordion-collapse-";
                // line 141
                yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["rand"] ?? null), "html", null, true);
                yield "-";
                yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["loop"], "index", [], "any", false, false, false, 141), "html", null, true);
                yield "\"
                        class=\"accordion-collapse collapse ";
                // line 142
                yield (((($tmp = ($context["is_expanded"] ?? null)) && $tmp instanceof Markup ? (string) $tmp : $tmp)) ? ("show") : (""));
                yield "\"
                        data-bs-parent=\"#glpi-destinations-accordion\"
                    >
                        <div class=\"accordion-body p-0\">
                            <form id=\"form-destination-";
                // line 146
                yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["destination"], "getID", [], "method", false, false, false, 146), "html", null, true);
                yield "\">
                                <div class=\"overflow-x-hidden px-4\">
                                    ";
                // line 148
                yield CoreExtension::getAttribute($this->env, $this->source, ($context["concrete_destination"] ?? null), "renderConfigForm", [                // line 149
($context["form"] ?? null),                 // line 150
$context["destination"], CoreExtension::getAttribute($this->env, $this->source,                 // line 151
$context["destination"], "getConfig", [], "method", false, false, false, 151)], "method", false, false, false, 148);
                // line 152
                yield "
                                    ";
                // line 153
                if ((CoreExtension::getAttribute($this->env, $this->source, ($context["concrete_destination"] ?? null), "useDefaultConfigLayout", [], "method", false, false, false, 153) && ($context["can_update"] ?? null))) {
                    // line 154
                    yield "                                        <div class=\"mt-3 mb-3\">
                                            ";
                    // line 155
                    yield Twig\Extension\CoreExtension::include($this->env, $context, "pages/admin/form/form_destination_actions.html.twig", ["form" =>                     // line 156
($context["form"] ?? null), "destination" =>                     // line 157
$context["destination"]], false);
                    // line 158
                    yield "
                                        </div>
                                    ";
                }
                // line 161
                yield "                                </div>

                                ";
                // line 164
                yield "                                <input type=\"hidden\" name=\"id\" value=\"";
                yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["destination"], "getID", [], "method", false, false, false, 164), "html", null, true);
                yield "\"/>
                                <input type=\"hidden\" name=\"_glpi_csrf_token\" value=\"";
                // line 165
                yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(Session::getNewCSRFToken(), "html", null, true);
                yield "\"/>
                            </form>
                        </div>
                    </div>
                </section>
            ";
                ++$context['loop']['index0'];
                ++$context['loop']['index'];
                $context['loop']['first'] = false;
                if (isset($context['loop']['revindex0'], $context['loop']['revindex'])) {
                    --$context['loop']['revindex0'];
                    --$context['loop']['revindex'];
                    $context['loop']['last'] = 0 === $context['loop']['revindex0'];
                }
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_key'], $context['destination'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 171
            yield "        </section>
    ";
        }
        // line 173
        yield "</div>

<script>
    import(\"/js/modules/Forms/DestinationAutoConfigController.js\").then((m) => {
        new m.GlpiFormDestinationAutoConfigController();
    });

    import(\"/js/modules/Forms/DestinationConditionController.js\").then((m) => {
        new m.GlpiFormDestinationConditionController();
    });
</script>
";
        yield from [];
    }

    /**
     * @codeCoverageIgnore
     */
    public function getTemplateName(): string
    {
        return "pages/admin/form/form_destination.html.twig";
    }

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo(): array
    {
        return array (  375 => 173,  371 => 171,  351 => 165,  346 => 164,  342 => 161,  337 => 158,  335 => 157,  334 => 156,  333 => 155,  330 => 154,  328 => 153,  325 => 152,  323 => 151,  322 => 150,  321 => 149,  320 => 148,  315 => 146,  308 => 142,  302 => 141,  294 => 135,  288 => 131,  284 => 130,  278 => 127,  274 => 125,  265 => 122,  261 => 121,  256 => 119,  252 => 118,  249 => 117,  246 => 116,  243 => 115,  238 => 114,  236 => 113,  230 => 110,  223 => 106,  220 => 105,  216 => 103,  210 => 102,  203 => 98,  196 => 94,  192 => 92,  189 => 91,  186 => 90,  183 => 89,  166 => 88,  161 => 87,  155 => 84,  152 => 83,  150 => 82,  145 => 79,  136 => 76,  131 => 74,  124 => 70,  121 => 69,  117 => 68,  113 => 66,  103 => 62,  99 => 61,  94 => 59,  89 => 57,  86 => 56,  81 => 55,  77 => 52,  68 => 49,  64 => 47,  60 => 46,  54 => 43,  50 => 42,  45 => 39,  42 => 32,);
    }

    public function getSourceContext(): Source
    {
        return new Source("", "pages/admin/form/form_destination.html.twig", "/home/tisoluci/public_html/crpamplona/templates/pages/admin/form/form_destination.html.twig");
    }
}
