mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Extended forms and started on recurring transactions.
This commit is contained in:
parent
980d9ce885
commit
28aaea1aa3
@ -37,8 +37,8 @@ return [
|
||||
'Illuminate\Validation\ValidationServiceProvider',
|
||||
'Illuminate\View\ViewServiceProvider',
|
||||
'Illuminate\Workbench\WorkbenchServiceProvider',
|
||||
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
|
||||
'Barryvdh\Debugbar\ServiceProvider',
|
||||
# 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
|
||||
# 'Barryvdh\Debugbar\ServiceProvider',
|
||||
'Firefly\Storage\StorageServiceProvider',
|
||||
'Firefly\Helper\HelperServiceProvider',
|
||||
'Firefly\Validation\ValidationServiceProvider',
|
||||
|
@ -19,8 +19,8 @@ class RecurringController extends BaseController
|
||||
{
|
||||
$this->_repository = $repository;
|
||||
|
||||
View::share('title','Recurring transactions');
|
||||
View::share('mainTitleIcon','fa-rotate-right');
|
||||
View::share('title', 'Recurring transactions');
|
||||
View::share('mainTitleIcon', 'fa-rotate-right');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -28,7 +28,7 @@ class RecurringController extends BaseController
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
View::share('subTitle','Create new');
|
||||
View::share('subTitle', 'Create new');
|
||||
$periods = \Config::get('firefly.periods_to_text');
|
||||
|
||||
return View::make('recurring.create')->with('periods', $periods);
|
||||
@ -41,7 +41,7 @@ class RecurringController extends BaseController
|
||||
*/
|
||||
public function delete(RecurringTransaction $recurringTransaction)
|
||||
{
|
||||
View::share('subTitle','Delete "' .$recurringTransaction->name.'"');
|
||||
View::share('subTitle', 'Delete "' . $recurringTransaction->name . '"');
|
||||
return View::make('recurring.delete')->with('recurringTransaction', $recurringTransaction);
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ class RecurringController extends BaseController
|
||||
{
|
||||
$periods = \Config::get('firefly.periods_to_text');
|
||||
|
||||
View::share('subTitle','Edit "' .$recurringTransaction->name.'"');
|
||||
View::share('subTitle', 'Edit "' . $recurringTransaction->name . '"');
|
||||
|
||||
return View::make('recurring.edit')->with('periods', $periods)->with(
|
||||
'recurringTransaction', $recurringTransaction
|
||||
@ -93,14 +93,11 @@ class RecurringController extends BaseController
|
||||
*/
|
||||
public function show(RecurringTransaction $recurringTransaction)
|
||||
{
|
||||
View::share('subTitle',$recurringTransaction->name);
|
||||
View::share('subTitle', $recurringTransaction->name);
|
||||
return View::make('recurring.show')->with('recurring', $recurringTransaction);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store()
|
||||
{
|
||||
|
||||
@ -108,25 +105,54 @@ class RecurringController extends BaseController
|
||||
default:
|
||||
throw new FireflyException('Method ' . Input::get('post_submit_action') . ' not implemented yet.');
|
||||
break;
|
||||
case 'store':
|
||||
case 'create_another':
|
||||
/*
|
||||
* Try to store:
|
||||
*/
|
||||
$messageBag = $this->_repository->store(Input::all());
|
||||
|
||||
/*
|
||||
* Failure!
|
||||
*/
|
||||
if ($messageBag->count() > 0) {
|
||||
Session::flash('error', 'Could not save recurring transaction: ' . $messageBag->first());
|
||||
return Redirect::route('recurring.create')->withInput()->withErrors($messageBag);
|
||||
}
|
||||
|
||||
/*
|
||||
* Success!
|
||||
*/
|
||||
Session::flash('success', 'Recurring transaction "' . e(Input::get('name')) . '" saved!');
|
||||
|
||||
/*
|
||||
* Redirect to original location or back to the form.
|
||||
*/
|
||||
if (Input::get('post_submit_action') == 'create_another') {
|
||||
return Redirect::route('recurring.create')->withInput();
|
||||
} else {
|
||||
return Redirect::route('recurring.index');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$recurringTransaction = $this->_repository->store(Input::all());
|
||||
|
||||
if ($recurringTransaction->errors()->count() == 0) {
|
||||
Session::flash('success', 'Recurring transaction "' . $recurringTransaction->name . '" saved!');
|
||||
//Event::fire('recurring.store', [$recurringTransaction]);
|
||||
if (Input::get('create') == '1') {
|
||||
return Redirect::route('recurring.create')->withInput();
|
||||
} else {
|
||||
return Redirect::route('recurring.index');
|
||||
}
|
||||
} else {
|
||||
Session::flash(
|
||||
'error', 'Could not save the recurring transaction: ' . $recurringTransaction->errors()->first()
|
||||
);
|
||||
|
||||
return Redirect::route('recurring.create')->withInput()->withErrors($recurringTransaction->errors());
|
||||
}
|
||||
//
|
||||
//
|
||||
// if ($recurringTransaction->errors()->count() == 0) {
|
||||
// Session::flash('success', 'Recurring transaction "' . $recurringTransaction->name . '" saved!');
|
||||
// //Event::fire('recurring.store', [$recurringTransaction]);
|
||||
// if (Input::get('create') == '1') {
|
||||
// return Redirect::route('recurring.create')->withInput();
|
||||
// } else {
|
||||
// return Redirect::route('recurring.index');
|
||||
// }
|
||||
// } else {
|
||||
// Session::flash(
|
||||
// 'error', 'Could not save the recurring transaction: ' . $recurringTransaction->errors()->first()
|
||||
// );
|
||||
//
|
||||
// return Redirect::route('recurring.create')->withInput()->withErrors($recurringTransaction->errors());
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -67,19 +67,9 @@ class TransactionController extends BaseController
|
||||
$piggies = $toolkit->makeSelectList($piggyRepository->get());
|
||||
$piggies[0] = '(no piggy bank)';
|
||||
|
||||
/*
|
||||
* Catch messages from validation round:
|
||||
*/
|
||||
if (Session::has('messages')) {
|
||||
$messages = Session::get('messages');
|
||||
Session::forget('messages');
|
||||
} else {
|
||||
$messages = new MessageBag;
|
||||
}
|
||||
|
||||
return View::make('transactions.create')->with('accounts', $assetAccounts)->with('budgets', $budgets)->with(
|
||||
'what', $what
|
||||
)->with('piggies', $piggies)->with('subTitle', 'Add a new ' . $what)->with('messages', $messages);
|
||||
)->with('piggies', $piggies)->with('subTitle', 'Add a new ' . $what);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,19 +16,52 @@ class Form
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public static function ffNumber($name, $value = null, array $options = [])
|
||||
public static function ffInteger($name, $value = null, array $options = [])
|
||||
{
|
||||
$options['step'] = 'any';
|
||||
$options['min'] = '0.01';
|
||||
$options['step'] = '1';
|
||||
return self::ffInput('number', $name, $value, $options);
|
||||
|
||||
}
|
||||
|
||||
public static function ffCheckbox($name, $value = 1, $checked = null, $options = [])
|
||||
{
|
||||
$options['checked'] = $checked ? true : null;
|
||||
return self::ffInput('checkbox', $name, $value, $options);
|
||||
}
|
||||
|
||||
public static function ffAmount($name, $value = null, array $options = [])
|
||||
{
|
||||
$options['step'] = 'any';
|
||||
$options['min'] = '0.01';
|
||||
return self::ffInput('amount', $name, $value, $options);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public static function ffDate($name, $value = null, array $options = [])
|
||||
{
|
||||
return self::ffInput('date', $name, $value, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
* @return string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public static function ffTags($name, $value = null, array $options = [])
|
||||
{
|
||||
$options['data-role'] = 'tagsinput';
|
||||
return self::ffInput('text', $name, $value, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param array $list
|
||||
@ -55,6 +88,22 @@ class Form
|
||||
|
||||
}
|
||||
|
||||
public static function label($name)
|
||||
{
|
||||
$labels = [
|
||||
'amount_min' => 'Amount (min)',
|
||||
'amount_max' => 'Amount (max)',
|
||||
'match' => 'Matches on',
|
||||
'repeat_freq' => 'Repetition',
|
||||
'account_from_id' => 'Account from',
|
||||
'account_to_id' => 'Account to',
|
||||
'account_id' => 'Asset account'
|
||||
];
|
||||
|
||||
return isset($labels[$name]) ? $labels[$name] : str_replace('_',' ',ucfirst($name));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
* @param $name
|
||||
@ -72,18 +121,11 @@ class Form
|
||||
$options['class'] = 'form-control';
|
||||
$options['id'] = 'ffInput_' . $name;
|
||||
$options['autocomplete'] = 'off';
|
||||
$options['type'] = 'text';
|
||||
|
||||
$label = self::label($name);
|
||||
/*
|
||||
* Make label and placeholder look nice.
|
||||
*/
|
||||
$options['placeholder'] = isset($options['label']) ? $options['label'] : ucfirst($name);
|
||||
$options['label'] = isset($options['label']) ? $options['label'] : ucfirst($name);
|
||||
if ($name == 'account_id') {
|
||||
$options['label'] = 'Asset account';
|
||||
}
|
||||
$options['label'] = str_replace(['_'], [' '], $options['label']);
|
||||
$options['placeholder'] = str_replace(['_'], [' '], $options['placeholder']);
|
||||
$options['placeholder'] = ucfirst($name);
|
||||
|
||||
/*
|
||||
* Get the value.
|
||||
@ -129,7 +171,6 @@ class Form
|
||||
/*
|
||||
* Add some HTML.
|
||||
*/
|
||||
$label = isset($options['label']) ? $options['label'] : ucfirst($name);
|
||||
$html = '<div class="' . $classes . '">';
|
||||
$html .= '<label for="' . $options['id'] . '" class="col-sm-4 control-label">' . $label . '</label>';
|
||||
$html .= '<div class="col-sm-8">';
|
||||
@ -138,14 +179,27 @@ class Form
|
||||
/*
|
||||
* Switch input type:
|
||||
*/
|
||||
unset($options['label']);
|
||||
switch ($type) {
|
||||
case 'text':
|
||||
$html .= \Form::input('text', $name, $value, $options);
|
||||
break;
|
||||
case 'number':
|
||||
case 'amount':
|
||||
$html .= '<div class="input-group"><div class="input-group-addon">€</div>';
|
||||
$html .= \Form::input('number', $name, $value, $options);
|
||||
$html .= '</div>';
|
||||
break;
|
||||
case 'number':
|
||||
$html .= \Form::input('number', $name, $value, $options);
|
||||
break;
|
||||
case 'checkbox':
|
||||
$checked = $options['checked'];
|
||||
unset($options['checked'], $options['placeholder'], $options['autocomplete'], $options['class']);
|
||||
$html .= '<div class="checkbox"><label>';
|
||||
$html .= \Form::checkbox($name, $value, $checked, $options);
|
||||
$html .= '</label></div>';
|
||||
|
||||
|
||||
break;
|
||||
case 'date':
|
||||
$html .= \Form::input('date', $name, $value, $options);
|
||||
|
@ -5,6 +5,7 @@ namespace Firefly\Storage\RecurringTransaction;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Queue\Jobs\Job;
|
||||
use Illuminate\Support\MessageBag;
|
||||
|
||||
/**
|
||||
* Class EloquentRecurringTransactionRepository
|
||||
@ -45,7 +46,7 @@ class EloquentRecurringTransactionRepository implements RecurringTransactionRepo
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Job $job
|
||||
* @param Job $job
|
||||
* @param array $payload
|
||||
*
|
||||
* @return mixed
|
||||
@ -57,13 +58,13 @@ class EloquentRecurringTransactionRepository implements RecurringTransactionRepo
|
||||
|
||||
/** @var \Importmap $importMap */
|
||||
$importMap = $repository->findImportmap($payload['mapID']);
|
||||
$user = $importMap->user;
|
||||
$user = $importMap->user;
|
||||
$this->overruleUser($user);
|
||||
|
||||
/*
|
||||
* maybe the recurring transaction is already imported:
|
||||
*/
|
||||
$oldId = intval($payload['data']['id']);
|
||||
$oldId = intval($payload['data']['id']);
|
||||
$description = $payload['data']['description'];
|
||||
$importEntry = $repository->findImportEntry($importMap, 'RecurringTransaction', $oldId);
|
||||
|
||||
@ -84,17 +85,17 @@ class EloquentRecurringTransactionRepository implements RecurringTransactionRepo
|
||||
$recurringTransaction = $this->findByName($payload['data']['description']);
|
||||
if (is_null($recurringTransaction)) {
|
||||
$amount = floatval($payload['data']['amount']);
|
||||
$pct = intval($payload['data']['pct']);
|
||||
$pct = intval($payload['data']['pct']);
|
||||
|
||||
$set = [
|
||||
'name' => $description,
|
||||
'match' => join(',', explode(' ', $description)),
|
||||
'amount_min' => $amount * ($pct / 100) * -1,
|
||||
'amount_max' => $amount * (1 + ($pct / 100)) * -1,
|
||||
'date' => date('Y-m-') . $payload['data']['dom'],
|
||||
'name' => $description,
|
||||
'match' => join(',', explode(' ', $description)),
|
||||
'amount_min' => $amount * ($pct / 100) * -1,
|
||||
'amount_max' => $amount * (1 + ($pct / 100)) * -1,
|
||||
'date' => date('Y-m-') . $payload['data']['dom'],
|
||||
'repeat_freq' => 'monthly',
|
||||
'active' => intval($payload['data']['inactive']) == 1 ? 0 : 1,
|
||||
'automatch' => 1,
|
||||
'active' => intval($payload['data']['inactive']) == 1 ? 0 : 1,
|
||||
'automatch' => 1,
|
||||
];
|
||||
|
||||
$recurringTransaction = $this->store($set);
|
||||
@ -131,45 +132,52 @@ class EloquentRecurringTransactionRepository implements RecurringTransactionRepo
|
||||
/**
|
||||
* @param $data
|
||||
*
|
||||
* @return mixed|\RecurringTransaction
|
||||
* @return MessageBag
|
||||
*/
|
||||
public function store($data)
|
||||
{
|
||||
$messageBag = new MessageBag;
|
||||
$recurringTransaction = new \RecurringTransaction(
|
||||
[
|
||||
'user_id' => $this->_user->id,
|
||||
'name' => $data['name'],
|
||||
'match' => join(' ', explode(',', $data['match'])),
|
||||
'amount_max' => floatval($data['amount_max']),
|
||||
'amount_min' => floatval($data['amount_min']),
|
||||
'date' => new Carbon($data['date']),
|
||||
'active' => isset($data['active']) ? intval($data['active']) : 0,
|
||||
'automatch' => isset($data['automatch']) ? intval($data['automatch']) : 0,
|
||||
'skip' => isset($data['skip']) ? intval($data['skip']) : 0,
|
||||
'user_id' => $this->_user->id,
|
||||
'name' => $data['name'],
|
||||
'match' => join(' ', explode(',', $data['match'])),
|
||||
'amount_max' => floatval($data['amount_max']),
|
||||
'amount_min' => floatval($data['amount_min']),
|
||||
'date' => new Carbon($data['date']),
|
||||
'active' => isset($data['active']) ? intval($data['active']) : 0,
|
||||
'automatch' => isset($data['automatch']) ? intval($data['automatch']) : 0,
|
||||
'skip' => isset($data['skip']) ? intval($data['skip']) : 0,
|
||||
'repeat_freq' => $data['repeat_freq'],
|
||||
]
|
||||
);
|
||||
|
||||
// unique name?
|
||||
$count = $this->_user->recurringtransactions()->whereName($data['name'])->count();
|
||||
if($count > 0) {
|
||||
$messageBag->add('name', 'A recurring transaction with this name already exists.');
|
||||
return $messageBag;
|
||||
}
|
||||
|
||||
// both amounts zero?:
|
||||
if ($recurringTransaction->amount_max == 0 && $recurringTransaction->amount_min == 0) {
|
||||
$recurringTransaction->errors()->add('amount_max', 'Amount max and min cannot both be zero.');
|
||||
|
||||
return $recurringTransaction;
|
||||
$messageBag->add('amount_max', 'Amount max and min cannot both be zero.');
|
||||
return $messageBag;
|
||||
}
|
||||
|
||||
if ($recurringTransaction->amount_max < $recurringTransaction->amount_min) {
|
||||
$recurringTransaction->errors()->add('amount_max', 'Amount max must be more than amount min.');
|
||||
return $recurringTransaction;
|
||||
$messageBag->add('amount_max', 'Amount max must be more than amount min.');
|
||||
return $messageBag;
|
||||
}
|
||||
|
||||
if ($recurringTransaction->amount_min > $recurringTransaction->amount_max) {
|
||||
$recurringTransaction->errors()->add('amount_max', 'Amount min must be less than amount max.');
|
||||
return $recurringTransaction;
|
||||
$messageBag->add('amount_max', 'Amount min must be less than amount max.');
|
||||
return $messageBag;
|
||||
}
|
||||
|
||||
if($recurringTransaction->date < Carbon::now()) {
|
||||
$recurringTransaction->errors()->add('date', 'Must be in the future.');
|
||||
return $recurringTransaction;
|
||||
if ($recurringTransaction->date < Carbon::now()) {
|
||||
$messageBag->add('date', 'Must be in the future.');
|
||||
return $messageBag;
|
||||
}
|
||||
|
||||
|
||||
@ -177,7 +185,7 @@ class EloquentRecurringTransactionRepository implements RecurringTransactionRepo
|
||||
$recurringTransaction->save();
|
||||
}
|
||||
|
||||
return $recurringTransaction;
|
||||
return $messageBag;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,8 +196,8 @@ class EloquentRecurringTransactionRepository implements RecurringTransactionRepo
|
||||
*/
|
||||
public function update(\RecurringTransaction $recurringTransaction, $data)
|
||||
{
|
||||
$recurringTransaction->name = $data['name'];
|
||||
$recurringTransaction->match = join(' ', explode(',', $data['match']));
|
||||
$recurringTransaction->name = $data['name'];
|
||||
$recurringTransaction->match = join(' ', explode(',', $data['match']));
|
||||
$recurringTransaction->amount_max = floatval($data['amount_max']);
|
||||
$recurringTransaction->amount_min = floatval($data['amount_min']);
|
||||
|
||||
@ -199,10 +207,10 @@ class EloquentRecurringTransactionRepository implements RecurringTransactionRepo
|
||||
|
||||
return $recurringTransaction;
|
||||
}
|
||||
$recurringTransaction->date = new Carbon($data['date']);
|
||||
$recurringTransaction->active = isset($data['active']) ? intval($data['active']) : 0;
|
||||
$recurringTransaction->automatch = isset($data['automatch']) ? intval($data['automatch']) : 0;
|
||||
$recurringTransaction->skip = isset($data['skip']) ? intval($data['skip']) : 0;
|
||||
$recurringTransaction->date = new Carbon($data['date']);
|
||||
$recurringTransaction->active = isset($data['active']) ? intval($data['active']) : 0;
|
||||
$recurringTransaction->automatch = isset($data['automatch']) ? intval($data['automatch']) : 0;
|
||||
$recurringTransaction->skip = isset($data['skip']) ? intval($data['skip']) : 0;
|
||||
$recurringTransaction->repeat_freq = $data['repeat_freq'];
|
||||
|
||||
if ($recurringTransaction->validate()) {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
namespace Firefly\Storage\RecurringTransaction;
|
||||
use Illuminate\Queue\Jobs\Job;
|
||||
use Illuminate\Support\MessageBag;
|
||||
|
||||
/**
|
||||
* Interface RecurringTransactionRepositoryInterface
|
||||
@ -34,7 +35,7 @@ interface RecurringTransactionRepositoryInterface
|
||||
/**
|
||||
* @param $data
|
||||
*
|
||||
* @return mixed
|
||||
* @return MessageBag
|
||||
*/
|
||||
public function store($data);
|
||||
|
||||
|
@ -78,12 +78,21 @@ App::down(
|
||||
\Form::macro('ffSelect', function ($name, array $list = [], $selected = null, array $options = []) {
|
||||
return \Firefly\Form\Form::ffSelect($name, $list, $selected, $options);
|
||||
});
|
||||
\Form::macro('ffNumber', function ($name, $value = null, array $options = []) {
|
||||
return \Firefly\Form\Form::ffNumber($name, $value, $options);
|
||||
\Form::macro('ffInteger', function ($name, $value = null, array $options = []) {
|
||||
return \Firefly\Form\Form::ffInteger($name, $value, $options);
|
||||
});
|
||||
\Form::macro('ffAmount', function ($name, $value = null, array $options = []) {
|
||||
return \Firefly\Form\Form::ffAmount($name, $value, $options);
|
||||
});
|
||||
\Form::macro('ffDate', function ($name, $value = null, array $options = []) {
|
||||
return \Firefly\Form\Form::ffDate($name, $value, $options);
|
||||
});
|
||||
\Form::macro('ffTags', function ($name, $value = null, array $options = []) {
|
||||
return \Firefly\Form\Form::ffTags($name, $value, $options);
|
||||
});
|
||||
\Form::macro('ffCheckbox',function ($name, $value = 1, $checked = null, $options = []) {
|
||||
return \Firefly\Form\Form::ffCheckbox($name, $value, $checked, $options);
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -10,74 +10,12 @@
|
||||
<i class="fa fa-exclamation-circle"></i> Mandatory fields
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<!-- name -->
|
||||
<div class="form-group">
|
||||
<label for="name" class="col-sm-4 control-label">Name</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="name" class="form-control" id="name" value="{{Input::old('name')}}" placeholder="Name">
|
||||
@if($errors->has('name'))
|
||||
<p class="text-danger">{{$errors->first('name')}}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="match" class="col-sm-4 control-label">Matches on</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="match" class="form-control" id="match" value="{{Input::old('match')}}" data-role="tagsinput">
|
||||
@if($errors->has('match'))
|
||||
<p class="text-danger">{{$errors->first('match')}}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('amount_min', 'Minimum amount', ['class' => 'col-sm-4 control-label'])}}
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">€</span>
|
||||
{{Form::input('number','amount_min', Input::old('amount_min'), ['step' => 'any', 'class' => 'form-control'])}}
|
||||
</div>
|
||||
|
||||
@if($errors->has('amount_min'))
|
||||
<p class="text-danger">{{$errors->first('amount_min')}}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('amount_max', 'Maximum amount', ['class' => 'col-sm-4 control-label'])}}
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">€</span>
|
||||
{{Form::input('number','amount_max', Input::old('amount_max'), ['step' => 'any', 'class' => 'form-control'])}}
|
||||
</div>
|
||||
|
||||
@if($errors->has('amount_max'))
|
||||
<p class="text-danger">{{$errors->first('amount_max')}}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::label('date', 'Date', ['class' => 'col-sm-4 control-label'])}}
|
||||
<div class="col-sm-8">
|
||||
{{ Form::input('date','date', Input::old('date') ?: Carbon\Carbon::now()->addDay()->format('Y-m-d'), ['class'
|
||||
=> 'form-control']) }}
|
||||
@if($errors->has('date'))
|
||||
<p class="text-danger">{{$errors->first('date')}}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="period" class="col-sm-4 control-label">Recurrence</label>
|
||||
<div class="col-sm-8">
|
||||
{{Form::select('repeat_freq',$periods,Input::old('repeat_freq') ?: 'monthly',['class' => 'form-control'])}}
|
||||
@if($errors->has('repeat_freq'))
|
||||
<p class="text-danger">{{$errors->first('repeat_freq')}}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
{{Form::ffText('name')}}
|
||||
{{Form::ffTags('match')}}
|
||||
{{Form::ffAmount('amount_min')}}
|
||||
{{Form::ffAmount('amount_max')}}
|
||||
{{Form::ffDate('date',Carbon\Carbon::now()->addDay()->format('Y-m-d'))}}
|
||||
{{Form::ffSelect('repeat_freq',$periods,'monthly')}}
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
@ -93,43 +31,9 @@
|
||||
<i class="fa fa-smile-o"></i> Optional fields
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
{{ Form::label('skip', 'Skip', ['class' => 'col-sm-4 control-label'])}}
|
||||
<div class="col-sm-8">
|
||||
{{Form::input('number','skip', Input::old('skip') ?: 0, ['class' => 'form-control'])}}
|
||||
|
||||
@if($errors->has('skip'))
|
||||
<p class="text-danger">{{$errors->first('skip')}}</p>
|
||||
@else
|
||||
<span class="help-block">Make Firefly skip every <em>n</em> times. Fill in <code>2</code>, and Firefly
|
||||
will match, skip, skip and match a transaction.</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="automatch" class="col-sm-4 control-label">Auto-match</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
{{Form::checkbox('automatch',1,Input::old('automatch') == '1' || !Input::old('automatch'))}}
|
||||
Yes
|
||||
</label>
|
||||
</div>
|
||||
<span class="help-block">Firefly will automatically match transactions.</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="active" class="col-sm-4 control-label">Active</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
{{Form::checkbox('active',1,Input::old('active') == '1' || !Input::old('active'))}}
|
||||
Yes
|
||||
</label>
|
||||
</div>
|
||||
<span class="help-block">This recurring transaction is actually active.</span>
|
||||
</div>
|
||||
</div>
|
||||
{{Form::ffInteger('skip',0)}}
|
||||
{{Form::ffCheckbox('automatch',1,true)}}
|
||||
{{Form::ffCheckbox('active',1,true)}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
|
||||
<!-- ALWAYS SHOW AMOUNT -->
|
||||
{{Form::ffNumber('amount')}}
|
||||
{{Form::ffAmount('amount')}}
|
||||
|
||||
<!-- ALWAYS SHOW DATE -->
|
||||
{{Form::ffDate('date', date('Y-m-d'))}}
|
||||
|
@ -35,7 +35,7 @@
|
||||
@endif
|
||||
|
||||
<!-- ALWAYS SHOW AMOUNT -->
|
||||
{{Form::ffNumber('amount',$data['amount'])}}
|
||||
{{Form::ffAmount('amount',$data['amount'])}}
|
||||
|
||||
<!-- ALWAYS SHOW DATE -->
|
||||
{{Form::ffDate('date',$data['date'])}}
|
||||
|
Loading…
Reference in New Issue
Block a user