Expand code and some refactoring for #595

This commit is contained in:
James Cole 2017-03-18 08:09:14 +01:00
parent edafd16c75
commit 3215c4ee4b
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
14 changed files with 206 additions and 152 deletions

View File

@ -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);
}

View File

@ -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 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->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();

View File

@ -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 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->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 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->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);

View File

@ -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);
$count = 0;
$loop = 0;
$range = Preferences::get('viewRange', '1M')->data;
$start = null;
$end = null;
$periods = new Collection;
// 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 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);
// prep for "all" view.
if ($moment === 'all') {
$subTitle = trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]);
$start = $repository->firstUseDate($tag);
$end = new Carbon;
}
$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);
// 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);
}
// 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;
// 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', 'periods', 'subTitle', 'subTitleIcon', 'journals', 'sum', 'start', 'end'));
// 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', '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);

View File

@ -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 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->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();

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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 %}

View File

@ -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>

View File

@ -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']);

View File

@ -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 $range

View File

@ -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 $range

View File

@ -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