mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-20 11:19:16 +00:00
Take page size into account. [skip ci]
This commit is contained in:
@@ -209,12 +209,12 @@ class TransactionController extends Controller
|
||||
*/
|
||||
public function index(JournalRepositoryInterface $repository, string $what)
|
||||
{
|
||||
$pageSize = Preferences::get('transactionPageSize', 50)->data;
|
||||
$subTitleIcon = Config::get('firefly.transactionIconsByWhat.' . $what);
|
||||
$types = Config::get('firefly.transactionTypesByWhat.' . $what);
|
||||
$subTitle = trans('firefly.title_' . $what);
|
||||
$page = intval(Input::get('page'));
|
||||
$offset = $page > 0 ? ($page - 1) * 50 : 0;
|
||||
$journals = $repository->getJournalsOfTypes($types, $offset, $page);
|
||||
$journals = $repository->getJournalsOfTypes($types, $page, $pageSize);
|
||||
|
||||
$journals->setPath('transactions/' . $what);
|
||||
|
||||
@@ -308,7 +308,7 @@ class TransactionController extends Controller
|
||||
Session::flash('info', $att->getMessages()->get('attachments'));
|
||||
}
|
||||
|
||||
Log::debug('Triggered TransactionJournalStored with transaction journal #' . $journal->id.' and piggy #' . intval($request->get('piggy_bank_id')));
|
||||
Log::debug('Triggered TransactionJournalStored with transaction journal #' . $journal->id . ' and piggy #' . intval($request->get('piggy_bank_id')));
|
||||
event(new TransactionJournalStored($journal, intval($request->get('piggy_bank_id'))));
|
||||
|
||||
Session::flash('success', strval(trans('firefly.stored_journal', ['description' => e($journal->description)])));
|
||||
|
@@ -123,28 +123,23 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param array $types
|
||||
* @param int $offset
|
||||
* @param int $page
|
||||
*
|
||||
* @param int $pagesize
|
||||
* @param int $pageSize
|
||||
*
|
||||
* @return LengthAwarePaginator
|
||||
*/
|
||||
public function getJournalsOfTypes(array $types, int $offset, int $page, int $pagesize = 50): LengthAwarePaginator
|
||||
public function getJournalsOfTypes(array $types, int $page, int $pageSize = 50): LengthAwarePaginator
|
||||
{
|
||||
$set = $this->user
|
||||
$offset = ($page - 1) * $pageSize;
|
||||
$query = $this->user
|
||||
->transactionJournals()
|
||||
->expanded()
|
||||
->transactionTypes($types)
|
||||
->take($pagesize)
|
||||
->offset($offset)
|
||||
->orderBy('date', 'DESC')
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('id', 'DESC')
|
||||
->get(TransactionJournal::QUERYFIELDS);
|
||||
->transactionTypes($types);
|
||||
|
||||
$count = $this->user->transactionJournals()->transactionTypes($types)->count();
|
||||
$journals = new LengthAwarePaginator($set, $count, $pagesize, $page);
|
||||
|
||||
$count = $query->count();
|
||||
$set = $query->take($pageSize)->offset($offset)->get(TransactionJournal::QUERYFIELDS);
|
||||
$journals = new LengthAwarePaginator($set, $count, $pageSize, $page);
|
||||
|
||||
return $journals;
|
||||
}
|
||||
|
@@ -57,12 +57,12 @@ interface JournalRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param array $types
|
||||
* @param int $offset
|
||||
* @param int $page
|
||||
* @param int $pageSize
|
||||
*
|
||||
* @return LengthAwarePaginator
|
||||
*/
|
||||
public function getJournalsOfTypes(array $types, int $offset, int $page): LengthAwarePaginator;
|
||||
public function getJournalsOfTypes(array $types, int $page, int $pageSize = 50): LengthAwarePaginator;
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
|
@@ -38,7 +38,7 @@
|
||||
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body table-responsive no-padding">
|
||||
{% include 'list/journals' with {sorting:true} %}
|
||||
{% include 'list.journals' with {sorting:true} %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -99,7 +99,7 @@
|
||||
<h3 class="box-title">{{ 'connected_journals'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body table-responsive no-padding">
|
||||
{% include 'list/journals' %}
|
||||
{% include 'list.journals' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
<h3 class="box-title">{{ subTitle }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{% include 'list/journals.twig' with {'journals': list} %}
|
||||
{% include 'list.journals' with {'journals': list} %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -35,7 +35,7 @@
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
|
||||
</div>
|
||||
{% include 'list/journals.twig' %}
|
||||
{% include 'list.journals' %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3 col-sm-5">
|
||||
|
@@ -12,7 +12,7 @@
|
||||
{{ subTitle }}
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
{% include 'list/journals.twig' with {'journals': list} %}
|
||||
{% include 'list.journals' with {'journals': list} %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -35,7 +35,7 @@
|
||||
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
{% include 'list/journals' %}
|
||||
{% include 'list.journals' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -31,7 +31,7 @@
|
||||
<h3 class="box-title">{{ 'transactions'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
{% include 'list/journals' %}
|
||||
{% include 'list.journals' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -94,7 +94,7 @@
|
||||
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
{% include 'list/journals-tiny.twig' with {'transactions': data[0],'account': data[1]} %}
|
||||
{% include 'list.journals-tiny' with {'transactions': data[0],'account': data[1]} %}
|
||||
</div>
|
||||
<div class="box-footer clearfix">
|
||||
<a class="btn btn-sm btn-default btn-flat pull-right"
|
||||
|
@@ -14,7 +14,7 @@
|
||||
<h3 class="box-title">Transactions</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
{% include 'list/journals-tiny' with {'transactions' : result.transactions} %}
|
||||
{% include 'list.journals-tiny' with {'transactions' : result.transactions} %}
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<span class="pull-right">Results: {{ result.transactions|length }}</span>
|
||||
|
Reference in New Issue
Block a user