This commit is contained in:
James Cole 2018-05-26 07:25:22 +02:00
parent fcf9b782c1
commit 4031057bc0
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
3 changed files with 36 additions and 21 deletions

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Support\Binder;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use Illuminate\Routing\Route;
use Illuminate\Support\Collection;
use Log;
@ -44,22 +45,35 @@ class AccountList implements BinderInterface
public static function routeBinder(string $value, Route $route): Collection
{
if (auth()->check()) {
$list = [];
$incoming = explode(',', $value);
foreach ($incoming as $entry) {
$list[] = (int)$entry;
$collection = new Collection;
if ($value === 'allAssetAccounts') {
/** @var \Illuminate\Support\Collection $collection */
$collection = auth()->user()->accounts()
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->where('account_types.type', AccountType::ASSET)
->get(['accounts.*']);
}
$list = array_unique($list);
if (\count($list) === 0) {
Log::error('Account list is empty.');
throw new NotFoundHttpException; // @codeCoverageIgnore
if ($value !== 'allAssetAccounts') {
$list = [];
$incoming = explode(',', $value);
foreach ($incoming as $entry) {
$list[] = (int)$entry;
}
$list = array_unique($list);
if (\count($list) === 0) {
Log::error('Account list is empty.');
throw new NotFoundHttpException; // @codeCoverageIgnore
}
/** @var \Illuminate\Support\Collection $collection */
$collection = auth()->user()->accounts()
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->whereIn('accounts.id', $list)
->get(['accounts.*']);
}
/** @var \Illuminate\Support\Collection $collection */
$collection = auth()->user()->accounts()
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->whereIn('accounts.id', $list)
->get(['accounts.*']);
if ($collection->count() > 0) {
$collection = $collection->sortBy(
function (Account $account) {

View File

@ -153,7 +153,7 @@ body.waiting * {
}
span.info-box-text a, span.info-box-number a {
color: #000;
color: #fff;
}
span.info-box-icon a {
@ -161,7 +161,7 @@ span.info-box-icon a {
}
span.info-box-text a:hover, span.info-box-number a:hover {
color: #000;
color: #fff;
text-decoration: underline;
}
@ -169,4 +169,4 @@ span.info-box-text a:hover, span.info-box-number a:hover {
max-height: 300px;
overflow-y: auto;
overflow-x: hidden;
}
}

View File

@ -6,7 +6,8 @@
<span class="info-box-icon"><i class="fa fa-balance-scale"></i></span>
<div class="info-box-content">
<span class="info-box-text">{{ 'balance'|_ }}</span>
<span class="info-box-text">
<a href="{{ route('reports.report.default', ['allAssetAccounts','currentMonthStart','currentMonthEnd']) }}">{{ 'balance'|_ }}</a></span>
<span class="info-box-number" id="box-balance-sums"></span>
<div class="progress" id="box-balance-progress">
@ -14,7 +15,6 @@
</div>
<span class="progress-description">
<span id="box-balance-list" ></span>
<!--<span title="{{ 'expenses'|_ }}" id="box-balance-out"></span> / <span title="{{ 'income'|_ }}" id="box-balance-in"></span>-->
</span>
</div>
</div>
@ -26,7 +26,7 @@
<span class="info-box-icon"><i class="fa fa-calendar-o"></i></span>
<div class="info-box-content">
<span class="info-box-text">{{ 'bills_to_pay'|_ }}</span>
<span class="info-box-text"><a href="{{ route('bills.index') }}">{{ 'bills_to_pay'|_ }}</a></span>
<span class="info-box-number" id="box-bills-unpaid"></span>
<div class="progress">
@ -45,7 +45,7 @@
<div class="info-box bg-green-gradient" id="box-left-to-spend-box">
<span class="info-box-icon"><i class="fa fa-money"></i></span>
<div class="info-box-content">
<span class="info-box-text" id="box-left-to-spend-text">{{ 'left_to_spend'|_ }}</span>
<span class="info-box-text"><a id="box-left-to-spend-text" href="{{ route('budgets.index') }}">{{ 'left_to_spend'|_ }}</a></span>
<span class="info-box-number" id="box-left-to-spend"></span>
<div class="progress">
@ -65,7 +65,8 @@
<span class="info-box-icon"><i class="fa fa-line-chart"></i></span>
<div class="info-box-content">
<span class="info-box-text">{{ 'net_worth'|_ }}</span>
<span class="info-box-text">
<a href="{{ route('reports.report.default', ['allAssetAccounts','currentYearStart','currentYearEnd']) }}">{{ 'net_worth'|_ }}</a></span>
<span class="info-box-number" id="box-net-worth"></span>
<div class="progress">