<div class="blade-static">
    <div class="form-group searchrow">
        <div class="form-input" ng-class="{'column-half': blade.exportFeaturesEnabled, 'column': !blade.exportFeaturesEnabled}">
            <input placeholder="{{ 'platform.placeholders.search-keyword' | translate }}" ng-model="filter.keyword" ng-keyup="$event.which === 13 && filter.criteriaChanged()">
            <button class="btn" title="Clear" ng-click="filter.keyword=null;filter.criteriaChanged()"></button>
        </div>
        <ui-select ng-model="filter.current" ng-change="filter.change()" class="column-half" ng-if="blade.exportFeaturesEnabled">
            <ui-select-match allow-clear="true" placeholder="{{'export.blades.export-generic-viewer.placeholders.select-filter' | translate}}">{{$select.selected.name | translate}}</ui-select-match>
            <ui-select-choices repeat="x in exportSearchFilters | filter: $select.search">
                <span ng-bind-html="x.name | translate | highlight: $select.search"></span>
            </ui-select-choices>
        </ui-select>
        <a href="" ng-click="filter.edit()" class="filter-edit" ng-if="blade.exportFeaturesEnabled"><i class="fa fa-pencil"></i></a>
    </div>
</div>
<div class="blade-static __bottom" ng-if="pageSettings.itemsPerPageCount < pageSettings.totalItems" ng-include="'pagerTemplate.html'"></div>
<div class="blade-content __xlarge-wide">
    <div class="blade-inner">
        <div class="inner-block" ng-init="setGridOptions({
                    data: 'blade.currentEntities',
                    useExternalSorting: true,
                    rowTemplate: 'assignment-list.row.html',
                    columnDefs: [
                        { name: 'actions', displayName: '', enableColumnResizing: false, enableSorting: false, width: 30, cellTemplate: 'list-actions.cell.html', pinnedLeft:true },
                        { name: 'name', displayName: 'pricing.blades.assignment-list.labels.name' },
                        { name: 'catalog', displayName: 'pricing.blades.assignment-list.labels.catalog', enableSorting: false},
                        { name: 'pricelist.name', displayName: 'pricing.blades.assignment-list.labels.pricelist' },
                        { name: 'pricelist.currency', displayName: 'pricing.blades.assignment-list.labels.pricelist-currency' },
                        { name: 'priority', displayName: 'pricing.blades.assignment-list.labels.priority', width: 72, sort: { direction: uiGridConstants.DESC } },
                        { name: 'startDate', displayName: 'pricing.blades.assignment-list.labels.activation', width: 87 },
                        { name: 'endDate', displayName: 'pricing.blades.assignment-list.labels.expiration', width: 87 },
                        { name: 'modifiedDate', displayName: 'pricing.blades.assignment-list.labels.last-modified', width: 87 },
                        { name: 'modifiedBy', displayName: 'pricing.blades.assignment-list.labels.modified-by', width: 87, headerTooltip: 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></div>
                <ul class="menu __context" role="menu" id="pas_menu">
                    <li class="menu-item" ng-click='deleteList([contextMenuEntity])' va-permission="pricing:delete">
                        <i class="menu-ico fas fa-trash-alt"></i> {{'platform.commands.delete' | 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="assignment-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="pas_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="pas_menu">
        <em class="fa fa-ellipsis-v"></em>
    </div>
</script>
