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

View File

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