49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
import ngModule from '../module';
|
|
import DescriptorPopover from 'salix/components/descriptor-popover';
|
|
|
|
class Controller extends DescriptorPopover {
|
|
get worker() {
|
|
return this.entity;
|
|
}
|
|
|
|
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'
|
|
}
|
|
}
|
|
}
|
|
]
|
|
};
|
|
|
|
return this.getData(`Workers/${this.id}`, {filter})
|
|
.then(res => this.entity = res.data);
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnWorkerDescriptorPopover', {
|
|
slotTemplate: require('./index.html'),
|
|
controller: Controller
|
|
});
|