<? if ( is_array( $this -> categories ) ):?>
  <ol>
    <? foreach ( $this -> categories as $category ):?>
    <li id="list_<?= $category['id'];?>" class="list_<?= $category['id'];?>" category="<?= $category['id'];?>">
      <div class="context_0 content content_menu">
        <span class="disclose"><span></span></span>
        <? if ( !$category['status'] ) echo '<i class="fa fa-ban fa-lg text-danger" title="Kategoria nieaktywna"></i>';?> 
        <b><?= $category['languages'][$this -> dlang]['title'];?></b>
        <div class="btn-group ml20 pull-right">
          <a href="/admin/shop_category/category_edit/id=<?= $category['id'];?>" title="Edytuj kategorię" class="btn btn-sm btn-system">
            <i class="fa fa-file-text"></i> <span class="hidden-xs">Edytuj kategorię</span>
          </a>
          <a href="#" title="Usuń kategorię" class="btn btn-sm btn-danger category-delete" category-id="<?= $category['id'];?>">
            <i class="fa fa-trash"></i> <span class="hidden-xs">Usuń kategorię</span>
          </a>
          <a href="/admin/shop_category/category_products/id=<?= $category['id'];?>" title="Lista produktów" class="btn btn-sm btn-info" category-id="<?= $category['id'];?>">
            <i class="fa fa-bars"></i> <span class="hidden-xs">Lista produków</span>
          </a>
          <? if ( $this -> level < 2 ):?>
            <a href="/admin/shop_category/category_edit/pid=<?= $category['id'];?>" title="Dodaj podkategorię" class="btn btn-sm btn-success">
              <i class="fa fa-plus-circle"></i> <span class="hidden-xs">Dodaj podkategorię</span>
            </a>
          <? endif;?>
        </div>
      </div>
      <?= \Tpl::view( 'shop-category/subcategories-list', [
              'categories' => \admin\factory\ShopCategory::subcategories( $category['id'] ),
              'level' => $this -> level + 1,
              'dlang' => $this -> dlang
            ] );?>
    </li>
    <? endforeach;?>
  </ol>
<? endif;?>