<?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/category_list.twig */
class __TwigTemplate_989da2e8df2f78666ed3769f83fc6337 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\">
          ";
        // line 6
        if ((($context["config_category_download"] ?? null) == 1)) {
            // line 7
            echo "          <a href=\"";
            echo ($context["download"] ?? null);
            echo "\" data-toggle=\"tooltip\" title=\"";
            echo ($context["button_download"] ?? null);
            echo "\" class=\"btn btn-warning\"><i class=\"fa fa-download\"></i></a>
          ";
        }
        // line 9
        echo "          <a href=\"";
        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> 
          <a href=\"";
        // line 10
        echo ($context["repair"] ?? null);
        echo "\" data-toggle=\"tooltip\" title=\"";
        echo ($context["button_rebuild"] ?? null);
        echo "\" class=\"btn btn-default\"><i class=\"fa fa-refresh\"></i></a>
        <button type=\"button\" data-toggle=\"tooltip\" title=\"";
        // line 11
        echo ($context["button_delete"] ?? null);
        echo "\" class=\"btn btn-danger\" onclick=\"confirm('";
        echo ($context["text_confirm"] ?? null);
        echo "') ? \$('#form-category').submit() : false;\"><i class=\"fa fa-trash-o\"></i></button>
      </div>
      <h1>";
        // line 13
        echo ($context["heading_title"] ?? null);
        echo "</h1>
      <ul class=\"breadcrumb\">
        ";
        // line 15
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["breadcrumbs"] ?? null));
        foreach ($context['_seq'] as $context["_key"] => $context["breadcrumb"]) {
            // line 16
            echo "        <li><a href=\"";
            echo twig_get_attribute($this->env, $this->source, $context["breadcrumb"], "href", [], "any", false, false, false, 16);
            echo "\">";
            echo twig_get_attribute($this->env, $this->source, $context["breadcrumb"], "text", [], "any", false, false, false, 16);
            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 18
        echo "      </ul>
    </div>
  </div>
  <div class=\"container-fluid\">
    ";
        // line 22
        if (($context["error_warning"] ?? null)) {
            // line 23
            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 27
        echo "    ";
        if (($context["success"] ?? null)) {
            // line 28
            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 32
        echo "    
    <div id=\"ajax-success\" class=\"alert alert-success alert-dismissible\" style=\"display: none;\">
      <i class=\"fa fa-check-circle\"></i> <span class=\"message\"></span>
      <button type=\"button\" class=\"close\" onclick=\"\$('#ajax-success').hide();\">&times;</button>
    </div>
    
    <div class=\"panel panel-default\">
      <div class=\"panel-heading\">
        <h3 class=\"panel-title\"><i class=\"fa fa-list\"></i> ";
        // line 40
        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 43
        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 46
        echo ($context["button_filter"] ?? null);
        echo "
                </button>
                <button type=\"button\" id=\"button-clear\" class=\"btn btn-danger\">
                    ";
        // line 49
        echo ($context["button_clear"] ?? null);
        echo "
                </button>
            </div>
        </div>
      </div>
      <div class=\"panel-body\">
        <form action=\"";
        // line 55
        echo ($context["delete"] ?? null);
        echo "\" method=\"post\" enctype=\"multipart/form-data\" id=\"form-category\">
          <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 61
        if ((($context["sort"] ?? null) == "name")) {
            // line 62
            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 64
            echo "                    <a href=\"";
            echo ($context["sort_name"] ?? null);
            echo "\">";
            echo ($context["column_name"] ?? null);
            echo "</a>
                    ";
        }
        // line 65
        echo "</td>
                    <th>";
        // line 66
        echo ($context["text_products"] ?? null);
        echo "</th>
                    <th>";
        // line 67
        echo ($context["text_slug"] ?? null);
        echo "</th>
                  <td class=\"text-left\">";
        // line 68
        if ((($context["sort"] ?? null) == "sort_order")) {
            // line 69
            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 71
            echo "                    <a href=\"";
            echo ($context["sort_sort_order"] ?? null);
            echo "\">";
            echo ($context["column_sort_order"] ?? null);
            echo "</a>
                    ";
        }
        // line 72
        echo "</td>
                    <td class=\"text-left\">";
        // line 73
        echo ($context["text_date_added"] ?? null);
        echo "</td>
                  <td class=\"text-right\">";
        // line 74
        echo ($context["column_action"] ?? null);
        echo "</td>
                </tr>
              </thead>
              <tbody>
                ";
        // line 78
        if (($context["categories"] ?? null)) {
            // line 79
            echo "                ";
            $context['_parent'] = $context;
            $context['_seq'] = twig_ensure_traversable(($context["categories"] ?? null));
            foreach ($context['_seq'] as $context["_key"] => $context["category"]) {
                // line 80
                echo "                <tr>
                  <td class=\"text-center\">";
                // line 81
                if (twig_in_filter(twig_get_attribute($this->env, $this->source, $context["category"], "category_id", [], "any", false, false, false, 81), ($context["selected"] ?? null))) {
                    // line 82
                    echo "                    <input type=\"checkbox\" name=\"selected[]\" value=\"";
                    echo twig_get_attribute($this->env, $this->source, $context["category"], "category_id", [], "any", false, false, false, 82);
                    echo "\" checked=\"checked\" />
                    ";
                } else {
                    // line 84
                    echo "                    <input type=\"checkbox\" name=\"selected[]\" value=\"";
                    echo twig_get_attribute($this->env, $this->source, $context["category"], "category_id", [], "any", false, false, false, 84);
                    echo "\" />
                    ";
                }
                // line 85
                echo "</td>
                  <td class=\"text-left\">
                      ";
                // line 87
                echo twig_get_attribute($this->env, $this->source, $context["category"], "name", [], "any", false, false, false, 87);
                echo "
                      <br/>
                        ";
                // line 89
                if (twig_get_attribute($this->env, $this->source, $context["category"], "status", [], "any", false, false, false, 89)) {
                    // line 90
                    echo "                          <small class=\"text-success\">";
                    echo ($context["text_enabled"] ?? null);
                    echo "</small>
                        ";
                } else {
                    // line 92
                    echo "                          <small class=\"text-danger\">";
                    echo ($context["text_disabled"] ?? null);
                    echo "</small>
                        ";
                }
                // line 94
                echo "                  </td>
                  <td><a href=\"";
                // line 95
                echo twig_get_attribute($this->env, $this->source, $context["category"], "product_link", [], "any", false, false, false, 95);
                echo "\"><span style=\"background-color: #8378ff; padding: 5px 10px; color: #fff; border-radius: 10px;\">";
                echo twig_get_attribute($this->env, $this->source, $context["category"], "product_total", [], "any", false, false, false, 95);
                echo "</span></a></td>
                  <td class=\"text-left\">";
                // line 96
                echo twig_get_attribute($this->env, $this->source, $context["category"], "seo_keyword", [], "any", false, false, false, 96);
                echo "</td>
                  <td class=\"text-left\">
                      <input type=\"text\" value=\"";
                // line 98
                echo twig_get_attribute($this->env, $this->source, $context["category"], "sort_order", [], "any", false, false, false, 98);
                echo "\" data-category-id=\"";
                echo twig_get_attribute($this->env, $this->source, $context["category"], "category_id", [], "any", false, false, false, 98);
                echo "\" class=\"sort-order-input\" />
                  </td>
                  <td class=\"text-left\">
\t\t\t\t\t\t<i class=\"fa fa-calendar\" data-toggle=\"tooltip\" title=\"";
                // line 101
                echo ($context["text_date_added"] ?? null);
                echo "\"></i> ";
                echo twig_get_attribute($this->env, $this->source, $context["category"], "date_added", [], "any", false, false, false, 101);
                echo " ";
                if (twig_get_attribute($this->env, $this->source, $context["category"], "added_by", [], "any", false, false, false, 101)) {
                    echo " (";
                    echo twig_get_attribute($this->env, $this->source, $context["category"], "added_by", [], "any", false, false, false, 101);
                    echo ") ";
                }
                echo " <br/>
\t\t\t\t\t\t<i class=\"fa fa-refresh\" data-toggle=\"tooltip\" title=\"";
                // line 102
                echo ($context["text_date_modified"] ?? null);
                echo "\"></i> ";
                echo twig_get_attribute($this->env, $this->source, $context["category"], "date_modified", [], "any", false, false, false, 102);
                echo " ";
                if (twig_get_attribute($this->env, $this->source, $context["category"], "updated_by", [], "any", false, false, false, 102)) {
                    echo " (";
                    echo twig_get_attribute($this->env, $this->source, $context["category"], "updated_by", [], "any", false, false, false, 102);
                    echo ") ";
                }
                // line 103
                echo "\t\t\t\t\t</td>
                  <td class=\"text-right\">
                      <a href=\"";
                // line 105
                echo twig_get_attribute($this->env, $this->source, $context["category"], "edit", [], "any", false, false, false, 105);
                echo "\" data-toggle=\"tooltip\" title=\"";
                echo ($context["button_edit"] ?? null);
                echo "\" class=\"btn btn-primary\"><i class=\"fa fa-pencil\"></i></a>
                      <a href=\"";
                // line 106
                echo twig_get_attribute($this->env, $this->source, $context["category"], "view", [], "any", false, false, false, 106);
                echo "\" data-toggle=\"tooltip\" target=\"_blank\" class=\"btn btn-primary\"><i class=\"fa fa-eye\"></i></a>
                  </td>
                </tr>
                ";
            }
            $_parent = $context['_parent'];
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['category'], $context['_parent'], $context['loop']);
            $context = array_intersect_key($context, $_parent) + $_parent;
            // line 110
            echo "                ";
        } else {
            // line 111
            echo "                <tr>
                  <td class=\"text-center\" colspan=\"4\">";
            // line 112
            echo ($context["text_no_results"] ?? null);
            echo "</td>
                </tr>
                ";
        }
        // line 115
        echo "              </tbody>
            </table>
          </div>
        </form>
        <div class=\"row\">
          <div class=\"col-sm-6 text-left\">";
        // line 120
        echo ($context["pagination"] ?? null);
        echo "</div>
          <div class=\"col-sm-6 text-right\">";
        // line 121
        echo ($context["results"] ?? null);
        echo "</div>
        </div>
      </div>
    </div>
  </div>
</div>
<script type=\"text/javascript\"><!--
    \$('#button-filter').on('click', function() {
      var url = 'index.php?route=catalog/category&user_token=";
        // line 129
        echo ($context["user_token"] ?? null);
        echo "';
    
      var filter_name = \$('input[name=\\'filter_name\\']').val();
            
      if (filter_name) 
      {
        url += '&filter_name=' + encodeURIComponent(filter_name);
      }
      location = url;
    });
 \$('#button-clear').on('click', function() {
 location ='index.php?route=catalog/category&user_token=";
        // line 140
        echo ($context["user_token"] ?? null);
        echo "';
});                     
// Category
\$('input[name=\\'filter_name\\']').autocomplete({
  'source': function(request, response) {
    \$.ajax({
      url: 'index.php?route=catalog/category/autocomplete&user_token=";
        // line 146
        echo ($context["user_token"] ?? null);
        echo "&filter_name=' +  encodeURIComponent(request),
      dataType: 'json',
      success: function(json) {
        response(\$.map(json, function(item) {
          return {
            label: item['name'],
            value: item['category_id']
          }
        }));
      }
    });
  },
  'select': function(item) {
    \$('input[name=\\'filter_name\\']').val(item['label']);
  }
});     
//--></script>
<script type=\"text/javascript\">
\$(document).ready(function(){
    \$('.sort-order-input').on('change', function() {
        var categoryId = \$(this).data('category-id');
        var sortOrder = \$(this).val();

        \$.ajax({
            url: 'index.php?route=catalog/category/updateSortOrder&user_token=";
        // line 170
        echo ($context["user_token"] ?? null);
        echo "',
            type: 'post',
            dataType: 'json',
            data: {
                category_id: categoryId,
                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 189
        echo ($context["footer"] ?? null);
    }

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

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

    /**
     * @codeCoverageIgnore
     */
    public function getDebugInfo()
    {
        return array (  451 => 189,  429 => 170,  402 => 146,  393 => 140,  379 => 129,  368 => 121,  364 => 120,  357 => 115,  351 => 112,  348 => 111,  345 => 110,  335 => 106,  329 => 105,  325 => 103,  315 => 102,  303 => 101,  295 => 98,  290 => 96,  284 => 95,  281 => 94,  275 => 92,  269 => 90,  267 => 89,  262 => 87,  258 => 85,  252 => 84,  246 => 82,  244 => 81,  241 => 80,  236 => 79,  234 => 78,  227 => 74,  223 => 73,  220 => 72,  212 => 71,  202 => 69,  200 => 68,  196 => 67,  192 => 66,  189 => 65,  181 => 64,  171 => 62,  169 => 61,  160 => 55,  151 => 49,  145 => 46,  139 => 43,  133 => 40,  123 => 32,  115 => 28,  112 => 27,  104 => 23,  102 => 22,  96 => 18,  85 => 16,  81 => 15,  76 => 13,  69 => 11,  63 => 10,  56 => 9,  48 => 7,  46 => 6,  37 => 1,);
    }

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