From f4887bbbf7460678efa86e151157c626a995090b Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 6 Dec 2016 08:15:53 +0100 Subject: [PATCH] More routes and pages fixed. --- .../Report/ChartJsReportChartGenerator.php | 8 ++-- .../Report/ReportChartGeneratorInterface.php | 8 ++-- app/Helpers/Help/Help.php | 1 - .../Controllers/Chart/ReportController.php | 42 ++++++++++--------- app/Http/Controllers/JsonController.php | 1 - app/Http/Controllers/RuleController.php | 1 - app/Http/Middleware/Range.php | 1 - app/Validation/FireflyValidator.php | 1 - public/js/ff/reports/default/year.js | 6 +-- resources/lang/en_US/firefly.php | 2 +- resources/views/import/csv/configure.twig | 2 +- resources/views/import/csv/map.twig | 2 +- resources/views/import/csv/roles.twig | 2 +- resources/views/reports/default/year.twig | 6 +++ routes/web.php | 12 +++--- 15 files changed, 49 insertions(+), 46 deletions(-) diff --git a/app/Generator/Chart/Report/ChartJsReportChartGenerator.php b/app/Generator/Chart/Report/ChartJsReportChartGenerator.php index 1cdb1bdedd..207062464a 100644 --- a/app/Generator/Chart/Report/ChartJsReportChartGenerator.php +++ b/app/Generator/Chart/Report/ChartJsReportChartGenerator.php @@ -29,7 +29,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface * * @return array */ - public function multiYearInOut(Collection $entries): array + public function multiYearOperations(Collection $entries): array { $data = [ 'count' => 2, @@ -62,7 +62,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface * * @return array */ - public function multiYearInOutSummarized(string $income, string $expense, int $count): array + public function multiYearSum(string $income, string $expense, int $count): array { $data = [ 'count' => 2, @@ -117,7 +117,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface * * @return array */ - public function yearInOut(Collection $entries): array + public function yearOperations(Collection $entries): array { // language: $format = (string)trans('config.month'); @@ -153,7 +153,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface * * @return array */ - public function yearInOutSummarized(string $income, string $expense, int $count): array + public function yearSum(string $income, string $expense, int $count): array { $data = [ diff --git a/app/Generator/Chart/Report/ReportChartGeneratorInterface.php b/app/Generator/Chart/Report/ReportChartGeneratorInterface.php index 021fad844a..97bcc6f944 100644 --- a/app/Generator/Chart/Report/ReportChartGeneratorInterface.php +++ b/app/Generator/Chart/Report/ReportChartGeneratorInterface.php @@ -28,7 +28,7 @@ interface ReportChartGeneratorInterface * * @return array */ - public function multiYearInOut(Collection $entries): array; + public function multiYearOperations(Collection $entries): array; /** * @param string $income @@ -37,7 +37,7 @@ interface ReportChartGeneratorInterface * * @return array */ - public function multiYearInOutSummarized(string $income, string $expense, int $count): array; + public function multiYearSum(string $income, string $expense, int $count): array; /** * @param Collection $entries @@ -51,7 +51,7 @@ interface ReportChartGeneratorInterface * * @return array */ - public function yearInOut(Collection $entries): array; + public function yearOperations(Collection $entries): array; /** * @param string $income @@ -60,6 +60,6 @@ interface ReportChartGeneratorInterface * * @return array */ - public function yearInOutSummarized(string $income, string $expense, int $count): array; + public function yearSum(string $income, string $expense, int $count): array; } diff --git a/app/Helpers/Help/Help.php b/app/Helpers/Help/Help.php index 79e3e7e721..2167b9ad43 100644 --- a/app/Helpers/Help/Help.php +++ b/app/Helpers/Help/Help.php @@ -120,7 +120,6 @@ class Help implements HelpInterface * @param string $language * @param string $content * - * @internal param $title */ public function putInCache(string $route, string $language, string $content) { diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php index 50ed37c990..d490481db2 100644 --- a/app/Http/Controllers/Chart/ReportController.php +++ b/app/Http/Controllers/Chart/ReportController.php @@ -49,13 +49,12 @@ class ReportController extends Controller * This chart, by default, is shown on the multi-year and year report pages, * which means that giving it a 2 week "period" should be enough granularity. * - * @param Carbon $start - * @param Carbon $end * @param Collection $accounts - * + * @param Carbon $start + * @param Carbon $end * @return \Illuminate\Http\JsonResponse */ - public function netWorth(Carbon $start, Carbon $end, Collection $accounts) + public function netWorth(Collection $accounts, Carbon $start, Carbon $end) { // chart properties for cache: $cache = new CacheProperties; @@ -90,13 +89,16 @@ class ReportController extends Controller /** + * Shows income and expense, debet/credit: operations + * + * @param Collection $accounts * @param Carbon $start * @param Carbon $end - * @param Collection $accounts + * * * @return \Illuminate\Http\JsonResponse */ - public function yearInOut(Carbon $start, Carbon $end, Collection $accounts) + public function operations(Collection $accounts, Carbon $start, Carbon $end) { // chart properties for cache: $cache = new CacheProperties; @@ -112,14 +114,14 @@ class ReportController extends Controller if ($start->diffInMonths($end) > 12) { // data = method X - $data = $this->multiYearInOut($chartSource['earned'], $chartSource['spent'], $start, $end); + $data = $this->multiYearOperations($chartSource['earned'], $chartSource['spent'], $start, $end); $cache->store($data); return Response::json($data); } // data = method Y - $data = $this->singleYearInOut($chartSource['earned'], $chartSource['spent'], $start, $end); + $data = $this->singleYearOperations($chartSource['earned'], $chartSource['spent'], $start, $end); $cache->store($data); return Response::json($data); @@ -128,14 +130,14 @@ class ReportController extends Controller } /** + * Shows sum income and expense, debet/credit: operations * @param Carbon $start * @param Carbon $end * @param Collection $accounts * * @return \Illuminate\Http\JsonResponse - * @internal param AccountRepositoryInterface $repository */ - public function yearInOutSummarized(Carbon $start, Carbon $end, Collection $accounts) + public function sum(Collection $accounts, Carbon $start, Carbon $end) { // chart properties for cache: @@ -151,13 +153,13 @@ class ReportController extends Controller if ($start->diffInMonths($end) > 12) { // per year - $data = $this->multiYearInOutSummarized($chartSource['earned'], $chartSource['spent'], $start, $end); + $data = $this->multiYearSum($chartSource['earned'], $chartSource['spent'], $start, $end); $cache->store($data); return Response::json($data); } // per month! - $data = $this->singleYearInOutSummarized($chartSource['earned'], $chartSource['spent'], $start, $end); + $data = $this->singleYearSum($chartSource['earned'], $chartSource['spent'], $start, $end); $cache->store($data); return Response::json($data); @@ -172,7 +174,7 @@ class ReportController extends Controller * * @return array */ - protected function multiYearInOut(array $earned, array $spent, Carbon $start, Carbon $end) + protected function multiYearOperations(array $earned, array $spent, Carbon $start, Carbon $end) { $entries = new Collection; while ($start < $end) { @@ -184,7 +186,7 @@ class ReportController extends Controller $start->addYear(); } - $data = $this->generator->multiYearInOut($entries); + $data = $this->generator->multiYearOperations($entries); return $data; } @@ -197,7 +199,7 @@ class ReportController extends Controller * * @return array */ - protected function multiYearInOutSummarized(array $earned, array $spent, Carbon $start, Carbon $end) + protected function multiYearSum(array $earned, array $spent, Carbon $start, Carbon $end) { $income = '0'; $expense = '0'; @@ -213,7 +215,7 @@ class ReportController extends Controller $start->addYear(); } - $data = $this->generator->multiYearInOutSummarized($income, $expense, $count); + $data = $this->generator->multiYearSum($income, $expense, $count); return $data; } @@ -245,7 +247,7 @@ class ReportController extends Controller * * @return array */ - protected function singleYearInOut(array $earned, array $spent, Carbon $start, Carbon $end) + protected function singleYearOperations(array $earned, array $spent, Carbon $start, Carbon $end) { // per month? simply use each month. @@ -260,7 +262,7 @@ class ReportController extends Controller $start->addMonth(); } - $data = $this->generator->yearInOut($entries); + $data = $this->generator->yearOperations($entries); return $data; } @@ -273,7 +275,7 @@ class ReportController extends Controller * * @return array */ - protected function singleYearInOutSummarized(array $earned, array $spent, Carbon $start, Carbon $end) + protected function singleYearSum(array $earned, array $spent, Carbon $start, Carbon $end) { $income = '0'; $expense = '0'; @@ -289,7 +291,7 @@ class ReportController extends Controller $start->addMonth(); } - $data = $this->generator->yearInOutSummarized($income, $expense, $count); + $data = $this->generator->yearSum($income, $expense, $count); return $data; } diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php index 33beceec79..0cf47797f0 100644 --- a/app/Http/Controllers/JsonController.php +++ b/app/Http/Controllers/JsonController.php @@ -102,7 +102,6 @@ class JsonController extends Controller * * @return \Illuminate\Http\JsonResponse * - * @internal param ARI $accountRepository */ public function boxIn(AccountTaskerInterface $accountTasker, AccountRepositoryInterface $repository) { diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.php index 98443574d2..6a1d606af1 100644 --- a/app/Http/Controllers/RuleController.php +++ b/app/Http/Controllers/RuleController.php @@ -104,7 +104,6 @@ class RuleController extends Controller * @param Rule $rule * * @return View - * @internal param RuleRepositoryInterface $repository */ public function delete(Rule $rule) { diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.php index a01e0578ce..ee9ca3ec22 100644 --- a/app/Http/Middleware/Range.php +++ b/app/Http/Middleware/Range.php @@ -61,7 +61,6 @@ class Range * @param string|null $guard * * @return mixed - * @internal param Closure $next */ public function handle(Request $request, Closure $next, $guard = null) { diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index d20fb5dc5f..35b973c265 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -474,7 +474,6 @@ class FireflyValidator extends Validator * @param $value * * @return bool - * @internal param $parameters * */ private function validateByAccountId($value): bool diff --git a/public/js/ff/reports/default/year.js b/public/js/ff/reports/default/year.js index 10f305b8f6..259b9fa18a 100644 --- a/public/js/ff/reports/default/year.js +++ b/public/js/ff/reports/default/year.js @@ -12,9 +12,9 @@ $(function () { function drawChart() { "use strict"; - lineChart('chart/report/net-worth/' + startDate + '/' + endDate + '/' + accountIds, 'net-worth'); - columnChart('chart/report/in-out/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-chart'); - columnChart('chart/report/in-out-sum/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-sum-chart'); + lineChart(netWorthUri, 'net-worth'); + columnChart(opChartUri, 'income-expenses-chart'); + columnChart(sumChartUri, 'income-expenses-sum-chart'); } diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index 47f30e970e..11d55a5cac 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -84,7 +84,7 @@ return [ 'destination_accounts' => 'Destination account(s)', 'user_id_is' => 'Your user id is :user', 'field_supports_markdown' => 'This field supports Markdown.', - 'need_more_help' => 'If you need more help using Firefly III, please open a ticker on Github.', + 'need_more_help' => 'If you need more help using Firefly III, please open a ticket on Github.', 'nothing_to_display' => 'There are no transactions to show you', 'show_all_no_filter' => 'Show all transactions without grouping them by date.', 'expenses_by_category' => 'Expenses by category', diff --git a/resources/views/import/csv/configure.twig b/resources/views/import/csv/configure.twig index d650adbbb8..9a9e53a0b0 100644 --- a/resources/views/import/csv/configure.twig +++ b/resources/views/import/csv/configure.twig @@ -22,7 +22,7 @@ -
+
diff --git a/resources/views/import/csv/map.twig b/resources/views/import/csv/map.twig index 159f73edd6..ebc0cf669d 100644 --- a/resources/views/import/csv/map.twig +++ b/resources/views/import/csv/map.twig @@ -22,7 +22,7 @@
- + diff --git a/resources/views/import/csv/roles.twig b/resources/views/import/csv/roles.twig index aad820fbbd..74cf95b948 100644 --- a/resources/views/import/csv/roles.twig +++ b/resources/views/import/csv/roles.twig @@ -21,7 +21,7 @@ - + diff --git a/resources/views/reports/default/year.twig b/resources/views/reports/default/year.twig index e6d0ac3637..e6438a7531 100644 --- a/resources/views/reports/default/year.twig +++ b/resources/views/reports/default/year.twig @@ -170,6 +170,12 @@ var reportType = '{{ reportType }}'; var accountIds = '{{ accountIds }}'; + // report uri's + var opChartUri ='{{ route('chart.report.operations', [accountIds, start.format('Ymd'), end.format('Ymd')]) }}'; + var sumChartUri='{{ route('chart.report.sum', [accountIds, start.format('Ymd'), end.format('Ymd')]) }}'; + var netWorthUri ='{{ route('chart.report.net-worth', [accountIds, start.format('Ymd'), end.format('Ymd')]) }}'; + + // data uri's var accountReportUri = '{{ route('report-data.account.general', [accountIds, start.format('Ymd'), end.format('Ymd')]) }}'; var incomeReportUri = '{{ route('report-data.operations.income', [accountIds, start.format('Ymd'), end.format('Ymd')]) }}'; var expenseReportUri = '{{ route('report-data.operations.expenses', [accountIds, start.format('Ymd'), end.format('Ymd')]) }}'; diff --git a/routes/web.php b/routes/web.php index e3014bd0b6..f7ad436d8f 100755 --- a/routes/web.php +++ b/routes/web.php @@ -317,10 +317,10 @@ Route::group( * Chart\Report Controller */ Route::group( - ['middleware' => 'user-full-auth', 'namespace' => 'Chart', 'prefix' => 'chart/report'], function () { - Route::get('operations/{accountList}/{start_date}/{end_date}', ['uses' => 'ReportController@operations']); - Route::get('operations-sum/{accountList}/{start_date}/{end_date}/', ['uses' => 'ReportController@operationsSum']); - Route::get('net-worth/{accountList}/{start_date}/{end_date}/', ['uses' => 'ReportController@netWorth']); + ['middleware' => 'user-full-auth', 'namespace' => 'Chart', 'prefix' => 'chart/report', 'as' => 'chart.report.'], function () { + Route::get('operations/{accountList}/{start_date}/{end_date}', ['uses' => 'ReportController@operations' ,'as' => 'operations']); + Route::get('operations-sum/{accountList}/{start_date}/{end_date}/', ['uses' => 'ReportController@sum', 'as' => 'sum']); + Route::get('net-worth/{accountList}/{start_date}/{end_date}/', ['uses' => 'ReportController@netWorth', 'as' => 'net-worth']); } ); @@ -340,8 +340,8 @@ Route::group( Route::get('finished/{importJob}', ['uses' => 'ImportController@finished', 'as' => 'finished']); Route::post('upload', ['uses' => 'ImportController@upload', 'as' => 'upload']); - Route::post('configure/{importJob}', ['uses' => 'ImportController@postConfigure', 'as' => 'process_configuration']); - Route::post('settings/{importJob}', ['uses' => 'ImportController@postSettings', 'as' => 'postSettings']); + Route::post('configure/{importJob}', ['uses' => 'ImportController@postConfigure', 'as' => 'process-configuration']); + Route::post('settings/{importJob}', ['uses' => 'ImportController@postSettings', 'as' => 'post-settings']); Route::post('start/{importJob}', ['uses' => 'ImportController@start', 'as' => 'start']);