creada clase para listar modelos relacionados con el modelo cliente

This commit is contained in:
Daniel Herrero 2017-11-30 13:37:21 +01:00
parent c8b510f09f
commit 7d32f95c23
5 changed files with 42 additions and 85 deletions

View File

@ -21,10 +21,6 @@
<vn-textfield vn-two label="IBAN" field="$ctrl.client.iban" vn-acl="administrative"></vn-textfield> <vn-textfield vn-two label="IBAN" field="$ctrl.client.iban" vn-acl="administrative"></vn-textfield>
<vn-textfield vn-one label="Vencimiento" field="$ctrl.client.dueDay" vn-acl="administrative"></vn-textfield> <vn-textfield vn-one label="Vencimiento" field="$ctrl.client.dueDay" vn-acl="administrative"></vn-textfield>
</vn-horizontal> </vn-horizontal>
<!-- <vn-horizontal>
<vn-textfield vn-one label="Crédito" field="$ctrl.client.credit" vn-acl="administrative"></vn-textfield>
<vn-textfield vn-one label="Crédito asegurado" field="$ctrl.client.creditInsurance" vn-acl="administrative"></vn-textfield>
</vn-horizontal> -->
<vn-horizontal margin-medium-bottom> <vn-horizontal margin-medium-bottom>
<vn-one> <vn-one>
<vn-check label="Recibido core VNH" field="$ctrl.client.hasCoreVnh" vn-acl="administrative"></vn-check> <vn-check label="Recibido core VNH" field="$ctrl.client.hasCoreVnh" vn-acl="administrative"></vn-check>

View File

@ -17,9 +17,6 @@ export default class Controller {
this.billData.payMethodFk = this.client.payMethodFk; this.billData.payMethodFk = this.client.payMethodFk;
this.billData.iban = this.client.iban; this.billData.iban = this.client.iban;
this.billData.dueDay = this.client.dueDay; this.billData.dueDay = this.client.dueDay;
/* this.billData.discount = this.client.discount;
this.billData.credit = this.client.credit;
this.billData.creditInsurance = this.client.creditInsurance; */
} }
} }
submit() { submit() {

View File

@ -1,45 +1,9 @@
import ngModule from '../module'; import ngModule from '../module';
import FilterClientList from '../filterClientList';
class ClientCreditList { class ClientCreditList extends FilterClientList {}
constructor($scope, $timeout) {
this.$ = $scope;
this.$timeout = $timeout;
this.waitingMgCrud = 0;
}
onOrder(field, order) {
this.filter(`${field} ${order}`);
}
filter(order) {
if (this.$.index && this.client && this.client.id) {
this.waitingMgCrud = 0;
this.$.index.filter = {
page: 1,
size: 10,
clientFk: this.client.id
};
if (order) {
this.$.index.filter.order = order;
}
this.$.index.accept();
} else if (this.waitingMgCrud > 0) {
throw new Error('Magic Crud is not loaded');
} else {
this.waitingMgCrud++;
this.$timeout(() => {
this.filter(order);
}, 250);
}
}
}
ClientCreditList.$inject = ['$scope', '$timeout'];
ngModule.component('vnClientCreditList', { ngModule.component('vnClientCreditList', {
template: require('./credit-list.html'), template: require('./credit-list.html'),
controller: ClientCreditList, controller: ClientCreditList
bindings: {
client: '<'
}
}); });

View File

@ -0,0 +1,36 @@
export default class FilterClientList {
constructor($scope, $timeout, $state) {
this.$ = $scope;
this.$timeout = $timeout;
this.waitingMgCrud = 0;
this.clientFk = $state.params.id;
}
onOrder(field, order) {
this.filter(`${field} ${order}`);
}
filter(order) {
if (this.$.index && this.clientFk) {
this.waitingMgCrud = 0;
this.$.index.filter = {
page: 1,
size: 10,
clientFk: this.clientFk
};
if (order) {
this.$.index.filter.order = order;
}
this.$.index.accept();
} else if (this.waitingMgCrud > 3) {
throw new Error('Magic Crud is not loaded');
} else {
this.waitingMgCrud++;
this.$timeout(() => {
this.filter(order);
}, 250);
}
}
}
FilterClientList.$inject = ['$scope', '$timeout', '$state'];

View File

@ -1,45 +1,9 @@
import ngModule from '../module'; import ngModule from '../module';
import FilterClientList from '../filterClientList';
class ClientGreugeList { class ClientGreugeList extends FilterClientList {}
constructor($scope, $timeout) {
this.$ = $scope;
this.$timeout = $timeout;
this.waitingMgCrud = 0;
}
onOrder(field, order) {
this.filter(`${field} ${order}`);
}
filter(order) {
if (this.$.index && this.client && this.client.id) {
this.waitingMgCrud = 0;
this.$.index.filter = {
page: 1,
size: 10,
clientFk: this.client.id
};
if (order) {
this.$.index.filter.order = order;
}
this.$.index.accept();
} else if (this.waitingMgCrud > 3) {
throw new Error('Magic Crud is not loaded');
} else {
this.waitingMgCrud++;
this.$timeout(() => {
this.filter(order);
}, 250);
}
}
}
ClientGreugeList.$inject = ['$scope', '$timeout'];
ngModule.component('vnClientGreugeList', { ngModule.component('vnClientGreugeList', {
template: require('./greuge-list.html'), template: require('./greuge-list.html'),
controller: ClientGreugeList, controller: ClientGreugeList
bindings: {
client: '<'
}
}); });