{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
	  <div class="pull-right">
		<a href="{{ add }}" data-toggle="tooltip" title="{{ button_add }}" class="btn btn-primary"><i class="fa fa-plus"></i></a>
		<a onclick="$('#form-category').attr('action', '{{ copy }}'); $('#form-category').submit();" data-toggle="tooltip" title="{{ button_copy }}" class="btn btn-warning"><i class="fa fa-copy"></i></a>
		<a href="{{ repair }}" data-toggle="tooltip" title="{{ button_rebuild }}" class="btn btn-default"><i class="fa fa-refresh"></i></a>
        <button type="button" data-toggle="tooltip" title="{{ button_delete }}" class="btn btn-danger" onclick="confirm('{{ text_confirm }}') ? $('#form-category').submit() : false;"><i class="fa fa-trash-o"></i></button>
      </div>
      <h1>{{ heading_title }}</h1>
      <ul class="breadcrumb">
        {% for breadcrumb in breadcrumbs %}
        <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
        {% endfor %}
      </ul>
    </div>
  </div>
  <div class="container-fluid">
    {% if error_warning %}
    <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    {% endif %}
    {% if success %}
    <div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> {{ success }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    {% endif %}
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-list"></i> {{ text_list }}</h3>
      </div>
      <div class="panel-body">
        <div class="maxy-backdrop"></div>
	    <div class="messages-body"></div>
		<form action="{{ delete }}" method="post" enctype="multipart/form-data" id="form-category">
          <div class="table-responsive">
            <table class="table table-bordered table-hover">
              <thead>
                <tr class="table-pagination">
				  <td colspan="6">
					<div class="pull-left">{{ pagination }}</div>
					{% if pagination %}
					  <div class="pull-right pagination-text">{{ results }}</div>
					  {% else %}
					  <div class="pull-right">{{ results }}</div>
					{% endif %}
				  </td>
				</tr>
				<tr>
                  <td style="width: 1px;" class="text-center"><input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);" /></td>
                  <td class="text-center" style="width: 90px;">{{ column_image }}</td>
				  <td class="text-left">{% if sort == 'name' %}<a href="{{ sort_name }}" class="{{ order|lower }}">{{ column_name }}</a>{% else %}<a href="{{ sort_name }}">{{ column_name }}</a>{% endif %}</td>
				  <td class="text-center" style="width: 90px;">{% if sort == 'sort_order' %}<a href="{{ sort_sort_order }}" class="{{ order|lower }}">{{ column_sort_order }}</a>{% else %}<a href="{{ sort_sort_order }}">{{ column_sort_order }}</a>{% endif %}</td>
				  <td class="text-center" style="width: 90px;">{% if sort == 'status' %}<a href="{{ sort_status }}" class="{{ order|lower }}">{{ column_status }}</a>{% else %}<a href="{{ sort_status }}">{{ column_status }}</a>{% endif %}</td>
                  <td class="text-center" style="min-width: 100px; width: 100px;">{{ column_action }}</td>
                </tr>
				<tr class="table-filter">
				  <td></td>
				  <td class="text-center">
				    <select name="filter_image" onchange="filter();" class="form-control">
					  <option value="*"></option>
					  {% if filter_image == '1' %}
					  <option value="1" selected="selected">{{ text_yes }}</option>
					  {% else %}
					  <option value="1">{{ text_yes }}</option>
					  {% endif %}
					  {% if filter_image == '0' %}
					  <option value="0" selected="selected">{{ text_no }}</option>
					  {% else %}
					  <option value="0">{{ text_no }}</option>
					  {% endif %}
					</select>
				  </td>
				  <td class="text-left">
				    <input type="text" name="filter_category" value="{{ filter_category }}" class="form-control" />	
					<input type="hidden" name="filter_category_id" value="{{ filter_category_id }}" />
				  </td>
				  <td class="text-center">
				    <input type="text" name="filter_sort_order" value="{{ filter_sort_order }}" class="form-control" />
				  </td>
				  <td class="text-center">
				    <select name="filter_status" onchange="filter();" class="form-control">
					  <option value="*"></option>
					  {% if filter_status == '1' %}
					  <option value="1" selected="selected">{{ text_enabled }}</option>
					  {% else %}
					  <option value="1">{{ text_enabled }}</option>
					  {% endif %}
					  {% if filter_status == '0' %}
					  <option value="0" selected="selected">{{ text_disabled }}</option>
					  {% else %}
					  <option value="0">{{ text_disabled }}</option>
					  {% endif %}
					</select>
				  </td>
				  <td class="text-center"><button type="button" onclick="filter();" class="btn btn-primary btn-sm"><i class="fa fa-filter fa-fw"></i> {{ button_filter }}</button></td>
				</tr>
              </thead>
              <tbody>
			  {% if categories %}
				  {% for category in categories %}
					<tr>
					  <td class="text-center">
					    {% if category.category_id in selected %}
						  <input type="checkbox" name="selected[]" value="{{ category.category_id }}" checked="checked" />
						  {% else %}
						  <input type="checkbox" name="selected[]" value="{{ category.category_id }}" />
						{% endif %}
					  </td>
					  <td class="text-center">
					    {% if category_image %}
						  <a data-toggle="popover-maxy" data-target="#category-image-{{ category.category_id }}" data-placement="right right-top" id="category-image{{ category.category_id }}" class="btn-hover-list"><img src="{{ category.image }}" alt="{{ category.name }}" class="img-thumbnail" /></a>
						  {% else %}
						  <img src="{{ category.image }}" alt="{{ category.name }}" class="img-thumbnail" />
					    {% endif %}
					  </td>
					  <td class="text-left">
					    {% if category_name %}
						  <a onclick="getName('{{ category.category_id }}');" data-toggle="popover-maxy" data-target="#category-name-{{ category.category_id }}" data-placement="right right-top" id="category-name{{ category.category_id }}" class="btn-hover-list">{{ category.name }}</a>
						  {% else %}
						  {{ category.name }}
					    {% endif %}
					  </td>
					  <td class="text-center">
					    {% if category_sort_order %}
						  <a data-toggle="popover-maxy" data-target="#category-sort-{{ category.category_id }}" data-placement="left left-top" id="category-sort{{ category.category_id }}" class="btn btn-default btn-sm">{{ category.sort_order }}</a>
						  {% else %}
						  {{ category.sort_order }}
						{% endif %}
					  </td>
					  {% if category_status %}
						<td class="text-center" id="category-status-{{ category.category_id }}"><a onclick="editButtons('{{ category.category_id }}', 'category_status');" id="status-{{ category.category_id }}">{{ category.status }}</a><input type="hidden" name="statuses" value="{{ category.statuses }}" /></td>
						{% else %}
						<td class="text-center">{{ category.no_status }}</td>
					  {% endif %}
					  <td class="text-center">
					    {% if category_more %}<a data-toggle="popover-maxy" data-target="#category-more-{{ category.category_id }}" data-placement="left" class="btn btn-warning btn-sm"><i class="fa fa-star-o fa-fw"></i></a>{% endif %}
						<a href="{{ category.edit }}" data-toggle="tooltip" title="{{ button_edit }}" class="btn btn-primary btn-sm"><i class="fa fa-pencil fa-fw"></i></a>
					  </td>
					</tr>
				  {% endfor %}
                  {% else %}
                  <tr>
                    <td class="text-center" colspan="6">{{ text_no_results }}</td>
                  </tr>
                {% endif %}
              </tbody>
			  <tfoot>
                <tr>
                  <td style="width: 1px;" class="text-center"><input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);" /></td>
                  <td class="text-center" style="width: 90px;">{{ column_image }}</td>
				  <td class="text-left">{% if sort == 'name' %}<a href="{{ sort_name }}" class="{{ order|lower }}">{{ column_name }}</a>{% else %}<a href="{{ sort_name }}">{{ column_name }}</a>{% endif %}</td>
				  <td class="text-center" style="width: 90px;">{% if sort == 'sort_order' %}<a href="{{ sort_sort_order }}" class="{{ order|lower }}">{{ column_sort_order }}</a>{% else %}<a href="{{ sort_sort_order }}">{{ column_sort_order }}</a>{% endif %}</td>
				  <td class="text-center" style="width: 90px;">{% if sort == 'status' %}<a href="{{ sort_status }}" class="{{ order|lower }}">{{ column_status }}</a>{% else %}<a href="{{ sort_status }}">{{ column_status }}</a>{% endif %}</td>
                  <td class="text-center" style="min-width: 100px; width: 100px;">{{ column_action }}</td>
                </tr>
				<tr class="table-pagination">
				  <td colspan="6">
					<div class="pull-left">{{ pagination }}</div>
					{% if pagination %}
					  <div class="pull-right pagination-text">{{ results }}</div>
					  {% else %}
					  <div class="pull-right">{{ results }}</div>
					{% endif %}
				  </td>
				</tr>
              </tfoot>
            </table>
          </div>
        </form>
      </div>
    </div>
  </div>
