mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-19 19:01:39 +00:00
Fix #1292
This commit is contained in:
@@ -285,8 +285,6 @@ class AccountController extends Controller
|
|||||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // long and complex but not that excessively so.
|
|
||||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null)
|
public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null)
|
||||||
@@ -306,9 +304,9 @@ class AccountController extends Controller
|
|||||||
|
|
||||||
$today = new Carbon;
|
$today = new Carbon;
|
||||||
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
|
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
|
||||||
$page = intval($request->get('page'));
|
$page = (int)$request->get('page');
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
$currencyId = intval($this->repository->getMetaValue($account, 'currency_id'));
|
$currencyId = (int)$this->repository->getMetaValue($account, 'currency_id');
|
||||||
$currency = $this->currencyRepos->findNull($currencyId);
|
$currency = $this->currencyRepos->findNull($currencyId);
|
||||||
if (0 === $currencyId) {
|
if (0 === $currencyId) {
|
||||||
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
|
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
|
||||||
@@ -320,15 +318,53 @@ class AccountController extends Controller
|
|||||||
$periods = $this->getPeriodOverview($account, $end);
|
$periods = $this->getPeriodOverview($account, $end);
|
||||||
$collector = app(JournalCollectorInterface::class);
|
$collector = app(JournalCollectorInterface::class);
|
||||||
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);
|
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);
|
||||||
if (null !== $start) {
|
|
||||||
$collector->setRange($start, $end);
|
$collector->setRange($start, $end);
|
||||||
}
|
|
||||||
$transactions = $collector->getPaginatedJournals();
|
$transactions = $collector->getPaginatedJournals();
|
||||||
$transactions->setPath(route('accounts.show', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]));
|
$transactions->setPath(route('accounts.show', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]));
|
||||||
|
$showAll = false;
|
||||||
|
|
||||||
return view(
|
return view(
|
||||||
'accounts.show',
|
'accounts.show',
|
||||||
compact('account', 'currency', 'today', 'periods', 'subTitleIcon', 'transactions', 'subTitle', 'start', 'end', 'chartUri')
|
compact('account', 'showAll', 'currency', 'today', 'periods', 'subTitleIcon', 'transactions', 'subTitle', 'start', 'end', 'chartUri')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show an account.
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @param Account $account
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
|
||||||
|
*
|
||||||
|
* @throws FireflyException
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function showAll(Request $request, Account $account)
|
||||||
|
{
|
||||||
|
if (AccountType::INITIAL_BALANCE === $account->accountType->type) {
|
||||||
|
return $this->redirectToOriginalAccount($account);
|
||||||
|
}
|
||||||
|
$today = new Carbon;
|
||||||
|
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
|
||||||
|
$page = (int)$request->get('page');
|
||||||
|
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
|
||||||
|
$currencyId = (int)$this->repository->getMetaValue($account, 'currency_id');
|
||||||
|
$currency = $this->currencyRepos->findNull($currencyId);
|
||||||
|
if (0 === $currencyId) {
|
||||||
|
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
|
||||||
|
}
|
||||||
|
$subTitle = trans('firefly.all_journals_for_account', ['name' => $account->name]);
|
||||||
|
$periods = new Collection;
|
||||||
|
$collector = app(JournalCollectorInterface::class);
|
||||||
|
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);
|
||||||
|
$transactions = $collector->getPaginatedJournals();
|
||||||
|
$transactions->setPath(route('accounts.show.all', [$account->id]));
|
||||||
|
$showAll = true;
|
||||||
|
|
||||||
|
return view(
|
||||||
|
'accounts.show',
|
||||||
|
compact('account', 'showAll', 'currency', 'today', 'periods', 'subTitleIcon', 'transactions', 'subTitle')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
public/js/ff/accounts/show.js
vendored
5
public/js/ff/accounts/show.js
vendored
@@ -18,7 +18,7 @@
|
|||||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** global: chartUri, incomeCategoryUri, expenseCategoryUri, expenseBudgetUri, token */
|
/** global: chartUri, incomeCategoryUri, showAll, expenseCategoryUri, expenseBudgetUri, token */
|
||||||
|
|
||||||
var fixHelper = function (e, tr) {
|
var fixHelper = function (e, tr) {
|
||||||
"use strict";
|
"use strict";
|
||||||
@@ -33,11 +33,12 @@ var fixHelper = function (e, tr) {
|
|||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
if (!showAll) {
|
||||||
lineChart(chartUri, 'overview-chart');
|
lineChart(chartUri, 'overview-chart');
|
||||||
pieChart(incomeCategoryUri, 'account-cat-in');
|
pieChart(incomeCategoryUri, 'account-cat-in');
|
||||||
pieChart(expenseCategoryUri, 'account-cat-out');
|
pieChart(expenseCategoryUri, 'account-cat-out');
|
||||||
pieChart(expenseBudgetUri, 'account-budget-out');
|
pieChart(expenseBudgetUri, 'account-budget-out');
|
||||||
|
}
|
||||||
|
|
||||||
// sortable!
|
// sortable!
|
||||||
if (typeof $(".sortable-table tbody").sortable !== "undefined") {
|
if (typeof $(".sortable-table tbody").sortable !== "undefined") {
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% if not showAll %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
@@ -66,6 +67,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% if account.notes.count == 1 %}
|
{% if account.notes.count == 1 %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
@@ -94,9 +96,15 @@
|
|||||||
{% include 'list.journals' with {sorting:true, hideBills:true, hideBudgets: true, hideCategories: true, showReconcile: showReconcile} %}
|
{% include 'list.journals' with {sorting:true, hideBills:true, hideBudgets: true, hideCategories: true, showReconcile: showReconcile} %}
|
||||||
<p>
|
<p>
|
||||||
<i class="fa fa-calendar"></i>
|
<i class="fa fa-calendar"></i>
|
||||||
|
{% if periods.count > 0 %}
|
||||||
|
<a href="{{ route('accounts.show.all', [account.id]) }}">
|
||||||
|
{{ 'show_all_no_filter'|_ }}
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
<a href="{{ route('accounts.show', [account.id]) }}">
|
<a href="{{ route('accounts.show', [account.id]) }}">
|
||||||
{{ 'show_the_current_period_and_overview'|_ }}
|
{{ 'show_the_current_period_and_overview'|_ }}
|
||||||
</a>
|
</a>
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -139,21 +147,23 @@
|
|||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
var showAll = true;
|
||||||
currencySymbol = "{{ currency.symbol }}";
|
currencySymbol = "{{ currency.symbol }}";
|
||||||
var accountID = {{ account.id }};
|
var accountID = {{ account.id }};
|
||||||
|
{% if not showAll %}
|
||||||
|
showAll = false;
|
||||||
// uri's for charts:
|
// uri's for charts:
|
||||||
var chartUri = '{{ chartUri }}';
|
var chartUri = '{{ chartUri }}';
|
||||||
{% if start and end %}
|
|
||||||
var incomeCategoryUri = '{{ route('chart.account.income-category', [account.id, start.format('Ymd'), end.format('Ymd')]) }}';
|
var incomeCategoryUri = '{{ route('chart.account.income-category', [account.id, start.format('Ymd'), end.format('Ymd')]) }}';
|
||||||
var expenseCategoryUri = '{{ route('chart.account.expense-category', [account.id, start.format('Ymd'), end.format('Ymd')]) }}';
|
var expenseCategoryUri = '{{ route('chart.account.expense-category', [account.id, start.format('Ymd'), end.format('Ymd')]) }}';
|
||||||
var expenseBudgetUri = '{{ route('chart.account.expense-budget', [account.id, start.format('Ymd'), end.format('Ymd')]) }}';
|
var expenseBudgetUri = '{{ route('chart.account.expense-budget', [account.id, start.format('Ymd'), end.format('Ymd')]) }}';
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
var drawVerticalLine = '';
|
var drawVerticalLine = '';
|
||||||
{# render vertical line with text "today" #}
|
{# render vertical line with text "today" #}
|
||||||
{% if start.lte(today) and end.gte(today) %}
|
{% if start.lte(today) and end.gte(today) %}
|
||||||
drawVerticalLine = '{{ today.formatLocalized(monthAndDayFormat) }}';
|
drawVerticalLine = '{{ today.formatLocalized(monthAndDayFormat) }}';
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="js/lib/Chart.bundle.min.js?v={{ FF_VERSION }}"></script>
|
<script type="text/javascript" src="js/lib/Chart.bundle.min.js?v={{ FF_VERSION }}"></script>
|
||||||
|
@@ -92,6 +92,16 @@ Breadcrumbs::register(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Breadcrumbs::register(
|
||||||
|
'accounts.show.all',
|
||||||
|
function (BreadCrumbsGenerator $breadcrumbs, Account $account, Carbon $start = null, Carbon $end = null) {
|
||||||
|
$what = config('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||||
|
|
||||||
|
$breadcrumbs->parent('accounts.index', $what);
|
||||||
|
$breadcrumbs->push($account->name, route('accounts.show', [$account->id]));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
Breadcrumbs::register(
|
Breadcrumbs::register(
|
||||||
'accounts.reconcile',
|
'accounts.reconcile',
|
||||||
function (BreadCrumbsGenerator $breadcrumbs, Account $account) {
|
function (BreadCrumbsGenerator $breadcrumbs, Account $account) {
|
||||||
@@ -966,7 +976,7 @@ Breadcrumbs::register(
|
|||||||
if ($journals->count() > 0) {
|
if ($journals->count() > 0) {
|
||||||
$journalIds = $journals->pluck('id')->toArray();
|
$journalIds = $journals->pluck('id')->toArray();
|
||||||
$what = strtolower($journals->first()->transactionType->type);
|
$what = strtolower($journals->first()->transactionType->type);
|
||||||
$breadcrumbs->parent('transactions.index');
|
$breadcrumbs->parent('transactions.index', $what);
|
||||||
$breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.edit', $journalIds));
|
$breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.edit', $journalIds));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -983,7 +993,7 @@ Breadcrumbs::register(
|
|||||||
function (BreadCrumbsGenerator $breadcrumbs, Collection $journals) {
|
function (BreadCrumbsGenerator $breadcrumbs, Collection $journals) {
|
||||||
$journalIds = $journals->pluck('id')->toArray();
|
$journalIds = $journals->pluck('id')->toArray();
|
||||||
$what = strtolower($journals->first()->transactionType->type);
|
$what = strtolower($journals->first()->transactionType->type);
|
||||||
$breadcrumbs->parent('transactions.index');
|
$breadcrumbs->parent('transactions.index', $what);
|
||||||
$breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.delete', $journalIds));
|
$breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.delete', $journalIds));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -995,7 +1005,7 @@ Breadcrumbs::register(
|
|||||||
if ($journals->count() > 0) {
|
if ($journals->count() > 0) {
|
||||||
$journalIds = $journals->pluck('id')->toArray();
|
$journalIds = $journals->pluck('id')->toArray();
|
||||||
$what = strtolower($journals->first()->transactionType->type);
|
$what = strtolower($journals->first()->transactionType->type);
|
||||||
$breadcrumbs->parent('transactions.index');
|
$breadcrumbs->parent('transactions.index', $what);
|
||||||
$breadcrumbs->push(trans('firefly.mass_bulk_journals'), route('transactions.bulk.edit', $journalIds));
|
$breadcrumbs->push(trans('firefly.mass_bulk_journals'), route('transactions.bulk.edit', $journalIds));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@@ -112,6 +112,7 @@ Route::group(
|
|||||||
Route::get('create/{what}', ['uses' => 'AccountController@create', 'as' => 'create'])->where('what', 'revenue|asset|expense');
|
Route::get('create/{what}', ['uses' => 'AccountController@create', 'as' => 'create'])->where('what', 'revenue|asset|expense');
|
||||||
Route::get('edit/{account}', ['uses' => 'AccountController@edit', 'as' => 'edit']);
|
Route::get('edit/{account}', ['uses' => 'AccountController@edit', 'as' => 'edit']);
|
||||||
Route::get('delete/{account}', ['uses' => 'AccountController@delete', 'as' => 'delete']);
|
Route::get('delete/{account}', ['uses' => 'AccountController@delete', 'as' => 'delete']);
|
||||||
|
Route::get('show/{account}/all', ['uses' => 'AccountController@showAll', 'as' => 'show.all']);
|
||||||
Route::get('show/{account}/{start_date?}/{end_date?}', ['uses' => 'AccountController@show', 'as' => 'show']);
|
Route::get('show/{account}/{start_date?}/{end_date?}', ['uses' => 'AccountController@show', 'as' => 'show']);
|
||||||
|
|
||||||
// reconcile routes:
|
// reconcile routes:
|
||||||
|
Reference in New Issue
Block a user