salix/modules/worker/front/summary/index.js

75 lines
2.0 KiB
JavaScript
Raw Normal View History

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';
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;
2024-05-07 09:47:22 +00:00
const query = `Workers/${value.id}`;
2021-02-24 15:12:44 +00:00
const filter = {
2024-05-07 09:47:22 +00:00
include: [
{
relation: 'user',
scope: {
fields: ['name', 'roleFk'],
include: [{
relation: 'role',
scope: {
fields: ['name']
}
},
{
relation: 'emailUser',
scope: {
fields: ['email']
}
}]
}
},
{
relation: 'client',
scope: {fields: ['fi', 'phone']}
},
{
relation: 'boss',
scope: {fields: ['id', 'name']}
},
{
relation: 'sip',
scope: {fields: ['extension']}
},
{
relation: 'department',
scope: {
include: {
relation: 'department',
scope: {fields: ['id', 'code', 'name']}
}
}
}
]
2019-01-29 20:45:43 +00:00
};
2024-05-07 09:47:22 +00:00
this.$http.get(query, {params: {filter}}).then(res => {
this.$.worker = res.data;
2019-01-29 20:45:43 +00:00
});
2019-01-28 15:24:45 +00:00
}
get isHr() {
return this.aclService.hasAny(['hr']);
}
2019-01-28 15:24:45 +00:00
}
ngModule.vnComponent('vnWorkerSummary', {
2019-01-28 15:24:45 +00:00
template: require('./index.html'),
controller: Controller,
bindings: {
worker: '<'
}
});