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; } loadData() { const filter = { fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName', 'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMail', 'hasToMistake', 'clientFk'], include: [ { relation: 'client', scope: {fields: ['name']} }, { relation: 'worker', scope: {fields: ['name']} } ] }; return this.getData(`Departments/${this.id}`, {filter}) .then(res => this.entity = res.data); } } Controller.$inject = ['$element', '$scope', '$rootScope']; ngModule.vnComponent('vnWorkerDepartmentDescriptor', { template: require('./index.html'), controller: Controller, bindings: { department: '<' } });