mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 10:33:30 +00:00
Fix bread crumbs, clean up routes.
This commit is contained in:
@@ -70,14 +70,6 @@ class ReportController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function defaultYear($report_type, Carbon $start, Carbon $end, Collection $accounts)
|
public function defaultYear($report_type, Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
$subTitle = trans(
|
|
||||||
'firefly.report_default_year',
|
|
||||||
[
|
|
||||||
'start' => $start->formatLocalized($this->monthFormat),
|
|
||||||
'end' => $end->formatLocalized($this->monthFormat)
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$subTitleIcon = 'fa-bar-chart';
|
|
||||||
$incomeTopLength = 8;
|
$incomeTopLength = 8;
|
||||||
$expenseTopLength = 8;
|
$expenseTopLength = 8;
|
||||||
|
|
||||||
@@ -101,7 +93,7 @@ class ReportController extends Controller
|
|||||||
'reports.default.year',
|
'reports.default.year',
|
||||||
compact(
|
compact(
|
||||||
'start', 'accountReport', 'incomes', 'report_type', 'accountIds', 'end',
|
'start', 'accountReport', 'incomes', 'report_type', 'accountIds', 'end',
|
||||||
'expenses', 'subTitle', 'subTitleIcon', 'incomeTopLength', 'expenseTopLength'
|
'expenses', 'incomeTopLength', 'expenseTopLength'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -117,15 +109,6 @@ class ReportController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function defaultMonth($report_type, Carbon $start, Carbon $end, Collection $accounts)
|
public function defaultMonth($report_type, Carbon $start, Carbon $end, Collection $accounts)
|
||||||
{
|
{
|
||||||
// some fields for translation:
|
|
||||||
$subTitle = trans(
|
|
||||||
'firefly.report_default_month',
|
|
||||||
[
|
|
||||||
'start' => $start->formatLocalized($this->monthAndDayFormat),
|
|
||||||
'end' => $end->formatLocalized($this->monthAndDayFormat)
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$subTitleIcon = 'fa-calendar';
|
|
||||||
$incomeTopLength = 8;
|
$incomeTopLength = 8;
|
||||||
$expenseTopLength = 8;
|
$expenseTopLength = 8;
|
||||||
|
|
||||||
@@ -151,7 +134,6 @@ class ReportController extends Controller
|
|||||||
'reports.default.month',
|
'reports.default.month',
|
||||||
compact(
|
compact(
|
||||||
'start', 'end', 'report_type',
|
'start', 'end', 'report_type',
|
||||||
'subTitle', 'subTitleIcon',
|
|
||||||
'accountReport',
|
'accountReport',
|
||||||
'incomes', 'incomeTopLength',
|
'incomes', 'incomeTopLength',
|
||||||
'expenses', 'expenseTopLength',
|
'expenses', 'expenseTopLength',
|
||||||
@@ -165,14 +147,7 @@ class ReportController extends Controller
|
|||||||
|
|
||||||
public function defaultMultiYear($report_type, $start, $end, $accounts)
|
public function defaultMultiYear($report_type, $start, $end, $accounts)
|
||||||
{
|
{
|
||||||
$subTitle = trans(
|
|
||||||
'firefly.report_default_multi-year',
|
|
||||||
[
|
|
||||||
'start' => $start->formatLocalized($this->monthFormat),
|
|
||||||
'end' => $end->formatLocalized($this->monthFormat)
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$subTitleIcon = 'fa-calendar';
|
|
||||||
|
|
||||||
// list of users stuff:
|
// list of users stuff:
|
||||||
$budgets = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface')->getActiveBudgets();
|
$budgets = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface')->getActiveBudgets();
|
||||||
@@ -187,7 +162,7 @@ class ReportController extends Controller
|
|||||||
$accountIds = join(';', $accountIds);
|
$accountIds = join(';', $accountIds);
|
||||||
|
|
||||||
return view(
|
return view(
|
||||||
'reports.default.multi-year', compact('budgets', 'accounts', 'categories', 'start', 'end', 'accountIds', 'report_type', 'subTitle', 'subTitleIcon')
|
'reports.default.multi-year', compact('budgets', 'accounts', 'categories', 'start', 'end', 'accountIds', 'report_type')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,6 +184,18 @@ class ReportController extends Controller
|
|||||||
switch ($report_type) {
|
switch ($report_type) {
|
||||||
default:
|
default:
|
||||||
case 'default':
|
case 'default':
|
||||||
|
|
||||||
|
View::share(
|
||||||
|
'subTitle', trans(
|
||||||
|
'firefly.report_default',
|
||||||
|
[
|
||||||
|
'start' => $start->formatLocalized($this->monthFormat),
|
||||||
|
'end' => $end->formatLocalized($this->monthFormat)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
View::share('subTitleIcon', 'fa-calendar');
|
||||||
|
|
||||||
// more than one year date difference means year report.
|
// more than one year date difference means year report.
|
||||||
if ($start->diffInMonths($end) > 12) {
|
if ($start->diffInMonths($end) > 12) {
|
||||||
// return view('error')->with('message', 'No report yet for this time period.');
|
// return view('error')->with('message', 'No report yet for this time period.');
|
||||||
|
@@ -351,30 +351,14 @@ Breadcrumbs::register(
|
|||||||
);
|
);
|
||||||
|
|
||||||
Breadcrumbs::register(
|
Breadcrumbs::register(
|
||||||
'reports.year', function (Generator $breadcrumbs, Carbon $date, $shared) {
|
'reports.report', function (Generator $breadcrumbs, Carbon $start, Carbon $end, $reportType, $accountIds) {
|
||||||
$breadcrumbs->parent('reports.index');
|
$breadcrumbs->parent('reports.index');
|
||||||
if ($shared) {
|
|
||||||
$title = trans('breadcrumbs.yearly_report_shared', ['date' => $date->year]);
|
|
||||||
} else {
|
|
||||||
$title = trans('breadcrumbs.yearly_report', ['date' => $date->year]);
|
|
||||||
}
|
|
||||||
$breadcrumbs->push($title, route('reports.year', [$date->year]));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
Breadcrumbs::register(
|
$pref = Preferences::get('language', 'en')->data;
|
||||||
'reports.month', function (Generator $breadcrumbs, Carbon $date, $shared) {
|
$monthFormat = Config::get('firefly.monthAndDay.' . $pref);
|
||||||
$breadcrumbs->parent('reports.year', $date, $shared);
|
$title = trans('firefly.report_default', ['start' => $start->formatLocalized($monthFormat), 'end' => $end->formatLocalized($monthFormat)]);
|
||||||
$language = Preferences::get('language', 'en')->data;
|
|
||||||
$format = Config::get('firefly.month.' . $language);
|
|
||||||
|
|
||||||
if ($shared) {
|
$breadcrumbs->push($title, route('reports.report', ['url' => 'abcde']));
|
||||||
$title = trans('breadcrumbs.monthly_report_shared', ['date' => $date->formatLocalized($format)]);
|
|
||||||
} else {
|
|
||||||
$title = trans('breadcrumbs.monthly_report', ['date' => $date->formatLocalized($format)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$breadcrumbs->push($title, route('reports.month', [$date->year, $date->month]));
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -448,12 +448,10 @@ Route::group(
|
|||||||
* Report Controller
|
* Report Controller
|
||||||
*/
|
*/
|
||||||
Route::get('/reports', ['uses' => 'ReportController@index', 'as' => 'reports.index']);
|
Route::get('/reports', ['uses' => 'ReportController@index', 'as' => 'reports.index']);
|
||||||
Route::post('/reports/select', ['uses' => 'ReportController@select', 'as' => 'reports.select']);
|
// Route::post('/reports/select', ['uses' => 'ReportController@select', 'as' => 'reports.select']);
|
||||||
Route::get('/reports/report/{report_type}/{start_date}/{end_date}/{accountList}', ['uses' => 'ReportController@report', 'as' => 'reports.report']);
|
Route::get('/reports/report/{report_type}/{start_date}/{end_date}/{accountList}', ['uses' => 'ReportController@report', 'as' => 'reports.report']);
|
||||||
Route::get('/reports/{year}/{shared?}', ['uses' => 'ReportController@year', 'as' => 'reports.year'])->where(['year' => '[0-9]{4}', 'shared' => 'shared']);
|
// Route::get('/reports/{year}/{shared?}', ['uses' => 'ReportController@year', 'as' => 'reports.year'])->where(['year' => '[0-9]{4}', 'shared' => 'shared']);
|
||||||
Route::get('/reports/{year}/{month}/{shared?}', ['uses' => 'ReportController@month', 'as' => 'reports.month'])->where(
|
// Route::get('/reports/{year}/{month}/{shared?}', ['uses' => 'ReportController@month', 'as' => 'reports.month'])->where(['year' => '[0-9]{4}', 'month' => '[0-9]{1,2}', 'shared' => 'shared']);
|
||||||
['year' => '[0-9]{4}', 'month' => '[0-9]{1,2}', 'shared' => 'shared']
|
|
||||||
);
|
|
||||||
|
|
||||||
// pop ups for budget report:
|
// pop ups for budget report:
|
||||||
|
|
||||||
|
@@ -374,9 +374,7 @@ return [
|
|||||||
// 'reportForMonth' => 'Montly report for :month',
|
// 'reportForMonth' => 'Montly report for :month',
|
||||||
// 'reportForMonthShared' => 'Montly report for :month (including shared accounts)',
|
// 'reportForMonthShared' => 'Montly report for :month (including shared accounts)',
|
||||||
|
|
||||||
'report_default_month' => 'Default financial report for :start until :end',
|
'report_default' => 'Default financial report for :start until :end',
|
||||||
'report_default_year' => 'Default financial report for :start until :end',
|
|
||||||
'report_default_multi-year' => 'Default financial report for :start until :end',
|
|
||||||
|
|
||||||
'incomeVsExpenses' => 'Income vs. expenses',
|
'incomeVsExpenses' => 'Income vs. expenses',
|
||||||
'accountBalances' => 'Account balances',
|
'accountBalances' => 'Account balances',
|
||||||
|
@@ -395,9 +395,7 @@ return [
|
|||||||
// 'reportForMonth' => 'Maandoverzicht voor :month',
|
// 'reportForMonth' => 'Maandoverzicht voor :month',
|
||||||
// 'reportForMonthShared' => 'Maandoverzicht voor :month (inclusief gedeelde rekeningen)',
|
// 'reportForMonthShared' => 'Maandoverzicht voor :month (inclusief gedeelde rekeningen)',
|
||||||
|
|
||||||
'report_default_month' => 'Standard financieel rapport (:start tot :end)',
|
'report_default' => 'Standard financieel rapport (:start tot :end)',
|
||||||
'report_default_year' => 'Standard financieel rapport (:start tot :end)',
|
|
||||||
'report_default_multi-year' => 'Standard financieel rapport (:start tot :end)',
|
|
||||||
|
|
||||||
'incomeVsExpenses' => 'Inkomsten tegenover uitgaven',
|
'incomeVsExpenses' => 'Inkomsten tegenover uitgaven',
|
||||||
'accountBalances' => 'Rekeningsaldi',
|
'accountBalances' => 'Rekeningsaldi',
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{% extends "./layout/default.twig" %}
|
{% extends "./layout/default.twig" %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, start, shared) }}
|
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, start, end, report_type, accountIds) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{% extends "./layout/default.twig" %}
|
{% extends "./layout/default.twig" %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, start, end) }}
|
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, start, end, report_type, accountIds) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{% extends "./layout/default.twig" %}
|
{% extends "./layout/default.twig" %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, start, shared) }}
|
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, start, end, report_type, accountIds) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
Reference in New Issue
Block a user