<div class="blade-static">
    <div class="form-group">
        <div class="form-input __search">
            <input placeholder="{{ 'platform.placeholders.search-keyword' | translate }}" ng-model="filter.keyword" ng-keyup="$event.which === 13 && filter.criteriaChanged()" />
            <button class="btn __other" style="position: relative;right: 45px;">
                <i class="btn-ico fa fa-times-circle" title="Clear" ng-click="filter.keyword = null; filter.criteriaChanged()"></i>
            </button>
        </div>
    </div>
</div>
<div class="blade-content __medium-wide">
    <div class="blade-inner">
        <div class="inner-block" ng-init="setGridOptions({
                data: 'blade.currentEntities',
                rowTemplate: 'video-list.row.html',
                rowHeight: 60,
                useExternalSorting: true,
                enableCellEditOnFocus: false,
                columnDefs: [
                    { name: 'actions', displayName: '', enableColumnResizing: false, enableSorting: false, width: 30, cellTemplate: 'video-list-actions.cell.html', pinnedLeft: true, enableCellEdit: false },
                    { name: 'thumbnailUrl', displayName: 'catalog.blades.video-list.labels.preview', enableColumnResizing: false, enableSorting: false, width: 70, cellTemplate: 'video-list-preview.cell.html', enableCellEdit: false },
                    { name: 'name', displayName: 'catalog.blades.video-list.labels.name', width: 170, enableCellEdit: false },
                    { name: 'languageCode', displayName: 'catalog.blades.video-list.labels.language', width: 75, enableCellEdit: false },
                    { name: 'sortOrder', displayName: 'catalog.blades.video-list.labels.priority', width: 75, cellTemplate: 'video-list-priority.cell.html', enableCellEdit: true, editableCellTemplate: 'video-list-priority-edit.cell.html', sort: { direction: uiGridConstants.ASC }, validators: { required: true, minPriorityValidator: true } }
                ]})">
            <div class="table-wrapper" ng-if="blade.currentEntities.length">
                <div ui-grid="gridOptions" ui-grid-auto-resize ui-grid-save-state ui-grid-selection ui-grid-resize-columns ui-grid-move-columns ui-grid-pinning ui-grid-height ui-grid-cellNav ui-grid-validate ui-grid-edit></div>
                <ul class="menu __context" role="menu" id="video_menu">
                    <li class="menu-item" ng-click='edit(contextMenuEntity)'>
                        <i class="menu-ico fa fa-pencil"></i> {{ 'platform.commands.edit' | translate }}
                    </li>
                    <li class="menu-item" ng-click='delete(contextMenuEntity)'>
                        <i class="menu-ico fas fa-trash-alt"></i> {{ 'platform.commands.delete' | translate }}
                    </li>
                    <li class="menu-item" ng-click='copyItemID(contextMenuEntity)'>
                        <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 class="blade-static __bottom" ng-if="pageSettings.itemsPerPageCount < pageSettings.totalItems" ng-include="'pagerTemplate.html'"></div>
</div>

<script type="text/ng-template" id="video-list.row.html">
    <div ng-click="grid.appScope.blade.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="video_menu"></div>
</script>

<script type="text/ng-template" id="video-list-actions.cell.html">
    <div class="ui-grid-actions" left-click-menu="grid.appScope.contextMenuEntity = row.entity" data-target="video_menu">
        <i class="fa fa-ellipsis-v"></i>
    </div>
</script>

<script type="text/ng-template" id="video-list-preview.cell.html">
    <div class="ui-grid-cell-contents">
        <div class="product-img">
            <img class="image" ng-attr-id="{{ row.entity.id }}" ng-src="{{ COL_FIELD }}"/>
        </div>
    </div>
</script>

<script type="text/ng-template" id="video-list-priority.cell.html">
    <div class="ui-grid-cell-contents">
        <div class="form-editor form-input">
            <input class="form-input" ng-class="{ 'ng-invalid': grid.validate.isInvalid(row.entity, col.colDef) }" value="{{ COL_FIELD CUSTOM_FILTERS }}" required readonly="readonly" />
        </div>
    </div>
</script>

<script type="text/ng-template" id="video-list-priority-edit.cell.html">
    <div class="form-editor form-input">
        <input class="form-input" num-type="integer" type="number" ng-min="0" min="0" required ng-model="MODEL_COL_FIELD" ng-change="END_CELL_EDIT" ui-grid-editor />
    </div>
</script>
