import ngModule from '../../module'; import Descriptor from 'salix/components/descriptor'; class Controller extends Descriptor { constructor($element, $, $rootScope) { super($element, $); this.$rootScope = $rootScope; } get department() { return this.entity; } set department(value) { this.entity = value; } filterDepartments(department, event) { if (event.defaultPrevented) return; event.preventDefault(); event.stopPropagation(); this.$state.go(`worker.index`, {q: JSON.stringify({departmentFk: department.id})}); } deleteDepartment() { return this.$http.delete(`Departments/${this.id}`) .then(() => { this.$state.go('worker.department'); this.vnApp.showSuccess(this.$t('Department deleted.')); }); } } Controller.$inject = ['$element', '$scope', '$rootScope']; ngModule.vnComponent('vnWorkerDepartmentDescriptor', { template: require('./index.html'), controller: Controller, bindings: { department: '<' } });