Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Expanded on categories.
James Coleeb8f8fa9351d
diff --git a/app/controllers/CategoryController.php b/app/controllers/CategoryController.phpindex 19ca21766f..cb9aa2c649 100644--- a/app/controllers/CategoryController.php+++ b/app/controllers/CategoryController.php@@ -78,7 +78,14 @@ class CategoryController extends BaseController*/public function show(Category $category){- return View::make('categories.show', compact('category'));+ $hideCategory = true;++ /** @var \FireflyIII\Database\Category $repos */+ $repos = App::make('FireflyIII\Database\Category');++ $journals = $repos->getTransactionJournals($category, 50);++ return View::make('categories.show', compact('category','journals','hideCategory'));}/**diff --git a/app/lib/FireflyIII/Database/Category.php b/app/lib/FireflyIII/Database/Category.phpindex 0e4085e439..faa11b7f65 100644--- a/app/lib/FireflyIII/Database/Category.php+++ b/app/lib/FireflyIII/Database/Category.php@@ -170,6 +170,20 @@ class Category implements CUD, CommonDatabaseCalls, CategoryInterfacethrow new NotImplementedException;}+ public function getTransactionJournals(\Category $category, $limit = 50)+ {+ $offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;+ $set = $category->transactionJournals()->withRelevantData()->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);+ $count = $category->transactionJournals()->count();+ $items = [];+ foreach ($set as $entry) {+ $items[] = $entry;+ }++ return \Paginator::make($items, $count, $limit);++ }+/*** @param \Category $budget* @param Carbon $datediff --git a/app/views/categories/show.blade.php b/app/views/categories/show.blade.phpindex 594680d8ca..5cebffd6ed 100644--- a/app/views/categories/show.blade.php+++ b/app/views/categories/show.blade.php@@ -17,7 +17,7 @@Transactions</div><div class="panel-body">- <div id="transactions"></div>+ @include('list.journals-full')</div></div></div>diff --git a/app/views/list/journals-full.blade.php b/app/views/list/journals-full.blade.phpindex b4cec4ae25..d118ec5fa1 100644--- a/app/views/list/journals-full.blade.php+++ b/app/views/list/journals-full.blade.php@@ -13,7 +13,9 @@@if(!isset($hideBudget) || (isset($hideBudget) && $hideBudget=== false))<th><i class="fa fa-tasks fa-fw" title="Budget"></i></th>@endif- <th><i class="fa fa-bar-chart fa-fw" title="Category"></i></th>+ @if(!isset($hideCategory) || (isset($hideCategory) && $hideCategory=== false))+ <th><i class="fa fa-bar-chart fa-fw" title="Category"></i></th>+ @endif<th><i class="fa fa-fw fa-rotate-right" title="Recurring transaction"></i></th></tr>@foreach($journals as $journal)@@ -89,12 +91,14 @@@endif</td>@endif+ @if(!isset($hideCategory) || (isset($hideCategory) && $hideCategory=== false))<td><?php $category = isset($journal->categories[0]) ? $journal->categories[0] : null; ?>@if($category)<a href="{{route('categories.show',$category->id)}}">{{{$category->name}}}</a>@endif</td>+ @endif<td>@if($journal->recurringTransaction)<a href="{{route('recurring.show',$journal->recurring_transaction_id)}}">{{{$journal->recurringTransaction->name}}}</a>diff --git a/public/assets/javascript/firefly/categories.js b/public/assets/javascript/firefly/categories.jsindex 502dfd7366..4827e81307 100644--- a/public/assets/javascript/firefly/categories.js+++ b/public/assets/javascript/firefly/categories.js@@ -1,18 +1,9 @@$(function () {- if (typeof googleTable == 'function') {- googleTable('table/categories', 'category-list');- if (typeof(componentID) != 'undefined') {- googleTable('table/component/' + componentID + '/0/transactions','transactions');-- if (typeof googleColumnChart == 'function') {- googleColumnChart('chart/component/' + componentID + '/spending/' + year, 'componentOverview');- }-- }+ if (typeof componentID != 'undefined' && typeof repetitionID == 'undefined') {+ googleColumnChart('chart/component/' + componentID + '/spending/' + year, 'componentOverview');}-});\ No newline at end of file