mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fixed transactions lists.
This commit is contained in:
parent
ac2ab65471
commit
f9750a64f8
@ -224,25 +224,31 @@ class TransactionController extends BaseController
|
||||
public function index($what)
|
||||
{
|
||||
|
||||
/** @var \FireflyIII\Database\TransactionJournal $repository */
|
||||
$repository = App::make('FireflyIII\Database\TransactionJournal');
|
||||
|
||||
switch ($what) {
|
||||
case 'expenses':
|
||||
case 'withdrawal':
|
||||
$subTitleIcon = 'fa-long-arrow-left';
|
||||
$subTitle = 'Expenses';
|
||||
$journals = $repository->getWithdrawalsPaginated(50);
|
||||
break;
|
||||
case 'revenue':
|
||||
case 'deposit':
|
||||
$subTitleIcon = 'fa-long-arrow-right';
|
||||
$subTitle = 'Revenue, income and deposits';
|
||||
$journals = $repository->getDepositsPaginated(50);
|
||||
break;
|
||||
case 'transfer':
|
||||
case 'transfers':
|
||||
$subTitleIcon = 'fa-arrows-h';
|
||||
$subTitle = 'Transfers';
|
||||
$journals = $repository->getTransfersPaginated(50);
|
||||
break;
|
||||
}
|
||||
|
||||
return View::make('transactions.index', compact('subTitle', 'subTitleIcon'))->with('what', $what);
|
||||
return View::make('transactions.index', compact('subTitle', 'subTitleIcon','journals'))->with('what', $what);
|
||||
|
||||
}
|
||||
|
||||
@ -251,9 +257,8 @@ class TransactionController extends BaseController
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function show(
|
||||
TransactionJournal $journal
|
||||
) {
|
||||
public function show(TransactionJournal $journal)
|
||||
{
|
||||
return View::make('transactions.show')->with('journal', $journal)->with(
|
||||
'subTitle', $journal->transactionType->type . ' "' . $journal->description . '"'
|
||||
);
|
||||
|
@ -505,24 +505,6 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
return $sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some objects.
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getDeposits($limit = null, $offset = null)
|
||||
{
|
||||
$query = $this->getUser()->transactionjournals()->withRelevantData()->transactionTypes(['Deposit']);
|
||||
if(!is_null($limit)) {
|
||||
$query->take($limit);
|
||||
}
|
||||
if(!is_null($offset) && intval($offset) > 0) {
|
||||
$query->skip($offset);
|
||||
}
|
||||
|
||||
return $query->get(['transaction_journals.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Account $account
|
||||
* @param int $count
|
||||
@ -546,39 +528,42 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some objects.
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getTransfers($limit = null, $offset = null)
|
||||
{
|
||||
$query = $this->getUser()->transactionjournals()->withRelevantData()->transactionTypes(['Transfer']);
|
||||
public function getWithdrawalsPaginated($limit = 50) {
|
||||
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||
|
||||
if(!is_null($limit)) {
|
||||
$query->take($limit);
|
||||
$set = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->withRelevantData()->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
|
||||
$count = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->count();
|
||||
$items = [];
|
||||
foreach ($set as $entry) {
|
||||
$items[] = $entry;
|
||||
}
|
||||
if(!is_null($offset) && intval($offset) > 0) {
|
||||
$query->skip($offset);
|
||||
}
|
||||
return $query->get(['transaction_journals.*']);
|
||||
|
||||
return \Paginator::make($items, $count, $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Some objects.
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getWithdrawals($limit = null, $offset = null)
|
||||
{
|
||||
$query = $this->getUser()->transactionjournals()->withRelevantData()->transactionTypes(['Withdrawal']);
|
||||
public function getDepositsPaginated($limit = 50) {
|
||||
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||
|
||||
if(!is_null($limit) && intval($limit) > 0) {
|
||||
$query->take($limit);
|
||||
$set = $this->getUser()->transactionJournals()->transactionTypes(['Deposit'])->withRelevantData()->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
|
||||
$count = $this->getUser()->transactionJournals()->transactionTypes(['Deposit'])->count();
|
||||
$items = [];
|
||||
foreach ($set as $entry) {
|
||||
$items[] = $entry;
|
||||
}
|
||||
if(!is_null($offset) && intval($offset) > 0) {
|
||||
$query->skip($offset);
|
||||
|
||||
return \Paginator::make($items, $count, $limit);
|
||||
}
|
||||
|
||||
public function getTransfersPaginated($limit = 50) {
|
||||
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||
|
||||
$set = $this->getUser()->transactionJournals()->transactionTypes(['Transfer'])->withRelevantData()->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
|
||||
$count = $this->getUser()->transactionJournals()->transactionTypes(['Transfer'])->count();
|
||||
$items = [];
|
||||
foreach ($set as $entry) {
|
||||
$items[] = $entry;
|
||||
}
|
||||
return $query->get(['transaction_journals.*']);
|
||||
|
||||
return \Paginator::make($items, $count, $limit);
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{route('categories.show',$category->id)" title="{{{$category->name}}}">{{{$category->name}}}</a>
|
||||
<a href="{{route('categories.show',$category->id)}}" title="{{{$category->name}}}">{{{$category->name}}}</a>
|
||||
</td>
|
||||
<td>
|
||||
<?php $active = $category->lastActionDate(); ?>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<i class="fa {{$subTitleIcon}}"></i> {{{$subTitle}}}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div id="transaction-table"></div>
|
||||
@include('list.journals-full')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -15,15 +15,3 @@
|
||||
|
||||
|
||||
@stop
|
||||
@section('scripts')
|
||||
<script type="text/javascript">
|
||||
var what = '{{{$what}}}';
|
||||
</script>
|
||||
<!-- load the libraries and scripts necessary for Google Charts: -->
|
||||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
||||
{{HTML::script('assets/javascript/firefly/gcharts.options.js')}}
|
||||
{{HTML::script('assets/javascript/firefly/gcharts.js')}}
|
||||
|
||||
|
||||
{{HTML::script('assets/javascript/firefly/transactions.js')}}
|
||||
@stop
|
Loading…
Reference in New Issue
Block a user