2019-02-15 11:39:21 +00:00
|
|
|
import ngModule from '../module';
|
2020-04-25 09:50:04 +00:00
|
|
|
import DescriptorPopover from 'salix/components/descriptor-popover';
|
2019-02-15 11:39:21 +00:00
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
class Controller extends DescriptorPopover {
|
|
|
|
get worker() {
|
|
|
|
return this.entity;
|
2019-02-15 11:39:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
loadData() {
|
2020-04-25 09:50:04 +00:00
|
|
|
const filter = {
|
2019-02-15 11:39:21 +00:00
|
|
|
include: [
|
|
|
|
{
|
|
|
|
relation: 'user',
|
2019-03-15 11:58:26 +00:00
|
|
|
scope: {
|
|
|
|
fields: ['name'],
|
|
|
|
include: {
|
|
|
|
relation: 'emailUser',
|
|
|
|
scope: {
|
|
|
|
fields: ['email']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-25 09:50:04 +00:00
|
|
|
}, {
|
2019-02-15 11:39:21 +00:00
|
|
|
relation: 'client',
|
|
|
|
scope: {fields: ['fi']}
|
2020-04-25 09:50:04 +00:00
|
|
|
}, {
|
2019-02-15 11:39:21 +00:00
|
|
|
relation: 'sip',
|
|
|
|
scope: {fields: ['extension']}
|
2020-04-25 09:50:04 +00:00
|
|
|
}, {
|
2019-02-19 14:09:50 +00:00
|
|
|
relation: 'department',
|
|
|
|
scope: {
|
|
|
|
include: {
|
|
|
|
relation: 'department'
|
|
|
|
}
|
|
|
|
}
|
2019-02-15 11:39:21 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
return this.getData(`Workers/${this.id}`, {filter})
|
|
|
|
.then(res => this.entity = res.data);
|
2019-02-15 11:39:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-25 09:50:04 +00:00
|
|
|
ngModule.vnComponent('vnWorkerDescriptorPopover', {
|
|
|
|
slotTemplate: require('./index.html'),
|
|
|
|
controller: Controller
|
2019-02-15 11:39:21 +00:00
|
|
|
});
|