mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-05 21:53:08 -06:00
Add savings total for savings widget on dashboard
This commit is contained in:
parent
8f9b1b866b
commit
c587081fe4
@ -8,6 +8,7 @@ use Input;
|
|||||||
use Preferences;
|
use Preferences;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
|
use Steam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class HomeController
|
* Class HomeController
|
||||||
@ -60,6 +61,11 @@ class HomeController extends Controller
|
|||||||
$accounts = $repository->getFrontpageAccounts($frontPage);
|
$accounts = $repository->getFrontpageAccounts($frontPage);
|
||||||
$savings = $repository->getSavingsAccounts();
|
$savings = $repository->getSavingsAccounts();
|
||||||
|
|
||||||
|
$savingsTotal = 0;
|
||||||
|
foreach ($savings as $savingAccount) {
|
||||||
|
$savingsTotal += Steam::balance($savingAccount);
|
||||||
|
}
|
||||||
|
|
||||||
// check if all books are correct.
|
// check if all books are correct.
|
||||||
$sum = $repository->sumOfEverything();
|
$sum = $repository->sumOfEverything();
|
||||||
if ($sum != 0) {
|
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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<i class="fa fa-line-chart"></i> Savings
|
<i class="fa fa-line-chart"></i> Savings
|
||||||
|
<span class="pull-right">{!! Amount::format($savingsTotal) !!}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
@if(count($savings) == 0)
|
@if(count($savings) == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user