<div class="blade-static" ng-if="blade.currentEntities.length">
  <div class="form-group">
    <vc-item-search blade="blade"></vc-item-search>
  </div>
</div>
<div class="blade-content __medium-wide">
  <div class="blade-inner">
    <div class="inner-block" ng-init="setGridOptions({
                    useExternalSorting: true,
                    rowTemplate: 'catalog-list.row.html',
                    infiniteScrollRowsFromEnd: 10,
                    rowHeight: 60,
                    columnDefs: [
                                { name: 'actions', displayName: '', enableColumnResizing: false, enableSorting: false, width: 30, cellTemplate: 'catalog-list-actions.cell.html', pinnedLeft:true },
                                {
                                    displayName: 'catalog.blades.catalogs-list.labels.name', name: 'name',
                                    sort: { direction: uiGridConstants.ASC }, cellTemplate: 'catalog-list-name.cell.html'
                                }
                    ]})">
      <div class="table-wrapper" ng-if="blade.currentEntities.length">
        <div ui-grid="gridOptions" ui-grid-auto-resize ui-grid-save-state ui-grid-resize-columns ui-grid-move-columns ui-grid-pinning ui-grid-height ui-grid-infinite-scroll> </div>
        <ul class="menu __context" role="menu" id="cl_menu">
          <li class="menu-item" ng-click='editCatalog(contextMenuEntity)' va-permission="catalog:read" security-scopes="contextMenuEntity.securityScopes">
            <i class="menu-ico fa fa-edit"></i> {{'platform.commands.manage' | translate}}
          </li>
          <li class="menu-item" ng-click='deleteCatalog(contextMenuEntity)' va-permission="catalog:delete">
            <i class="menu-ico fas fa-trash-alt"></i> {{'platform.commands.delete' | translate}}
          </li>
          <li class="menu-item" ng-click='copyItemID(contextMenuEntity)' va-permission="catalog:read">
            <i class="menu-ico far fa-copy"></i> {{ 'catalog.commands.copy-id' | translate }}
          </li>
        </ul>
      </div>
      <div class="note" ng-if="!blade.currentEntities.length">{{ 'platform.list.no-data' | translate }}</div>
    </div>
  </div>
</div>

<script type="text/ng-template" id="catalog-list.row.html">
  <div ng-click='grid.appScope.selectNode(row.entity)' ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.uid" ui-grid-one-bind-id-grid="rowRenderIndex + '-' + col.uid + '-cell'" class="ui-grid-cell" ng-class="{'ui-grid-row-header-cell': col.isRowHeader, '__hovered': grid.appScope.contextMenuEntity === row.entity, '__selected': row.entity.id===grid.appScope.selectedNodeId }" role="{{col.isRowHeader ? 'rowheader' : 'gridcell' }}" ui-grid-cell context-menu="grid.appScope.contextMenuEntity = row.entity" data-target="cl_menu"></div>
</script>

<script type="text/ng-template" id="catalog-list-actions.cell.html">
  <div class="ui-grid-actions" left-click-menu="grid.appScope.contextMenuEntity = row.entity" data-target="cl_menu">
    <i class="fa fa-ellipsis-v"></i>
  </div>
</script>
<script type="text/ng-template" id="catalog-list-name.cell.html">
  <div class="ui-grid-cell-contents">
    <i class="table-ico fa" ng-class="row.entity.isVirtual ? 'fa-cloud' : 'fa-folder'"></i>
    <div class="inner-contents">
      <div class="table-t">{{COL_FIELD}}</div>
      <div class="table-descr" ng-if="row.entity.isVirtual">
        <span class="label">{{ 'catalog.blades.catalogs-list.labels.virtual' | translate }}</span>
      </div>
    </div>
  </div>
</script>
