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

47 lines
1.1 KiB
JavaScript
Raw Normal View History

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