mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-23 09:26:29 -06:00
First full transaction list (again) and removed some google table references.
This commit is contained in:
parent
a58a560bbb
commit
0530c0402c
@ -220,11 +220,17 @@ class AccountController extends BaseController
|
||||
break;
|
||||
}
|
||||
|
||||
// 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, 50);
|
||||
|
||||
|
||||
//$data = $this->_accounts->show($account, 40);
|
||||
return View::make('accounts.show')->with('account', $account)->with(
|
||||
return View::make('accounts.show',compact('account','subTitleIcon','journals'))->with('account', $account)->with(
|
||||
'subTitle', 'Details for ' . strtolower($account->accountType->type) . ' "' . $account->name . '"'
|
||||
)->with(compact('subTitleIcon'));
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -483,5 +483,25 @@ class Account implements CUD, CommonDatabaseCalls, AccountInterface
|
||||
|
||||
}
|
||||
|
||||
public function getTransactionJournals(\Account $account, $limit = 50)
|
||||
{
|
||||
$start = \Session::get('start');
|
||||
$end = \Session::get('end');
|
||||
$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)->before($end)->after($start)->orderBy('date', 'DESC')
|
||||
->get(['transaction_journals.*']);
|
||||
$count = $this->getUser()->transactionJournals()->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->before($end)->after($start)->orderBy('date', 'DESC')->where('transactions.account_id', $account->id)->count();
|
||||
$items = [];
|
||||
foreach ($set as $entry) {
|
||||
$items[] = $entry;
|
||||
}
|
||||
|
||||
return \Paginator::make($items, $count, $limit);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -213,7 +213,7 @@ class TransactionJournal extends Ardent
|
||||
$q->orderBy('amount', 'ASC');
|
||||
}, 'transactiontype', 'components' => function ($q) {
|
||||
$q->orderBy('class');
|
||||
}, 'transactions.account.accounttype', 'recurringTransaction']
|
||||
}, 'transactions.account.accounttype', 'recurringTransaction','budgets','categories']
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
<i class="fa fa-repeat fa-fw"></i> Transactions
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div id="account-transactions"></div>
|
||||
@include('list.journals-full')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
90
app/views/list/journals-full.blade.php
Normal file
90
app/views/list/journals-full.blade.php
Normal file
@ -0,0 +1,90 @@
|
||||
<table class="table table-striped table-bordered">
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
<th>Description</th>
|
||||
<th>Amount</th>
|
||||
<th>Date</th>
|
||||
<th>From</th>
|
||||
<th>To</th>
|
||||
<th><i class="fa fa-tasks fa-fw" title="Budget"></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>
|
||||
</tr>
|
||||
@foreach($journals as $journal)
|
||||
<tr>
|
||||
<td>
|
||||
<div class="btn-group btn-group-xs">
|
||||
<a href="{{route('transactions.edit',$journal->id)}}" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-pencil"></span></a>
|
||||
<a href="{{route('transactions.delete',$journal->id)}}" class="btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
@if($journal->transactiontype->type == 'Withdrawal')
|
||||
<span class="glyphicon glyphicon-arrow-left" title="Withdrawal"></span>
|
||||
@endif
|
||||
@if($journal->transactiontype->type == 'Deposit')
|
||||
<span class="glyphicon glyphicon-arrow-right" title="Deposit"></span>
|
||||
@endif
|
||||
@if($journal->transactiontype->type == 'Transfer')
|
||||
<span class="glyphicon glyphicon-resize-full" title="Transfer"></span>
|
||||
@endif
|
||||
@if($journal->transactiontype->type == 'Opening balance')
|
||||
<span class="glyphicon glyphicon-ban-circle" title="Opening balance"></span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{route('transactions.show',$journal->id)}}" title="{{{$journal->description}}}">{{{$journal->description}}}</a>
|
||||
</td>
|
||||
<td>
|
||||
@if($journal->transactiontype->type == 'Withdrawal')
|
||||
<span class="text-danger">{{mf($journal->transactions[1]->amount,false)}}</span>
|
||||
@endif
|
||||
@if($journal->transactiontype->type == 'Deposit')
|
||||
<span class="text-success">{{mf($journal->transactions[1]->amount,false)}}</span>
|
||||
@endif
|
||||
@if($journal->transactiontype->type == 'Transfer')
|
||||
<span class="text-info">{{mf($journal->transactions[1]->amount,false)}}</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{{$journal->date->format('j F Y')}}
|
||||
</td>
|
||||
<td>
|
||||
@if($journal->transactions[0]->account->accounttype->description == 'Cash account')
|
||||
<span class="text-success">(cash)</span>
|
||||
@else
|
||||
<a href="{{route('accounts.show',$journal->transactions[0]->account_id)}}">{{{$journal->transactions[0]->account->name}}}</a>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($journal->transactions[1]->account->accounttype->description == 'Cash account')
|
||||
<span class="text-success">(cash)</span>
|
||||
@else
|
||||
<a href="{{route('accounts.show',$journal->transactions[1]->account_id)}}">{{{$journal->transactions[1]->account->name}}}</a>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<?php $budget = isset($journal->budgets[0]) ? $journal->budgets[0] : null; ?>
|
||||
@if($budget)
|
||||
<a href="{{route('budgets.show',$budget->id)}}">{{{$budget->name}}}</a>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<?php $category = isset($journal->categories[0]) ? $journal->categories[0] : null; ?>
|
||||
@if($category)
|
||||
<a href="{{route('categories.show',$category->id)}}">{{{$category->name}}}</a>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($journal->recurringTransaction)
|
||||
<a href="{{route('recurring.show',$journal->recurring_transaction_id)}}">{{{$journal->recurringTransaction->name}}}</a>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
|
||||
{{$journals->links()}}
|
@ -8,13 +8,5 @@ $(function () {
|
||||
googleSankeyChart('chart/sankey/' + accountID + '/out', 'account-out-sankey');
|
||||
googleSankeyChart('chart/sankey/' + accountID + '/in', 'account-in-sankey');
|
||||
}
|
||||
if (typeof(googleTable) == 'function') {
|
||||
if (typeof accountID != 'undefined') {
|
||||
googleTable('table/account/' + accountID + '/transactions', 'account-transactions');
|
||||
}
|
||||
if (typeof what != 'undefined') {
|
||||
googleTable('table/accounts/' + what, 'account-list');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
@ -7,14 +7,8 @@ $(function () {
|
||||
$('.updateIncome').on('click', updateIncome);
|
||||
|
||||
|
||||
if (typeof(googleTable) == 'function') {
|
||||
if (typeof componentID != 'undefined' && typeof repetitionID == 'undefined') {
|
||||
googleTable('table/component/' + componentID + '/0/transactions', 'transactions');
|
||||
googleColumnChart('chart/component/' + componentID + '/spending/' + year, 'componentOverview');
|
||||
|
||||
} else if (typeof componentID != 'undefined' && typeof repetitionID != 'undefined') {
|
||||
googleTable('table/component/' + componentID + '/' + repetitionID + '/transactions', 'transactions');
|
||||
}
|
||||
if (typeof componentID != 'undefined' && typeof repetitionID == 'undefined') {
|
||||
googleColumnChart('chart/component/' + componentID + '/spending/' + year, 'componentOverview');
|
||||
}
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user