65 lines
1.6 KiB
JavaScript
65 lines
1.6 KiB
JavaScript
import ngModule from '../module';
|
|
|
|
class Controller {
|
|
constructor($http, $stateParams) {
|
|
Object.assign(this, {
|
|
$http,
|
|
$stateParams,
|
|
});
|
|
}
|
|
|
|
$onInit() {
|
|
this.reload();
|
|
}
|
|
|
|
reload() {
|
|
let query = `Workers/${this.$stateParams.id}`;
|
|
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'
|
|
}
|
|
}
|
|
}, {
|
|
relation: 'phones',
|
|
scope: {
|
|
fields: ['phone'],
|
|
order: 'typeFk ASC'
|
|
}
|
|
}
|
|
]
|
|
};
|
|
|
|
this.$http.get(query, {params: {filter}}).then(res => {
|
|
this.worker = res.data;
|
|
});
|
|
}
|
|
}
|
|
|
|
Controller.$inject = ['$http', '$stateParams'];
|
|
|
|
ngModule.component('vnWorkerCard', {
|
|
template: require('./index.html'),
|
|
controller: Controller
|
|
});
|