Consistent overview for #1292

This commit is contained in:
James Cole 2018-03-25 21:16:46 +02:00
parent 5f08790f12
commit dd5d2d1616
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
3 changed files with 21 additions and 10 deletions

View File

@ -78,6 +78,7 @@ class BudgetController extends Controller
* @param Budget $budget
*
* @return \Illuminate\Http\JsonResponse
* @throws \InvalidArgumentException
*/
public function amount(Request $request, BudgetRepositoryInterface $repository, Budget $budget)
{
@ -141,6 +142,7 @@ class BudgetController extends Controller
* @param Request $request
*
* @return View
* @throws \RuntimeException
*/
public function create(Request $request)
{
@ -174,6 +176,7 @@ class BudgetController extends Controller
* @param Budget $budget
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws \RuntimeException
*/
public function destroy(Request $request, Budget $budget)
{
@ -190,6 +193,7 @@ class BudgetController extends Controller
* @param Budget $budget
*
* @return View
* @throws \RuntimeException
*/
public function edit(Request $request, Budget $budget)
{
@ -222,12 +226,13 @@ class BudgetController extends Controller
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
// make date if present:
if (null !== $moment || 0 !== strlen(strval($moment))) {
if (null !== $moment || '' !== (string)$moment) {
try {
$start = new Carbon($moment);
$end = app('navigation')->endOfPeriod($start, $range);
} catch (Exception $e) {
// start and end are already defined.
Log::debug('start and end are already defined.');
}
}
$next = clone $end;
@ -330,7 +335,7 @@ class BudgetController extends Controller
// @codeCoverageIgnoreStart
$result = $cache->get();
return view('budgets.info', compact('result', 'begin', 'currentEnd'));
return view('budgets.info', compact('result'));
// @codeCoverageIgnoreEnd
}
$result = [
@ -451,6 +456,7 @@ class BudgetController extends Controller
* @param BudgetIncomeRequest $request
*
* @return \Illuminate\Http\RedirectResponse
* @throws \InvalidArgumentException
*/
public function postUpdateIncome(BudgetIncomeRequest $request)
{
@ -471,14 +477,15 @@ class BudgetController extends Controller
* @param Budget $budget
*
* @return View
* @throws \InvalidArgumentException
*/
public function show(Request $request, Budget $budget)
{
/** @var Carbon $start */
$start = session('first', Carbon::create()->startOfYear());
$end = new Carbon;
$page = intval($request->get('page'));
$pageSize = intval(Preferences::get('listPageSize', 50)->data);
$page = (int)$request->get('page');
$pageSize = (int)Preferences::get('listPageSize', 50)->data;
$limits = $this->getLimits($budget, $start, $end);
$repetition = null;
@ -501,6 +508,7 @@ class BudgetController extends Controller
*
* @return View
*
* @throws \InvalidArgumentException
* @throws FireflyException
*/
public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit)
@ -538,6 +546,7 @@ class BudgetController extends Controller
* @param BudgetFormRequest $request
*
* @return \Illuminate\Http\RedirectResponse
* @throws \RuntimeException
*/
public function store(BudgetFormRequest $request)
{
@ -563,6 +572,7 @@ class BudgetController extends Controller
* @param Budget $budget
*
* @return \Illuminate\Http\RedirectResponse
* @throws \RuntimeException
*/
public function update(BudgetFormRequest $request, Budget $budget)
{

View File

@ -30,9 +30,10 @@ $(function () {
}
// other three charts:
pieChart(expenseCategoryUri, 'budget-cat-out');
pieChart(expenseAssetUri, 'budget-asset-out');
pieChart(expenseExpenseUri, 'budget-expense-out');
if (budgetLimitID > 0) {
pieChart(expenseCategoryUri, 'budget-cat-out');
pieChart(expenseAssetUri, 'budget-asset-out');
pieChart(expenseExpenseUri, 'budget-expense-out');
}
});

View File

@ -34,7 +34,7 @@
</div>
</div>
</div>
{% if budgetLimit %}
<div class="row">
<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
<div class="box">
@ -73,6 +73,7 @@
</div>
</div>
</div>
{% endif %}
<div class="row">
<div class="col-lg-offset-9 col-lg-3 col-md-offset-9 col-md-3 col-sm-12 col-xs-12">
@ -168,7 +169,6 @@
var expenseExpenseUri = '{{ route('chart.budget.expense-expense', [budget.id, budgetLimit.id]) }}';
{% else %}
var budgetChartUri = '{{ route('chart.budget.budget', [budget.id] ) }}';
var expenseCategoryUri = '{{ route('chart.budget.expense-category', [budget.id]) }}';
var expenseAssetUri = '{{ route('chart.budget.expense-asset', [budget.id]) }}';
var expenseExpenseUri = '{{ route('chart.budget.expense-expense', [budget.id]) }}';