Better titles.

This commit is contained in:
James Cole 2016-04-03 14:55:56 +02:00
parent 7a216f95ca
commit 2e444da2a3
7 changed files with 28 additions and 11 deletions

View File

@ -24,6 +24,7 @@ use FireflyIII\Support\Binder\AccountList;
use Illuminate\Http\Request;
use InvalidArgumentException;
use Response;
use View;
/**
* Class ReportController
@ -42,6 +43,10 @@ class ReportController extends Controller
{
$attributes = $request->get('attributes');
$attributes = $this->parseAttributes($attributes);
View::share('start', $attributes['startDate']);
View::share('end', $attributes['endDate']);
switch ($attributes['location']) {
default:
throw new FireflyException('Firefly cannot handle "' . e($attributes['location']) . '" ');
@ -94,11 +99,13 @@ class ReportController extends Controller
$journals = $budgetRepository->expensesSplit($budget, $account, $attributes['startDate'], $attributes['endDate']);
break;
case ($role === BalanceLine::ROLE_DEFAULTROLE && is_null($budget->id)):
$journals = $budgetRepository->getAllWithoutBudget($account, $attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
$budget->name = strval(trans('firefly.no_budget'));
$journals = $budgetRepository->getAllWithoutBudget($account, $attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
break;
case ($role === BalanceLine::ROLE_DIFFROLE):
// journals no budget, not corrected by a tag.
$journals = $budgetRepository->getAllWithoutBudget($account, $attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
$budget->name = strval(trans('firefly.leftUnbalanced'));
$journals = $journals->filter(
function (TransactionJournal $journal) {
$tags = $journal->tags()->where('tagMode', 'balancingAct')->count();
@ -111,7 +118,7 @@ class ReportController extends Controller
case ($role === BalanceLine::ROLE_TAGROLE):
throw new FireflyException('Firefly cannot handle this type of info-button (BalanceLine::TagRole)');
}
$view = view('popup.report.balance-amount', compact('journals'))->render();
$view = view('popup.report.balance-amount', compact('journals', 'budget', 'account'))->render();
return $view;
}
@ -139,7 +146,7 @@ class ReportController extends Controller
$journals = $repository->getExpenses($budget, $attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
}
$view = view('popup.report.budget-spent-amount', compact('journals'))->render();
$view = view('popup.report.budget-spent-amount', compact('journals', 'budget'))->render();
return $view;
}
@ -158,7 +165,7 @@ class ReportController extends Controller
$repository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface');
$category = $repository->find(intval($attributes['categoryId']));
$journals = $repository->getJournalsForAccountsInRange($category, $attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
$view = view('popup.report.category-entry', compact('journals'))->render();
$view = view('popup.report.category-entry', compact('journals', 'category'))->render();
return $view;
}
@ -177,7 +184,7 @@ class ReportController extends Controller
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
$account = $repository->find(intval($attributes['accountId']));
$journals = $repository->getExpensesByDestination($account, $attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
$view = view('popup.report.expense-entry', compact('journals'))->render();
$view = view('popup.report.expense-entry', compact('journals', 'account'))->render();
return $view;
}
@ -196,7 +203,8 @@ class ReportController extends Controller
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
$account = $repository->find(intval($attributes['accountId']));
$journals = $repository->getIncomeByDestination($account, $attributes['accounts'], $attributes['startDate'], $attributes['endDate']);
$view = view('popup.report.income-entry', compact('journals'))->render();
$view = view('popup.report.income-entry', compact('journals', 'account'))->render();
return $view;
}

View File

@ -659,6 +659,11 @@ return [
'report_preset_ranges' => 'Pre-set ranges',
'shared' => 'Shared',
'fiscal_year' => 'Fiscal year',
'income_entry' => 'Income from account ":name" between :start and :end',
'expense_entry' => 'Expenses to account ":name" between :start and :end',
'category_entry' => 'Expenses in category ":name" between :start and :end',
'budget_spent_amount' => 'Expenses in budget ":budget" between :start and :end',
'balance_amount' => 'Expenses in budget ":budget" paid from account ":account" between :start and :end',
// charts:
'dayOfMonth' => 'Day of the month',

View File

@ -3,7 +3,9 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'close'|_ }}"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="balanceAmountTitle">{{ 'balance_amount'|_ }}</h4>
<h4 class="modal-title" id="balanceAmountTitle">{{ trans('firefly.balance_amount',
{budget: budget.name, account: account.name, start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat)}
) }}</h4>
</div>
<div class="modal-body">
{% set hideSource = true %}

View File

@ -3,7 +3,9 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'close'|_ }}"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="budgetSpentAmountLabel">{{ 'budget_spent_amount'|_ }}</h4>
<h4 class="modal-title" id="budgetSpentAmountLabel">
{{ trans('firefly.budget_spent_amount', {start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat), budget: budget.name})}}
</h4>
</div>
<div class="modal-body">
{% set hideBudget = true %}

View File

@ -3,7 +3,7 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'close'|_ }}"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="expenseEntryTitle">{{ 'category_entry'|_ }}</h4>
<h4 class="modal-title" id="expenseEntryTitle">{{ trans('firefly.category_entry', {name: category.name, start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat)}) }}</h4>
</div>
<div class="modal-body">
{% set hideCategory = true %}

View File

@ -3,7 +3,7 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'close'|_ }}"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="expenseEntryTitle">{{ 'expense_entry'|_ }}</h4>
<h4 class="modal-title" id="expenseEntryTitle">{{ trans('firefly.expense_entry', {name: account.name, start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat)}) }}</h4>
</div>
<div class="modal-body">
{% set hideDestination = true %}

View File

@ -3,7 +3,7 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'close'|_ }}"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="incomeEntryTitle">{{ 'income_entry'|_ }}</h4>
<h4 class="modal-title" id="incomeEntryTitle">{{ trans('firefly.income_entry', {name: account.name, start: start.formatLocalized(monthAndDayFormat), end: end.formatLocalized(monthAndDayFormat)}) }}</h4>
</div>
<div class="modal-body">
{% set hideBudget = true %}