<div class="blade-static" ng-if="blade.variations.length">
    <div class="form-group">
        <div class="form-input __search">
            <input placeholder="{{'platform.placeholders.search-keyword' | translate }}" ng-model="blade.searchText" ng-keyup="gridApi.grid.queueGridRefresh()" ng-trim="false">
            <button class="btn __other" style="position: relative;right: 45px;">
                <i class="btn-ico fa fa-remove" title="Clear" ng-click="blade.searchText='';gridApi.grid.queueGridRefresh()"></i>
            </button>
        </div>
    </div>
</div>
<div class="blade-static __bottom" ng-if="pageSettings.itemsPerPageCount < pageSettings.totalItems" ng-include="'pagerTemplate.html'"></div>
<div class="blade-content __medium-wide">
    <div class="blade-inner">
        <div class="inner-block" ng-init="setGridOptions({
                    data: 'blade.variations',
                    rowTemplate: 'list.row.html',
                    rowHeight: 61,
                    columnDefs: [
                        { name: 'actions', displayName: '', enableColumnResizing: false, enableSorting: false, width: 30, cellTemplate: 'list-actions.cell.html', pinnedLeft:true },
                        {
                            name: 'imageUrl', displayName: 'catalog.blades.item-variation-list.labels.picture',
                            enableColumnResizing: false, enableSorting: false, width: 60, cellTemplate: 'icon.cell.html'
                        },
                        { name: 'name', displayName: 'catalog.blades.item-variation-list.labels.name', sort: { direction: uiGridConstants.ASC }},
                        { name: 'code', displayName: 'catalog.blades.item-variation-list.labels.sku', width: 170 },
                        { name: 'manufacturerPartNumber', displayName: 'catalog.blades.item-variation-list.labels.manufacturer-part-number', width: 170}
                    ],
                    enablePaginationControls: false,
                    paginationPageSize: pageSettings.itemsPerPageCount})">
            <div class="note" ng-if="blade.variations.length == 0">{{'catalog.blades.item-variation-list.labels.no-items' | translate }}</div>
            <div class="table-wrapper" ng-if="blade.variations.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-pagination ui-grid-height></div>
                <ul class="menu __context" role="menu" id="ivr_menu">
                    <li class="menu-item" ng-click='deleteList([contextMenuEntity])' ng-if="canDeleteVariation()">
                        <i class="menu-ico fas fa-trash-alt"></i> {{'platform.commands.delete' | translate}}
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>

<script type="text/ng-template" id="list.row.html">
    <div ng-click='grid.appScope.selectVariation(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="ivr_menu"></div>
</script>
<script type="text/ng-template" id="list-actions.cell.html">
    <div class="ui-grid-actions" left-click-menu="grid.appScope.contextMenuEntity = row.entity" data-target="ivr_menu">
        <i class="fa fa-ellipsis-v"></i>
    </div>
</script>
<script type="text/ng-template" id="icon.cell.html">
    <div class="ui-grid-cell-contents">
        <div class="product-img">
            <img class="image" ng-src="{{COL_FIELD}}" ng-if="COL_FIELD">
            <i class="table-ico fas fa-image" ng-if="!COL_FIELD"></i>
        </div>
    </div>
</script>
