salix/modules/worker/front/department/descriptor/index.js

47 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-05-16 06:54:54 +00:00
import ngModule from '../../module';
2023-05-15 11:15:33 +00:00
import Descriptor from 'salix/components/descriptor';
class Controller extends Descriptor {
constructor($element, $, $rootScope) {
super($element, $);
this.$rootScope = $rootScope;
}
2023-05-16 11:10:26 +00:00
get department() {
return this.entity;
}
2023-05-15 11:15:33 +00:00
2023-05-16 11:10:26 +00:00
set department(value) {
this.entity = value;
}
loadData() {
const filter = {
2023-05-26 12:08:37 +00:00
fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName',
2023-05-26 12:23:34 +00:00
'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMail', 'hasToMistake', 'clientFk'],
2023-05-16 11:10:26 +00:00
include: [
{
relation: 'client',
2023-05-26 12:08:37 +00:00
scope: {fields: ['name']}
},
{
relation: 'worker',
scope: {fields: ['name']}
2023-05-16 11:10:26 +00:00
}
]
};
2023-05-15 11:15:33 +00:00
return this.getData(`Departments/${this.id}`, {filter})
2023-05-16 11:10:26 +00:00
.then(res => this.entity = res.data);
}
2023-05-15 11:15:33 +00:00
}
Controller.$inject = ['$element', '$scope', '$rootScope'];
ngModule.vnComponent('vnWorkerDepartmentDescriptor', {
template: require('./index.html'),
controller: Controller,
bindings: {
department: '<'
2023-05-15 11:15:33 +00:00
}
});