<input type="hidden" name="text_none" value="{{ text_none }}" id="product-text-none" />
<input type="hidden" name="placeholder" value="{{ placeholder }}" id="category-placeholder" />
<input type="hidden" name="permission" value="{{ permission }}" id="category-permission" />
<input type="hidden" name="error_permission" value="{{ error_permission }}" id="category-error-permission" />
{% for category in categories %}
<div id="category-image-{{ category.category_id }}" class="popover popover-primary animate littleFadeInRight">
  <div class="arrow"></div><h3 class="popover-title">{{ column_image }}
  <a id="close-image-{{ category.category_id }}" data-dismiss="popover-maxy" class="btn btn-default btn-xs"><i class="fa fa-close"></i></a></h3>
  <div class="popover-content">
	<div class="row">
	  <a onclick="linkImage('{{ category.category_id }}');" class="btn btn-link"><img src="{{ category.thumb }}" class="img-thumbnail" /></a><input type="hidden" name="image" value="" id="category-image" />
    </div>
  </div>
  <div class="popover-footer">
    <a onclick="editImage('{{ category.category_id }}');" class="btn btn-primary btn-sm"><i class="fa fa-save fa-fw"></i></a><a onclick="imageClear('{{ category.category_id }}');" class="btn btn-danger btn-sm"><i class="fa fa-eraser fa-fw"></i></a>
  </div>
