refs #5334 refactor summary
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Carlos Satorres 2023-05-29 14:46:39 +02:00
parent 2a78a912eb
commit f4e877dada
2 changed files with 15 additions and 37 deletions

View File

@ -1,20 +1,12 @@
import ngModule from '../../module';
import Section from 'salix/components/section';
class Controller extends Section {
constructor($element, $) {
super($element, $);
}
onSubmit() {
return this.$.watcher.submit()
.then(() => this.card.reload());
}
}
export default class Controller extends Section {}
ngModule.vnComponent('vnWorkerDepartmentBasicData', {
template: require('./index.html'),
controller: Controller,
bindings: {
worker: '<'
department: '<'
}
});

View File

@ -1,39 +1,25 @@
import ngModule from '../../module';
import Summary from 'salix/components/summary';
class Controller extends Summary {
get department() {
return this._department;
}
import Component from 'core/lib/component';
class Controller extends Component {
set department(value) {
this._department = value;
this.$.department = null;
this.$.summary = null;
if (!value) return;
const query = `Departments/${value.id}`;
const filter = {
fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName',
'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMail', 'hasToMistake', 'clientFk'],
include: [
{
relation: 'client',
scope: {fields: ['name']}
},
{
relation: 'worker',
scope: {fields: ['name']}
}, {
relation: 'department',
scope: {fields: ['name']}
}
{relation: 'client'},
{relation: 'worker'},
{relation: 'department'}
]
};
this.$http.get(query, {params: {filter}})
.then(res => {
this.$.department = res.data;
});
this.$http.get(`Departments/${value.id}`, {filter})
.then(res => this.$.summary = res.data);
}
get department() {
return this._department;
}
get isHr() {
@ -41,10 +27,10 @@ class Controller extends Summary {
}
}
ngModule.vnComponent('vnWorkerDepartmentSummary', {
ngModule.component('vnWorkerDepartmentSummary', {
template: require('./index.html'),
controller: Controller,
bindings: {
worker: '<'
department: '<'
}
});