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

51 lines
1.3 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-26 12:08:37 +00:00
fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName',
2023-05-26 12:23:34 +00:00
'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMail', 'hasToMistake', 'clientFk'],
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-26 12:08:37 +00:00
}, {
relation: 'department',
scope: {fields: ['name']}
2023-05-15 08:43:06 +00:00
}
]
};
2023-05-26 12:23:34 +00:00
this.$http.get(query, {params: {filter}})
.then(res => {
this.$.department = res.data;
});
2023-05-15 08:43:06 +00:00
}
get isHr() {
return this.aclService.hasAny(['hr']);
}
}
2023-05-26 09:43:51 +00:00
ngModule.vnComponent('vnWorkerDepartmentSummary', {
2023-05-15 08:43:06 +00:00
template: require('./index.html'),
controller: Controller,
bindings: {
worker: '<'
}
});