64 lines
1.7 KiB
JavaScript
64 lines
1.7 KiB
JavaScript
import ngModule from '../module';
|
|
import Section from 'salix/components/section';
|
|
|
|
class Controller extends Section {
|
|
get worker() {
|
|
return this._worker;
|
|
}
|
|
|
|
set worker(value) {
|
|
this._worker = value;
|
|
this.$.worker = null;
|
|
if (!value) return;
|
|
|
|
let query = `Workers/${value.id}`;
|
|
let filter = {
|
|
include: [
|
|
{
|
|
relation: 'user',
|
|
scope: {
|
|
fields: ['name', 'roleFk'],
|
|
include: [{
|
|
relation: 'role',
|
|
scope: {
|
|
fields: ['name']
|
|
}
|
|
},
|
|
{
|
|
relation: 'emailUser',
|
|
scope: {
|
|
fields: ['email']
|
|
}
|
|
}]
|
|
}
|
|
}, {
|
|
relation: 'client',
|
|
scope: {fields: ['fi']}
|
|
}, {
|
|
relation: 'sip',
|
|
scope: {fields: ['extension']}
|
|
}, {
|
|
relation: 'department',
|
|
scope: {
|
|
include: {
|
|
relation: 'department'
|
|
}
|
|
}
|
|
}
|
|
]
|
|
};
|
|
|
|
this.$http.get(query, {params: {filter}}).then(res => {
|
|
this.$.worker = res.data;
|
|
});
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnWorkerSummary', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
worker: '<'
|
|
}
|
|
});
|