From 13b0a57600d98d1c92195286c3768b650dffb5cc Mon Sep 17 00:00:00 2001 From: febbweiss Date: Thu, 8 Oct 2015 11:59:53 +0000 Subject: [PATCH] Feature: display account balance --- public/account/account.controller.js | 7 ++++++- public/account/account.view.html | 17 ++++++++++++++++- public/index.html | 3 ++- test/account.controller.spec.js | 8 ++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/public/account/account.controller.js b/public/account/account.controller.js index c8080f2..9d406f0 100644 --- a/public/account/account.controller.js +++ b/public/account/account.controller.js @@ -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); diff --git a/public/account/account.view.html b/public/account/account.view.html index 8e137c4..8503fc9 100644 --- a/public/account/account.view.html +++ b/public/account/account.view.html @@ -1,3 +1,18 @@ +
@@ -17,7 +32,7 @@
-
+