Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Optimize view [skip ci]
James Cole61014d45f4c9
diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.phpindex 38f544598a..3c040efe99 100644--- a/app/Http/Controllers/CategoryController.php+++ b/app/Http/Controllers/CategoryController.php@@ -177,11 +177,12 @@ class CategoryController extends Controller}/**- * @param Category $category+ * @param JournalCollectorInterface $collector+ * @param Category $category** @return View*/- public function show(Category $category)+ public function show(JournalCollectorInterface $collector, Category $category){$range = Preferences::get('viewRange', '1M')->data;$start = session('start', Navigation::startOfPeriod(new Carbon, $range));@@ -192,9 +193,7 @@ class CategoryController extends Controller$subTitle = $category->name;$subTitleIcon = 'fa-bar-chart';- // use journal collector- $collector = app(JournalCollectorInterface::class);- $collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category);+ $collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category)->withBudgetInformation();$journals = $collector->getPaginatedJournals();$journals->setPath('categories/show/' . $category->id);@@ -224,9 +223,9 @@ class CategoryController extends Controller$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);$showAll = true;- // new collector:+ /** @var JournalCollectorInterface $collector */$collector = app(JournalCollectorInterface::class);- $collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setCategory($category);+ $collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setCategory($category)->withBudgetInformation();$journals = $collector->getPaginatedJournals();$journals->setPath('categories/show/' . $category->id . '/all');@@ -251,9 +250,9 @@ class CategoryController extends Controller$page = intval(Input::get('page')) === 0 ? 1 : intval(Input::get('page'));$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);- // new collector:+ /** @var JournalCollectorInterface $collector */$collector = app(JournalCollectorInterface::class);- $collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category);+ $collector->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setRange($start, $end)->setCategory($category)->withBudgetInformation();$journals = $collector->getPaginatedJournals();$journals->setPath('categories/show/' . $category->id . '/' . $date);diff --git a/resources/views/categories/show-by-date.twig b/resources/views/categories/show-by-date.twigdeleted file mode 100644index c2ffe6c1b0..0000000000--- a/resources/views/categories/show-by-date.twig+++ /dev/null@@ -1,50 +0,0 @@-{% extends "./layout/default" %}--{% block breadcrumbs %}- {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, category, carbon) }}-{% endblock %}--{% block content %}-- <div class="row">- <div class="col-lg-12 col-md-12 col-sm-12">- <div class="box">- <div class="box-header with-border">- <h3 class="box-title">{{ 'overview'|_ }} (period)</h3>- </div>- <div class="box-body">- <canvas id="period-specific-period" style="width:100%;height:350px;" height="350"></canvas>- </div>- </div>- </div>- </div>- <div class="row">- <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">- <p><a href="{{ route('categories.show',[category.id]) }}">Back to all periods</a></p>- </div>- </div>- <div class="row">- <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">-- <div class="box">- <div class="box-header with-border">- <h3 class="box-title">{{ 'transactions'|_ }}</h3>- </div>- <div class="box-body">- {% include 'list.journals-tasker' %}- </div>- </div>- </div>- </div>--{% endblock %}-{% block scripts %}- <script type="text/javascript">- var specific = '{{ route('chart.category.specific', [category.id, carbon.format('Ymd')]) }}';- </script>- <script type="text/javascript" src="js/lib/Chart.bundle.min.js"></script>- <script type="text/javascript" src="js/ff/charts.defaults.js"></script>- <script type="text/javascript" src="js/ff/charts.js"></script>- <script type="text/javascript" src="js/ff/categories/show-by-date.js"></script>- <script type="text/javascript" src="js/ff/transactions/list.js"></script>-{% endblock %}diff --git a/resources/views/categories/show.twig b/resources/views/categories/show.twigindex 894a981e89..77954e0501 100644--- a/resources/views/categories/show.twig+++ b/resources/views/categories/show.twig@@ -64,7 +64,7 @@<h3 class="box-title">{{ 'transactions'|_ }}</h3></div><div class="box-body">- {% include 'list.journals-tasker' %}+ {% include 'list.journals-tasker' with {hideCategories: true} %}{% if entries %}<p><i class="fa fa-calendar" aria-hidden="true"></i>