More routes and pages fixed.

This commit is contained in:
James Cole
2016-12-06 08:15:53 +01:00
parent d8f291be6e
commit f4887bbbf7
15 changed files with 49 additions and 46 deletions

View File

@@ -29,7 +29,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
* *
* @return array * @return array
*/ */
public function multiYearInOut(Collection $entries): array public function multiYearOperations(Collection $entries): array
{ {
$data = [ $data = [
'count' => 2, 'count' => 2,
@@ -62,7 +62,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
* *
* @return array * @return array
*/ */
public function multiYearInOutSummarized(string $income, string $expense, int $count): array public function multiYearSum(string $income, string $expense, int $count): array
{ {
$data = [ $data = [
'count' => 2, 'count' => 2,
@@ -117,7 +117,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
* *
* @return array * @return array
*/ */
public function yearInOut(Collection $entries): array public function yearOperations(Collection $entries): array
{ {
// language: // language:
$format = (string)trans('config.month'); $format = (string)trans('config.month');
@@ -153,7 +153,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
* *
* @return array * @return array
*/ */
public function yearInOutSummarized(string $income, string $expense, int $count): array public function yearSum(string $income, string $expense, int $count): array
{ {
$data = [ $data = [

View File

@@ -28,7 +28,7 @@ interface ReportChartGeneratorInterface
* *
* @return array * @return array
*/ */
public function multiYearInOut(Collection $entries): array; public function multiYearOperations(Collection $entries): array;
/** /**
* @param string $income * @param string $income
@@ -37,7 +37,7 @@ interface ReportChartGeneratorInterface
* *
* @return array * @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 * @param Collection $entries
@@ -51,7 +51,7 @@ interface ReportChartGeneratorInterface
* *
* @return array * @return array
*/ */
public function yearInOut(Collection $entries): array; public function yearOperations(Collection $entries): array;
/** /**
* @param string $income * @param string $income
@@ -60,6 +60,6 @@ interface ReportChartGeneratorInterface
* *
* @return array * @return array
*/ */
public function yearInOutSummarized(string $income, string $expense, int $count): array; public function yearSum(string $income, string $expense, int $count): array;
} }

View File

@@ -120,7 +120,6 @@ class Help implements HelpInterface
* @param string $language * @param string $language
* @param string $content * @param string $content
* *
* @internal param $title
*/ */
public function putInCache(string $route, string $language, string $content) public function putInCache(string $route, string $language, string $content)
{ {

View File

@@ -49,13 +49,12 @@ class ReportController extends Controller
* This chart, by default, is shown on the multi-year and year report pages, * 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. * which means that giving it a 2 week "period" should be enough granularity.
* *
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts * @param Collection $accounts
* * @param Carbon $start
* @param Carbon $end
* @return \Illuminate\Http\JsonResponse * @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: // chart properties for cache:
$cache = new CacheProperties; $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 $start
* @param Carbon $end * @param Carbon $end
* @param Collection $accounts *
* *
* @return \Illuminate\Http\JsonResponse * @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: // chart properties for cache:
$cache = new CacheProperties; $cache = new CacheProperties;
@@ -112,14 +114,14 @@ class ReportController extends Controller
if ($start->diffInMonths($end) > 12) { if ($start->diffInMonths($end) > 12) {
// data = method X // data = method X
$data = $this->multiYearInOut($chartSource['earned'], $chartSource['spent'], $start, $end); $data = $this->multiYearOperations($chartSource['earned'], $chartSource['spent'], $start, $end);
$cache->store($data); $cache->store($data);
return Response::json($data); return Response::json($data);
} }
// data = method Y // data = method Y
$data = $this->singleYearInOut($chartSource['earned'], $chartSource['spent'], $start, $end); $data = $this->singleYearOperations($chartSource['earned'], $chartSource['spent'], $start, $end);
$cache->store($data); $cache->store($data);
return Response::json($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 $start
* @param Carbon $end * @param Carbon $end
* @param Collection $accounts * @param Collection $accounts
* *
* @return \Illuminate\Http\JsonResponse * @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: // chart properties for cache:
@@ -151,13 +153,13 @@ class ReportController extends Controller
if ($start->diffInMonths($end) > 12) { if ($start->diffInMonths($end) > 12) {
// per year // per year
$data = $this->multiYearInOutSummarized($chartSource['earned'], $chartSource['spent'], $start, $end); $data = $this->multiYearSum($chartSource['earned'], $chartSource['spent'], $start, $end);
$cache->store($data); $cache->store($data);
return Response::json($data); return Response::json($data);
} }
// per month! // per month!
$data = $this->singleYearInOutSummarized($chartSource['earned'], $chartSource['spent'], $start, $end); $data = $this->singleYearSum($chartSource['earned'], $chartSource['spent'], $start, $end);
$cache->store($data); $cache->store($data);
return Response::json($data); return Response::json($data);
@@ -172,7 +174,7 @@ class ReportController extends Controller
* *
* @return array * @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; $entries = new Collection;
while ($start < $end) { while ($start < $end) {
@@ -184,7 +186,7 @@ class ReportController extends Controller
$start->addYear(); $start->addYear();
} }
$data = $this->generator->multiYearInOut($entries); $data = $this->generator->multiYearOperations($entries);
return $data; return $data;
} }
@@ -197,7 +199,7 @@ class ReportController extends Controller
* *
* @return array * @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'; $income = '0';
$expense = '0'; $expense = '0';
@@ -213,7 +215,7 @@ class ReportController extends Controller
$start->addYear(); $start->addYear();
} }
$data = $this->generator->multiYearInOutSummarized($income, $expense, $count); $data = $this->generator->multiYearSum($income, $expense, $count);
return $data; return $data;
} }
@@ -245,7 +247,7 @@ class ReportController extends Controller
* *
* @return array * @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. // per month? simply use each month.
@@ -260,7 +262,7 @@ class ReportController extends Controller
$start->addMonth(); $start->addMonth();
} }
$data = $this->generator->yearInOut($entries); $data = $this->generator->yearOperations($entries);
return $data; return $data;
} }
@@ -273,7 +275,7 @@ class ReportController extends Controller
* *
* @return array * @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'; $income = '0';
$expense = '0'; $expense = '0';
@@ -289,7 +291,7 @@ class ReportController extends Controller
$start->addMonth(); $start->addMonth();
} }
$data = $this->generator->yearInOutSummarized($income, $expense, $count); $data = $this->generator->yearSum($income, $expense, $count);
return $data; return $data;
} }

View File

@@ -102,7 +102,6 @@ class JsonController extends Controller
* *
* @return \Illuminate\Http\JsonResponse * @return \Illuminate\Http\JsonResponse
* *
* @internal param ARI $accountRepository
*/ */
public function boxIn(AccountTaskerInterface $accountTasker, AccountRepositoryInterface $repository) public function boxIn(AccountTaskerInterface $accountTasker, AccountRepositoryInterface $repository)
{ {

View File

@@ -104,7 +104,6 @@ class RuleController extends Controller
* @param Rule $rule * @param Rule $rule
* *
* @return View * @return View
* @internal param RuleRepositoryInterface $repository
*/ */
public function delete(Rule $rule) public function delete(Rule $rule)
{ {

View File

@@ -61,7 +61,6 @@ class Range
* @param string|null $guard * @param string|null $guard
* *
* @return mixed * @return mixed
* @internal param Closure $next
*/ */
public function handle(Request $request, Closure $next, $guard = null) public function handle(Request $request, Closure $next, $guard = null)
{ {

View File

@@ -474,7 +474,6 @@ class FireflyValidator extends Validator
* @param $value * @param $value
* *
* @return bool * @return bool
* @internal param $parameters
* *
*/ */
private function validateByAccountId($value): bool private function validateByAccountId($value): bool

View File

@@ -12,9 +12,9 @@ $(function () {
function drawChart() { function drawChart() {
"use strict"; "use strict";
lineChart('chart/report/net-worth/' + startDate + '/' + endDate + '/' + accountIds, 'net-worth'); lineChart(netWorthUri, 'net-worth');
columnChart('chart/report/in-out/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-chart'); columnChart(opChartUri, 'income-expenses-chart');
columnChart('chart/report/in-out-sum/' + startDate + '/' + endDate + '/' + accountIds, 'income-expenses-sum-chart'); columnChart(sumChartUri, 'income-expenses-sum-chart');
} }

View File

@@ -84,7 +84,7 @@ return [
'destination_accounts' => 'Destination account(s)', 'destination_accounts' => 'Destination account(s)',
'user_id_is' => 'Your user id is <strong>:user</strong>', 'user_id_is' => 'Your user id is <strong>:user</strong>',
'field_supports_markdown' => 'This field supports <a href="https://en.support.wordpress.com/markdown-quick-reference/">Markdown</a>.', 'field_supports_markdown' => 'This field supports <a href="https://en.support.wordpress.com/markdown-quick-reference/">Markdown</a>.',
'need_more_help' => 'If you need more help using Firefly III, please <a href="https://github.com/JC5/firefly-iii/issues">open a ticker on Github</a>.', 'need_more_help' => 'If you need more help using Firefly III, please <a href="https://github.com/JC5/firefly-iii/issues">open a ticket on Github</a>.',
'nothing_to_display' => 'There are no transactions to show you', 'nothing_to_display' => 'There are no transactions to show you',
'show_all_no_filter' => 'Show all transactions without grouping them by date.', 'show_all_no_filter' => 'Show all transactions without grouping them by date.',
'expenses_by_category' => 'Expenses by category', 'expenses_by_category' => 'Expenses by category',

View File

@@ -22,7 +22,7 @@
</div> </div>
</div> </div>
<form class="form-horizontal" action="{{ route('import.process_configuration', job.key) }}" method="post" enctype="multipart/form-data"> <form class="form-horizontal" action="{{ route('import.process-configuration', job.key) }}" method="post" enctype="multipart/form-data">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/> <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<div class="row"> <div class="row">

View File

@@ -22,7 +22,7 @@
</div> </div>
</div> </div>
<form action="{{ route('import.postSettings', job.key) }}" method="post"> <form action="{{ route('import.post-settings', job.key) }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/> <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<input type="hidden" name="settings" value="map"/> <input type="hidden" name="settings" value="map"/>

View File

@@ -21,7 +21,7 @@
</div> </div>
</div> </div>
<form action="{{ route('import.postSettings', job.key) }}" method="post"> <form action="{{ route('import.post-settings', job.key) }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/> <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<input type="hidden" name="settings" value="roles"/> <input type="hidden" name="settings" value="roles"/>

View File

@@ -170,6 +170,12 @@
var reportType = '{{ reportType }}'; var reportType = '{{ reportType }}';
var accountIds = '{{ accountIds }}'; 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 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 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')]) }}'; var expenseReportUri = '{{ route('report-data.operations.expenses', [accountIds, start.format('Ymd'), end.format('Ymd')]) }}';

View File

@@ -317,10 +317,10 @@ Route::group(
* Chart\Report Controller * Chart\Report Controller
*/ */
Route::group( Route::group(
['middleware' => 'user-full-auth', 'namespace' => 'Chart', 'prefix' => 'chart/report'], function () { ['middleware' => 'user-full-auth', 'namespace' => 'Chart', 'prefix' => 'chart/report', 'as' => 'chart.report.'], function () {
Route::get('operations/{accountList}/{start_date}/{end_date}', ['uses' => 'ReportController@operations']); Route::get('operations/{accountList}/{start_date}/{end_date}', ['uses' => 'ReportController@operations' ,'as' => 'operations']);
Route::get('operations-sum/{accountList}/{start_date}/{end_date}/', ['uses' => 'ReportController@operationsSum']); 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']); 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::get('finished/{importJob}', ['uses' => 'ImportController@finished', 'as' => 'finished']);
Route::post('upload', ['uses' => 'ImportController@upload', 'as' => 'upload']); Route::post('upload', ['uses' => 'ImportController@upload', 'as' => 'upload']);
Route::post('configure/{importJob}', ['uses' => 'ImportController@postConfigure', 'as' => 'process_configuration']); Route::post('configure/{importJob}', ['uses' => 'ImportController@postConfigure', 'as' => 'process-configuration']);
Route::post('settings/{importJob}', ['uses' => 'ImportController@postSettings', 'as' => 'postSettings']); Route::post('settings/{importJob}', ['uses' => 'ImportController@postSettings', 'as' => 'post-settings']);
Route::post('start/{importJob}', ['uses' => 'ImportController@start', 'as' => 'start']); Route::post('start/{importJob}', ['uses' => 'ImportController@start', 'as' => 'start']);