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

/* __string_template__e250e4b37cb5494b10d2b11c31b44ef82874aa80071810341ffb9e28d8e8a911 */
class __TwigTemplate_b38eea7c6c2dd7a3b5b8d161406f3b4c8ff7cb38ee8315dbbe9aa18890622623 extends Template
{
    private $source;
    private $macros = [];

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

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

        $this->parent = false;

        $this->blocks = [
        ];
        $this->sandbox = $this->env->getExtension('\Twig\Extension\SandboxExtension');
        $this->checkSecurity();
    }

    protected function doDisplay(array $context, array $blocks = [])
    {
        $macros = $this->macros;
        // line 1
        echo "<input type='hidden' name='answeroptions_sortorder' value='' />
<input type='hidden' id='answeroptions_deletedqids' name='answeroptions_deletedqids' value='' />

";
        // line 4
        $context["first"] = true;
        // line 5
        $context["scale_id"] = 0;
        // line 6
        echo "
<!-- Loop all language, and then hide all but the current selected one with JS. -->
";
        // line 8
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["allLanguages"] ?? 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["lang"]) {
            // line 9
            echo "    <div class=\"lang-hide lang-";
            echo $this->sandbox->ensureToStringAllowed($context["lang"], 9, $this->source);
            echo " ";
            echo ((($context["first"] ?? null)) ? ("base-lang") : ("extra-lang"));
            echo "\">
        ";
            // line 10
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(range(0, (($context["scalecount"] ?? null) - 1)));
            $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["scale_id"]) {
                // line 11
                echo "
            ";
                // line 12
                $context["position"] = 1;
                // line 13
                echo "            ";
                if ((1 === twig_compare(($context["scalecount"] ?? null), 1))) {
                    // line 14
                    echo "                <div class='header ui-widget-header' style='margin-top:5px;'>
                    <i>";
                    // line 15
                    echo sprintf(gT("Answer scale %s"), ($context["scale_id"] + 1));
                    echo "</i>
                </div>
            ";
                }
                // line 18
                echo "
            <!-- Answer options table -->
            <div class=\"answeroptions-table-wrapper\" style=\"max-height: 394px;\">
                <table
                    class='answertable answeroptions-table table table-responsive'
                    id='answeroptions_";
                // line 23
                echo $this->sandbox->ensureToStringAllowed($context["lang"], 23, $this->source);
                echo "_";
                echo $this->sandbox->ensureToStringAllowed($context["scale_id"], 23, $this->source);
                echo "'
                    data-scaleid='";
                // line 24
                echo $this->sandbox->ensureToStringAllowed($context["scale_id"], 24, $this->source);
                echo "'
                    data-input-data-id='add-answer-option-input-javascript-datas'
                >

                    <!-- Headers -->
                    <thead>
                        <tr>
                            <th></th>
                            <th class='col-lg-1'>";
                // line 32
                echo gT("Code");
                echo "
                            <i
                class=\"ri-information-fill\"
                data-bs-toggle=\"tooltip\"
                title=\"";
                // line 36
                echo gT("A mandatory unique alpha-numeric code for each answer option (1-5 characters)");
                echo "\"
            > </i>                            </th>

                            ";
                // line 39
                if (($context["assessmentvisible"] ?? null)) {
                    // line 40
                    echo "                                <th class='col-lg-1'>
                                    ";
                    // line 41
                    echo gT("Assessment value");
                    echo " <i
                class=\"ri-information-fill\"
                data-bs-toggle=\"tooltip\"
                title=\"";
                    // line 44
                    echo gT("A positive or negative integer number as assement value if this option is selected");
                    echo "\"
            > </i>     
                                </th>
                            ";
                } else {
                    // line 48
                    echo "                                <th style='display:none;'>
                                    &nbsp;
                                </th>
                            ";
                }
                // line 52
                echo "
                            <th class='col-lg-8'>
                                ";
                // line 54
                echo gT("Answer options");
                echo "
                                <i class=\"ri-earth-fill\" data-bs-toggle=\"tooltip\" title=\"";
                // line 55
                echo gT("This setting is localized");
                echo "\"></i>
                            </th>

                            <th class='col-lg-1'>
                                ";
                // line 59
                if (($context["first"] ?? null)) {
                    // line 60
                    echo "                                    ";
                    echo gT("Actions");
                    echo "
                                ";
                }
                // line 62
                echo "                            </th>
                        </tr>
                    </thead>

                    <!-- Body -->
                    <tbody>
                        ";
                // line 68
                $context['_parent'] = $context;
                $context['_seq'] = twig_ensure_traversable((($__internal_compile_0 = ($context["answers"] ?? null)) && is_array($__internal_compile_0) || $__internal_compile_0 instanceof ArrayAccess ? ($__internal_compile_0[$context["scale_id"]] ?? null) : 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["answerOption"]) {
                    // line 69
                    echo "                            <!-- Line tag -->
                            ";
                    // line 70
                    $this->loadTemplate("answerOptionRow.twig", "__string_template__e250e4b37cb5494b10d2b11c31b44ef82874aa80071810341ffb9e28d8e8a911", 70)->display(twig_array_merge($context, ["activated" =>                     // line 71
($context["activated"] ?? null), "position" =>                     // line 72
($context["position"] ?? null), "first" =>                     // line 73
($context["first"] ?? null), "assessmentvisible" =>                     // line 74
($context["assessmentvisible"] ?? null), "scale_id" =>                     // line 75
$context["scale_id"], "question" =>                     // line 76
($context["question"] ?? null), "answerOption" =>                     // line 77
$context["answerOption"], "answerOptionl10n" => (($__internal_compile_1 = twig_get_attribute($this->env, $this->source,                     // line 78
$context["answerOption"], "answerl10ns", [], "any", false, false, true, 78)) && is_array($__internal_compile_1) || $__internal_compile_1 instanceof ArrayAccess ? ($__internal_compile_1[$context["lang"]] ?? null) : null), "oldCode" => true, "language" =>                     // line 80
$context["lang"]]));
                    // line 82
                    echo "
                            ";
                    // line 83
                    $context["position"] = (($context["position"] ?? null) + 1);
                    // line 84
                    echo "                        ";
                    ++$context['loop']['index0'];
                    ++$context['loop']['index'];
                    $context['loop']['first'] = false;
                    if (isset($context['loop']['length'])) {
                        --$context['loop']['revindex0'];
                        --$context['loop']['revindex'];
                        $context['loop']['last'] = 0 === $context['loop']['revindex0'];
                    }
                }
                $_parent = $context['_parent'];
                unset($context['_seq'], $context['_iterated'], $context['_key'], $context['answerOption'], $context['_parent'], $context['loop']);
                $context = array_intersect_key($context, $_parent) + $_parent;
                // line 85
                echo "                    </tbody>
                </table>
            </div>

            <div class=\"action-buttons\" style=\"padding-bottom: 10px;\">
                ";
                // line 90
                if (($context["first"] ?? null)) {
                    // line 91
                    echo "                    <!-- TODO: Not used??? -->
                    <input type='hidden' id='answercount_";
                    // line 92
                    echo $this->sandbox->ensureToStringAllowed($context["scale_id"], 92, $this->source);
                    echo "' name='answercount_";
                    echo $this->sandbox->ensureToStringAllowed($context["scale_id"], 92, $this->source);
                    echo "' value='";
                    echo $this->sandbox->ensureToStringAllowed(($context["anscount"] ?? null), 92, $this->source);
                    echo "' />
                    ";
                    // line 93
                    $context["disabled"] = "";
                    // line 94
                    echo "                ";
                }
                // line 95
                echo "
                <button
                    ";
                // line 97
                echo $this->sandbox->ensureToStringAllowed(($context["disabled"] ?? null), 97, $this->source);
                echo "
                    data-scale-id=\"";
                // line 98
                echo $this->sandbox->ensureToStringAllowed($context["scale_id"], 98, $this->source);
                echo "\"
                    class='btnlsbrowser btn btn-outline-secondary'
                    type='button'
                    onclick=\"LS.questionEditor.showLabelSetPicker(event, 'answeroptions');\"
                >
                    ";
                // line 103
                echo gT("Load label set");
                echo "
                </button>

                ";
                // line 106
                if (($context["hasLabelSetPermission"] ?? null)) {
                    // line 107
                    echo "                    <button
                        class='bthsaveaslabel btn btn-outline-secondary'
                        id='bthsaveaslabel_";
                    // line 109
                    echo $this->sandbox->ensureToStringAllowed($context["scale_id"], 109, $this->source);
                    echo "'
                        type='button'
                        onclick=\"LS.questionEditor.showLabelSetSaver(event, 'answeroptions-table');\"
                        data-bs-target=\"#saveaslabelModal\"
                    >
                        ";
                    // line 114
                    echo gT("Save label set");
                    echo "
                    </button>
                ";
                }
                // line 117
                echo "
                <button ";
                // line 118
                echo $this->sandbox->ensureToStringAllowed(($context["disabled"] ?? null), 118, $this->source);
                echo "  id='btnquickadd_";
                echo $this->sandbox->ensureToStringAllowed($context["lang"], 118, $this->source);
                echo "_";
                echo $this->sandbox->ensureToStringAllowed($context["scale_id"], 118, $this->source);
                echo "' data-scale-id=\"";
                echo $this->sandbox->ensureToStringAllowed($context["scale_id"], 118, $this->source);
                echo "\" class='btn btn-outline-secondary btnquickadd float-end' type='button'  data-bs-toggle=\"modal\" data-bs-target=\"#quickaddModal\" data-scale-id=\"";
                echo $this->sandbox->ensureToStringAllowed($context["scale_id"], 118, $this->source);
                echo "\">
                    ";
                // line 119
                echo gT("Quick add");
                echo "
                </button>
            </div>
            ";
                // line 122
                $context["position"] = sprintf("%05d", $this->sandbox->ensureToStringAllowed(($context["position"] ?? null), 122, $this->source));
                // line 123
                echo "        ";
                ++$context['loop']['index0'];
                ++$context['loop']['index'];
                $context['loop']['first'] = false;
                if (isset($context['loop']['length'])) {
                    --$context['loop']['revindex0'];
                    --$context['loop']['revindex'];
                    $context['loop']['last'] = 0 === $context['loop']['revindex0'];
                }
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['scale_id'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 124
            echo "    </div>
    ";
            // line 125
            $context["first"] = false;
            ++$context['loop']['index0'];
            ++$context['loop']['index'];
            $context['loop']['first'] = false;
            if (isset($context['loop']['length'])) {
                --$context['loop']['revindex0'];
                --$context['loop']['revindex'];
                $context['loop']['last'] = 0 === $context['loop']['revindex0'];
            }
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['lang'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 127
        echo "
<!--   Modals   -->
";
        // line 129
        if ((0 === twig_compare(($context["first"] ?? null), false))) {
            echo " ";
            // line 130
            echo "    ";
            $this->loadTemplate("modals.twig", "__string_template__e250e4b37cb5494b10d2b11c31b44ef82874aa80071810341ffb9e28d8e8a911", 130)->display($context);
        }
        // line 132
        echo "
<!-- For javascript -->
<input
    type=\"hidden\"
    id=\"add-answer-option-input-javascript-datas\"
    data-url=\"";
        // line 137
        echo LS_Twig_Extension::createUrl("/questionAdministration/getAnswerOptionRowForAllLanguages/");
        echo "\"
    data-quickurl=\"";
        // line 138
        echo LS_Twig_Extension::createUrl("/questionAdministration/getAnswerOptionRowQuickAdd", ["surveyid" => twig_get_attribute($this->env, $this->source,         // line 141
($context["question"] ?? null), "sid", [], "any", false, false, true, 141), "gid" => twig_get_attribute($this->env, $this->source,         // line 142
($context["question"] ?? null), "gid", [], "any", false, false, true, 142)]);
        // line 144
        echo "\"
    data-assessmentvisible=\"";
        // line 145
        if ((0 === twig_compare(($context["assessmentvisible"] ?? null), true))) {
            echo "1";
        } else {
            echo "0";
        }
        echo "\"
    data-errormessage=\"An error occured while processing the ajax request.\"
    data-languages='";
        // line 147
        echo CJSON::encode($this->sandbox->ensureToStringAllowed(($context["allLanguages"] ?? null), 147, $this->source));
        echo "'
    data-surveyid=\"";
        // line 148
        echo $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, ($context["question"] ?? null), "sid", [], "any", false, false, true, 148), 148, $this->source);
        echo "\"
    data-gid=\"";
        // line 149
        echo $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, ($context["question"] ?? null), "gid", [], "any", false, false, true, 149), 149, $this->source);
        echo "\"
    data-qid=\"";
        // line 150
        echo $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, ($context["question"] ?? null), "qid", [], "any", false, false, true, 150), 150, $this->source);
        echo "\"
    data-scale-id=\"";
        // line 151
        echo $this->sandbox->ensureToStringAllowed(($context["scale_id"] ?? null), 151, $this->source);
        echo "\" ";
        // line 152
        echo "/>
