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() {
|
2020-04-30 10:48:52 +00:00
|
|
|
return this.entity;
|
2019-10-21 12:21:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set worker(value) {
|
2020-04-30 10:48:52 +00:00
|
|
|
this.entity = value;
|
|
|
|
}
|
2019-10-21 12:21:52 +00:00
|
|
|
|
2020-04-30 10:48: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
|
|
|
};
|
2020-04-30 10:48: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: '<'
|
|
|
|
}
|
|
|
|
});
|