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

48 lines
1.4 KiB
JavaScript
Raw Permalink 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 = {
2024-05-07 09:47:22 +00:00
include: [
{
relation: 'user',
scope: {
fields: ['name', 'emailVerified'],
include: {
relation: 'emailUser',
scope: {
fields: ['email']
}
}
}
}, {
relation: 'sip',
scope: {
fields: ['extension', 'secret']
}
}, {
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([
2024-05-07 09:47:22 +00:00
this.$http.get(`Workers/${this.$params.id}`, {filter})
.then(res => this.worker = res.data),
2023-07-14 09:51:15 +00:00
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
});