From 2e444da2a347e275bebd5cd45f5f6c23b11b4474 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 3 Apr 2016 14:55:56 +0200 Subject: [PATCH] Better titles. --- .../Controllers/Popup/ReportController.php | 20 +++++++++++++------ resources/lang/en_US/firefly.php | 5 +++++ .../views/popup/report/balance-amount.twig | 4 +++- .../popup/report/budget-spent-amount.twig | 4 +++- .../views/popup/report/category-entry.twig | 2 +- .../views/popup/report/expense-entry.twig | 2 +- .../views/popup/report/income-entry.twig | 2 +- 7 files changed, 28 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/Popup/ReportController.php b/app/Http/Controllers/Popup/ReportController.php index 9a28791ab2..2bfd7f941b 100644 --- a/app/Http/Controllers/Popup/ReportController.php +++ b/app/Http/Controllers/Popup/ReportController.php @@ -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; } diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index 696c89b530..17600f2e8a 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -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', diff --git a/resources/views/popup/report/balance-amount.twig b/resources/views/popup/report/balance-amount.twig index ad6c20490a..179726fc51 100644 --- a/resources/views/popup/report/balance-amount.twig +++ b/resources/views/popup/report/balance-amount.twig @@ -3,7 +3,9 @@