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

49 lines
1.3 KiB
JavaScript
Raw Normal View History

import ngModule from '../module';
2020-04-25 09:50:04 +00:00
import DescriptorPopover from 'salix/components/descriptor-popover';
2020-04-25 09:50:04 +00:00
class Controller extends DescriptorPopover {
get worker() {
return this.entity;
}
loadData() {
2020-04-25 09:50:04 +00:00
const filter = {
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
}, {
relation: 'client',
scope: {fields: ['fi']}
2020-04-25 09:50:04 +00:00
}, {
relation: 'sip',
scope: {fields: ['extension']}
2020-04-25 09:50:04 +00:00
}, {
relation: 'department',
scope: {
include: {
relation: 'department'
}
}
}
]
};
2020-04-25 09:50:04 +00:00
return this.getData(`Workers/${this.id}`, {filter})
.then(res => this.entity = res.data);
}
}
2020-04-25 09:50:04 +00:00
ngModule.vnComponent('vnWorkerDescriptorPopover', {
slotTemplate: require('./index.html'),
controller: Controller
});