Feature: display account balance

This commit is contained in:
2015-10-08 11:59:53 +00:00
parent 784fb188d2
commit 13b0a57600
4 changed files with 32 additions and 3 deletions

View File

@@ -65,6 +65,7 @@
vm.dataLoading = false;
vm.entries = [];
vm.balance = undefined;
vm.categories = [];
vm.sub_categories = [];
vm.account = undefined;
@@ -92,6 +93,7 @@
AccountService.list($routeParams.account_id)
.then(function(response) {
if( response.success ) {
vm.balance = response.data.balance;
vm.entries = response.data.entries;
} else {
FlashService.error(response.message);
@@ -104,6 +106,7 @@
AccountService.create(vm.account, vm.entry)
.then( function(response) {
if( response.success) {
vm.balance = response.data.balance;
vm.entries = response.data.entries;
} else {
FlashService.error(response.message);
@@ -120,7 +123,8 @@
AccountService.drop(vm.account, entry)
.then(function(response) {
if( response.success ) {
vm.entries = response.data.entries;
vm.balance = response.data.balance;
vm.entries = response.data.entries;
} else {
FlashService.error( response.message );
}
@@ -134,6 +138,7 @@
.then( function(response) {
vm.dataLoading = false;
if( response.success ) {
vm.balance = response.data.balance;
var index = vm.entries.map(function (item) {
return item._id;
}).indexOf(origin._id);