Add savings total for savings widget on dashboard

This commit is contained in:
Balazs Varkonyi 2015-04-09 11:52:35 +02:00
parent 8f9b1b866b
commit c587081fe4
2 changed files with 8 additions and 1 deletions

View File

@ -8,6 +8,7 @@ use Input;
use Preferences;
use Redirect;
use Session;
use Steam;
/**
* Class HomeController
@ -60,6 +61,11 @@ class HomeController extends Controller
$accounts = $repository->getFrontpageAccounts($frontPage);
$savings = $repository->getSavingsAccounts();
$savingsTotal = 0;
foreach ($savings as $savingAccount) {
$savingsTotal += Steam::balance($savingAccount);
}
// check if all books are correct.
$sum = $repository->sumOfEverything();
if ($sum != 0) {
@ -77,7 +83,7 @@ class HomeController extends Controller
}
}
return view('index', compact('count', 'title', 'savings', 'subTitle', 'mainTitleIcon', 'transactions'));
return view('index', compact('count', 'title', 'savings', 'subTitle', 'mainTitleIcon', 'transactions', 'savingsTotal'));
}

View File

@ -55,6 +55,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-line-chart"></i> Savings
<span class="pull-right">{!! Amount::format($savingsTotal) !!}</span>
</div>
<div class="panel-body">
@if(count($savings) == 0)