client credit list terminado

This commit is contained in:
Daniel Herrero 2017-11-28 13:21:26 +01:00
parent ea36825d35
commit f76a258fce
3 changed files with 31 additions and 15 deletions

View File

@ -10,13 +10,13 @@
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
<vn-column-header vn-one pad-medium-h field="amount" text="credit"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="created" text="Desde"></vn-column-header>
<vn-column-header vn-two pad-medium-h field="created" text="Desde"></vn-column-header>
<vn-six></vn-six>
</vn-grid-header>
<vn-one class="list list-content">
<vn-horizontal vn-one class="list list-element text-center" ng-repeat="credit in index.model.instances track by credit.id">
<vn-one pad-medium-h>{{::credit.amount | number:2}}</vn-one>
<vn-one pad-medium-h>{{::credit.created}}</vn-one>
<vn-two pad-medium-h>{{::credit.created | date:'dd/MM/yyyy HH:mm' }}</vn-two>
<vn-six></vn-six>
</vn-horizontal>
</vn-one>
@ -26,4 +26,7 @@
</vn-one>
</vn-vertical>
</vn-card>
</vn-vertical>
</vn-vertical>
<a ui-sref="clientCard.credit.create" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>
</a>

View File

@ -1,24 +1,37 @@
import ngModule from '../module';
class ClientCreditList {
constructor($scope) {
constructor($scope, $timeout) {
this.$ = $scope;
this.$timeout = $timeout;
this.waitingMgCrud = 0;
}
onOrder(field, order) {
this.filter(`${field} ${order}`);
}
filter(order) {
this.$.index.filter = {
page: 1,
size: 10,
clientFk: this.client.id
};
if (this.$.index) {
this.waitingMgCrud = 0;
this.$.index.filter = {
page: 1,
size: 10,
clientFk: this.client.id
};
if (order) {
this.$.index.filter.order = order;
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);
});
}
this.$.index.accept();
}
$onChanges() {
@ -27,7 +40,7 @@ class ClientCreditList {
}
}
}
ClientCreditList.$inject = ['$scope'];
ClientCreditList.$inject = ['$scope', '$timeout'];
ngModule.component('vnClientCreditList', {
template: require('./credit-list.html'),

View File

@ -9,7 +9,7 @@ export default class MenuActions {
switchItem() {
if (!this.items || !this.items.length) return;
let stateName = this.$state.current.name.replace('create', 'list').replace('edit', 'list');
let stateName = this.$state.current.name.replace('.create', '.list').replace('.edit', '.list');
for (let i = 0; i < this.items.length; i++) {
this.items[i].active = (this.items[i].href === stateName);