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

59 lines
1.4 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',
2019-03-15 11:58:26 +00:00
scope: {
fields: ['name'],
include: {
relation: 'emailUser',
scope: {
fields: ['email']
}
}
}
2019-02-20 08:16:19 +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
}
]
};
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
});