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

/* catalog/attribute_list.twig */
class __TwigTemplate_ecec1ec4cf5cdc15816c5b9abb2a53b3 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 ($context["header"] ?? null);
        echo ($context["column_left"] ?? null);
        echo "
<div id=\"content\">
  <div class=\"page-header\">
    <div class=\"container-fluid\">
      <div class=\"pull-right\"><a href=\"";
        // line 5
        echo ($context["add"] ?? null);
        echo "\" data-toggle=\"tooltip\" title=\"";
        echo ($context["button_add"] ?? null);
        echo "\" class=\"btn btn-primary\"><i class=\"fa fa-plus\"></i></a>
        <button type=\"button\" data-toggle=\"tooltip\" title=\"";
        // line 6
        echo ($context["button_delete"] ?? null);
        echo "\" class=\"btn btn-danger\" onclick=\"confirm('";
        echo ($context["text_confirm"] ?? null);
        echo "') ? \$('#form-attribute').submit() : false;\"><i class=\"fa fa-trash-o\"></i></button>
      </div>
      <h1>";
        // line 8
        echo ($context["heading_title"] ?? null);
        echo "</h1>
      <ul class=\"breadcrumb\">
        ";
        // line 10
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["breadcrumbs"] ?? null));
        foreach ($context['_seq'] as $context["_key"] => $context["breadcrumb"]) {
            // line 11
            echo "        <li><a href=\"";
            echo twig_get_attribute($this->env, $this->source, $context["breadcrumb"], "href", [], "any", false, false, false, 11);
            echo "\">";
            echo twig_get_attribute($this->env, $this->source, $context["breadcrumb"], "text", [], "any", false, false, false, 11);
            echo "</a></li>
        ";
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['breadcrumb'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 13
        echo "      </ul>
    </div>
  </div>
  <div class=\"container-fluid\">
    ";
        // line 17
        if (($context["error_warning"] ?? null)) {
            // line 18
            echo "    <div class=\"alert alert-danger alert-dismissible\"><i class=\"fa fa-exclamation-circle\"></i> ";
            echo ($context["error_warning"] ?? null);
            echo "
      <button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>
    </div>
    ";
        }
        // line 22
        echo "    ";
        if (($context["success"] ?? null)) {
            // line 23
            echo "    <div class=\"alert alert-success alert-dismissible\"><i class=\"fa fa-check-circle\"></i> ";
            echo ($context["success"] ?? null);
            echo "
      <button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>
    </div>
    ";
        }
        // line 27
        echo "    <div class=\"panel panel-default\">
      <div class=\"panel-heading\">
        <h3 class=\"panel-title\"><i class=\"fa fa-list\"></i> ";
        // line 29
        echo ($context["text_list"] ?? null);
        echo "</h3>
         <div class=\"pull-right\">
            <div class=\"input-group\" style=\"top: -8px;\">
                <input type=\"text\" style=\"width: 55%; display: inline-block;\" name=\"filter_name\" value=\"";
        // line 32
        echo ($context["filter_name"] ?? null);
        echo "\" id=\"input-name\" class=\"form-control\" placeholder=\"Search...\" />
                <button type=\"button\" id=\"button-filter\" class=\"btn btn-primary\">
                    <i class=\"fa fa-filter\"></i> ";
        // line 34
        echo ($context["button_filter"] ?? null);
        echo "
                </button>
                <button type=\"button\" id=\"button-clear\" class=\"btn btn-danger\">
                    ";
        // line 37
        echo ($context["button_clear"] ?? null);
        echo "
                </button>
            </div>
        </div>
      </div>
      <div class=\"panel-body\">
        <form action=\"";
        // line 43
        echo ($context["delete"] ?? null);
        echo "\" method=\"post\" enctype=\"multipart/form-data\" id=\"form-attribute\">
          <div class=\"table-responsive\">
            <table class=\"table table-bordered table-hover\">
              <thead>
                <tr>
                  <td style=\"width: 1px;\" class=\"text-center\"><input type=\"checkbox\" onclick=\"\$('input[name*=\\'selected\\']').prop('checked', this.checked);\" /></td>
                  <td class=\"text-left\">";
        // line 49
        if ((($context["sort"] ?? null) == "ad.name")) {
            // line 50
            echo "                    <a href=\"";
            echo ($context["sort_name"] ?? null);
            echo "\" class=\"";
            echo twig_lower_filter($this->env, ($context["order"] ?? null));
            echo "\">";
            echo ($context["column_name"] ?? null);
            echo "</a>
                    ";
        } else {
            // line 52
            echo "                    <a href=\"";
            echo ($context["sort_name"] ?? null);
            echo "\">";
            echo ($context["column_name"] ?? null);
            echo "</a>
                    ";
        }
        // line 53
        echo "</td>
                    <td class=\"text-left\">";
        // line 54
        echo ($context["column_products"] ?? null);
        echo "</td>
                  <td class=\"text-left\">";
        // line 55
        if ((($context["sort"] ?? null) == "attribute_group")) {
            // line 56
            echo "                    <a href=\"";
            echo ($context["sort_attribute_group"] ?? null);
            echo "\" class=\"";
            echo twig_lower_filter($this->env, ($context["order"] ?? null));
            echo "\">";
            echo ($context["column_attribute_group"] ?? null);
            echo "</a>
                    ";
        } else {
            // line 58
            echo "                    <a href=\"";
            echo ($context["sort_attribute_group"] ?? null);
            echo "\">";
            echo ($context["column_attribute_group"] ?? null);
            echo "</a>
                    ";
        }
        // line 59
        echo "</td>
                  <td class=\"text-right\">";
        // line 60
        if ((($context["sort"] ?? null) == "a.sort_order")) {
            // line 61
            echo "                    <a href=\"";
            echo ($context["sort_sort_order"] ?? null);
            echo "\" class=\"";
            echo twig_lower_filter($this->env, ($context["order"] ?? null));
            echo "\">";
            echo ($context["column_sort_order"] ?? null);
            echo "</a>
                    ";
        } else {
            // line 63
            echo "                    <a href=\"";
            echo ($context["sort_sort_order"] ?? null);
            echo "\">";
            echo ($context["column_sort_order"] ?? null);
            echo "</a>
                    ";
        }
        // line 64
        echo "</td>
                  <td class=\"text-right\">";
        // line 65
        echo ($context["column_action"] ?? null);
        echo "</td>
                </tr>
              </thead>
              <tbody>
                ";
        // line 69
        if (($context["attributes"] ?? null)) {
            // line 70
            echo "                ";
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(($context["attributes"] ?? null));
            foreach ($context['_seq'] as $context["_key"] => $context["attribute"]) {
                // line 71
                echo "                <tr>
                  <td class=\"text-center\">";
                // line 72
                if (twig_in_filter(twig_get_attribute($this->env, $this->source, $context["attribute"], "attribute_id", [], "any", false, false, false, 72), ($context["selected"] ?? null))) {
                    // line 73
                    echo "                    <input type=\"checkbox\" name=\"selected[]\" value=\"";
                    echo twig_get_attribute($this->env, $this->source, $context["attribute"], "attribute_id", [], "any", false, false, false, 73);
                    echo "\" checked=\"checked\" />
                    ";
                } else {
                    // line 75
                    echo "                    <input type=\"checkbox\" name=\"selected[]\" value=\"";
                    echo twig_get_attribute($this->env, $this->source, $context["attribute"], "attribute_id", [], "any", false, false, false, 75);
                    echo "\" />
                    ";
                }
                // line 76
                echo "</td>
                  <td class=\"text-left\">";
                // line 77
                echo twig_get_attribute($this->env, $this->source, $context["attribute"], "name", [], "any", false, false, false, 77);
                echo "</td>
                  <td class=\"text-left\"><a href=\"";
                // line 78
                echo twig_get_attribute($this->env, $this->source, $context["attribute"], "product_link", [], "any", false, false, false, 78);
                echo "\"><span style=\"background-color: #8378ff; padding: 5px 10px; color: #fff; border-radius: 10px;\">";
                echo twig_get_attribute($this->env, $this->source, $context["attribute"], "product_count", [], "any", false, false, false, 78);
                echo "</span></a></td>
                  <td class=\"text-left\">";
                // line 79
                echo twig_get_attribute($this->env, $this->source, $context["attribute"], "attribute_group", [], "any", false, false, false, 79);
                echo "</td>
                  <td class=\"text-right\">
                      <input type=\"text\" value=\"";
                // line 81
                echo twig_get_attribute($this->env, $this->source, $context["attribute"], "sort_order", [], "any", false, false, false, 81);
                echo "\" data-attribute-id=\"";
                echo twig_get_attribute($this->env, $this->source, $context["attribute"], "attribute_id", [], "any", false, false, false, 81);
                echo "\" class=\"sort-order-input\" />
                  </td>
                  <td class=\"text-right\"><a href=\"";
                // line 83
                echo twig_get_attribute($this->env, $this->source, $context["attribute"], "edit", [], "any", false, false, false, 83);
                echo "\" data-toggle=\"tooltip\" title=\"";
                echo ($context["button_edit"] ?? null);
                echo "\" class=\"btn btn-primary\"><i class=\"fa fa-pencil\"></i></a></td>
                </tr>
                ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['attribute'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 86
            echo "                ";
        } else {
            // line 87
            echo "                <tr>
                  <td class=\"text-center\" colspan=\"5\">";
            // line 88
            echo ($context["text_no_results"] ?? null);
            echo "</td>
                </tr>
                ";
        }
        // line 91
        echo "              </tbody>
            </table>
          </div>
        </form>
        <div class=\"row\">
          <div class=\"col-sm-6 text-left\">";
        // line 96
        echo ($context["pagination"] ?? null);
        echo "</div>
          <div class=\"col-sm-6 text-right\">";
        // line 97
        echo ($context["results"] ?? null);
        echo "</div>
        </div>
      </div>
    </div>
  </div>
</div>
<script type=\"text/javascript\"><!--
\t\t\t\t\t\t    \$('#button-filter').on('click', function() {
\t\t\t\t\t\t\t  var url = 'index.php?route=catalog/attribute&user_token=";
        // line 105
        echo ($context["user_token"] ?? null);
        echo "';

\t\t\t\t\t\t\t  var filter_name = \$('input[name=\\'filter_name\\']').val();
\t\t\t\t\t\t\t\t\t
\t\t\t\t\t\t\t  if (filter_name) 
\t\t\t\t\t\t\t  {
\t\t\t\t\t\t\t\turl += '&filter_name=' + encodeURIComponent(filter_name);
\t\t\t\t\t\t\t  }
\t\t\t\t\t\t\t  location = url;
\t\t\t\t\t\t\t});
\t \$('#button-clear').on('click', function() {
\t location ='index.php?route=catalog/attribute&user_token=";
        // line 116
        echo ($context["user_token"] ?? null);
        echo "';
\t});\t\t\t\t\t\t
\t// Category
\t\$('input[name=\\'filter_name\\']').autocomplete({
\t  'source': function(request, response) {
\t    \$.ajax({
\t      url: 'index.php?route=catalog/attribute/autocomplete&user_token=";
        // line 122
        echo ($context["user_token"] ?? null);
        echo "&filter_name=' +  encodeURIComponent(request),
\t      dataType: 'json',
\t      success: function(json) {
\t\t    response(\$.map(json, function(item) {
\t          return {
\t            label: item['name'],
\t            value: item['attribute_id']
\t          }
\t        }));
\t      }
\t    });
\t  },
\t  'select': function(item) {
\t    \$('input[name=\\'filter_name\\']').val(item['label']);
\t  }
\t});\t\t
\t//--></script>
<script type=\"text/javascript\">
\$(document).ready(function(){
    \$('.sort-order-input').on('change', function() {
        var attributeId = \$(this).data('attribute-id');
        var sortOrder = \$(this).val();

        \$.ajax({
            url: 'index.php?route=catalog/attribute/updateSortOrder&user_token=";
        // line 146
        echo ($context["user_token"] ?? null);
        echo "',
            type: 'post',
            dataType: 'json',
            data: {
                attribute_id: attributeId,
                sort_order: sortOrder
            },
            success: function(json) {
            if (json.success) {
                \$('#ajax-success .message').text(json.success);
                \$('#ajax-success').fadeIn().delay(3000).fadeOut();
            } else if (json.error) {
                alert(json.error);
            }
        }
        });
    });
});
</script>
";
        // line 165
        echo ($context["footer"] ?? null);
        echo "
";
    }

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

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo()
    {
        return array (  390 => 165,  368 => 146,  341 => 122,  332 => 116,  318 => 105,  307 => 97,  303 => 96,  296 => 91,  290 => 88,  287 => 87,  284 => 86,  273 => 83,  266 => 81,  261 => 79,  255 => 78,  251 => 77,  248 => 76,  242 => 75,  236 => 73,  234 => 72,  231 => 71,  226 => 70,  224 => 69,  217 => 65,  214 => 64,  206 => 63,  196 => 61,  194 => 60,  191 => 59,  183 => 58,  173 => 56,  171 => 55,  167 => 54,  164 => 53,  156 => 52,  146 => 50,  144 => 49,  135 => 43,  126 => 37,  120 => 34,  115 => 32,  109 => 29,  105 => 27,  97 => 23,  94 => 22,  86 => 18,  84 => 17,  78 => 13,  67 => 11,  63 => 10,  58 => 8,  51 => 6,  45 => 5,  37 => 1,);
    }

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