mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-16 14:48:11 +00:00
Code cleanup that (hopefully) matches style CI
This commit is contained in:
@@ -32,7 +32,9 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Controllers\PeriodOverview;
|
||||
use FireflyIII\Support\Http\Controllers\UserNavigation;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Collection;
|
||||
use View;
|
||||
|
||||
@@ -51,6 +53,7 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* ShowController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function __construct()
|
||||
@@ -63,7 +66,7 @@ class ShowController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('mainTitleIcon', 'fa-credit-card');
|
||||
app('view')->share('title', (string)trans('firefly.accounts'));
|
||||
app('view')->share('title', (string) trans('firefly.accounts'));
|
||||
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
|
||||
@@ -77,13 +80,13 @@ class ShowController extends Controller
|
||||
/**
|
||||
* Show an account.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Account $account
|
||||
* @param Request $request
|
||||
* @param Account $account
|
||||
* @param Carbon|null $start
|
||||
* @param Carbon|null $end
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||
* @throws Exception
|
||||
* @return RedirectResponse|Redirector|View
|
||||
*/
|
||||
public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
@@ -103,12 +106,12 @@ class ShowController extends Controller
|
||||
$objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
|
||||
$today = new Carbon;
|
||||
$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $account->accountType->type));
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
$page = (int) $request->get('page');
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
$currency = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
||||
$fStart = $start->formatLocalized($this->monthAndDayFormat);
|
||||
$fEnd = $end->formatLocalized($this->monthAndDayFormat);
|
||||
$subTitle = (string)trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
|
||||
$subTitle = (string) trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
|
||||
$chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
|
||||
$firstTransaction = $this->repository->oldestJournalDate($account) ?? $start;
|
||||
$periods = $this->getAccountPeriodOverview($account, $firstTransaction, $end);
|
||||
@@ -123,13 +126,25 @@ class ShowController extends Controller
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath(route('accounts.show', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]));
|
||||
$showAll = false;
|
||||
$balance = app('steam')->balance($account, $end);
|
||||
$balance = app('steam')->balance($account, $end);
|
||||
|
||||
return view(
|
||||
'accounts.show',
|
||||
compact(
|
||||
'account', 'showAll', 'objectType', 'currency', 'today', 'periods', 'subTitleIcon', 'groups', 'subTitle', 'start', 'end',
|
||||
'chartUri', 'location','balance'
|
||||
'account',
|
||||
'showAll',
|
||||
'objectType',
|
||||
'currency',
|
||||
'today',
|
||||
'periods',
|
||||
'subTitleIcon',
|
||||
'groups',
|
||||
'subTitle',
|
||||
'start',
|
||||
'end',
|
||||
'chartUri',
|
||||
'location',
|
||||
'balance'
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -139,8 +154,9 @@ class ShowController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Account $account
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||
*
|
||||
* @throws Exception
|
||||
* @return RedirectResponse|Redirector|View
|
||||
*/
|
||||
public function showAll(Request $request, Account $account)
|
||||
{
|
||||
@@ -156,10 +172,10 @@ class ShowController extends Controller
|
||||
$today = new Carbon;
|
||||
$start = $this->repository->oldestJournalDate($account) ?? Carbon::now()->startOfMonth();
|
||||
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
|
||||
$page = (int)$request->get('page');
|
||||
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
|
||||
$page = (int) $request->get('page');
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
$currency = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
||||
$subTitle = (string)trans('firefly.all_journals_for_account', ['name' => $account->name]);
|
||||
$subTitle = (string) trans('firefly.all_journals_for_account', ['name' => $account->name]);
|
||||
$periods = new Collection;
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
@@ -173,10 +189,22 @@ class ShowController extends Controller
|
||||
return view(
|
||||
'accounts.show',
|
||||
compact(
|
||||
'account', 'showAll', 'location', 'objectType', 'isLiability', 'currency', 'today',
|
||||
'chartUri', 'periods', 'subTitleIcon', 'groups', 'subTitle', 'start', 'end', 'balance'
|
||||
'account',
|
||||
'showAll',
|
||||
'location',
|
||||
'objectType',
|
||||
'isLiability',
|
||||
'currency',
|
||||
'today',
|
||||
'chartUri',
|
||||
'periods',
|
||||
'subTitleIcon',
|
||||
'groups',
|
||||
'subTitle',
|
||||
'start',
|
||||
'end',
|
||||
'balance'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user