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)
|
public function index($what)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/** @var \FireflyIII\Database\TransactionJournal $repository */
|
||||||
|
$repository = App::make('FireflyIII\Database\TransactionJournal');
|
||||||
|
|
||||||
switch ($what) {
|
switch ($what) {
|
||||||
case 'expenses':
|
case 'expenses':
|
||||||
case 'withdrawal':
|
case 'withdrawal':
|
||||||
$subTitleIcon = 'fa-long-arrow-left';
|
$subTitleIcon = 'fa-long-arrow-left';
|
||||||
$subTitle = 'Expenses';
|
$subTitle = 'Expenses';
|
||||||
|
$journals = $repository->getWithdrawalsPaginated(50);
|
||||||
break;
|
break;
|
||||||
case 'revenue':
|
case 'revenue':
|
||||||
case 'deposit':
|
case 'deposit':
|
||||||
$subTitleIcon = 'fa-long-arrow-right';
|
$subTitleIcon = 'fa-long-arrow-right';
|
||||||
$subTitle = 'Revenue, income and deposits';
|
$subTitle = 'Revenue, income and deposits';
|
||||||
|
$journals = $repository->getDepositsPaginated(50);
|
||||||
break;
|
break;
|
||||||
case 'transfer':
|
case 'transfer':
|
||||||
case 'transfers':
|
case 'transfers':
|
||||||
$subTitleIcon = 'fa-arrows-h';
|
$subTitleIcon = 'fa-arrows-h';
|
||||||
$subTitle = 'Transfers';
|
$subTitle = 'Transfers';
|
||||||
|
$journals = $repository->getTransfersPaginated(50);
|
||||||
break;
|
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
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function show(
|
public function show(TransactionJournal $journal)
|
||||||
TransactionJournal $journal
|
{
|
||||||
) {
|
|
||||||
return View::make('transactions.show')->with('journal', $journal)->with(
|
return View::make('transactions.show')->with('journal', $journal)->with(
|
||||||
'subTitle', $journal->transactionType->type . ' "' . $journal->description . '"'
|
'subTitle', $journal->transactionType->type . ' "' . $journal->description . '"'
|
||||||
);
|
);
|
||||||
|
@ -505,24 +505,6 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
|||||||
return $sum;
|
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 \Account $account
|
||||||
* @param int $count
|
* @param int $count
|
||||||
@ -546,39 +528,42 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
|||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getWithdrawalsPaginated($limit = 50) {
|
||||||
* Some objects.
|
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getTransfers($limit = null, $offset = null)
|
|
||||||
{
|
|
||||||
$query = $this->getUser()->transactionjournals()->withRelevantData()->transactionTypes(['Transfer']);
|
|
||||||
|
|
||||||
if(!is_null($limit)) {
|
$set = $this->getUser()->transactionJournals()->transactionTypes(['Withdrawal'])->withRelevantData()->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
|
||||||
$query->take($limit);
|
$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 \Paginator::make($items, $count, $limit);
|
||||||
}
|
|
||||||
return $query->get(['transaction_journals.*']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getDepositsPaginated($limit = 50) {
|
||||||
* Some objects.
|
$offset = intval(\Input::get('page')) > 0 ? intval(\Input::get('page')) * $limit : 0;
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getWithdrawals($limit = null, $offset = null)
|
|
||||||
{
|
|
||||||
$query = $this->getUser()->transactionjournals()->withRelevantData()->transactionTypes(['Withdrawal']);
|
|
||||||
|
|
||||||
if(!is_null($limit) && intval($limit) > 0) {
|
$set = $this->getUser()->transactionJournals()->transactionTypes(['Deposit'])->withRelevantData()->take($limit)->offset($offset)->orderBy('date', 'DESC')->get(['transaction_journals.*']);
|
||||||
$query->take($limit);
|
$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>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<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>
|
||||||
<td>
|
<td>
|
||||||
<?php $active = $category->lastActionDate(); ?>
|
<?php $active = $category->lastActionDate(); ?>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<i class="fa {{$subTitleIcon}}"></i> {{{$subTitle}}}
|
<i class="fa {{$subTitleIcon}}"></i> {{{$subTitle}}}
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div id="transaction-table"></div>
|
@include('list.journals-full')
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -15,15 +15,3 @@
|
|||||||
|
|
||||||
|
|
||||||
@stop
|
@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