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

60 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-01-28 15:24:45 +00:00
import ngModule from '../module';
2020-04-25 09:50:04 +00:00
import Descriptor from 'salix/components/descriptor';
2019-01-28 15:24:45 +00:00
2020-04-25 09:50:04 +00:00
class Controller extends Descriptor {
2019-10-21 12:21:52 +00:00
get worker() {
return this.entity;
2019-10-21 12:21:52 +00:00
}
set worker(value) {
this.entity = value;
}
2019-10-21 12:21:52 +00:00
loadData() {
const filter = {
include: [
{
relation: 'user',
scope: {
fields: ['name'],
include: {
relation: 'emailUser',
scope: {
fields: ['email']
}
}
}
}, {
relation: 'client',
scope: {
fields: ['fi']
}
}, {
relation: 'sip',
scope: {
fields: ['extension']
}
}, {
relation: 'department',
scope: {
include: {
relation: 'department'
}
}
}
]
2019-10-21 12:21:52 +00:00
};
return this.getData(`Workers/${this.id}`, {filter})
.then(res => this.entity = res.data);
2019-10-21 12:21:52 +00:00
}
}
2020-04-25 09:50:04 +00:00
ngModule.vnComponent('vnWorkerDescriptor', {
2019-01-28 15:24:45 +00:00
template: require('./index.html'),
2019-10-21 12:21:52 +00:00
controller: Controller,
2019-01-28 15:24:45 +00:00
bindings: {
worker: '<'
}
});