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

46 lines
1.2 KiB
JavaScript

import ngModule from '../../module';
import Component from 'core/lib/component';
class Controller extends Component {
set department(value) {
this._department = value;
this.$.summary = null;
if (!value) return;
const filter = {
fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName',
'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMai', 'hasToMistake', 'clientFk'],
include: [
{relation: 'client',
scope: {
fields: ['id', 'name']
}},
{
relation: 'worker',
scope: {
fields: ['id', 'firstName', 'lastName']
}
}
]
};
this.$http.get(`Departments/${value.id}`, {filter})
.then(res => this.$.summary = res.data);
}
get department() {
return this._department;
}
get isHr() {
return this.aclService.hasAny(['hr']);
}
}
ngModule.component('vnWorkerDepartmentSummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
department: '<'
}
});