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

48 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() {
2023-07-14 09:51:15 +00:00
const filter = {
2019-01-29 20:00:27 +00:00
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
}
]
};
2023-07-14 09:51:15 +00:00
return Promise.all([
this.$http.get(`Workers/${this.$params.id}`, {filter})
.then(res => this.worker = res.data),
this.$http.get(`Workers/${this.$params.id}/activeContract`)
2023-07-28 12:40:03 +00:00
.then(res => this.hasWorkCenter = res.data?.workCenterFk)
2023-07-14 09:51:15 +00:00
]);
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
});