49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
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: ['id', 'name']
|
|
}},
|
|
{
|
|
relation: 'worker',
|
|
scope: {
|
|
fields: ['id', 'firstName', 'lastName']
|
|
}
|
|
}
|
|
]
|
|
};
|
|
|
|
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: '<'
|
|
}
|
|
});
|