salix/modules/worker/front/department/summary/index.js

47 lines
1.1 KiB
JavaScript

import ngModule from '../../module';
import Summary from 'salix/components/summary';
class Controller extends Summary {
get department() {
return this._department;
}
set department(value) {
this._department = value;
this.$.department = null;
if (!value) return;
const query = `Departments/${value.id}`;
const filter = {
fields: ['chatName', 'notificationEmail'],
include: [
{
relation: 'client',
scope: {fields: ['name']}
},
{
relation: 'worker',
scope: {fields: ['name']}
}
]
};
this.$http.get(query, {params: {filter}}).then(res => {
this.$.worker = res.data;
});
}
get isHr() {
return this.aclService.hasAny(['hr']);
}
}
ngModule.vnComponent('vnDepartmentSummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
worker: '<'
}
});