Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Expand code and some refactoring for #595
James Cole3215c4ee4b72
diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.phpindex 2e0758a4cf..c947e3612b 100644--- a/app/Http/Controllers/AccountController.php+++ b/app/Http/Controllers/AccountController.php@@ -269,7 +269,7 @@ class AccountController extends Controller'end' => $end->formatLocalized($this->monthAndDayFormat)]);$chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d')]);- $periods = $this->periodEntries($account);+ $periods = $this->getPeriodOverview($account);}// prep for current period@@ -280,7 +280,7 @@ class AccountController extends Controller'firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),'end' => $end->formatLocalized($this->monthAndDayFormat)]);- $periods = $this->periodEntries($account);+ $periods = $this->getPeriodOverview($account);}$accountType = $account->accountType->type;@@ -316,7 +316,9 @@ class AccountController extends Controller}- return view('accounts.show', compact('account','moment', 'accountType', 'periods', 'subTitleIcon', 'journals', 'subTitle', 'start', 'end', 'chartUri'));+ return view(+ 'accounts.show', compact('account', 'moment', 'accountType', 'periods', 'subTitleIcon', 'journals', 'subTitle', 'start', 'end', 'chartUri')+ );}/**@@ -404,7 +406,7 @@ class AccountController extends Controller** @return Collection*/- private function periodEntries(Account $account): Collection+ private function getPeriodOverview(Account $account): Collection{/** @var AccountRepositoryInterface $repository */$repository = app(AccountRepositoryInterface::class);@@ -441,7 +443,14 @@ class AccountController extends Controller$earned = $tasker->amountInInPeriod(new Collection([$account]), $assets, $end, $currentEnd);$dateStr = $end->format('Y-m-d');$dateName = Navigation::periodShow($end, $range);- $entries->push([$dateStr, $dateName, $spent, $earned, clone $end]);+ $entries->push(+ [+ 'string' => $dateStr,+ 'name' => $dateName,+ 'spent' => $spent,+ 'earned' => $earned,+ 'date' => clone $end]+ );$end = Navigation::subtractPeriod($end, $range, 1);}diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.phpindex e82386126d..5f5a3f1cc5 100644--- a/app/Http/Controllers/BudgetController.php+++ b/app/Http/Controllers/BudgetController.php@@ -220,14 +220,14 @@ class BudgetController extends Controller'firefly.without_budget_between',['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]);- $periods = $this->noBudgetPeriodEntries();+ $periods = $this->getPeriodOverview();}// prep for current periodif (strlen($moment) === 0) {$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));- $periods = $this->noBudgetPeriodEntries();+ $periods = $this->getPeriodOverview();$subTitle = trans('firefly.without_budget_between',['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]@@ -500,7 +500,7 @@ class BudgetController extends Controller/*** @return Collection*/- private function noBudgetPeriodEntries(): Collection+ private function getPeriodOverview(): Collection{$repository = app(JournalRepositoryInterface::class);$first = $repository->first();diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.phpindex b625c634b8..e67e71e1b1 100644--- a/app/Http/Controllers/CategoryController.php+++ b/app/Http/Controllers/CategoryController.php@@ -180,14 +180,14 @@ class CategoryController extends Controller'firefly.without_category_between',['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]);- $periods = $this->noCategoryPeriodEntries();+ $periods = $this->getNoCategoryPeriodOverview();}// prep for current periodif (strlen($moment) === 0) {$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));- $periods = $this->noCategoryPeriodEntries();+ $periods = $this->getNoCategoryPeriodOverview();$subTitle = trans('firefly.without_category_between',['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]@@ -231,18 +231,16 @@ class CategoryController extends Controller}/**- * @param Request $request- * @param JournalCollectorInterface $collector- * @param Category $category- * @param string $moment+ * @param Request $request+ * @param CategoryRepositoryInterface $repository+ * @param Category $category+ * @param string $moment** @return View*/- public function show(Request $request, JournalCollectorInterface $collector, Category $category, string $moment = '')+ public function show(Request $request, CategoryRepositoryInterface $repository, Category $category, string $moment = ''){// default values:- /** @var CategoryRepositoryInterface $repository */- $repository = app(CategoryRepositoryInterface::class);$subTitle = $category->name;$subTitleIcon = 'fa-bar-chart';$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));@@ -271,21 +269,21 @@ class CategoryController extends Controller['name' => $category->name,'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]);- $periods = $this->periodEntries($category);+ $periods = $this->getPeriodOverview($category);}// prep for current periodif (strlen($moment) === 0) {$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));- $periods = $this->periodEntries($category);+ $periods = $this->getPeriodOverview($category);$subTitle = trans('firefly.journals_in_period_for_category',['name' => $category->name,'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]);}// grab journals, but be prepared to jump a period back to get the right ones:- Log::info('Now at transaction loop start.');+ Log::info('Now at category loop start.');while ($count === 0 && $loop < 3) {$loop++;Log::info('Count is zero, search for journals.');@@ -427,7 +425,7 @@ class CategoryController extends Controller/*** @return Collection*/- private function noCategoryPeriodEntries(): Collection+ private function getNoCategoryPeriodOverview(): Collection{$repository = app(JournalRepositoryInterface::class);$first = $repository->first();@@ -504,7 +502,7 @@ class CategoryController extends Controller** @return Collection*/- private function periodEntries(Category $category): Collection+ private function getPeriodOverview(Category $category): Collection{/** @var CategoryRepositoryInterface $repository */$repository = app(CategoryRepositoryInterface::class);diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.phpindex a8b5a4d50a..f348445c18 100644--- a/app/Http/Controllers/TagController.php+++ b/app/Http/Controllers/TagController.php@@ -14,15 +14,14 @@ declare(strict_types = 1);namespace FireflyIII\Http\Controllers;use Carbon\Carbon;-use Exception;use FireflyIII\Helpers\Collector\JournalCollectorInterface;use FireflyIII\Http\Requests\TagFormRequest;use FireflyIII\Models\Tag;-use FireflyIII\Models\Transaction;use FireflyIII\Repositories\Tag\TagRepositoryInterface;use FireflyIII\Support\CacheProperties;use Illuminate\Http\Request;use Illuminate\Support\Collection;+use Log;use Navigation;use Preferences;use Session;@@ -228,95 +227,145 @@ class TagController extends Controller** @return View*/- public function show(Request $request, JournalCollectorInterface $collector, Tag $tag)+ public function show(Request $request, TagRepositoryInterface $repository, Tag $tag, string $moment = ''){- $start = clone session('start', Carbon::now()->startOfMonth());- $end = clone session('end', Carbon::now()->endOfMonth());+ // default values:$subTitle = $tag->tag;$subTitleIcon = 'fa-tag';- $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));+ $page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);- $periods = $this->getPeriodOverview($tag);-- // use collector:- $collector->setAllAssetAccounts()- ->setLimit($pageSize)->setPage($page)->setTag($tag)->withOpposingAccount()->disableInternalFilter()- ->withBudgetInformation()->withCategoryInformation()->setRange($start, $end);- $journals = $collector->getPaginatedJournals();- $journals->setPath('tags/show/' . $tag->id);-- $sum = $journals->sum(- function (Transaction $transaction) {- return $transaction->transaction_amount;- }- );+ $count = 0;+ $loop = 0;+ $range = Preferences::get('viewRange', '1M')->data;+ $start = null;+ $end = null;+ $periods = new Collection;+++ // prep for "all" view.+ if ($moment === 'all') {+ $subTitle = trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]);+ $start = $repository->firstUseDate($tag);+ $end = new Carbon;+ }- return view('tags.show', compact('tag', 'periods', 'subTitle', 'subTitleIcon', 'journals', 'sum', 'start', 'end'));- }+ // prep for "specific date" view.+ if (strlen($moment) > 0 && $moment !== 'all') {+ $start = new Carbon($moment);+ $end = Navigation::endOfPeriod($start, $range);+ $subTitle = trans(+ 'firefly.journals_in_period_for_tag',+ ['tag' => $tag->tag,+ 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]+ );+ $periods = $this->getPeriodOverview($tag);+ }- /**- * @param Request $request- * @param JournalCollectorInterface $collector- * @param Tag $tag- *- * @return View- */- public function showAll(Request $request, JournalCollectorInterface $collector, Tag $tag)- {- $subTitle = $tag->tag;- $subTitleIcon = 'fa-tag';- $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));- $pageSize = intval(Preferences::get('transactionPageSize', 50)->data);- $collector->setAllAssetAccounts()->setLimit($pageSize)->setPage($page)->setTag($tag)- ->withOpposingAccount()->disableInternalFilter()- ->withBudgetInformation()->withCategoryInformation();- $journals = $collector->getPaginatedJournals();- $journals->setPath('tags/show/' . $tag->id . '/all');-- $sum = $journals->sum(- function (Transaction $transaction) {- return $transaction->transaction_amount;+ // prep for current period+ if (strlen($moment) === 0) {+ $start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));+ $end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));+ $periods = $this->getPeriodOverview($tag);+ $subTitle = trans(+ 'firefly.journals_in_period_for_tag',+ ['tag' => $tag->tag, 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]+ );+ }+ // grab journals, but be prepared to jump a period back to get the right ones:+ Log::info('Now at tag loop start.');+ while ($count === 0 && $loop < 3) {+ $loop++;+ Log::info('Count is zero, search for journals.');+ /** @var JournalCollectorInterface $collector */+ $collector = app(JournalCollectorInterface::class);+ $collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withOpposingAccount()+ ->setTag($tag)->withBudgetInformation()->withCategoryInformation();+ $journals = $collector->getPaginatedJournals();+ $journals->setPath('tags/show/' . $tag->id);+ $count = $journals->getCollection()->count();+ if ($count === 0) {+ $start->subDay();+ $start = Navigation::startOfPeriod($start, $range);+ $end = Navigation::endOfPeriod($start, $range);+ Log::info(sprintf('Count is still zero, go back in time to "%s" and "%s"!', $start->format('Y-m-d'), $end->format('Y-m-d')));}- );-- return view('tags.show', compact('tag', 'subTitle', 'subTitleIcon', 'journals', 'sum', 'start', 'end'));-- }-- public function showByDate(Request $request, JournalCollectorInterface $collector, Tag $tag, string $date)- {- $range = Preferences::get('viewRange', '1M')->data;-- try {- $start = new Carbon($date);- $end = Navigation::endOfPeriod($start, $range);- } catch (Exception $e) {- $start = Navigation::startOfPeriod($this->repository->firstUseDate($tag), $range);- $end = Navigation::startOfPeriod($this->repository->lastUseDate($tag), $range);}- $subTitle = $tag->tag;- $subTitleIcon = 'fa-tag';- $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));- $pageSize = intval(Preferences::get('transactionPageSize', 50)->data);- $periods = $this->getPeriodOverview($tag);-- // use collector:- $collector->setAllAssetAccounts()- ->setLimit($pageSize)->setPage($page)->setTag($tag)->withOpposingAccount()->disableInternalFilter()- ->withBudgetInformation()->withCategoryInformation()->setRange($start, $end);- $journals = $collector->getPaginatedJournals();- $journals->setPath('tags/show/' . $tag->id);-- $sum = $journals->sum(- function (Transaction $transaction) {- return $transaction->transaction_amount;- }- );+ // fix title:+ if (((strlen($moment) > 0 && $moment !== 'all') || strlen($moment) === 0) && $count > 0) {+ $subTitle = trans(+ 'firefly.journals_in_period_for_tag',+ ['tag' => $tag->tag, 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]+ );+ }+ $sum = '0';- return view('tags.show', compact('tag', 'periods', 'subTitle', 'subTitleIcon', 'journals', 'sum', 'start', 'end'));+ return view('tags.show', compact('tag', 'periods', 'subTitle', 'subTitleIcon', 'journals', 'sum', 'start', 'end', 'moment'));}+ // /**+ // * @param Request $request+ // * @param JournalCollectorInterface $collector+ // * @param Tag $tag+ // *+ // * @return View+ // */+ // public function showAll(Request $request, JournalCollectorInterface $collector, Tag $tag)+ // {+ // $subTitle = $tag->tag;+ // $subTitleIcon = 'fa-tag';+ // $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));+ // $pageSize = intval(Preferences::get('transactionPageSize', 50)->data);+ // $collector->setAllAssetAccounts()->setLimit($pageSize)->setPage($page)->setTag($tag)+ // ->withOpposingAccount()->disableInternalFilter()+ // ->withBudgetInformation()->withCategoryInformation();+ // $journals = $collector->getPaginatedJournals();+ // $journals->setPath('tags/show/' . $tag->id . '/all');+ //+ // $sum = $journals->sum(+ // function (Transaction $transaction) {+ // return $transaction->transaction_amount;+ // }+ // );+ //+ // return view('tags.show', compact('tag', 'subTitle', 'subTitleIcon', 'journals', 'sum', 'start', 'end'));+ //+ // }+ //+ // public function showByDate(Request $request, JournalCollectorInterface $collector, Tag $tag, string $date)+ // {+ // $range = Preferences::get('viewRange', '1M')->data;+ //+ // try {+ // $start = new Carbon($date);+ // $end = Navigation::endOfPeriod($start, $range);+ // } catch (Exception $e) {+ // $start = Navigation::startOfPeriod($this->repository->firstUseDate($tag), $range);+ // $end = Navigation::startOfPeriod($this->repository->lastUseDate($tag), $range);+ // }+ //+ // $subTitle = $tag->tag;+ // $subTitleIcon = 'fa-tag';+ // $page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));+ // $pageSize = intval(Preferences::get('transactionPageSize', 50)->data);+ // $periods = $this->getPeriodOverview($tag);+ //+ // // use collector:+ // $collector->setAllAssetAccounts()+ // ->setLimit($pageSize)->setPage($page)->setTag($tag)->withOpposingAccount()->disableInternalFilter()+ // ->withBudgetInformation()->withCategoryInformation()->setRange($start, $end);+ // $journals = $collector->getPaginatedJournals();+ // $journals->setPath('tags/show/' . $tag->id);+ //+ // $sum = $journals->sum(+ // function (Transaction $transaction) {+ // return $transaction->transaction_amount;+ // }+ // );+ //+ // return view('tags.show', compact('tag', 'periods', 'subTitle', 'subTitleIcon', 'journals', 'sum', 'start', 'end'));+ // }+/*** @param TagFormRequest $request*@@ -396,11 +445,11 @@ class TagController extends Controller// get expenses and what-not in this period and this tag.$arr = [- 'date_string' => $end->format('Y-m-d'),- 'date_name' => Navigation::periodShow($end, $range),- 'date' => $end,- 'spent' => $this->repository->spentInperiod($tag, $end, $currentEnd),- 'earned' => $this->repository->earnedInperiod($tag, $end, $currentEnd),+ 'string' => $end->format('Y-m-d'),+ 'name' => Navigation::periodShow($end, $range),+ 'date' => clone $end,+ 'spent' => $this->repository->spentInperiod($tag, $end, $currentEnd),+ 'earned' => $this->repository->earnedInperiod($tag, $end, $currentEnd),];$collection->push($arr);diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.phpindex 01066d5b8b..8159fe6b01 100644--- a/app/Http/Controllers/TransactionController.php+++ b/app/Http/Controllers/TransactionController.php@@ -92,14 +92,14 @@ class TransactionController extends Controller'firefly.title_' . $what . '_between',['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]);- $periods = $this->getPeriodEntries($what);+ $periods = $this->getPeriodOverview($what);}// prep for current periodif (strlen($moment) === 0) {$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));- $periods = $this->getPeriodEntries($what);+ $periods = $this->getPeriodOverview($what);$subTitle = trans('firefly.title_' . $what . '_between',['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]@@ -193,7 +193,7 @@ class TransactionController extends Controller* @return Collection* @throws FireflyException*/- private function getPeriodEntries(string $what): Collection+ private function getPeriodOverview(string $what): Collection{$repository = app(JournalRepositoryInterface::class);$first = $repository->first();diff --git a/resources/views/accounts/show.twig b/resources/views/accounts/show.twigindex b4fe840ed1..39a1729876 100644--- a/resources/views/accounts/show.twig+++ b/resources/views/accounts/show.twig@@ -103,25 +103,25 @@</div>{% if periods.count > 0 %}<div class="col-lg-2 col-md-2 col-sm-12 col-xs-12">- {% for entry in periods %}- {% if (entry[2] != 0 or entry[3] != 0) or (accountType == 'Asset account') %}- <div class="box {% if entry[4] == start %}box-solid box-primary{% endif %}">+ {% for period in periods %}+ {% if (period.spent != 0 or period.earned != 0) or (accountType == 'Asset account') %}+ <div class="box {% if period.date == start %}box-solid box-primary{% endif %}"><div class="box-header with-border">- <h3 class="box-title"><a href="{{ route('accounts.show',[account.id,entry[0]]) }}">{{ entry[1] }}</a>+ <h3 class="box-title"><a href="{{ route('accounts.show',[account.id,period.string]) }}">{{ period.name }}</a></h3></div><div class="box-body no-padding"><table class="table table-hover">- {% if entry[2] != 0 or (accountType == 'Asset account') %}+ {% if period.spent != 0 or (accountType == 'Asset account') %}<tr><td style="width:33%;">{{ 'spent'|_ }}</td>- <td style="text-align: right;">{{ entry[2]|formatAmount }}</td>+ <td style="text-align: right;">{{ period.spent|formatAmount }}</td></tr>{% endif %}- {% if entry[3] != 0 or (accountType == 'Asset account') %}+ {% if period.earned != 0 or (accountType == 'Asset account') %}<tr><td style="width: 33%;">{{ 'earned'|_ }}</td>- <td style="text-align: right;">{{ entry[3]|formatAmount }}</td>+ <td style="text-align: right;">{{ period.earned|formatAmount }}</td></tr>{% endif %}</table>diff --git a/resources/views/budgets/no-budget.twig b/resources/views/budgets/no-budget.twigindex 66b6dbec6a..2509c7eb22 100644--- a/resources/views/budgets/no-budget.twig+++ b/resources/views/budgets/no-budget.twig@@ -40,21 +40,21 @@{% if periods.count > 0 %}<div class="col-lg-2 col-md-2 col-sm-12 col-xs-12">- {% for entry in periods %}- <div class="box {% if entry.date == start %}box-solid box-primary{% endif %}">+ {% for period in periods %}+ <div class="box {% if period.date == start %}box-solid box-primary{% endif %}"><div class="box-header with-border">- <h3 class="box-title"><a href="{{ route('budgets.no-budget',[entry.string]) }}">{{ entry.name }}</a>+ <h3 class="box-title"><a href="{{ route('budgets.no-budget',[period.string]) }}">{{ period.name }}</a></h3></div><div class="box-body no-padding"><table class="table table-hover"><tr><td style="width:33%;">{{ 'transactions'|_ }}</td>- <td style="text-align: right;">{{ entry.count }}</td>+ <td style="text-align: right;">{{ period.count }}</td></tr><tr><td style="width:33%;">{{ 'spent'|_ }}</td>- <td style="text-align: right;">{{ entry.sum|formatAmount }}</td>+ <td style="text-align: right;">{{ period.sum|formatAmount }}</td></tr></table></div>diff --git a/resources/views/categories/no-category.twig b/resources/views/categories/no-category.twigindex f6660a08b7..601c371a62 100644--- a/resources/views/categories/no-category.twig+++ b/resources/views/categories/no-category.twig@@ -40,29 +40,29 @@{% if periods.count > 0 %}<div class="col-lg-2 col-md-2 col-sm-12 col-xs-12">- {% for entry in periods %}- <div class="box {% if entry.date == start %}box-solid box-primary{% endif %}">+ {% for period in periods %}+ <div class="box {% if period.date == start %}box-solid box-primary{% endif %}"><div class="box-header with-border">- <h3 class="box-title"><a href="{{ route('categories.no-category',[entry.string]) }}">{{ entry.name }}</a>+ <h3 class="box-title"><a href="{{ route('categories.no-category',[period.string]) }}">{{ period.name }}</a></h3></div><div class="box-body no-padding"><table class="table table-hover"><tr><td style="width:33%;">{{ 'transactions'|_ }}</td>- <td style="text-align: right;">{{ entry.count }}</td>+ <td style="text-align: right;">{{ period.count }}</td></tr><tr><td style="width:33%;">{{ 'spent'|_ }}</td>- <td style="text-align: right;">{{ entry.spent|formatAmount }}</td>+ <td style="text-align: right;">{{ period.spent|formatAmount }}</td></tr><tr><td style="width:33%;">{{ 'earned'|_ }}</td>- <td style="text-align: right;">{{ entry.earned|formatAmount }}</td>+ <td style="text-align: right;">{{ period.earned|formatAmount }}</td></tr><tr><td style="width:33%;">{{ 'transferred'|_ }}</td>- <td style="text-align: right;" class="text-info">{{ entry.transferred|formatAmountPlain }}</td>+ <td style="text-align: right;" class="text-info">{{ period.transferred|formatAmountPlain }}</td></tr></table></div>diff --git a/resources/views/tags/show.twig b/resources/views/tags/show.twigindex 460247a426..75845f6132 100644--- a/resources/views/tags/show.twig+++ b/resources/views/tags/show.twig@@ -1,7 +1,7 @@{% extends "./layout/default" %}{% block breadcrumbs %}- {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, tag) }}+ {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, tag, moment, start, end) }}{% endblock %}{% block content %}@@ -75,15 +75,15 @@</div></div></div>- {% if periods %}+ {% if periods.count > 0 %}<div class="row"><div class="col-lg-offset-10 col-lg-2 col-md-offset-10 col-md-2 col-sm-12 col-xs-12">- <p class="small text-center"><a href="{{ route('tags.show.all',[tag.id]) }}">{{ 'showEverything'|_ }}</a></p>+ <p class="small text-center"><a href="{{ route('tags.show',[tag.id,'all']) }}">{{ 'showEverything'|_ }}</a></p></div></div>{% endif %}<div class="row">- <div class="{% if periods %}col-lg-10 col-md-10 col-sm-12 col-xs-12{% else %}col-lg-12 col-md-12 col-sm-12 col-xs-12{% endif %}">+ <div class="{% if periods.count > 0 %}col-lg-10 col-md-10 col-sm-12 col-xs-12{% else %}col-lg-12 col-md-12 col-sm-12 col-xs-12{% endif %}"><div class="box"><div class="box-header with-border"><h3 class="box-title">{{ 'transactions'|_ }}</h3>@@ -106,7 +106,7 @@{% if periods %}<p><i class="fa fa-calendar" aria-hidden="true"></i>- <a href="{{ route('tags.show.all', [tag.id]) }}">+ <a href="{{ route('tags.show', [tag.id,'all']) }}">{{ 'show_all_no_filter'|_ }}</a></p>@@ -124,7 +124,7 @@{% if periods %}<p><i class="fa fa-calendar" aria-hidden="true"></i>- <a href="{{ route('tags.show.all', [tag.id]) }}">+ <a href="{{ route('tags.show', [tag.id,'all']) }}">{{ 'show_all_no_filter'|_ }}</a></p>@@ -145,7 +145,7 @@{% if period.spent != 0 or period.earned != 0 %}<div class="box {% if period.date == start %}box-solid box-primary{% endif %}"><div class="box-header with-border">- <h3 class="box-title"><a href="{{ route('tags.show.date',[tag.id, period.date_string]) }}">{{ period.date_name }}</a>+ <h3 class="box-title"><a href="{{ route('tags.show',[tag.id, period.string]) }}">{{ period.name }}</a></h3></div><div class="box-body no-padding">@@ -174,7 +174,7 @@{% if periods %}<div class="row"><div class="col-lg-offset-10 col-lg-2 col-md-offset-10 col-md-2 col-sm-12 col-xs-12">- <p class="small text-center"><a href="{{ route('tags.show.all',[tag.id]) }}">{{ 'showEverything'|_ }}</a></p>+ <p class="small text-center"><a href="{{ route('tags.show',[tag.id]) }}">{{ 'showEverything'|_ }}</a></p></div></div>{% endif %}diff --git a/resources/views/transactions/index.twig b/resources/views/transactions/index.twigindex fa64dff78f..342b82ac39 100644--- a/resources/views/transactions/index.twig+++ b/resources/views/transactions/index.twig@@ -40,34 +40,34 @@{% if periods.count > 0 %}<div class="col-lg-2 col-md-2 col-sm-12 col-xs-12">- {% for entry in periods %}- <div class="box {% if entry.date == start %}box-solid box-primary{% endif %}">+ {% for period in periods %}+ <div class="box {% if period.date == start %}box-solid box-primary{% endif %}"><div class="box-header with-border">- <h3 class="box-title"><a href="{{ route('transactions.index',[what, entry.string]) }}">{{ entry.name }}</a>+ <h3 class="box-title"><a href="{{ route('transactions.index',[what, period.string]) }}">{{ period.name }}</a></h3></div><div class="box-body no-padding"><table class="table table-hover"><tr><td style="width:33%;">{{ 'transactions'|_ }}</td>- <td style="text-align: right;">{{ entry.count }}</td>+ <td style="text-align: right;">{{ period.count }}</td></tr>{% if what == 'withdrawal' %}<tr><td style="width:33%;">{{ 'spent'|_ }}</td>- <td style="text-align: right;">{{ entry.spent|formatAmount }}</td>+ <td style="text-align: right;">{{ period.spent|formatAmount }}</td></tr>{% endif %}{% if what == 'deposit' %}<tr><td style="width:33%;">{{ 'earned'|_ }}</td>- <td style="text-align: right;">{{ entry.earned|formatAmount }}</td>+ <td style="text-align: right;">{{ period.earned|formatAmount }}</td></tr>{% endif %}{% if what == 'transfers' or what == 'transfer' %}<tr><td style="width:33%;">{{ 'transferred'|_ }}</td>- <td style="text-align: right;" class="text-info">{{ entry.transferred|formatAmountPlain }}</td>+ <td style="text-align: right;" class="text-info">{{ period.transferred|formatAmountPlain }}</td></tr>{% endif %}</table>diff --git a/routes/web.php b/routes/web.phpindex 90d770af33..660d624873 100755--- a/routes/web.php+++ b/routes/web.php@@ -642,9 +642,7 @@ Route::group(Route::get('', ['uses' => 'TagController@index', 'as' => 'index']);Route::get('create', ['uses' => 'TagController@create', 'as' => 'create']);- Route::get('show/{tag}/all', ['uses' => 'TagController@showAll', 'as' => 'show.all']);- Route::get('show/{tag}/{date}', ['uses' => 'TagController@showByDate', 'as' => 'show.date']);- Route::get('show/{tag}', ['uses' => 'TagController@show', 'as' => 'show']);+ Route::get('show/{tag}/{moment?}', ['uses' => 'TagController@show', 'as' => 'show']);Route::get('edit/{tag}', ['uses' => 'TagController@edit', 'as' => 'edit']);Route::get('delete/{tag}', ['uses' => 'TagController@delete', 'as' => 'delete']);diff --git a/tests/Feature/Controllers/AccountControllerTest.php b/tests/Feature/Controllers/AccountControllerTest.phpindex 3254ade196..ec90ccc9fc 100644--- a/tests/Feature/Controllers/AccountControllerTest.php+++ b/tests/Feature/Controllers/AccountControllerTest.php@@ -142,7 +142,7 @@ class AccountControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\AccountController::show- * @covers \FireflyIII\Http\Controllers\AccountController::periodEntries+ * @covers \FireflyIII\Http\Controllers\AccountController::getPeriodOverview* @dataProvider dateRangeProvider** @param string $rangediff --git a/tests/Feature/Controllers/BudgetControllerTest.php b/tests/Feature/Controllers/BudgetControllerTest.phpindex 2e7fe63d5e..1a33ac7b28 100644--- a/tests/Feature/Controllers/BudgetControllerTest.php+++ b/tests/Feature/Controllers/BudgetControllerTest.php@@ -142,7 +142,7 @@ class BudgetControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\BudgetController::noBudget- * @covers \FireflyIII\Http\Controllers\BudgetController::noBudgetPeriodEntries+ * @covers \FireflyIII\Http\Controllers\BudgetController::getPeriodOverview* @dataProvider dateRangeProvider** @param string $range@@ -214,7 +214,7 @@ class BudgetControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\BudgetController::noBudget- * @covers \FireflyIII\Http\Controllers\BudgetController::noBudgetPeriodEntries+ * @covers \FireflyIII\Http\Controllers\BudgetController::getPeriodOverview* @dataProvider dateRangeProvider** @param string $rangediff --git a/tests/Feature/Controllers/CategoryControllerTest.php b/tests/Feature/Controllers/CategoryControllerTest.phpindex e2887d1272..8f384f1eba 100644--- a/tests/Feature/Controllers/CategoryControllerTest.php+++ b/tests/Feature/Controllers/CategoryControllerTest.php@@ -116,7 +116,7 @@ class CategoryControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\CategoryController::noCategory- * @covers \FireflyIII\Http\Controllers\CategoryController::noCategoryPeriodEntries+ * @covers \FireflyIII\Http\Controllers\CategoryController::getNoCategoryPeriodOverview* @dataProvider dateRangeProvider** @param string $range@@ -152,7 +152,7 @@ class CategoryControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\CategoryController::noCategory- * @covers \FireflyIII\Http\Controllers\CategoryController::noCategoryPeriodEntries+ * @covers \FireflyIII\Http\Controllers\CategoryController::getNoCategoryPeriodOverview* @dataProvider dateRangeProvider** @param string $range@@ -186,7 +186,7 @@ class CategoryControllerTest extends TestCase/*** @covers \FireflyIII\Http\Controllers\CategoryController::noCategory- * @covers \FireflyIII\Http\Controllers\CategoryController::noCategoryPeriodEntries+ * @covers \FireflyIII\Http\Controllers\CategoryController::getNoCategoryPeriodOverview* @dataProvider dateRangeProvider** @param string $range