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

49 lines
1.4 KiB
JavaScript

import ngModule from '../module';
import ModuleCard from 'salix/components/module-card';
class Controller extends ModuleCard {
reload() {
let filter = {
include: [
{
relation: 'user',
scope: {
fields: ['name'],
include: {
relation: 'emailUser',
scope: {
fields: ['email']
}
}
}
}, {
relation: 'sip',
scope: {
fields: ['extension', 'secret']
}
}, {
relation: 'department',
scope: {
include: {
relation: 'department'
}
}
}
]
};
this.$http.get(`Workers/${this.$params.id}`, {filter})
.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;
}));
}
}
ngModule.vnComponent('vnWorkerCard', {
template: require('./index.html'),
controller: Controller
});