[stickyHeader]="true"
idlClass="acqpl" [dataSource]="gridSource">
+ <eg-grid-toolbar-action label="New Selection List" i18n-label (onClick)="new_picklist" [disableOnRows]="createNotAppropriate"></eg-grid-toolbar-action>
+ <eg-grid-toolbar-action label="Clone Selected" i18n-label (onClick)="cloneSelected($event)" [disableOnRows]="cloneNotAppropriate"></eg-grid-toolbar-action>
+ <eg-grid-toolbar-action label="Merge Selected" i18n-label (onClick)="mergeSelected($event)" [disableOnRows]="mergeNotAppropriate"></eg-grid-toolbar-action>
+ <eg-grid-toolbar-action label="Delete Selected" i18n-label (onClick)="deleteSelected($event)" [disableOnRows]="deleteNotAppropriate"></eg-grid-toolbar-action>
+
<eg-grid-column path="name" [cellTemplate]="nameTmpl"></eg-grid-column>
</eg-grid>
import {IdlObject} from '@eg/core/idl.service';
import {NetService} from '@eg/core/net.service';
import {AuthService} from '@eg/core/auth.service';
+import {PermService} from '@eg/core/perm.service';
import {GridComponent} from '@eg/share/grid/grid.component';
import {GridDataSource} from '@eg/share/grid/grid';
import {AcqSearchService} from './acq-search.service';
gridSource: GridDataSource;
@ViewChild('acqSearchPicklistsGrid', { static: true }) picklistResultsGrid: GridComponent;
+ permissions: {[name: string]: boolean};
+ noSelectedRows: (rows: IdlObject[]) => boolean;
+ createNotAppropriate: (rows: IdlObject[]) => boolean;
+ cloneNotAppropriate: (rows: IdlObject[]) => boolean;
+ mergeNotAppropriate: (rows: IdlObject[]) => boolean;
+ deleteNotAppropriate: (rows: IdlObject[]) => boolean;
+
constructor(
private router: Router,
private route: ActivatedRoute,
private net: NetService,
private auth: AuthService,
- private acqSearch: AcqSearchService) {
+ private acqSearch: AcqSearchService,
+ private perm: PermService
+ ) {
+ this.permissions = {};
}
ngOnInit() {
this.gridSource = this.acqSearch.getAcqSearchDataSource('picklist');
+
+ this.perm.hasWorkPermHere(['CREATE_PICKLIST','UPDATE_PICKLIST','VIEW_PICKLIST']).
+ then(perms => this.permissions = perms);
+
+ this.noSelectedRows = (rows: IdlObject[]) => (rows.length === 0);
+ this.createNotAppropriate = function() { return !this.hasCreatePerm; }
+ this.cloneNotAppropriate = (rows: IdlObject[]) => (!this.permissions.CREATE_PICKLIST || this.noSelectedRows(rows));
+ this.mergeNotAppropriate = (rows: IdlObject[]) => (!this.permissions.UPDATE_PICKLIST || this.noSelectedRows(rows));
+ this.deleteNotAppropriate = (rows: IdlObject[]) => (!this.permissions.UPDATE_PICKLIST || this.noSelectedRows(rows));
}
}