</div>
<div id="category-name-{{ category.category_id }}" class="popover popover-md popover-hover-list popover-primary animate littleFadeInRight">
  <div class="arrow"></div>
  <h3 class="popover-title">{{ column_name }}<a id="close-name-{{ category.category_id }}" class="btn btn-default btn-xs"><i class="fa fa-close"></i></a></h3>
  <div id="category-name-content-{{ category.category_id }}"></div>
</div>
<div id="category-sort-{{ category.category_id }}" class="popover popover-primary animate littleFadeInLeft">
  <div class="arrow"></div>
  <h3 class="popover-title">{{ column_sort_order }}<a id="close-sort-{{ category.category_id }}" data-dismiss="popover-maxy" class="btn btn-default btn-xs"><i class="fa fa-close"></i></a></h3>
  <div class="popover-content">
    <input type="number" name="sort_order" value="{{ category.sort_order }}" placeholder="{{ column_sort_order }}" id="input-sort{{ category.category_id }}" class="form-control" />
  </div>
  <div class="popover-footer">
    <a onclick="editSort('{{ category.category_id }}');" class="btn btn-primary btn-sm"><i class="fa fa-save fa-fw"></i></a><a onclick="sortClear('{{ category.category_id }}');" class="btn btn-danger btn-sm"><i class="fa fa-eraser fa-fw"></i></a>
  </div>
</div>
<div id="category-more-{{ category['category_id'] }}" class="popover popover-primary popover-more animate littleFadeInLeft">
  <div class="arrow"></div>
  <div class="popover-content">
	{% if category_general %}<a onclick="editMore('{{ category.category_id }}', 'general');" class="btn btn-primary btn-sm" data-toggle="tooltip" title="{{ text_general }}"><i class="fa fa-reorder"></i></a>{% endif %}
    {% if category_parent %}<a onclick="editMore('{{ category.category_id }}', 'parent');" class="btn btn-primary btn-sm" data-toggle="tooltip" title="{{ text_parent }}"><i class="fa fa-sitemap"></i></a>{% endif %}
	{% if category_seo %}<a onclick="editMore('{{ category.category_id }}', 'seo');" class="btn btn-primary btn-sm" data-toggle="tooltip" title="{{ text_seo }}"><i class="fa fa-link"></i></a>{% endif %}
	{% if category_filter %}<a onclick="editMore('{{ category.category_id }}', 'filter');" class="btn btn-primary btn-sm" data-toggle="tooltip" title="{{ text_filter }}"><i class="fa fa-filter"></i></a>{% endif %}
	{% if category_store %}<a onclick="editMore('{{ category.category_id }}', 'stores');" class="btn btn-primary btn-sm" data-toggle="tooltip" title="{{ text_stores }}"><i class="fa fa-flag"></i></a>{% endif %}
	{% if category_design %}<a onclick="editMore('{{ category.category_id }}', 'design');" class="btn btn-primary btn-sm" data-toggle="tooltip" title="{{ text_design }}"><i class="fa fa-paint-brush"></i></a>{% endif %}
	{% if category_top %}<span id="category-top-{{ category.category_id }}"><a onclick="editButtons('{{ category.category_id }}', 'top');" data-toggle="tooltip" title="{{ column_top }}" id="top-{{ category.category_id }}">{{ category.top }}</a><input type="hidden" name="tops" value="{{ category.tops }}" /></span>{% endif %}
  </div>
</div>
{% endfor %}
<div id="modal-category-edit" class="modal fade">
  <div class="modal-dialog modal-lg animated zoomIn">
    <div class="modal-content">
	  <div id="modal-category-content"></div>
	</div>
  </div>
</div>
</div>
{{ footer }}