mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Expanded on categories.
This commit is contained in:
parent
9adbbd872c
commit
eb8f8fa935
@ -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'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,6 +170,20 @@ class Category implements CUD, CommonDatabaseCalls, CategoryInterface
|
||||
throw 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 $date
|
||||
|
@ -17,7 +17,7 @@
|
||||
Transactions
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div id="transactions"></div>
|
||||
@include('list.journals-full')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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>
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user