diff --git a/modules/client/back/models/defaulter.json b/modules/client/back/models/defaulter.json index baad79ec4..03d68ea71 100644 --- a/modules/client/back/models/defaulter.json +++ b/modules/client/back/models/defaulter.json @@ -39,11 +39,6 @@ "type": "belongsTo", "model": "PayMethod", "foreignKey": "payMethod" - }, - "businessType": { - "type":"belongsTo", - "model": "businessType", - "foreignKey": "businessTypeFk" } } } \ No newline at end of file diff --git a/modules/client/front/defaulter/index.html b/modules/client/front/defaulter/index.html index 4832487b4..cf880e0f7 100644 --- a/modules/client/front/defaulter/index.html +++ b/modules/client/front/defaulter/index.html @@ -4,7 +4,7 @@ filter="::$ctrl.filter" limit="20" order="amount DESC" - data="defaulters" + data="$ctrl.defaulters" on-data-change="$ctrl.reCheck()" auto-load="true"> @@ -54,7 +54,7 @@ Client - + Es trabajador @@ -97,7 +97,7 @@ - + diff --git a/modules/client/front/defaulter/index.js b/modules/client/front/defaulter/index.js index 6fb1f5b2c..920248547 100644 --- a/modules/client/front/defaulter/index.js +++ b/modules/client/front/defaulter/index.js @@ -5,7 +5,7 @@ import UserError from 'core/lib/user-error'; export default class Controller extends Section { constructor($element, $) { super($element, $); - this.defaulter = {}; + this.defaulters = []; this.checkedDefaulers = []; this.smartTableOptions = { @@ -62,14 +62,6 @@ export default class Controller extends Section { { field: 'defaulterSinced', datepicker: true - }, - { - field: 'businessType', - autocomplete: { - url: 'Clients', - showField: 'businessTypeFk', - valueField: 'id' - } } ] }; @@ -77,6 +69,18 @@ export default class Controller extends Section { this.getBalanceDueTotal(); } + set defaulters(value) { + if (!value || !value.length) return; + for (let defaulter of value) + defaulter.isWorker = defaulter.businessType === 'worker'; + + this._defaulters = value; + } + + get defaulters() { + return this._defaulters; + } + get checked() { const clients = this.$.model.data || []; const checkedLines = []; @@ -160,7 +164,7 @@ export default class Controller extends Section { switch (param) { case 'creditInsurance': case 'amount': - case 'businessTypeFk': + case 'businessType': case 'clientFk': case 'workerFk': case 'country': @@ -186,11 +190,6 @@ export default class Controller extends Section { return [minHour, maxHour]; } - - isWorker() { - if (businessType === 'worker') - return true; - } } ngModule.vnComponent('vnClientDefaulter', {