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

51 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-01-28 15:24:45 +00:00
import ngModule from '../module';
class Controller {
constructor($http, $stateParams) {
Object.assign(this, {
$http,
$stateParams,
});
}
$onInit() {
this.reload();
}
reload() {
let query = `api/Workers/${this.$stateParams.id}`;
2019-01-29 20:00:27 +00:00
let filter = {
include: [
{
relation: 'user',
scope: {fields: ['name', 'email']}
}, {
relation: 'client',
scope: {fields: ['fi']}
}, {
relation: 'sip',
scope: {fields: ['extension']}
2019-02-18 11:54:33 +00:00
}, {
relation: 'department',
scope: {
include: {
relation: 'department'
}
}
2019-01-29 20:00:27 +00:00
}
]
};
this.$http.get(query, {params: {filter}}).then(res => {
2019-01-28 15:24:45 +00:00
this.worker = res.data;
});
}
}
Controller.$inject = ['$http', '$stateParams'];
ngModule.component('vnWorkerCard', {
template: require('./index.html'),
controller: Controller
});