mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Got up to categories with the new tables.
This commit is contained in:
parent
0530c0402c
commit
ac2ab65471
@ -4,10 +4,10 @@ return [
|
|||||||
'driver' => 'smtp',
|
'driver' => 'smtp',
|
||||||
'host' => 'smtp.gmail.com',
|
'host' => 'smtp.gmail.com',
|
||||||
'port' => 587,
|
'port' => 587,
|
||||||
'from' => ['address' => '@gmail.com', 'name' => 'Firefly III'],
|
'from' => ['address' => 'thegrumpydictator@gmail.com', 'name' => 'Firefly III'],
|
||||||
'encryption' => 'tls',
|
'encryption' => 'tls',
|
||||||
'username' => '@gmail.com',
|
'username' => 'thegrumpydictator@gmail.com',
|
||||||
'password' => '',
|
'password' => 'eyp-ort-ab-ig-york-ig-e-kne',
|
||||||
'sendmail' => '/usr/sbin/sendmail -bs',
|
'sendmail' => '/usr/sbin/sendmail -bs',
|
||||||
'pretend' => false,
|
'pretend' => false,
|
||||||
];
|
];
|
||||||
|
@ -224,7 +224,7 @@ class AccountController extends BaseController
|
|||||||
/** @var \FireflyIII\Database\Account $acct */
|
/** @var \FireflyIII\Database\Account $acct */
|
||||||
$acct = App::make('FireflyIII\Database\Account');
|
$acct = App::make('FireflyIII\Database\Account');
|
||||||
|
|
||||||
$journals = $acct->getTransactionJournals($account, 50);
|
$journals = $acct->getTransactionJournals($account, 10);
|
||||||
|
|
||||||
|
|
||||||
//$data = $this->_accounts->show($account, 40);
|
//$data = $this->_accounts->show($account, 40);
|
||||||
|
@ -191,17 +191,28 @@ class BudgetController extends BaseController
|
|||||||
if (!is_null($repetition) && $repetition->limit->budget->id != $budget->id) {
|
if (!is_null($repetition) && $repetition->limit->budget->id != $budget->id) {
|
||||||
App::abort(500);
|
App::abort(500);
|
||||||
}
|
}
|
||||||
|
/** @var \FireflyIII\Database\Budget $repos */
|
||||||
|
$repos = App::make('FireflyIII\Database\Budget');
|
||||||
|
|
||||||
if (is_null($repetition)) {
|
if (is_null($repetition)) {
|
||||||
// get all other repetitions:
|
// get all other repetitions:
|
||||||
$limits = $budget->limits()->orderBy('startdate', 'DESC')->get();
|
$limits = $budget->limits()->orderBy('startdate', 'DESC')->get();
|
||||||
|
// get all transaction journals for this budget.
|
||||||
|
$journals = $repos->getTransactionJournals($budget, 50);
|
||||||
|
|
||||||
|
$subTitle = $budget->name;
|
||||||
} else {
|
} else {
|
||||||
// get nothing? i dunno
|
// get nothing? i dunno
|
||||||
$limits = [$repetition->limit];
|
$limits = [$repetition->limit];
|
||||||
|
// get all transaction journals for this budget and limit repetition.
|
||||||
|
$journals = [];
|
||||||
|
$subTitle = $budget->name.' in ' . $repetition->startdate->format('F Y');
|
||||||
|
$journals = $repos->getTransactionJournalsInRepetition($budget, $repetition, 50);
|
||||||
}
|
}
|
||||||
|
$hideBudget = true;
|
||||||
|
|
||||||
return View::make('budgets.show', compact('limits', 'budget', 'repetition'));
|
|
||||||
|
return View::make('budgets.show', compact('limits', 'budget', 'repetition', 'journals','subTitle','hideBudget'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,7 +65,10 @@ class CategoryController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return View::make('categories.index');
|
/** @var \FireflyIII\Database\Category $repos */
|
||||||
|
$repos = App::make('FireflyIII\Database\Category');
|
||||||
|
$categories = $repos->get();
|
||||||
|
return View::make('categories.index',compact('categories'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -182,6 +182,36 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
|||||||
throw new NotImplementedException;
|
throw new NotImplementedException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTransactionJournals(\Budget $budget, $limit = 50)
|
||||||
|
{
|
||||||
|
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||||
|
$set = $budget->transactionJournals()->withRelevantData()->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
|
||||||
|
$count = $budget->transactionJournals()->count();
|
||||||
|
$items = [];
|
||||||
|
foreach ($set as $entry) {
|
||||||
|
$items[] = $entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return \Paginator::make($items, $count, $limit);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTransactionJournalsInRepetition(\Budget $budget, \LimitRepetition $repetition, $limit = 50)
|
||||||
|
{
|
||||||
|
$start = $repetition->startdate;
|
||||||
|
$end = $repetition->enddate;
|
||||||
|
|
||||||
|
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||||
|
$set = $budget->transactionJournals()->withRelevantData()->before($end)->after($start)->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
|
||||||
|
$count = $budget->transactionJournals()->before($end)->after($start)->count();
|
||||||
|
$items = [];
|
||||||
|
foreach ($set as $entry) {
|
||||||
|
$items[] = $entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return \Paginator::make($items, $count, $limit);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Budget $budget
|
* @param \Budget $budget
|
||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
@ -210,10 +240,10 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
|||||||
return \Auth::user()->transactionjournals()->whereNotIn(
|
return \Auth::user()->transactionjournals()->whereNotIn(
|
||||||
'transaction_journals.id', function ($query) use ($start, $end) {
|
'transaction_journals.id', function ($query) use ($start, $end) {
|
||||||
$query->select('transaction_journals.id')->from('transaction_journals')->leftJoin(
|
$query->select('transaction_journals.id')->from('transaction_journals')->leftJoin(
|
||||||
'component_transaction_journal', 'component_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'
|
'component_transaction_journal', 'component_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id'
|
||||||
)->leftJoin('components', 'components.id', '=', 'component_transaction_journal.component_id')->where(
|
)->leftJoin('components', 'components.id', '=', 'component_transaction_journal.component_id')->where(
|
||||||
'transaction_journals.date', '>=', $start->format('Y-m-d')
|
'transaction_journals.date', '>=', $start->format('Y-m-d')
|
||||||
)->where('transaction_journals.date', '<=', $end->format('Y-m-d'))->where('components.class', 'Budget');
|
)->where('transaction_journals.date', '<=', $end->format('Y-m-d'))->where('components.class', 'Budget');
|
||||||
}
|
}
|
||||||
)->before($end)->after($start)->lessThan(0)->transactionTypes(['Withdrawal'])->get();
|
)->before($end)->after($start)->lessThan(0)->transactionTypes(['Withdrawal'])->get();
|
||||||
}
|
}
|
||||||
|
@ -31,4 +31,16 @@ class Category extends Component
|
|||||||
{
|
{
|
||||||
return $this->belongsToMany('TransactionJournal', 'component_transaction_journal', 'component_id');
|
return $this->belongsToMany('TransactionJournal', 'component_transaction_journal', 'component_id');
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @return Carbon
|
||||||
|
*/
|
||||||
|
public function lastActionDate()
|
||||||
|
{
|
||||||
|
$transaction = $this->transactionjournals()->orderBy('updated_at', 'DESC')->first();
|
||||||
|
if(is_null($transaction)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $transaction->date;
|
||||||
|
}
|
||||||
}
|
}
|
@ -17,7 +17,7 @@
|
|||||||
Transactions
|
Transactions
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div id="transactions"></div>
|
@include('list.journals-full')
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div id="category-list"></div>
|
@include('list.categories')
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<?php $active = $account->lastActionDate(); ?>
|
<?php $active = $account->lastActionDate(); ?>
|
||||||
@if($active)
|
@if($active)
|
||||||
{{{$active->format('j F Y @ H:i')}}}
|
{{{$active->format('j F Y')}}}
|
||||||
@else
|
@else
|
||||||
<em>Never</em>
|
<em>Never</em>
|
||||||
@endif
|
@endif
|
||||||
|
28
app/views/list/categories.blade.php
Normal file
28
app/views/list/categories.blade.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<table class="table table-striped table-bordered">
|
||||||
|
<tr>
|
||||||
|
<th> </th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Last activity</th>
|
||||||
|
</tr>
|
||||||
|
@foreach($categories as $category)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="btn-group btn-group-xs">
|
||||||
|
<a href="{{route('categories.edit',$category->id)}}" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span></a>
|
||||||
|
<a href="{{route('categories.delete',$category->id)}}" class="btn btn-danger btn-xs"><span class="glyphicon glyphicon-trash"></span></a>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{route('categories.show',$category->id)" title="{{{$category->name}}}">{{{$category->name}}}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php $active = $category->lastActionDate(); ?>
|
||||||
|
@if($active)
|
||||||
|
{{{$active->format('j F Y')}}}
|
||||||
|
@else
|
||||||
|
<em>Never</em>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</table>
|
@ -1,3 +1,6 @@
|
|||||||
|
@if(is_object($journals))
|
||||||
|
{{$journals->links()}}
|
||||||
|
@endif
|
||||||
<table class="table table-striped table-bordered">
|
<table class="table table-striped table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
@ -7,7 +10,9 @@
|
|||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th>From</th>
|
<th>From</th>
|
||||||
<th>To</th>
|
<th>To</th>
|
||||||
<th><i class="fa fa-tasks fa-fw" title="Budget"></i></th>
|
@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>
|
<th><i class="fa fa-bar-chart fa-fw" title="Category"></i></th>
|
||||||
<th><i class="fa fa-fw fa-rotate-right" title="Recurring transaction"></i></th>
|
<th><i class="fa fa-fw fa-rotate-right" title="Recurring transaction"></i></th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -64,12 +69,14 @@
|
|||||||
<a href="{{route('accounts.show',$journal->transactions[1]->account_id)}}">{{{$journal->transactions[1]->account->name}}}</a>
|
<a href="{{route('accounts.show',$journal->transactions[1]->account_id)}}">{{{$journal->transactions[1]->account->name}}}</a>
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>
|
@if(!isset($hideBudget) || (isset($hideBudget) && $hideBudget=== false))
|
||||||
<?php $budget = isset($journal->budgets[0]) ? $journal->budgets[0] : null; ?>
|
<td>
|
||||||
@if($budget)
|
<?php $budget = isset($journal->budgets[0]) ? $journal->budgets[0] : null; ?>
|
||||||
<a href="{{route('budgets.show',$budget->id)}}">{{{$budget->name}}}</a>
|
@if($budget)
|
||||||
@endif
|
<a href="{{route('budgets.show',$budget->id)}}">{{{$budget->name}}}</a>
|
||||||
</td>
|
@endif
|
||||||
|
</td>
|
||||||
|
@endif
|
||||||
<td>
|
<td>
|
||||||
<?php $category = isset($journal->categories[0]) ? $journal->categories[0] : null; ?>
|
<?php $category = isset($journal->categories[0]) ? $journal->categories[0] : null; ?>
|
||||||
@if($category)
|
@if($category)
|
||||||
@ -87,4 +94,6 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{{$journals->links()}}
|
@if(is_object($journals))
|
||||||
|
{{$journals->links()}}
|
||||||
|
@endif
|
Loading…
Reference in New Issue
Block a user