mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-27 03:10:32 -06:00
Show everything on demand.
This commit is contained in:
parent
2c2abe8b8e
commit
5a505c8469
@ -241,8 +241,12 @@ class AccountController extends BaseController
|
||||
// get a paginated view of all transactions for this account:
|
||||
/** @var \FireflyIII\Database\Account $acct */
|
||||
$acct = App::make('FireflyIII\Database\Account');
|
||||
|
||||
$journals = $acct->getTransactionJournals($account, 10);
|
||||
if (Input::get('showAll') == 'true') {
|
||||
|
||||
$journals = $acct->getAllTransactionJournals($account, 10);
|
||||
} else {
|
||||
$journals = $acct->getTransactionJournals($account, 10);
|
||||
}
|
||||
|
||||
|
||||
//$data = $this->_accounts->show($account, 40);
|
||||
|
@ -445,6 +445,26 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
|
||||
}
|
||||
|
||||
public function getAllTransactionJournals(\Account $account, $limit = 50)
|
||||
{
|
||||
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||
$set = $this->getUser()->transactionJournals()->withRelevantData()->leftJoin(
|
||||
'transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id'
|
||||
)->where('transactions.account_id', $account->id)->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(
|
||||
['transaction_journals.*']
|
||||
);
|
||||
$count = $this->getUser()->transactionJournals()->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->orderBy('date', 'DESC')->where('transactions.account_id', $account->id)->count();
|
||||
$items = [];
|
||||
foreach ($set as $entry) {
|
||||
$items[] = $entry;
|
||||
}
|
||||
|
||||
return \Paginator::make($items, $count, $limit);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getTransactionJournals(\Account $account, $limit = 50)
|
||||
{
|
||||
$start = \Session::get('start');
|
||||
@ -476,11 +496,12 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
*/
|
||||
public function getTransactionJournalsInRange(\Account $account, Carbon $start, Carbon $end)
|
||||
{
|
||||
$set = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->withRelevantData()->leftJoin(
|
||||
$set = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->withRelevantData()->leftJoin(
|
||||
'transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id'
|
||||
)->where('transactions.account_id', $account->id)->before($end)->after($start)->orderBy('date', 'DESC')->get(
|
||||
['transaction_journals.*']
|
||||
);
|
||||
|
||||
return $set;
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,20 @@
|
||||
<div class="col-lg-4 col-md-6 col-sm-12">
|
||||
<!-- time based navigation -->
|
||||
@include('partials.date_nav')
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-clock-o fa-fw"></i> View options for {{{$account->name}}}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
@if(Input::get('showAll') == 'true')
|
||||
<a href="{{route('accounts.show',$account->id)}}" class="btn btn-default">Stick to date-range</a>
|
||||
@else
|
||||
<a href="{{route('accounts.show',$account->id)}}?showAll=true" class="btn btn-default">Show all transactions</a>
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user