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

49 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-01-28 15:24:45 +00:00
import ngModule from '../module';
2019-11-10 10:08:44 +00:00
import ModuleCard from 'salix/components/module-card';
2019-01-28 15:24:45 +00:00
2019-11-10 10:08:44 +00:00
class Controller extends ModuleCard {
2019-01-28 15:24:45 +00:00
reload() {
2019-01-29 20:00:27 +00:00
let filter = {
include: [
{
relation: 'user',
2019-03-15 11:58:26 +00:00
scope: {
fields: ['name'],
include: {
relation: 'emailUser',
scope: {
fields: ['email']
}
}
}
2019-11-10 10:08:44 +00:00
}, {
2019-01-29 20:00:27 +00:00
relation: 'sip',
2019-03-08 08:41:53 +00:00
scope: {
fields: ['extension', 'secret']
}
2019-02-18 11:54:33 +00:00
}, {
relation: 'department',
scope: {
include: {
relation: 'department'
}
}
2019-01-29 20:00:27 +00:00
}
]
};
2019-11-10 10:08:44 +00:00
this.$http.get(`Workers/${this.$params.id}`, {filter})
2023-07-07 07:30:04 +00:00
.then(res => this.worker = res.data)
.then(() =>
this.$http.get(`Workers/${this.$params.id}/activeContract`)
.then(res => {
if (res.data) this.worker.hasWorkCenter = res.data.workCenterFk;
}));
2019-01-28 15:24:45 +00:00
}
}
ngModule.vnComponent('vnWorkerCard', {
2019-01-28 15:24:45 +00:00
template: require('./index.html'),
controller: Controller
});