2019-01-28 15:24:45 +00:00
|
|
|
import ngModule from '../module';
|
2020-11-23 12:41:51 +00:00
|
|
|
import Summary from 'salix/components/summary';
|
2019-01-28 15:24:45 +00:00
|
|
|
|
2020-11-23 12:41:51 +00:00
|
|
|
class Controller extends Summary {
|
2019-01-28 15:24:45 +00:00
|
|
|
get worker() {
|
|
|
|
return this._worker;
|
|
|
|
}
|
|
|
|
|
|
|
|
set worker(value) {
|
|
|
|
this._worker = value;
|
|
|
|
this.$.worker = null;
|
2019-01-29 20:45:43 +00:00
|
|
|
if (!value) return;
|
|
|
|
|
2021-02-24 15:12:44 +00:00
|
|
|
const query = `Workers/${value.id}`;
|
|
|
|
const filter = {
|
2019-01-29 20:45:43 +00:00
|
|
|
include: [
|
|
|
|
{
|
|
|
|
relation: 'user',
|
|
|
|
scope: {
|
2019-03-15 11:58:26 +00:00
|
|
|
fields: ['name', 'roleFk'],
|
|
|
|
include: [{
|
2019-01-29 20:45:43 +00:00
|
|
|
relation: 'role',
|
2019-03-15 11:58:26 +00:00
|
|
|
scope: {
|
|
|
|
fields: ['name']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
relation: 'emailUser',
|
|
|
|
scope: {
|
|
|
|
fields: ['email']
|
|
|
|
}
|
|
|
|
}]
|
2019-01-29 20:45:43 +00:00
|
|
|
}
|
2021-02-24 15:12:44 +00:00
|
|
|
},
|
|
|
|
{
|
2019-01-29 20:45:43 +00:00
|
|
|
relation: 'client',
|
2022-08-10 10:13:31 +00:00
|
|
|
scope: {fields: ['fi', 'phone']}
|
2021-02-24 15:12:44 +00:00
|
|
|
},
|
|
|
|
{
|
2021-02-19 16:45:45 +00:00
|
|
|
relation: 'boss',
|
2021-02-24 15:12:44 +00:00
|
|
|
scope: {fields: ['id', 'nickname']}
|
|
|
|
},
|
|
|
|
{
|
2019-01-29 20:45:43 +00:00
|
|
|
relation: 'sip',
|
|
|
|
scope: {fields: ['extension']}
|
2021-02-24 15:12:44 +00:00
|
|
|
},
|
|
|
|
{
|
2019-02-18 11:54:33 +00:00
|
|
|
relation: 'department',
|
|
|
|
scope: {
|
|
|
|
include: {
|
|
|
|
relation: 'department'
|
|
|
|
}
|
|
|
|
}
|
2019-01-29 20:45:43 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
this.$http.get(query, {params: {filter}}).then(res => {
|
|
|
|
this.$.worker = res.data;
|
|
|
|
});
|
2019-01-28 15:24:45 +00:00
|
|
|
}
|
2021-01-12 06:39:12 +00:00
|
|
|
|
|
|
|
get isHr() {
|
|
|
|
return this.aclService.hasAny(['hr']);
|
|
|
|
}
|
2019-01-28 15:24:45 +00:00
|
|
|
}
|
|
|
|
|
2020-07-24 12:22:30 +00:00
|
|
|
ngModule.vnComponent('vnWorkerSummary', {
|
2019-01-28 15:24:45 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
|
|
|
worker: '<'
|
|
|
|
}
|
|
|
|
});
|