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

View File

@@ -659,6 +659,11 @@ return [
'report_preset_ranges' => 'Pre-set ranges', 'report_preset_ranges' => 'Pre-set ranges',
'shared' => 'Shared', 'shared' => 'Shared',
'fiscal_year' => 'Fiscal year', '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: // charts:
'dayOfMonth' => 'Day of the month', 'dayOfMonth' => 'Day of the month',

View File

@@ -3,7 +3,9 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'close'|_ }}"><span aria-hidden="true">&times;</span></button> <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>
<div class="modal-body"> <div class="modal-body">
{% set hideSource = true %} {% set hideSource = true %}

View File

@@ -3,7 +3,9 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'close'|_ }}"><span aria-hidden="true">&times;</span></button> <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>
<div class="modal-body"> <div class="modal-body">
{% set hideBudget = true %} {% set hideBudget = true %}

View File

@@ -3,7 +3,7 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'close'|_ }}"><span aria-hidden="true">&times;</span></button> <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>
<div class="modal-body"> <div class="modal-body">
{% set hideCategory = true %} {% set hideCategory = true %}

View File

@@ -3,7 +3,7 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'close'|_ }}"><span aria-hidden="true">&times;</span></button> <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>
<div class="modal-body"> <div class="modal-body">
{% set hideDestination = true %} {% set hideDestination = true %}

View File

@@ -3,7 +3,7 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'close'|_ }}"><span aria-hidden="true">&times;</span></button> <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>
<div class="modal-body"> <div class="modal-body">
{% set hideBudget = true %} {% set hideBudget = true %}