";
    }

    /**
     * @codeCoverageIgnore
     */
    public function getTemplateName()
    {
        return "__string_template__e250e4b37cb5494b10d2b11c31b44ef82874aa80071810341ffb9e28d8e8a911";
    }

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo()
    {
        return array (  430 => 152,  427 => 151,  423 => 150,  419 => 149,  415 => 148,  411 => 147,  402 => 145,  399 => 144,  397 => 142,  396 => 141,  395 => 138,  391 => 137,  384 => 132,  380 => 130,  377 => 129,  373 => 127,  359 => 125,  356 => 124,  342 => 123,  340 => 122,  334 => 119,  322 => 118,  319 => 117,  313 => 114,  305 => 109,  301 => 107,  299 => 106,  293 => 103,  285 => 98,  281 => 97,  277 => 95,  274 => 94,  272 => 93,  264 => 92,  261 => 91,  259 => 90,  252 => 85,  238 => 84,  236 => 83,  233 => 82,  231 => 80,  230 => 78,  229 => 77,  228 => 76,  227 => 75,  226 => 74,  225 => 73,  224 => 72,  223 => 71,  222 => 70,  219 => 69,  202 => 68,  194 => 62,  188 => 60,  186 => 59,  179 => 55,  175 => 54,  171 => 52,  165 => 48,  158 => 44,  152 => 41,  149 => 40,  147 => 39,  141 => 36,  134 => 32,  123 => 24,  117 => 23,  110 => 18,  104 => 15,  101 => 14,  98 => 13,  96 => 12,  93 => 11,  76 => 10,  69 => 9,  52 => 8,  48 => 6,  46 => 5,  44 => 4,  39 => 1,);
    }

    public function getSourceContext()
    {
        return new Source("", "__string_template__e250e4b37cb5494b10d2b11c31b44ef82874aa80071810341ffb9e28d8e8a911", "");
    }
    
    public function checkSecurity()
    {
        static $tags = array("set" => 4, "for" => 8, "if" => 13, "include" => 70);
        static $filters = array("gT" => 55);
        static $functions = array("range" => 10, "sprintf" => 15, "gT" => 15, "createUrl" => 137, "json_encode" => 147);

        try {
            $this->sandbox->checkSecurity(
                ['set', 'for', 'if', 'include'],
                ['gT'],
                ['range', 'sprintf', 'gT', 'createUrl', 'json_encode']
            );
        } catch (SecurityError $e) {
            $e->setSourceContext($this->source);

            if ($e instanceof SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
                $e->setTemplateLine($tags[$e->getTagName()]);
            } elseif ($e instanceof SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
                $e->setTemplateLine($filters[$e->getFilterName()]);
            } elseif ($e instanceof SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
                $e->setTemplateLine($functions[$e->getFunctionName()]);
            }

            throw $e;
        }

    }
}
