mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 00:27:30 +00:00
Fix for issue #1167
This commit is contained in:
@@ -285,68 +285,46 @@ class AccountController extends Controller
|
|||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function show(Request $request, Account $account, string $moment = '')
|
public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null)
|
||||||
{
|
{
|
||||||
if (AccountType::INITIAL_BALANCE === $account->accountType->type) {
|
if (AccountType::INITIAL_BALANCE === $account->accountType->type) {
|
||||||
return $this->redirectToOriginalAccount($account);
|
return $this->redirectToOriginalAccount($account);
|
||||||
}
|
}
|
||||||
$range = Preferences::get('viewRange', '1M')->data;
|
if ($end < $start) {
|
||||||
|
throw new FireflyException('End is after start!');
|
||||||
|
}
|
||||||
|
$range = Preferences::get('viewRange', '1M')->data;
|
||||||
|
if (null === $start) {
|
||||||
|
$start = session('start');
|
||||||
|
}
|
||||||
|
if (null === $end) {
|
||||||
|
$end = app('navigation')->endOfPeriod($start, $range);
|
||||||
|
}
|
||||||
|
|
||||||
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
|
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
|
||||||
$page = intval($request->get('page'));
|
$page = intval($request->get('page'));
|
||||||
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
|
||||||
$chartUri = route('chart.account.single', [$account->id]);
|
|
||||||
$start = null;
|
|
||||||
$end = null;
|
|
||||||
$periods = new Collection;
|
|
||||||
$currencyId = intval($account->getMeta('currency_id'));
|
$currencyId = intval($account->getMeta('currency_id'));
|
||||||
$currency = $this->currencyRepos->find($currencyId);
|
$currency = $this->currencyRepos->find($currencyId);
|
||||||
if (0 === $currencyId) {
|
if (0 === $currencyId) {
|
||||||
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
|
$currency = app('amount')->getDefaultCurrency(); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
$fStart = $start->formatLocalized($this->monthAndDayFormat);
|
||||||
// prep for "all" view.
|
$fEnd = $end->formatLocalized($this->monthAndDayFormat);
|
||||||
if ('all' === $moment) {
|
$subTitle = trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
|
||||||
$subTitle = trans('firefly.all_journals_for_account', ['name' => $account->name]);
|
$chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
|
||||||
$chartUri = route('chart.account.all', [$account->id]);
|
$periods = $this->getPeriodOverview($account, $end);
|
||||||
$first = $this->journalRepos->first();
|
|
||||||
$start = $first->date ?? new Carbon;
|
|
||||||
$end = new Carbon;
|
|
||||||
}
|
|
||||||
|
|
||||||
// prep for "specific date" view.
|
|
||||||
if (strlen($moment) > 0 && 'all' !== $moment) {
|
|
||||||
$start = new Carbon($moment);
|
|
||||||
$start = app('navigation')->startOfPeriod($start, $range);
|
|
||||||
$end = app('navigation')->endOfPeriod($start, $range);
|
|
||||||
$fStart = $start->formatLocalized($this->monthAndDayFormat);
|
|
||||||
$fEnd = $end->formatLocalized($this->monthAndDayFormat);
|
|
||||||
$subTitle = 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')]);
|
|
||||||
$periods = $this->getPeriodOverview($account, $start);
|
|
||||||
}
|
|
||||||
|
|
||||||
// prep for current period view
|
|
||||||
if (0 === strlen($moment)) {
|
|
||||||
$start = clone session('start', app('navigation')->startOfPeriod(new Carbon, $range));
|
|
||||||
$end = clone session('end', app('navigation')->endOfPeriod(new Carbon, $range));
|
|
||||||
$fStart = $start->formatLocalized($this->monthAndDayFormat);
|
|
||||||
$fEnd = $end->formatLocalized($this->monthAndDayFormat);
|
|
||||||
$subTitle = trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
|
|
||||||
$periods = $this->getPeriodOverview($account, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// grab journals:
|
|
||||||
$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) {
|
if (null !== $start) {
|
||||||
$collector->setRange($start, $end);
|
$collector->setRange($start, $end);
|
||||||
}
|
}
|
||||||
$transactions = $collector->getPaginatedJournals();
|
$transactions = $collector->getPaginatedJournals();
|
||||||
$transactions->setPath(route('accounts.show', [$account->id, $moment]));
|
$transactions->setPath(route('accounts.show', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]));
|
||||||
|
|
||||||
return view(
|
return view(
|
||||||
'accounts.show',
|
'accounts.show',
|
||||||
compact('account', 'currency', 'moment', 'periods', 'subTitleIcon', 'transactions', 'subTitle', 'start', 'end', 'chartUri')
|
compact('account', 'currency', 'periods', 'subTitleIcon', 'transactions', 'subTitle', 'start', 'end', 'chartUri')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,6 +417,9 @@ class AccountController extends Controller
|
|||||||
$range = Preferences::get('viewRange', '1M')->data;
|
$range = Preferences::get('viewRange', '1M')->data;
|
||||||
$start = $this->repository->oldestJournalDate($account);
|
$start = $this->repository->oldestJournalDate($account);
|
||||||
$end = $date ?? new Carbon;
|
$end = $date ?? new Carbon;
|
||||||
|
if ($end < $start) {
|
||||||
|
list($start, $end) = [$end, $start];
|
||||||
|
}
|
||||||
|
|
||||||
// properties for cache
|
// properties for cache
|
||||||
$cache = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
@@ -449,11 +430,8 @@ class AccountController extends Controller
|
|||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return $cache->get(); // @codeCoverageIgnore
|
return $cache->get(); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$dates = app('navigation')->blockPeriods($start, $end, $range);
|
$dates = app('navigation')->blockPeriods($start, $end, $range);
|
||||||
$entries = new Collection;
|
$entries = new Collection;
|
||||||
|
|
||||||
// loop dates
|
// loop dates
|
||||||
foreach ($dates as $date) {
|
foreach ($dates as $date) {
|
||||||
|
|
||||||
@@ -471,15 +449,15 @@ class AccountController extends Controller
|
|||||||
->withOpposingAccount();
|
->withOpposingAccount();
|
||||||
$spent = strval($collector->getJournals()->sum('transaction_amount'));
|
$spent = strval($collector->getJournals()->sum('transaction_amount'));
|
||||||
|
|
||||||
$dateStr = $date['end']->format('Y-m-d');
|
|
||||||
$dateName = app('navigation')->periodShow($date['start'], $date['period']);
|
$dateName = app('navigation')->periodShow($date['start'], $date['period']);
|
||||||
$entries->push(
|
$entries->push(
|
||||||
[
|
[
|
||||||
'string' => $dateStr,
|
|
||||||
'name' => $dateName,
|
'name' => $dateName,
|
||||||
'spent' => $spent,
|
'spent' => $spent,
|
||||||
'earned' => $earned,
|
'earned' => $earned,
|
||||||
'date' => clone $date['end'],]
|
'start' => $date['start']->format('Y-m-d'),
|
||||||
|
'end' => $date['end']->format('Y-m-d'),
|
||||||
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -58,69 +58,6 @@ class AccountController extends Controller
|
|||||||
$this->generator = app(GeneratorInterface::class);
|
$this->generator = app(GeneratorInterface::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Account $account
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Http\JsonResponse
|
|
||||||
*/
|
|
||||||
public function all(Account $account)
|
|
||||||
{
|
|
||||||
$cache = new CacheProperties;
|
|
||||||
$cache->addProperty('chart.account.all');
|
|
||||||
$cache->addProperty($account->id);
|
|
||||||
if ($cache->has()) {
|
|
||||||
return Response::json($cache->get()); // @codeCoverageIgnore
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @var AccountRepositoryInterface $repository */
|
|
||||||
$repository = app(AccountRepositoryInterface::class);
|
|
||||||
$start = $repository->oldestJournalDate($account);
|
|
||||||
$end = new Carbon;
|
|
||||||
|
|
||||||
// depending on diff, do something with range of chart.
|
|
||||||
$step = '1D';
|
|
||||||
$months = $start->diffInMonths($end);
|
|
||||||
if ($months > 3) {
|
|
||||||
$step = '1W';
|
|
||||||
}
|
|
||||||
if ($months > 24) {
|
|
||||||
$step = '1M'; // @codeCoverageIgnore
|
|
||||||
}
|
|
||||||
if ($months > 100) {
|
|
||||||
$step = '1Y'; // @codeCoverageIgnore
|
|
||||||
}
|
|
||||||
$chartData = [];
|
|
||||||
$current = clone $start;
|
|
||||||
switch ($step) {
|
|
||||||
case '1D':
|
|
||||||
$format = (string)trans('config.month_and_day');
|
|
||||||
$range = Steam::balanceInRange($account, $start, $end);
|
|
||||||
$previous = array_values($range)[0];
|
|
||||||
while ($end >= $current) {
|
|
||||||
$theDate = $current->format('Y-m-d');
|
|
||||||
$balance = $range[$theDate] ?? $previous;
|
|
||||||
$label = $current->formatLocalized($format);
|
|
||||||
$chartData[$label] = floatval($balance);
|
|
||||||
$previous = $balance;
|
|
||||||
$current->addDay();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case '1W':
|
|
||||||
case '1M': // @codeCoverageIgnore
|
|
||||||
case '1Y': // @codeCoverageIgnore
|
|
||||||
while ($end >= $current) {
|
|
||||||
$balance = floatval(Steam::balance($account, $current));
|
|
||||||
$label = app('navigation')->periodShow($current, $step);
|
|
||||||
$chartData[$label] = $balance;
|
|
||||||
$current = app('navigation')->addPeriod($current, $step, 1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$data = $this->generator->singleSet($account->name, $chartData);
|
|
||||||
$cache->store($data);
|
|
||||||
|
|
||||||
return Response::json($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the balances for all the user's expense accounts.
|
* Shows the balances for all the user's expense accounts.
|
||||||
@@ -366,34 +303,55 @@ class AccountController extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
public function period(Account $account, Carbon $start)
|
public function period(Account $account, Carbon $start, Carbon $end)
|
||||||
{
|
{
|
||||||
$range = Preferences::get('viewRange', '1M')->data;
|
$cache = new CacheProperties;
|
||||||
$end = app('navigation')->endOfPeriod($start, $range);
|
$cache->addProperty('chart.account.period');
|
||||||
$cache = new CacheProperties();
|
|
||||||
$cache->addProperty($start);
|
$cache->addProperty($start);
|
||||||
$cache->addProperty($end);
|
$cache->addProperty($end);
|
||||||
$cache->addProperty('chart.account.period');
|
|
||||||
$cache->addProperty($account->id);
|
$cache->addProperty($account->id);
|
||||||
if ($cache->has()) {
|
if ($cache->has()) {
|
||||||
return Response::json($cache->get()); // @codeCoverageIgnore
|
return Response::json($cache->get()); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
// depending on diff, do something with range of chart.
|
||||||
$format = (string)trans('config.month_and_day');
|
$step = '1D';
|
||||||
$range = Steam::balanceInRange($account, $start, $end);
|
$months = $start->diffInMonths($end);
|
||||||
$current = clone $start;
|
if ($months > 3) {
|
||||||
$previous = array_values($range)[0];
|
$step = '1W';
|
||||||
$chartData = [];
|
}
|
||||||
|
if ($months > 24) {
|
||||||
while ($end >= $current) {
|
$step = '1M'; // @codeCoverageIgnore
|
||||||
$theDate = $current->format('Y-m-d');
|
}
|
||||||
$balance = $range[$theDate] ?? $previous;
|
if ($months > 100) {
|
||||||
$label = $current->formatLocalized($format);
|
$step = '1Y'; // @codeCoverageIgnore
|
||||||
$chartData[$label] = $balance;
|
}
|
||||||
$previous = $balance;
|
$chartData = [];
|
||||||
$current->addDay();
|
$current = clone $start;
|
||||||
|
switch ($step) {
|
||||||
|
case '1D':
|
||||||
|
$format = (string)trans('config.month_and_day');
|
||||||
|
$range = Steam::balanceInRange($account, $start, $end);
|
||||||
|
$previous = array_values($range)[0];
|
||||||
|
while ($end >= $current) {
|
||||||
|
$theDate = $current->format('Y-m-d');
|
||||||
|
$balance = $range[$theDate] ?? $previous;
|
||||||
|
$label = $current->formatLocalized($format);
|
||||||
|
$chartData[$label] = floatval($balance);
|
||||||
|
$previous = $balance;
|
||||||
|
$current->addDay();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '1W':
|
||||||
|
case '1M': // @codeCoverageIgnore
|
||||||
|
case '1Y': // @codeCoverageIgnore
|
||||||
|
while ($end >= $current) {
|
||||||
|
$balance = floatval(Steam::balance($account, $current));
|
||||||
|
$label = app('navigation')->periodShow($current, $step);
|
||||||
|
$chartData[$label] = $balance;
|
||||||
|
$current = app('navigation')->addPeriod($current, $step, 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $this->generator->singleSet($account->name, $chartData);
|
$data = $this->generator->singleSet($account->name, $chartData);
|
||||||
$cache->store($data);
|
$cache->store($data);
|
||||||
|
|
||||||
@@ -457,49 +415,6 @@ class AccountController extends Controller
|
|||||||
return Response::json($data);
|
return Response::json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Shows an account's balance for a single month.
|
|
||||||
*
|
|
||||||
* @param Account $account
|
|
||||||
*
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
|
||||||
public function single(Account $account)
|
|
||||||
{
|
|
||||||
$start = clone session('start', Carbon::now()->startOfMonth());
|
|
||||||
$end = clone session('end', Carbon::now()->endOfMonth());
|
|
||||||
|
|
||||||
// chart properties for cache:
|
|
||||||
$cache = new CacheProperties();
|
|
||||||
$cache->addProperty($start);
|
|
||||||
$cache->addProperty($end);
|
|
||||||
$cache->addProperty('chart.account.single');
|
|
||||||
$cache->addProperty($account->id);
|
|
||||||
if ($cache->has()) {
|
|
||||||
return Response::json($cache->get()); // @codeCoverageIgnore
|
|
||||||
}
|
|
||||||
|
|
||||||
$format = (string)trans('config.month_and_day');
|
|
||||||
$range = Steam::balanceInRange($account, $start, $end);
|
|
||||||
$current = clone $start;
|
|
||||||
$previous = array_values($range)[0];
|
|
||||||
$chartData = [];
|
|
||||||
|
|
||||||
while ($end >= $current) {
|
|
||||||
$theDate = $current->format('Y-m-d');
|
|
||||||
$balance = $range[$theDate] ?? $previous;
|
|
||||||
$label = $current->formatLocalized($format);
|
|
||||||
$chartData[$label] = $balance;
|
|
||||||
$previous = $balance;
|
|
||||||
$current->addDay();
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = $this->generator->singleSet($account->name, $chartData);
|
|
||||||
$cache->store($data);
|
|
||||||
|
|
||||||
return Response::json($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $accounts
|
* @param Collection $accounts
|
||||||
* @param Carbon $start
|
* @param Carbon $start
|
||||||
|
@@ -90,8 +90,13 @@ class Navigation
|
|||||||
*/
|
*/
|
||||||
public function blockPeriods(\Carbon\Carbon $start, \Carbon\Carbon $end, string $range): array
|
public function blockPeriods(\Carbon\Carbon $start, \Carbon\Carbon $end, string $range): array
|
||||||
{
|
{
|
||||||
|
if ($end < $start) {
|
||||||
|
list($start, $end) = [$end, $start];
|
||||||
|
}
|
||||||
$periods = [];
|
$periods = [];
|
||||||
// Start by looping per period:
|
/*
|
||||||
|
* Start looping per months for 1 year + the rest of the year:
|
||||||
|
*/
|
||||||
$perMonthEnd = clone $end;
|
$perMonthEnd = clone $end;
|
||||||
$perMonthStart = clone $end;
|
$perMonthStart = clone $end;
|
||||||
$perMonthStart->startOfyear()->subYear();
|
$perMonthStart->startOfyear()->subYear();
|
||||||
@@ -285,7 +290,7 @@ class Navigation
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Carbon\Carbon $theDate
|
* @param \Carbon\Carbon $theDate
|
||||||
* @param string $repeatFrequency
|
* @param string $repeatFrequency
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{% extends "./layout/default" %}
|
{% extends "./layout/default" %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
{{ Breadcrumbs.render(Route.getCurrentRoute.getName, account, moment, start, end) }}
|
{{ Breadcrumbs.render(Route.getCurrentRoute.getName, account, start, end) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@@ -10,11 +10,7 @@
|
|||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
<h3 class="box-title">
|
<h3 class="box-title">
|
||||||
{% if moment == 'all' %}
|
{{ trans('firefly.chart_account_in_period', {name: account.name, start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat) }) }}
|
||||||
{{ trans('firefly.chart_all_journals_for_account', {name:account.name}) }}
|
|
||||||
{% else %}
|
|
||||||
{{ trans('firefly.chart_account_in_period', {name: account.name, start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat) }) }}
|
|
||||||
{% endif %}
|
|
||||||
</h3>
|
</h3>
|
||||||
<div class="box-tools pull-right">
|
<div class="box-tools pull-right">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
@@ -83,14 +79,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if periods.count > 0 %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-offset-10 col-lg-2 col-md-offset-8 col-md-4 col-sm-12 col-xs-12">
|
|
||||||
<p class="small text-center"><a href="{{ route('accounts.show',[account.id, 'all']) }}">{{ 'showEverything'|_ }}</a></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="{% if periods.count > 0 %}col-lg-10 col-md-8 col-sm-12{% else %}col-lg-12 col-md-12 col-sm-12{% endif %}">
|
<div class="{% if periods.count > 0 %}col-lg-10 col-md-8 col-sm-12{% else %}col-lg-12 col-md-12 col-sm-12{% endif %}">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
@@ -104,21 +92,12 @@
|
|||||||
{% set showReconcile = false %}
|
{% set showReconcile = false %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% 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} %}
|
||||||
{% if periods.count > 0 %}
|
<p>
|
||||||
<p>
|
<i class="fa fa-calendar"></i>
|
||||||
<i class="fa fa-calendar"></i>
|
<a href="{{ route('accounts.show', [account.id]) }}">
|
||||||
<a href="{{ route('accounts.show', [account.id, 'all']) }}">
|
{{ 'show_the_current_period_and_overview'|_ }}
|
||||||
{{ 'show_all_no_filter'|_ }}
|
</a>
|
||||||
</a>
|
</p>
|
||||||
</p>
|
|
||||||
{% else %}
|
|
||||||
<p>
|
|
||||||
<i class="fa fa-calendar"></i>
|
|
||||||
<a href="{{ route('accounts.show', [account.id]) }}">
|
|
||||||
{{ 'show_the_current_period_and_overview'|_ }}
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -128,7 +107,7 @@
|
|||||||
{% if (period.spent != 0 or period.earned != 0) %}
|
{% if (period.spent != 0 or period.earned != 0) %}
|
||||||
<div class="box {% if period.date == end %}box-solid box-primary{% endif %}">
|
<div class="box {% if period.date == end %}box-solid box-primary{% endif %}">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
<h3 class="box-title"><a href="{{ route('accounts.show',[account.id,period.string]) }}">{{ period.name }}</a>
|
<h3 class="box-title"><a href="{{ route('accounts.show',[account.id,period.start,period.end]) }}">{{ period.name }}</a>
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body no-padding">
|
<div class="box-body no-padding">
|
||||||
@@ -150,7 +129,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<p class="small text-center"><a href="{{ route('accounts.show',[account.id, 'all']) }}">{{ 'showEverything'|_ }}</a></p>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
@@ -166,22 +144,12 @@
|
|||||||
// uri's for charts:
|
// uri's for charts:
|
||||||
var chartUri = '{{ chartUri }}';
|
var chartUri = '{{ chartUri }}';
|
||||||
{% if start and end %}
|
{% 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')]) }}';
|
||||||
{% else %}
|
|
||||||
var incomeCategoryUri = '{{ route('chart.account.income-category', [account.id, 'all', 'all']) }}';
|
|
||||||
var expenseCategoryUri = '{{ route('chart.account.expense-category', [account.id, 'all', 'all']) }}';
|
|
||||||
var expenseBudgetUri = '{{ route('chart.account.expense-budget', [account.id, 'all', 'all']) }}';
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
{# overrule currency symbol for charts: #}
|
|
||||||
|
|
||||||
</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>
|
||||||
<script type="text/javascript" src="js/ff/charts.defaults.js?v={{ FF_VERSION }}"></script>
|
<script type="text/javascript" src="js/ff/charts.defaults.js?v={{ FF_VERSION }}"></script>
|
||||||
<script type="text/javascript" src="js/ff/charts.js?v={{ FF_VERSION }}"></script>
|
<script type="text/javascript" src="js/ff/charts.js?v={{ FF_VERSION }}"></script>
|
||||||
|
@@ -76,25 +76,18 @@ Breadcrumbs::register(
|
|||||||
|
|
||||||
Breadcrumbs::register(
|
Breadcrumbs::register(
|
||||||
'accounts.show',
|
'accounts.show',
|
||||||
function (BreadCrumbsGenerator $breadcrumbs, Account $account, string $moment, Carbon $start, Carbon $end) {
|
function (BreadCrumbsGenerator $breadcrumbs, Account $account, Carbon $start, Carbon $end) {
|
||||||
$what = config('firefly.shortNamesByFullName.' . $account->accountType->type);
|
$what = config('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||||
|
|
||||||
$breadcrumbs->parent('accounts.index', $what);
|
$breadcrumbs->parent('accounts.index', $what);
|
||||||
$breadcrumbs->push($account->name, route('accounts.show', [$account->id]));
|
$breadcrumbs->push($account->name, route('accounts.show', [$account->id]));
|
||||||
|
|
||||||
// push when is all:
|
|
||||||
if ('all' === $moment) {
|
|
||||||
$breadcrumbs->push(trans('firefly.everything'), route('accounts.show', [$account->id, 'all']));
|
|
||||||
}
|
|
||||||
// when is specific period or when empty:
|
|
||||||
if ('all' !== $moment && '(nothing)' !== $moment) {
|
|
||||||
$title = trans(
|
$title = trans(
|
||||||
'firefly.between_dates_breadcrumb',
|
'firefly.between_dates_breadcrumb',
|
||||||
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
|
['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
|
||||||
'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),]
|
'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),]
|
||||||
);
|
);
|
||||||
$breadcrumbs->push($title, route('accounts.show', [$account->id, $moment, $start, $end]));
|
$breadcrumbs->push($title, route('accounts.show', [$account->id, $start, $end]));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -101,7 +101,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}/{moment?}', ['uses' => 'AccountController@show', 'as' => 'show']);
|
Route::get('show/{account}/{start_date?}/{end_date?}', ['uses' => 'AccountController@show', 'as' => 'show']);
|
||||||
|
|
||||||
// reconcile routes:
|
// reconcile routes:
|
||||||
Route::get('reconcile/{account}/index/{start_date?}/{end_date?}', ['uses' => 'Account\ReconcileController@reconcile', 'as' => 'reconcile']);
|
Route::get('reconcile/{account}/index/{start_date?}/{end_date?}', ['uses' => 'Account\ReconcileController@reconcile', 'as' => 'reconcile']);
|
||||||
@@ -244,9 +244,7 @@ Route::group(
|
|||||||
Route::get('expense', ['uses' => 'AccountController@expenseAccounts', 'as' => 'expense']);
|
Route::get('expense', ['uses' => 'AccountController@expenseAccounts', 'as' => 'expense']);
|
||||||
Route::get('revenue', ['uses' => 'AccountController@revenueAccounts', 'as' => 'revenue']);
|
Route::get('revenue', ['uses' => 'AccountController@revenueAccounts', 'as' => 'revenue']);
|
||||||
Route::get('report/{accountList}/{start_date}/{end_date}', ['uses' => 'AccountController@report', 'as' => 'report']);
|
Route::get('report/{accountList}/{start_date}/{end_date}', ['uses' => 'AccountController@report', 'as' => 'report']);
|
||||||
Route::get('all/{account}', ['uses' => 'AccountController@all', 'as' => 'all']);
|
Route::get('period/{account}/{start_date}/{end_date}', ['uses' => 'AccountController@period', 'as' => 'period']);
|
||||||
Route::get('single/{account}', ['uses' => 'AccountController@single', 'as' => 'single']);
|
|
||||||
Route::get('period/{account}/{date}', ['uses' => 'AccountController@period', 'as' => 'period']);
|
|
||||||
|
|
||||||
Route::get('income-category/{account}/all/all', ['uses' => 'AccountController@incomeCategoryAll', 'as' => 'income-category-all']);
|
Route::get('income-category/{account}/all/all', ['uses' => 'AccountController@incomeCategoryAll', 'as' => 'income-category-all']);
|
||||||
Route::get('expense-category/{account}/all/all', ['uses' => 'AccountController@expenseCategoryAll', 'as' => 'expense-category-all']);
|
Route::get('expense-category/{account}/all/all', ['uses' => 'AccountController@expenseCategoryAll', 'as' => 'expense-category-all']);
|
||||||
|
Reference in New Issue
Block a user