diff --git a/app/controllers/RecurringController.php b/app/controllers/RecurringController.php index a70e92561e..612bdf7b89 100644 --- a/app/controllers/RecurringController.php +++ b/app/controllers/RecurringController.php @@ -37,8 +37,13 @@ class RecurringController extends BaseController } - public function edit() + public function edit(RecurringTransaction $recurringTransaction) { + $periods = \Config::get('firefly.periods_to_text'); + + return View::make('recurring.edit')->with('periods', $periods)->with( + 'recurringTransaction', $recurringTransaction + ); } public function index() @@ -71,7 +76,7 @@ class RecurringController extends BaseController } } - public function update() + public function update(RecurringTransaction $recurringTransaction) { } } \ No newline at end of file diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.php index 0dad583244..97d3d5ea37 100644 --- a/app/controllers/TransactionController.php +++ b/app/controllers/TransactionController.php @@ -133,14 +133,9 @@ class TransactionController extends BaseController * * @return $this|\Illuminate\View\View */ - public function show($journalId) + public function show(TransactionJournal $journal) { -// $journal = $this->_journal->find($journalId); -// if ($journal) { -// return View::make('transactions.show')->with('journal', $journal); -// } -// -// return View::make('error')->with('message', 'Invalid journal'); + return View::make('transactions.show')->with('journal', $journal); } /** diff --git a/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php b/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php index aad984cf59..f322aec042 100644 --- a/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php +++ b/app/lib/Firefly/Storage/TransactionJournal/EloquentTransactionJournalRepository.php @@ -386,7 +386,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito case 'Withdrawal': // means transaction[0] is the users account. $account = $accountRepository->find($data['account_id']); - $beneficiary = $accountRepository->findByName($data['beneficiary']); + $beneficiary = $accountRepository->createOrFindBeneficiary($data['beneficiary']); $transactions[0]->account()->associate($account); $transactions[1]->account()->associate($beneficiary); @@ -400,7 +400,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito case 'Deposit': // means transaction[0] is the beneficiary. $account = $accountRepository->find($data['account_id']); - $beneficiary = $accountRepository->findByName($data['beneficiary']); + $beneficiary = $accountRepository->createOrFindBeneficiary($data['beneficiary']); $journal->transactions[0]->account()->associate($beneficiary); $journal->transactions[1]->account()->associate($account); break; diff --git a/app/routes.php b/app/routes.php index ee14a44cb2..389a4c5130 100644 --- a/app/routes.php +++ b/app/routes.php @@ -147,6 +147,7 @@ Route::group(['before' => 'auth'], function () { // recurring transactions controller Route::get('/recurring',['uses' => 'RecurringController@index', 'as' => 'recurring.index']); + Route::get('/recurring/show/{recurring}',['uses' => 'RecurringController@show', 'as' => 'recurring.show']); Route::get('/recurring/create',['uses' => 'RecurringController@create', 'as' => 'recurring.create']); Route::get('/recurring/edit/{recurring}',['uses' => 'RecurringController@edit','as' => 'recurring.edit']); Route::get('/recurring/delete/{recurring}',['uses' => 'RecurringController@delete','as' => 'recurring.delete']); diff --git a/app/views/recurring/edit.blade.php b/app/views/recurring/edit.blade.php new file mode 100644 index 0000000000..1a4904ca45 --- /dev/null +++ b/app/views/recurring/edit.blade.php @@ -0,0 +1,194 @@ +@extends('layouts.default') +@section('content') +
+
+

Firefly + Edit recurring transaction "{{{$recurringTransaction->name}}}" +

+

Use recurring transactions to track repeated expenses

+

+ Bla bla. +

+
+
+ +{{Form::open(['class' => 'form-horizontal','url' => route('recurring.update', $recurringTransaction->id)])}} + +
+
+

Mandatory fields

+ + +
+ +
+ + @if($errors->has('name')) +

{{$errors->first('name')}}

+ @else + For example: rent, gas, insurance + @endif +
+
+
+ +
+ + @if($errors->has('match')) +

{{$errors->first('match')}}

+ @else + For example: rent, [company name]. All matches need to + be present for the recurring transaction to be recognized. This field is not case-sensitive. + @endif +
+
+ +
+ {{ Form::label('amount_min', 'Minimum amount', ['class' => 'col-sm-4 control-label'])}} +
+
+ + {{Form::input('number','amount_min', Input::old('amount_min') ?: $recurringTransaction->amount_min, + ['step' => 'any', 'class' => 'form-control'])}} +
+ + @if($errors->has('amount_min')) +

{{$errors->first('amount_min')}}

+ @else + Firefly will only include transactions with a higher amount than this. If your rent + is usually around € 500,-, enter 450 to be safe. + @endif +
+
+ +
+ {{ Form::label('amount_max', 'Maximum amount', ['class' => 'col-sm-4 control-label'])}} +
+
+ + {{Form::input('number','amount_max', Input::old('amount_max') ?: $recurringTransaction->amount_max, + ['step' => 'any', 'class' => 'form-control'])}} +
+ + @if($errors->has('amount_max')) +

{{$errors->first('amount_max')}}

+ @else + Firefly will only include transactions with a lower amount than this. + If your rent is usually around € 500,-, enter 550 to be safe. + @endif +
+
+ +
+ {{ Form::label('date', 'Date', ['class' => 'col-sm-4 control-label'])}} +
+ {{ Form::input('date','date', Input::old('date') ?: $recurringTransaction->date->format('Y-m-d'), + ['class' => 'form-control']) }} + @if($errors->has('date')) +

{{$errors->first('date')}}

+ @else + Select the next date you expect the transaction to occur. + @endif +
+
+ +
+ +
+ {{Form::select('repeat_freq',$periods,Input::old('repeat_freq') ?: $recurringTransaction->repeat_freq, + ['class' => 'form-control'])}} + @if($errors->has('repeat_freq')) +

{{$errors->first('repeat_freq')}}

+ @else + Select the period over which this transaction repeats + @endif +
+
+ +
+
+

Optional fields

+ +
+ {{ Form::label('skip', 'Skip', ['class' => 'col-sm-4 control-label'])}} +
+ {{Form::input('number','skip', Input::old('skip') ?: $recurringTransaction->skip, + ['class' => 'form-control'])}} + + @if($errors->has('skip')) +

{{$errors->first('skip')}}

+ @else + Make Firefly skip every n times. Fill in 2, and Firefly + will match, skip, skip and match a transaction. + @endif +
+
+ + + + + + + + + +
+ +
+
+ +
+ Firefly will automatically match transactions. +
+
+ +
+ +
+
+ +
+ This recurring transaction is actually active. +
+
+ + + +
+
+ +
+
+ + + +
+
+ +
+
+
+
+ +{{Form::close()}} + + +@stop +@section('styles') + +@stop +@section('scripts') + + +@stop \ No newline at end of file diff --git a/app/views/recurring/index.blade.php b/app/views/recurring/index.blade.php index e0f94a7a62..179d44f1e8 100644 --- a/app/views/recurring/index.blade.php +++ b/app/views/recurring/index.blade.php @@ -29,10 +29,10 @@ @foreach($list as $entry) - {{{$entry->name}}} + {{{$entry->name}}} @foreach(explode(' ',$entry->match) as $word) - {{{$word}}} + {{{$word}}} @endforeach diff --git a/app/views/transactions/create.blade.php b/app/views/transactions/create.blade.php index 28f4d0a9e8..19d05da1e1 100644 --- a/app/views/transactions/create.blade.php +++ b/app/views/transactions/create.blade.php @@ -38,6 +38,9 @@
+ @if($errors->has('description') +

{{$errors->first('description')}}

+ @endif
@@ -54,6 +57,9 @@
{{Form::select('account_id',$accounts,Input::old('account_id') ?: Input::get('account'),['class' => 'form-control'])}} + @if($errors->has('account_id') +

{{$errors->first('account_id')}}

+ @endif
@endif @@ -71,7 +77,11 @@
+ @if($errors->has('beneficiary') +

{{$errors->first('beneficiary')}}

+ @else This field will auto-complete your existing beneficiaries (if any), but you can type freely to create new ones. + @endif
@endif @@ -125,6 +135,9 @@
+ @if($errors->has('date') +

{{$errors->first('date')}}

+ @endif
@@ -138,7 +151,11 @@
{{Form::select('budget_id',$budgets,Input::old('budget_id') ?: 0,['class' => 'form-control'])}} + @if($errors->has('budget_id') +

{{$errors->first('budget_id')}}

+ @else Select one of your budgets to make this transaction a part of it. + @endif
@endif @@ -147,10 +164,14 @@
+ @if($errors->has('category') +

{{$errors->first('category')}}

+ @else Add more fine-grained information to this transaction by entering a category. Like the beneficiary-field, this field will auto-complete existing categories but can also be used to create new ones. + @endif
diff --git a/app/views/transactions/edit.blade.php b/app/views/transactions/edit.blade.php index 9f3e418d03..9fc90c54a4 100644 --- a/app/views/transactions/edit.blade.php +++ b/app/views/transactions/edit.blade.php @@ -157,6 +157,5 @@ @stop @section('scripts') - - + @stop \ No newline at end of file