diff --git a/client/client/src/credit-list/credit-list.html b/client/client/src/credit-list/credit-list.html
index 918890155..ab255e86f 100644
--- a/client/client/src/credit-list/credit-list.html
+++ b/client/client/src/credit-list/credit-list.html
@@ -10,13 +10,13 @@
-
+
{{::credit.amount | number:2}}
- {{::credit.created}}
+ {{::credit.created | date:'dd/MM/yyyy HH:mm' }}
@@ -26,4 +26,7 @@
-
\ No newline at end of file
+
+
+
+
\ No newline at end of file
diff --git a/client/client/src/credit-list/credit-list.js b/client/client/src/credit-list/credit-list.js
index a0da14e4c..a18de64aa 100644
--- a/client/client/src/credit-list/credit-list.js
+++ b/client/client/src/credit-list/credit-list.js
@@ -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'),
diff --git a/client/salix/src/components/left-menu/actions.js b/client/salix/src/components/left-menu/actions.js
index 4d4d6ee6d..30d379df1 100644
--- a/client/salix/src/components/left-menu/actions.js
+++ b/client/salix/src/components/left-menu/actions.js
@@ -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);