mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
New stuff for transaction edits [skip ci]
This commit is contained in:
parent
a40b281ea3
commit
03994dd774
@ -111,6 +111,11 @@ class TransactionController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$transactions = $this->_journal->paginate(25);
|
||||||
|
return View::make('transactions.index')->with('transactions',$transactions);
|
||||||
|
}
|
||||||
|
|
||||||
public function show($journalId)
|
public function show($journalId)
|
||||||
{
|
{
|
||||||
$journal = $this->_journal->find($journalId);
|
$journal = $this->_journal->find($journalId);
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
namespace Firefly\Storage\TransactionJournal;
|
namespace Firefly\Storage\TransactionJournal;
|
||||||
|
|
||||||
|
|
||||||
use Firefly\Exception\FireflyException;
|
|
||||||
|
|
||||||
class EloquentTransactionJournalRepository implements TransactionJournalRepositoryInterface
|
class EloquentTransactionJournalRepository implements TransactionJournalRepositoryInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -167,7 +165,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getByAccountInDateRange(\Account $account, $count = 25,\Carbon\Carbon $start, \Carbon\Carbon $end)
|
public function getByAccountInDateRange(\Account $account, $count = 25, \Carbon\Carbon $start, \Carbon\Carbon $end)
|
||||||
{
|
{
|
||||||
$accountID = $account->id;
|
$accountID = $account->id;
|
||||||
$query = \Auth::user()->transactionjournals()->with(
|
$query = \Auth::user()->transactionjournals()->with(
|
||||||
@ -180,8 +178,8 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
|||||||
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||||
->where('accounts.id', $accountID)
|
->where('accounts.id', $accountID)
|
||||||
->where('date','>=',$start->format('Y-m-d'))
|
->where('date', '>=', $start->format('Y-m-d'))
|
||||||
->where('date','<=',$end->format('Y-m-d'))
|
->where('date', '<=', $end->format('Y-m-d'))
|
||||||
->orderBy('transaction_journals.date', 'DESC')
|
->orderBy('transaction_journals.date', 'DESC')
|
||||||
->orderBy('transaction_journals.id', 'DESC')
|
->orderBy('transaction_journals.id', 'DESC')
|
||||||
->take($count)
|
->take($count)
|
||||||
@ -189,6 +187,26 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
|||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function paginate($count = 25)
|
||||||
|
{
|
||||||
|
$query = \Auth::user()->transactionjournals()->with(
|
||||||
|
[
|
||||||
|
'transactions' => function ($q) {
|
||||||
|
return $q->orderBy('amount', 'ASC');
|
||||||
|
},
|
||||||
|
'transactions.account',
|
||||||
|
'transactions.account.accounttype',
|
||||||
|
'transactioncurrency',
|
||||||
|
'transactiontype'
|
||||||
|
]
|
||||||
|
)
|
||||||
|
->orderBy('transaction_journals.date', 'DESC')
|
||||||
|
->orderBy('transaction_journals.id', 'DESC')
|
||||||
|
->take($count)
|
||||||
|
->paginate($count);
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
public function getByDateRange(\Carbon\Carbon $start, \Carbon\Carbon $end)
|
public function getByDateRange(\Carbon\Carbon $start, \Carbon\Carbon $end)
|
||||||
{
|
{
|
||||||
// lets make this simple.
|
// lets make this simple.
|
||||||
|
@ -11,10 +11,12 @@ interface TransactionJournalRepositoryInterface
|
|||||||
|
|
||||||
public function find($journalId);
|
public function find($journalId);
|
||||||
|
|
||||||
public function getByAccountInDateRange(\Account $account, $count = 25,\Carbon\Carbon $start, \Carbon\Carbon $end);
|
public function getByAccountInDateRange(\Account $account, $count = 25, \Carbon\Carbon $start, \Carbon\Carbon $end);
|
||||||
|
|
||||||
public function getByAccountAndDate(\Account $account, \Carbon\Carbon $date);
|
public function getByAccountAndDate(\Account $account, \Carbon\Carbon $date);
|
||||||
|
|
||||||
public function getByDateRange(\Carbon\Carbon $start, \Carbon\Carbon $end);
|
public function getByDateRange(\Carbon\Carbon $start, \Carbon\Carbon $end);
|
||||||
|
|
||||||
|
public function paginate($count = 25);
|
||||||
|
|
||||||
}
|
}
|
@ -48,6 +48,7 @@ Route::group(['before' => 'auth'], function () {
|
|||||||
Route::get('/transaction/show/{id}',['uses' => 'TransactionController@show','as' => 'transactions.show']);
|
Route::get('/transaction/show/{id}',['uses' => 'TransactionController@show','as' => 'transactions.show']);
|
||||||
Route::get('/transaction/edit/{id}',['uses' => 'TransactionController@edit','as' => 'transactions.edit']);
|
Route::get('/transaction/edit/{id}',['uses' => 'TransactionController@edit','as' => 'transactions.edit']);
|
||||||
Route::get('/transaction/delete/{id}',['uses' => 'TransactionController@delete','as' => 'transactions.delete']);
|
Route::get('/transaction/delete/{id}',['uses' => 'TransactionController@delete','as' => 'transactions.delete']);
|
||||||
|
Route::get('/transactions/index',['uses' => 'TransactionController@index','as' => 'transactions.index']);
|
||||||
// migration controller
|
// migration controller
|
||||||
Route::get('/migrate', ['uses' => 'MigrationController@index', 'as' => 'migrate']);
|
Route::get('/migrate', ['uses' => 'MigrationController@index', 'as' => 'migrate']);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ $r = Route::current()->getName();
|
|||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">
|
||||||
<li><a href="{{route('accounts.index')}}"><span class="glyphicon glyphicon-inbox"></span> Accounts</a></li>
|
<li><a href="{{route('accounts.index')}}"><span class="glyphicon glyphicon-inbox"></span> Accounts</a></li>
|
||||||
<li><a href="{{route('budgets.index')}}"><span class="glyphicon glyphicon-euro"></span> Budgets</a></li>
|
<li><a href="{{route('budgets.index')}}"><span class="glyphicon glyphicon-euro"></span> Budgets</a></li>
|
||||||
<li><a href="#">Something else here</a></li>
|
<li><a href="{{route('transactions.index')}}"><span class="glyphicon glyphicon-list-alt"></span> Transactions</a></li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li><a href="#">Separated link</a></li>
|
<li><a href="#">Separated link</a></li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
|
60
app/views/transactions/index.blade.php
Normal file
60
app/views/transactions/index.blade.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
@extends('layouts.default')
|
||||||
|
@section('content')
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
@foreach($transactions as $journal)
|
||||||
|
<tr>
|
||||||
|
<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>
|
||||||
|
bud / cat
|
||||||
|
</td>
|
||||||
|
<td><a href="#" 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>
|
||||||
|
@if($journal->transactions[0]->account->accounttype->description == 'Cash account')
|
||||||
|
<span class="text-success">(cash)</span>
|
||||||
|
@else
|
||||||
|
<a href="#">{{{$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="#">{{{$journal->transactions[1]->account->name}}}</a>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td>Edit / delete</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{{$transactions->links()}}
|
||||||
|
|
||||||
|
@stop
|
||||||
|
|
Loading…
Reference in New Issue
Block a user