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

/* extension/product_special_prices.twig */
class __TwigTemplate_8eec6fbe7d0f4981804789723116aef7 extends Template
{
    private $source;
    private $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 = [])
    {
        $macros = $this->macros;
        // line 1
        echo "<form action=\"POST\" id=\"popup-form\">
    <div style=\"";
        // line 2
        if ((($context["t"] ?? null) != "discount")) {
            echo "display:none;";
        }
        echo "\">
        <h3>";
        // line 3
        echo ($context["discounts_title"] ?? null);
        echo "</h3>
        <div id=\"tab-discount\">
            <table id=\"discount\" class=\"table list product-extra-table\">
              <thead>
                <tr>
                  <td class=\"left\">";
        // line 8
        echo ($context["entry_customer_group"] ?? null);
        echo "</td>
                  <td class=\"right\">";
        // line 9
        echo ($context["entry_quantity"] ?? null);
        echo "</td>
                  <td class=\"right\">";
        // line 10
        echo ($context["entry_priority"] ?? null);
        echo "</td>
                  <td class=\"right\">";
        // line 11
        echo ($context["entry_price"] ?? null);
        echo "</td>
                  <td class=\"left\">";
        // line 12
        echo ($context["entry_date_start"] ?? null);
        echo "</td>
                  <td class=\"left\">";
        // line 13
        echo ($context["entry_date_end"] ?? null);
        echo "</td>
                  <td></td>
                </tr>
              </thead>
              ";
        // line 17
        $context["discount_row"] = 0;
        // line 18
        echo "              ";
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["product_discounts"] ?? null));
        foreach ($context['_seq'] as $context["_key"] => $context["product_discount"]) {
            // line 19
            echo "                <tbody id=\"discount-row";
            echo ($context["discount_row"] ?? null);
            echo "\">
                  <tr>
                    <td class=\"left\">
                      <select 
                        name=\"product_discount[";
            // line 23
            echo ($context["discount_row"] ?? null);
            echo "][customer_group_id]\"
                      >
                        ";
            // line 25
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(($context["customer_groups"] ?? null));
            foreach ($context['_seq'] as $context["_key"] => $context["customer_group"]) {
                // line 26
                echo "                          ";
                if ((twig_get_attribute($this->env, $this->source, $context["customer_group"], "customer_group_id", [], "any", false, false, false, 26) == twig_get_attribute($this->env, $this->source, $context["product_discount"], "customer_group_id", [], "any", false, false, false, 26))) {
                    // line 27
                    echo "                            <option 
                              value=\"";
                    // line 28
                    echo twig_get_attribute($this->env, $this->source, $context["customer_group"], "customer_group_id", [], "any", false, false, false, 28);
                    echo "\" 
                              selected=\"selected\"
                            >
                              ";
                    // line 31
                    echo twig_get_attribute($this->env, $this->source, $context["customer_group"], "name", [], "any", false, false, false, 31);
                    echo "
                            </option>
                          ";
                } else {
                    // line 34
                    echo "                            <option 
                              value=\"";
                    // line 35
                    echo twig_get_attribute($this->env, $this->source, $context["customer_group"], "customer_group_id", [], "any", false, false, false, 35);
                    echo "\"
                            >
                              ";
                    // line 37
                    echo twig_get_attribute($this->env, $this->source, $context["customer_group"], "name", [], "any", false, false, false, 37);
                    echo "
                            </option>
                          ";
                }
                // line 40
                echo "                        ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['customer_group'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 41
            echo "                      </select>
                    </td>
                    <td class=\"right\">
                      <input 
                        style=\"text-align:right\" 
                        type=\"text\" 
                        name=\"product_discount[";
            // line 47
            echo ($context["discount_row"] ?? null);
            echo "][quantity]\" 
                        value=\"";
            // line 48
            echo twig_get_attribute($this->env, $this->source, $context["product_discount"], "quantity", [], "any", false, false, false, 48);
            echo "\" 
                        size=\"2\" 
                      />
                    </td>
                    <td class=\"right\">
                      <input 
                        style=\"text-align:right\" 
                        type=\"text\" 
                        name=\"product_discount[";
            // line 56
            echo ($context["discount_row"] ?? null);
            echo "][priority]\" 
                        value=\"";
            // line 57
            echo twig_get_attribute($this->env, $this->source, $context["product_discount"], "priority", [], "any", false, false, false, 57);
            echo "\" 
                        size=\"2\" 
                      />
                    </td>
                    <td class=\"right\">
                      <input 
                        style=\"text-align:right\" 
                        type=\"text\" 
                        name=\"product_discount[";
            // line 65
            echo ($context["discount_row"] ?? null);
            echo "][price]\" 
                        class=\"gross-price-field\" 
                        value=\"";
            // line 67
            echo twig_get_attribute($this->env, $this->source, $context["product_discount"], "price", [], "any", false, false, false, 67);
            echo "\" 
                      />
                    </td>
                    <td class=\"left\">
                      <input 
                        style=\"text-align:center\" 
                        type=\"text\" 
                        name=\"product_discount[";
            // line 74
            echo ($context["discount_row"] ?? null);
            echo "][date_start]\" 
                        value=\"";
            // line 75
            if ((twig_get_attribute($this->env, $this->source, $context["product_discount"], "date_start", [], "any", false, false, false, 75) != "0000-00-00")) {
                echo twig_get_attribute($this->env, $this->source, $context["product_discount"], "date_start", [], "any", false, false, false, 75);
            }
            echo "\" 
                        class=\"date datepicker\" 
                        data-format=\"YYYY-MM-DD\" 
                        data-date-format=\"YYYY-MM-DD\"
                      />
                    </td>
                    <td class=\"left\">
                      <input 
                        style=\"text-align:center\" 
                        type=\"text\" 
                        name=\"product_discount[";
            // line 85
            echo ($context["discount_row"] ?? null);
            echo "][date_end]\" 
                        value=\"";
            // line 86
            if ((twig_get_attribute($this->env, $this->source, $context["product_discount"], "date_end", [], "any", false, false, false, 86) != "0000-00-00")) {
                echo twig_get_attribute($this->env, $this->source, $context["product_discount"], "date_end", [], "any", false, false, false, 86);
            }
            echo "\" 
                        class=\"date datepicker\" 
                        data-format=\"YYYY-MM-DD\" 
                        data-date-format=\"YYYY-MM-DD\"
                      />
                    </td>
                    <td class=\"left\">
                      <a 
                        onclick=\"\$('#discount-row";
            // line 94
            echo ($context["discount_row"] ?? null);
            echo "').remove();\" 
                        class=\"btn btn-default button\"
                      >
                        <span>";
            // line 97
            echo ($context["button_remove"] ?? null);
            echo "</span>
                      </a>
                    </td>
                  </tr>
                </tbody>
                ";
            // line 102
            $context["discount_row"] = (($context["discount_row"] ?? null) + 1);
            // line 103
            echo "              ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['product_discount'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 104
        echo "              <tfoot>
                <tr>
                  <td colspan=\"6\"></td>
                  <td class=\"left\">
                    <a 
                      onclick=\"addDiscount();\" 
                      class=\"btn btn-default button\"
                    >
                      <span>";
        // line 112
        echo ($context["ad_button"] ?? null);
        echo "</span>
                    </a>
                  </td>
                </tr>
              </tfoot>
            </table>
        </div>
    </div>
    <div style=\"";
        // line 120
        if ((($context["t"] ?? null) != "special")) {
            echo "display:none;";
        }
        echo "\">
        <h3>";
        // line 121
        echo ($context["special_title"] ?? null);
        echo "</h3>
        <div id=\"tab-special\">
          <table id=\"special\" class=\"table list product-extra-table\">
            <thead>
              <tr>
                <td class=\"left\">";
        // line 126
        echo ($context["entry_customer_group"] ?? null);
        echo "</td>
                <td class=\"right\">";
        // line 127
        echo ($context["entry_priority"] ?? null);
        echo "</td>
                <td class=\"right\">";
        // line 128
        echo ($context["entry_price"] ?? null);
        echo "</td>
                <td class=\"left\">";
        // line 129
        echo ($context["entry_date_start"] ?? null);
        echo "</td>
                <td class=\"left\">";
        // line 130
        echo ($context["entry_date_end"] ?? null);
        echo "</td>
                <td></td>
              </tr>
            </thead>
            ";
        // line 134
        $context["special_row"] = 0;
        // line 135
        echo "            ";
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["product_specials"] ?? null));
        foreach ($context['_seq'] as $context["_key"] => $context["product_special"]) {
            // line 136
            echo "              <tbody id=\"special-row";
            echo ($context["special_row"] ?? null);
            echo "\">
                <tr>
                  <td class=\"left\">
                    <select name=\"product_special[";
            // line 139
            echo ($context["special_row"] ?? null);
            echo "][customer_group_id]\">
                      ";
            // line 140
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(($context["customer_groups"] ?? null));
            foreach ($context['_seq'] as $context["_key"] => $context["customer_group"]) {
                // line 141
                echo "                        ";
                if ((twig_get_attribute($this->env, $this->source, $context["customer_group"], "customer_group_id", [], "any", false, false, false, 141) == twig_get_attribute($this->env, $this->source, $context["product_special"], "customer_group_id", [], "any", false, false, false, 141))) {
                    // line 142
                    echo "                          <option 
                            value=\"";
                    // line 143
                    echo twig_get_attribute($this->env, $this->source, $context["customer_group"], "customer_group_id", [], "any", false, false, false, 143);
                    echo "\" 
                            selected=\"selected\"
                          >
                            ";
                    // line 146
                    echo twig_get_attribute($this->env, $this->source, $context["customer_group"], "name", [], "any", false, false, false, 146);
                    echo "
                          </option>
                        ";
                } else {
                    // line 149
                    echo "                          <option 
                            value=\"";
                    // line 150
                    echo twig_get_attribute($this->env, $this->source, $context["customer_group"], "customer_group_id", [], "any", false, false, false, 150);
                    echo "\"
                          >
                            ";
                    // line 152
                    echo twig_get_attribute($this->env, $this->source, $context["customer_group"], "name", [], "any", false, false, false, 152);
                    echo "
                          </option>
                        ";
                }
                // line 155
                echo "                      ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['customer_group'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 156
            echo "                    </select>
                  </td>
                  <td class=\"right\">
                    <input 
                      style=\"text-align:right\" 
                      type=\"text\" 
                      name=\"product_special[";
            // line 162
            echo ($context["special_row"] ?? null);
            echo "][priority]\" 
                      value=\"";
            // line 163
            echo twig_get_attribute($this->env, $this->source, $context["product_special"], "priority", [], "any", false, false, false, 163);
            echo "\" 
                      size=\"2\" 
                    />
                  </td>
                  <td class=\"right\">
                    <input 
                      style=\"text-align:right\" 
                      type=\"text\" 
                      name=\"product_special[";
            // line 171
            echo ($context["special_row"] ?? null);
            echo "][price]\" 
                      class=\"gross-price-field\" 
                      value=\"";
            // line 173
            echo twig_get_attribute($this->env, $this->source, $context["product_special"], "price", [], "any", false, false, false, 173);
            echo "\" 
                    />
                  </td>
                  <td class=\"left\">
                    <input 
                      style=\"text-align:center\" 
                      type=\"text\" 
                      name=\"product_special[";
            // line 180
            echo ($context["special_row"] ?? null);
            echo "][date_start]\" 
                      value=\"";
            // line 181
            if ((twig_get_attribute($this->env, $this->source, $context["product_special"], "date_start", [], "any", false, false, false, 181) != "0000-00-00")) {
                echo twig_get_attribute($this->env, $this->source, $context["product_special"], "date_start", [], "any", false, false, false, 181);
            }
            echo "\" 
                      class=\"date datepicker\" 
                      data-format=\"YYYY-MM-DD\" 
                      data-date-format=\"YYYY-MM-DD\"
                    />
                  </td>
                  <td class=\"left\">
                    <input 
                      style=\"text-align:center\" 
                      type=\"text\" 
                      name=\"product_special[";
            // line 191
            echo ($context["special_row"] ?? null);
            echo "][date_end]\" 
                      value=\"";
            // line 192
            if ((twig_get_attribute($this->env, $this->source, $context["product_special"], "date_end", [], "any", false, false, false, 192) != "0000-00-00")) {
                echo twig_get_attribute($this->env, $this->source, $context["product_special"], "date_end", [], "any", false, false, false, 192);
            }
            echo "\" 
                      class=\"date datepicker\" 
                      data-format=\"YYYY-MM-DD\" 
                      data-date-format=\"YYYY-MM-DD\"
                    />
                  </td>
                  <td class=\"left\">
                    <a 
                      onclick=\"\$('#special-row";
            // line 200
            echo ($context["special_row"] ?? null);
            echo "').remove();\" 
                      class=\"btn btn-default button\"
                    >
                      <span>";
            // line 203
            echo ($context["button_remove"] ?? null);
            echo "</span>
                    </a>
                  </td>
                </tr>
              </tbody>
              ";
            // line 208
            $context["special_row"] = (($context["special_row"] ?? null) + 1);
            // line 209
            echo "            ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['product_special'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 210
        echo "            <tfoot>
              <tr>
                <td colspan=\"5\"></td>
                <td class=\"left\">
                  <a 
                    onclick=\"addSpecial();\" 
                    class=\"btn btn-default button\"
                  >
                    <span>";
        // line 218
        echo ($context["ad_button"] ?? null);
        echo "</span>
                  </a>
                </td>
              </tr>
            </tfoot>
          </table>
        </div>
    </div>
    <input type=\"hidden\" name=\"product_id\" value=\"";
        // line 226
        echo ($context["product_id"] ?? null);
        echo "\">
</form>    
        
<script type=\"text/javascript\">
var discount_row = ";
        // line 230
        echo ($context["discount_row"] ?? null);
        echo ";

function addDiscount() {
\thtml  = '<tbody id=\"discount-row' + discount_row + '\" class=\"product-extra-table\">';
\thtml += '  <tr>'; 
    html += '<td class=\"left\"><select name=\"product_discount[' + discount_row + '][customer_group_id]\">';
    ";
        // line 236
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["customer_groups"] ?? null));
        foreach ($context['_seq'] as $context["_key"] => $context["customer_group"]) {
            // line 237
            echo "      html += '<option value=\"";
            echo twig_get_attribute($this->env, $this->source, $context["customer_group"], "customer_group_id", [], "any", false, false, false, 237);
            echo "\">";
            echo twig_get_attribute($this->env, $this->source, $context["customer_group"], "name", [], "any", false, false, false, 237);
            echo "</option>';
    ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['customer_group'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 239
        echo "    html += '</select></td>';\t\t
    html += '<td class=\"right\"><input style=\"text-align:right\" type=\"text\" name=\"product_discount[' + discount_row + '][quantity]\" value=\"\" size=\"2\" /></td>';
    html += '    <td class=\"right\"><input style=\"text-align:right\" type=\"text\" name=\"product_discount[' + discount_row + '][priority]\" value=\"\" size=\"2\" /></td>';
\thtml += '    <td class=\"right\"><input style=\"text-align:right\" type=\"text\" class=\"gross-price-field\" name=\"product_discount[' + discount_row + '][price]\" value=\"\" /></td>';
    html += '    <td class=\"left\"><input style=\"text-align:center\" type=\"text\" name=\"product_discount[' + discount_row + '][date_start]\" value=\"\" class=\"date datepicker\" data-format=\"YYYY-MM-DD\" data-date-format=\"YYYY-MM-DD\"/></td>';
\thtml += '    <td class=\"left\"><input style=\"text-align:center\" type=\"text\" name=\"product_discount[' + discount_row + '][date_end]\" value=\"\" class=\"date datepicker\" data-format=\"YYYY-MM-DD\" data-date-format=\"YYYY-MM-DD\"/></td>';
\thtml += '    <td class=\"left\"><a onclick=\"\$(\\'#discount-row' + discount_row + '\\').remove();\" class=\"btn btn-default button\"><span>";
        // line 245
        echo ($context["button_remove"] ?? null);
        echo "</span></a></td>';
\thtml += '  </tr>';\t
    html += '</tbody>';
\t
\t\$('#discount tfoot').before(html);
\tdiscount_row++;
}
//--></script> 
<script type=\"text/javascript\"><!--
var special_row = ";
        // line 254
        echo ($context["special_row"] ?? null);
        echo ";

function addSpecial() {
\thtml  = '<tbody id=\"special-row' + special_row + '\" class=\"product-extra-table\">';
\thtml += '<tr>'; 
    html += '<td class=\"left\"><select name=\"product_special[' + special_row + '][customer_group_id]\">';
    ";
        // line 260
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["customer_groups"] ?? null));
        foreach ($context['_seq'] as $context["_key"] => $context["customer_group"]) {
            // line 261
            echo "      html += '<option value=\"";
            echo twig_get_attribute($this->env, $this->source, $context["customer_group"], "customer_group_id", [], "any", false, false, false, 261);
            echo "\">";
            echo twig_get_attribute($this->env, $this->source, $context["customer_group"], "name", [], "any", false, false, false, 261);
            echo "</option>';
    ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['customer_group'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 263
        echo "    html += '</select></td>';\t\t
    html += '<td class=\"right\"><input style=\"text-align:right\" type=\"text\" name=\"product_special[' + special_row + '][priority]\" value=\"\" size=\"2\" /></td>';
\thtml += '    <td class=\"right\"><input style=\"text-align:right\" type=\"text\" class=\"gross-price-field\" name=\"product_special[' + special_row + '][price]\" value=\"\" /></td>';
    html += '    <td class=\"left\"><input style=\"text-align:center\" type=\"text\" name=\"product_special[' + special_row + '][date_start]\" value=\"\" class=\"date datepicker\" data-format=\"YYYY-MM-DD\" data-date-format=\"YYYY-MM-DD\"/></td>';
\thtml += '    <td class=\"left\"><input style=\"text-align:center\" type=\"text\" name=\"product_special[' + special_row + '][date_end]\" value=\"\" class=\"date datepicker\" data-format=\"YYYY-MM-DD\" data-date-format=\"YYYY-MM-DD\"/></td>';
\thtml += '    <td class=\"left\"><a onclick=\"\$(\\'#special-row' + special_row + '\\').remove();\" class=\"btn btn-default button\"><span>";
        // line 268
        echo ($context["button_remove"] ?? null);
        echo "</span></a></td>';
\thtml += '  </tr>';
    html += '</tbody>';
\t
\t\$('#special tfoot').before(html);
\tspecial_row++;
}
</script> ";
    }

    /**
     * @codeCoverageIgnore
     */
    public function getTemplateName()
    {
        return "extension/product_special_prices.twig";
    }

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo()
    {
        return array (  571 => 268,  564 => 263,  553 => 261,  549 => 260,  540 => 254,  528 => 245,  520 => 239,  509 => 237,  505 => 236,  496 => 230,  489 => 226,  478 => 218,  468 => 210,  462 => 209,  460 => 208,  452 => 203,  446 => 200,  433 => 192,  429 => 191,  414 => 181,  410 => 180,  400 => 173,  395 => 171,  384 => 163,  380 => 162,  372 => 156,  366 => 155,  360 => 152,  355 => 150,  352 => 149,  346 => 146,  340 => 143,  337 => 142,  334 => 141,  330 => 140,  326 => 139,  319 => 136,  314 => 135,  312 => 134,  305 => 130,  301 => 129,  297 => 128,  293 => 127,  289 => 126,  281 => 121,  275 => 120,  264 => 112,  254 => 104,  248 => 103,  246 => 102,  238 => 97,  232 => 94,  219 => 86,  215 => 85,  200 => 75,  196 => 74,  186 => 67,  181 => 65,  170 => 57,  166 => 56,  155 => 48,  151 => 47,  143 => 41,  137 => 40,  131 => 37,  126 => 35,  123 => 34,  117 => 31,  111 => 28,  108 => 27,  105 => 26,  101 => 25,  96 => 23,  88 => 19,  83 => 18,  81 => 17,  74 => 13,  70 => 12,  66 => 11,  62 => 10,  58 => 9,  54 => 8,  46 => 3,  40 => 2,  37 => 1,);
    }

    public function getSourceContext()
    {
        return new Source("", "extension/product_special_prices.twig", "");
    }
}
