2023-05-16 06:54:54 +00:00
|
|
|
import ngModule from '../../module';
|
2023-05-29 12:46:39 +00:00
|
|
|
import Component from 'core/lib/component';
|
2023-05-15 08:43:06 +00:00
|
|
|
|
2023-05-29 12:46:39 +00:00
|
|
|
class Controller extends Component {
|
2023-05-15 11:15:33 +00:00
|
|
|
set department(value) {
|
|
|
|
this._department = value;
|
2023-05-29 12:46:39 +00:00
|
|
|
this.$.summary = null;
|
2023-05-15 08:43:06 +00:00
|
|
|
if (!value) return;
|
|
|
|
|
|
|
|
const filter = {
|
2023-05-30 09:48:39 +00:00
|
|
|
fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName',
|
|
|
|
'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMai', 'hasToMistake', 'clientFk'],
|
2023-05-15 08:43:06 +00:00
|
|
|
include: [
|
2023-05-30 09:48:39 +00:00
|
|
|
{relation: 'client',
|
|
|
|
scope: {
|
|
|
|
fields: ['id', 'name']
|
|
|
|
}},
|
|
|
|
{
|
|
|
|
relation: 'worker',
|
|
|
|
scope: {
|
|
|
|
fields: ['id', 'firstName', 'lastName']
|
|
|
|
}
|
|
|
|
}
|
2023-05-15 08:43:06 +00:00
|
|
|
]
|
|
|
|
};
|
|
|
|
|
2023-05-29 12:46:39 +00:00
|
|
|
this.$http.get(`Departments/${value.id}`, {filter})
|
|
|
|
.then(res => this.$.summary = res.data);
|
|
|
|
}
|
|
|
|
get department() {
|
|
|
|
return this._department;
|
2023-05-15 08:43:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get isHr() {
|
|
|
|
return this.aclService.hasAny(['hr']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-29 12:46:39 +00:00
|
|
|
ngModule.component('vnWorkerDepartmentSummary', {
|
2023-05-15 08:43:06 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
2023-05-29 12:46:39 +00:00
|
|
|
department: '<'
|
2023-05-15 08:43:06 +00:00
|
|
|
}
|
|
|
|
});
|