Replace "moment" with more accurate start/end dates.

This commit is contained in:
James Cole
2018-08-08 17:53:40 +02:00
parent bc807965ab
commit 32e58d0a60
13 changed files with 83 additions and 94 deletions

View File

@@ -70,35 +70,24 @@ class IndexController extends Controller
* Show all budgets. * Show all budgets.
* *
* @param Request $request * @param Request $request
* @param string|null $moment *
* @param Carbon|null $start
* @param Carbon|null $end
* *
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* *
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/ */
public function index(Request $request, string $moment = null) public function index(Request $request, Carbon $start = null, Carbon $end = null)
{ {
// collect some basic vars: // collect some basic vars:
$range = app('preferences')->get('viewRange', '1M')->data; $range = app('preferences')->get('viewRange', '1M')->data;
$start = session('start', new Carbon); $start = $start ?? session('start', Carbon::now()->startOfMonth());
$end = session('end', new Carbon); $end = $end ?? app('navigation')->endOfPeriod($start, $range);
$page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page'); $page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data; $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$moment = $moment ?? '';
$defaultCurrency = app('amount')->getDefaultCurrency(); $defaultCurrency = app('amount')->getDefaultCurrency();
// make a date if the data is given.
if ('' !== (string)$moment) {
try {
$start = new Carbon($moment);
/** @var Carbon $end */
$end = app('navigation')->endOfPeriod($start, $range);
} catch (Exception $e) {
// start and end are already defined.
Log::debug(sprintf('start and end are already defined: %s', $e->getMessage()));
}
}
// make the next and previous period, and calculate the periods used for period navigation // make the next and previous period, and calculate the periods used for period navigation
$next = clone $end; $next = clone $end;
$next->addDay(); $next->addDay();
@@ -106,7 +95,7 @@ class IndexController extends Controller
$prev->subDay(); $prev->subDay();
$prev = app('navigation')->startOfPeriod($prev, $range); $prev = app('navigation')->startOfPeriod($prev, $range);
$previousLoop = $this->getPreviousPeriods($start, $range); $previousLoop = $this->getPreviousPeriods($start, $range);
$nextLoop = $this->getNextPeriods($end, $range); $nextLoop = $this->getNextPeriods($start, $range);
$currentMonth = app('navigation')->periodShow($start, $range); $currentMonth = app('navigation')->periodShow($start, $range);
$nextText = app('navigation')->periodShow($next, $range); $nextText = app('navigation')->periodShow($next, $range);
$prevText = app('navigation')->periodShow($prev, $range); $prevText = app('navigation')->periodShow($prev, $range);

View File

@@ -118,7 +118,6 @@ class ShowController extends Controller
$end = new Carbon; $end = new Carbon;
$page = (int)$request->get('page'); $page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data; $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$moment = 'all';
/** @var JournalCollectorInterface $collector */ /** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class); $collector = app(JournalCollectorInterface::class);
@@ -127,7 +126,7 @@ class ShowController extends Controller
$transactions = $collector->getPaginatedJournals(); $transactions = $collector->getPaginatedJournals();
$transactions->setPath(route('budgets.no-budget')); $transactions->setPath(route('budgets.no-budget'));
return view('budgets.no-budget', compact('transactions', 'subTitle', 'moment', 'start', 'end')); return view('budgets.no-budget', compact('transactions', 'subTitle', 'start', 'end'));
} }

View File

@@ -79,7 +79,6 @@ class NoCategoryController extends Controller
$start = $start ?? session('start'); $start = $start ?? session('start');
/** @var Carbon $end */ /** @var Carbon $end */
$end = $end ?? session('end'); $end = $end ?? session('end');
$moment = '';
$page = (int)$request->get('page'); $page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data; $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$subTitle = trans( $subTitle = trans(
@@ -99,7 +98,7 @@ class NoCategoryController extends Controller
$transactions = $collector->getPaginatedJournals(); $transactions = $collector->getPaginatedJournals();
$transactions->setPath(route('categories.no-category')); $transactions->setPath(route('categories.no-category'));
return view('categories.no-category', compact('transactions', 'subTitle', 'moment', 'periods', 'start', 'end')); return view('categories.no-category', compact('transactions', 'subTitle', 'periods', 'start', 'end'));
} }
@@ -107,14 +106,12 @@ class NoCategoryController extends Controller
* Show all transactions without a category. * Show all transactions without a category.
* *
* @param Request $request * @param Request $request
* @param string|null $moment
* *
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/ */
public function showAll(Request $request, string $moment = null) public function showAll(Request $request)
{ {
// default values: // default values:
$moment = $moment ?? '';
$start = null; $start = null;
$end = null; $end = null;
$periods = new Collection; $periods = new Collection;
@@ -136,7 +133,7 @@ class NoCategoryController extends Controller
$transactions = $collector->getPaginatedJournals(); $transactions = $collector->getPaginatedJournals();
$transactions->setPath(route('categories.no-category')); $transactions->setPath(route('categories.no-category'));
return view('categories.no-category', compact('transactions', 'subTitle', 'moment', 'periods', 'start', 'end')); return view('categories.no-category', compact('transactions', 'subTitle', 'periods', 'start', 'end'));
} }

View File

@@ -94,7 +94,6 @@ class ShowController extends Controller
/** @var Carbon $end */ /** @var Carbon $end */
$end = $end ?? session('end', Carbon::now()->endOfMonth()); $end = $end ?? session('end', Carbon::now()->endOfMonth());
$subTitleIcon = 'fa-bar-chart'; $subTitleIcon = 'fa-bar-chart';
$moment = '';
$page = (int)$request->get('page'); $page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data; $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$periods = $this->getPeriodOverview($category, $start); $periods = $this->getPeriodOverview($category, $start);
@@ -115,7 +114,7 @@ class ShowController extends Controller
Log::debug('End of show()'); Log::debug('End of show()');
return view('categories.show', compact('category', 'transactions', 'moment', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end')); return view('categories.show', compact('category', 'transactions', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
} }
/** /**
@@ -135,7 +134,6 @@ class ShowController extends Controller
$start = null; $start = null;
$end = null; $end = null;
$periods = new Collection; $periods = new Collection;
$moment = 'all';
$subTitle = (string)trans('firefly.all_journals_for_category', ['name' => $category->name]); $subTitle = (string)trans('firefly.all_journals_for_category', ['name' => $category->name]);
$first = $this->repository->firstUseDate($category); $first = $this->repository->firstUseDate($category);
@@ -153,7 +151,7 @@ class ShowController extends Controller
$transactions = $collector->getPaginatedJournals(); $transactions = $collector->getPaginatedJournals();
$transactions->setPath($path); $transactions->setPath($path);
return view('categories.show', compact('category', 'moment', 'transactions', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end')); return view('categories.show', compact('category', 'transactions', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
} }
/** /**

View File

@@ -170,7 +170,8 @@ class TagController extends Controller
* *
* @param Request $request * @param Request $request
* @param Tag $tag * @param Tag $tag
* @param string|null $moment * @param Carbon|null $start
* @param Carbon|null $end
* *
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* *
@@ -205,11 +206,10 @@ class TagController extends Controller
} }
/** /**
* Show a single tag. * Show a single tag over all time.
* *
* @param Request $request * @param Request $request
* @param Tag $tag * @param Tag $tag
* @param string|null $moment
* *
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* *

View File

@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Support\Http\Controllers; namespace FireflyIII\Support\Http\Controllers;
use Carbon\Carbon; use Carbon\Carbon;
use Log;
/** /**
* Trait DateCalculation * Trait DateCalculation
@@ -117,7 +116,8 @@ trait DateCalculation
// select thing for next 12 periods: // select thing for next 12 periods:
$loop = []; $loop = [];
/** @var Carbon $current */ /** @var Carbon $current */
$current = clone $date; $current = app('navigation')->startOfPeriod($date, $range);
$current = app('navigation')->endOfPeriod($current, $range);
$current->addDay(); $current->addDay();
$count = 0; $count = 0;
@@ -146,7 +146,7 @@ trait DateCalculation
// select thing for last 12 periods: // select thing for last 12 periods:
$loop = []; $loop = [];
/** @var Carbon $current */ /** @var Carbon $current */
$current = clone $date; $current = app('navigation')->startOfPeriod($date, $range);
$count = 0; $count = 0;
while ($count < 12) { while ($count < 12) {
$current->subDay(); $current->subDay();

View File

@@ -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 %}

View File

@@ -1,7 +1,7 @@
{% extends "./layout/default" %} {% extends "./layout/default" %}
{% block breadcrumbs %} {% block breadcrumbs %}
{{ Breadcrumbs.render(Route.getCurrentRoute.getName, '', start, end) }} {{ Breadcrumbs.render(Route.getCurrentRoute.getName, start, end) }}
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View File

@@ -1,7 +1,7 @@
{% extends "./layout/default" %} {% extends "./layout/default" %}
{% block breadcrumbs %} {% block breadcrumbs %}
{{ Breadcrumbs.render(Route.getCurrentRoute.getName, moment, start, end) }} {{ Breadcrumbs.render(Route.getCurrentRoute.getName, start, end) }}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@@ -10,7 +10,7 @@
{% if periods.count > 0 %} {% if periods.count > 0 %}
<div class="row"> <div class="row">
<div class="col-lg-offset-10 col-lg-2 col-md-offset-9 col-md-3 col-sm-12 col-xs-12"> <div class="col-lg-offset-10 col-lg-2 col-md-offset-9 col-md-3 col-sm-12 col-xs-12">
<p class="small text-center"><a href="{{ route('categories.no-category-all') }}">{{ 'showEverything'|_ }}</a></p> <p class="small text-center"><a href="{{ route('categories.no-category.all') }}">{{ 'showEverything'|_ }}</a></p>
</div> </div>
</div> </div>
{% endif %} {% endif %}
@@ -26,7 +26,7 @@
{% if periods.count > 0 %} {% if periods.count > 0 %}
<p> <p>
<i class="fa fa-calendar"></i> <i class="fa fa-calendar"></i>
<a href="{{ route('categories.no-category-all') }}">{{ 'show_all_no_filter'|_ }}</a> <a href="{{ route('categories.no-category.all') }}">{{ 'show_all_no_filter'|_ }}</a>
</p> </p>
{% else %} {% else %}
<p> <p>

View File

@@ -1,12 +1,12 @@
{% extends "./layout/default" %} {% extends "./layout/default" %}
{% block breadcrumbs %} {% block breadcrumbs %}
{{ Breadcrumbs.render(Route.getCurrentRoute.getName, category, '', start, end) }} {{ Breadcrumbs.render(Route.getCurrentRoute.getName, category, start, end) }}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
{% if moment != 'all' %} {% if Route.getCurrentRoute.getName == 'categories.show' %}
{# both charts #} {# both charts #}
<div class="col-lg-6 col-md-12 col-sm-12 col-xs-12"> <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12">
<div class="box"> <div class="box">
@@ -33,7 +33,7 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% if moment == 'all' %} {% if Route.getCurrentRoute.getName == 'categories.show.all' %}
{# all chart #} {# all chart #}
<div class="col-lg-12 col-md-12 col-sm-12"> <div class="col-lg-12 col-md-12 col-sm-12">
<div class="box"> <div class="box">

View File

@@ -52,8 +52,9 @@
<a href="#" class="btn btn-default mass_select"><i class="fa fa-fw fa-check-square-o"></i> {{ 'select_transactions'|_ }}</a> <a href="#" class="btn btn-default mass_select"><i class="fa fa-fw fa-check-square-o"></i> {{ 'select_transactions'|_ }}</a>
<a href="#" class="btn btn-default mass_stop_select" style="display:none;"><i class="fa faw-fw fa-square-o" <a href="#" class="btn btn-default mass_stop_select" style="display:none;"><i class="fa faw-fw fa-square-o"
></i> {{ 'stop_selection'|_ }}</a> ></i> {{ 'stop_selection'|_ }}</a>
{% if showReconcile == true %} {% if showReconcile == true %}
{% if moment == 'all' %} {% if Route.getCurrentRoute.getName =='accounts.show.all' %}
<a href="{{ route('accounts.reconcile', [account.id, start.format('Ymd')]) }}" class="btn btn-info mass_reconcile"><i <a href="{{ route('accounts.reconcile', [account.id, start.format('Ymd')]) }}" class="btn btn-info mass_reconcile"><i
class="fa fa-fw fa-check"></i> {{ 'reconcile_this_account'|_ }}</a> class="fa fa-fw fa-check"></i> {{ 'reconcile_this_account'|_ }}</a>
{% else %} {% else %}

View File

@@ -118,7 +118,7 @@ try {
Breadcrumbs::register( Breadcrumbs::register(
'accounts.show.all', 'accounts.show.all',
function (BreadcrumbsGenerator $breadcrumbs, Account $account, Carbon $start = null, Carbon $end = null) { function (BreadcrumbsGenerator $breadcrumbs, Account $account) {
$what = config('firefly.shortNamesByFullName.' . $account->accountType->type); $what = config('firefly.shortNamesByFullName.' . $account->accountType->type);
$breadcrumbs->parent('accounts.index', $what); $breadcrumbs->parent('accounts.index', $what);
@@ -379,15 +379,17 @@ try {
Breadcrumbs::register( Breadcrumbs::register(
'budgets.no-budget', 'budgets.no-budget',
function (BreadcrumbsGenerator $breadcrumbs, string $moment, Carbon $start, Carbon $end) { function (BreadcrumbsGenerator $breadcrumbs, Carbon $start = null, Carbon $end = null) {
$breadcrumbs->parent('budgets.index'); $breadcrumbs->parent('budgets.index');
$breadcrumbs->push(trans('firefly.journals_without_budget'), route('budgets.no-budget')); $breadcrumbs->push(trans('firefly.journals_without_budget'), route('budgets.no-budget'));
$title = trans( if (null !== $start && null !== $end) {
'firefly.between_dates_breadcrumb', $title = trans(
['start' => $start->formatLocalized((string)trans('config.month_and_day')), 'firefly.between_dates_breadcrumb',
'end' => $end->formatLocalized((string)trans('config.month_and_day')),] ['start' => $start->formatLocalized((string)trans('config.month_and_day')),
); 'end' => $end->formatLocalized((string)trans('config.month_and_day')),]
$breadcrumbs->push($title, route('budgets.no-budget', ['a', 'b'])); );
$breadcrumbs->push($title, route('budgets.no-budget'));
}
} }
); );
@@ -447,62 +449,66 @@ try {
Breadcrumbs::register( Breadcrumbs::register(
'categories.edit', 'categories.edit',
function (BreadcrumbsGenerator $breadcrumbs, Category $category) { function (BreadcrumbsGenerator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.show.all', $category, '', new Carbon, new Carbon); $breadcrumbs->parent('categories.show.all', $category);
$breadcrumbs->push(trans('firefly.edit_category', ['name' => limitStringLength($category->name)]), route('categories.edit', [$category->id])); $breadcrumbs->push(trans('firefly.edit_category', ['name' => limitStringLength($category->name)]), route('categories.edit', [$category->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'categories.delete', 'categories.delete',
function (BreadcrumbsGenerator $breadcrumbs, Category $category) { function (BreadcrumbsGenerator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.show', $category, '(nothing)', new Carbon, new Carbon); $breadcrumbs->parent('categories.show', $category);
$breadcrumbs->push(trans('firefly.delete_category', ['name' => limitStringLength($category->name)]), route('categories.delete', [$category->id])); $breadcrumbs->push(trans('firefly.delete_category', ['name' => limitStringLength($category->name)]), route('categories.delete', [$category->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'categories.show', 'categories.show',
function (BreadcrumbsGenerator $breadcrumbs, Category $category, string $moment, Carbon $start, Carbon $end) { function (BreadcrumbsGenerator $breadcrumbs, Category $category, Carbon $start = null, Carbon $end = null) {
$breadcrumbs->parent('categories.index'); $breadcrumbs->parent('categories.index');
$breadcrumbs->push(limitStringLength($category->name), route('categories.show', [$category->id])); $breadcrumbs->push(limitStringLength($category->name), route('categories.show', [$category->id]));
$title = trans( if (null !== $start && null !== $end) {
'firefly.between_dates_breadcrumb', $title = trans(
['start' => $start->formatLocalized((string)trans('config.month_and_day')), 'firefly.between_dates_breadcrumb',
'end' => $end->formatLocalized((string)trans('config.month_and_day')),] ['start' => $start->formatLocalized((string)trans('config.month_and_day')),
); 'end' => $end->formatLocalized((string)trans('config.month_and_day')),]
$breadcrumbs->push($title, route('categories.show', [$category->id, $moment])); );
$breadcrumbs->push($title, route('categories.show', [$category->id]));
}
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'categories.show.all', 'categories.show.all',
function (BreadcrumbsGenerator $breadcrumbs, Category $category, string $moment, Carbon $start, Carbon $end) { function (BreadcrumbsGenerator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.index'); $breadcrumbs->parent('categories.index');
$breadcrumbs->push(limitStringLength($category->name), route('categories.show', [$category->id])); $breadcrumbs->push(limitStringLength($category->name), route('categories.show', [$category->id]));
$breadcrumbs->push(trans('firefly.everything'), route('categories.show', [$category->id, 'all'])); $breadcrumbs->push(trans('firefly.everything'), route('categories.show.all', [$category->id]));
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'categories.no-category', 'categories.no-category',
function (BreadcrumbsGenerator $breadcrumbs, string $moment, Carbon $start, Carbon $end) { function (BreadcrumbsGenerator $breadcrumbs, Carbon $start = null, Carbon $end = null) {
$breadcrumbs->parent('categories.index'); $breadcrumbs->parent('categories.index');
$breadcrumbs->push(trans('firefly.journals_without_category'), route('categories.no-category')); $breadcrumbs->push(trans('firefly.journals_without_category'), route('categories.no-category'));
$title = trans( if (null !== $start && null !== $end) {
'firefly.between_dates_breadcrumb', $title = trans(
['start' => $start->formatLocalized((string)trans('config.month_and_day')), 'firefly.between_dates_breadcrumb',
'end' => $end->formatLocalized((string)trans('config.month_and_day')),] ['start' => $start->formatLocalized((string)trans('config.month_and_day')),
); 'end' => $end->formatLocalized((string)trans('config.month_and_day')),]
$breadcrumbs->push($title, route('categories.no-category', [$moment])); );
$breadcrumbs->push($title, route('categories.no-category'));
}
} }
); );
Breadcrumbs::register( Breadcrumbs::register(
'categories.no-category-all', 'categories.no-category.all',
function (BreadcrumbsGenerator $breadcrumbs, string $moment, Carbon $start, Carbon $end) { function (BreadcrumbsGenerator $breadcrumbs) {
$breadcrumbs->parent('categories.index'); $breadcrumbs->parent('categories.index');
$breadcrumbs->push(trans('firefly.journals_without_category'), route('categories.no-category')); $breadcrumbs->push(trans('firefly.journals_without_category'), route('categories.no-category'));
$breadcrumbs->push(trans('firefly.everything'), route('categories.no-category-all')); $breadcrumbs->push(trans('firefly.everything'), route('categories.no-category.all'));
} }
); );
@@ -854,7 +860,7 @@ try {
Breadcrumbs::register( Breadcrumbs::register(
'rules.create-from-bill', 'rules.create-from-bill',
function (BreadcrumbsGenerator $breadcrumbs, RuleGroup $ruleGroup = null) { function (BreadcrumbsGenerator $breadcrumbs) {
$breadcrumbs->parent('rules.index'); $breadcrumbs->parent('rules.index');
$breadcrumbs->push(trans('firefly.make_new_rule_no_group'), route('rules.create')); $breadcrumbs->push(trans('firefly.make_new_rule_no_group'), route('rules.create'));
} }
@@ -944,7 +950,7 @@ try {
Breadcrumbs::register( Breadcrumbs::register(
'tags.edit', 'tags.edit',
function (BreadcrumbsGenerator $breadcrumbs, Tag $tag) { function (BreadcrumbsGenerator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.show', $tag, '(nothing)', new Carbon, new Carbon); $breadcrumbs->parent('tags.show', $tag);
$breadcrumbs->push(trans('breadcrumbs.edit_tag', ['tag' => $tag->tag]), route('tags.edit', [$tag->id])); $breadcrumbs->push(trans('breadcrumbs.edit_tag', ['tag' => $tag->tag]), route('tags.edit', [$tag->id]));
} }
); );
@@ -952,7 +958,7 @@ try {
Breadcrumbs::register( Breadcrumbs::register(
'tags.delete', 'tags.delete',
function (BreadcrumbsGenerator $breadcrumbs, Tag $tag) { function (BreadcrumbsGenerator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.show', $tag, '(nothing)', new Carbon, new Carbon); $breadcrumbs->parent('tags.show', $tag);
$breadcrumbs->push(trans('breadcrumbs.delete_tag', ['tag' => $tag->tag]), route('tags.delete', [$tag->id])); $breadcrumbs->push(trans('breadcrumbs.delete_tag', ['tag' => $tag->tag]), route('tags.delete', [$tag->id]));
} }
); );
@@ -962,16 +968,15 @@ try {
function (BreadcrumbsGenerator $breadcrumbs, Tag $tag, Carbon $start = null, Carbon $end = null) { function (BreadcrumbsGenerator $breadcrumbs, Tag $tag, Carbon $start = null, Carbon $end = null) {
$breadcrumbs->parent('tags.index'); $breadcrumbs->parent('tags.index');
$start = $start ?? session('start');
$end = $end ?? session('end');
$breadcrumbs->push($tag->tag, route('tags.show', [$tag->id, $start, $end])); $breadcrumbs->push($tag->tag, route('tags.show', [$tag->id, $start, $end]));
$title = trans( if (null !== $start && $end !== null) {
'firefly.between_dates_breadcrumb', $title = trans(
['start' => $start->formatLocalized((string)trans('config.month_and_day')), 'firefly.between_dates_breadcrumb',
'end' => $end->formatLocalized((string)trans('config.month_and_day')),] ['start' => $start->formatLocalized((string)trans('config.month_and_day')),
); 'end' => $end->formatLocalized((string)trans('config.month_and_day')),]
$breadcrumbs->push($title, route('tags.show', [$tag->id, $start, $end])); );
$breadcrumbs->push($title, route('tags.show', [$tag->id, $start, $end]));
}
} }
); );
@@ -980,9 +985,9 @@ try {
'tags.show.all', 'tags.show.all',
function (BreadcrumbsGenerator $breadcrumbs, Tag $tag) { function (BreadcrumbsGenerator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.index'); $breadcrumbs->parent('tags.index');
$breadcrumbs->push($tag->tag, route('tags.show', $tag->id,null,null)); $breadcrumbs->push($tag->tag, route('tags.show', [$tag->id]));
$title = (string)trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]); $title = (string)trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]);
$breadcrumbs->push($title, route('tags.show.all',$tag->id)); $breadcrumbs->push($title, route('tags.show.all', $tag->id));
} }
); );
@@ -1008,7 +1013,7 @@ try {
Breadcrumbs::register( Breadcrumbs::register(
'transactions.index.all', 'transactions.index.all',
function (BreadcrumbsGenerator $breadcrumbs, string $what, Carbon $start = null, Carbon $end = null) { function (BreadcrumbsGenerator $breadcrumbs, string $what) {
$breadcrumbs->parent('home'); $breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.' . $what . '_list'), route('transactions.index', [$what])); $breadcrumbs->push(trans('breadcrumbs.' . $what . '_list'), route('transactions.index', [$what]));
} }

View File

@@ -210,7 +210,7 @@ Route::group(
// index // index
Route::get('{moment?}', ['uses' => 'Budget\IndexController@index', 'as' => 'index']); Route::get('{start_date?}/{end_date?}', ['uses' => 'Budget\IndexController@index', 'as' => 'index']);
// update budget amount and income amount // update budget amount and income amount
Route::get('income/{start_date}/{end_date}', ['uses' => 'Budget\AmountController@updateIncome', 'as' => 'income']); Route::get('income/{start_date}/{end_date}', ['uses' => 'Budget\AmountController@updateIncome', 'as' => 'income']);
@@ -246,7 +246,7 @@ Route::group(
Route::get('show/{category}/{start_date?}/{end_date?}', ['uses' => 'Category\ShowController@show', 'as' => 'show']); Route::get('show/{category}/{start_date?}/{end_date?}', ['uses' => 'Category\ShowController@show', 'as' => 'show']);
// no category controller: // no category controller:
Route::get('list/no-category/all', ['uses' => 'Category\NoCategoryController@showAll', 'as' => 'no-category-all']); Route::get('list/no-category/all', ['uses' => 'Category\NoCategoryController@showAll', 'as' => 'no-category.all']);
Route::get('list/no-category/{start_date?}/{end_date?}', ['uses' => 'Category\NoCategoryController@show', 'as' => 'no-category']); Route::get('list/no-category/{start_date?}/{end_date?}', ['uses' => 'Category\NoCategoryController@show', 'as' => 'no-category']);
} }