Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Reimplemented forms, added an overdue fix.
James Cole434b4ded4a06
diff --git a/app/Exception/FireflyException.php b/app/Exceptions/FireflyException.phpsimilarity index 58%rename from app/Exception/FireflyException.phprename to app/Exceptions/FireflyException.phpindex a2d36d3b59..a0079fa618 100644--- a/app/Exception/FireflyException.php+++ b/app/Exceptions/FireflyException.php@@ -1,12 +1,12 @@<?php-namespace FireflyIII\Exception;+namespace FireflyIII\Exceptions;/*** Class FireflyException*- * @package FireflyIII\Exception+ * @package FireflyIII\Exceptions*/class FireflyException extends \Exception{diff --git a/app/Exception/NotImplementedException.php b/app/Exceptions/NotImplementedException.phpsimilarity index 61%rename from app/Exception/NotImplementedException.phprename to app/Exceptions/NotImplementedException.phpindex 718e394f3e..614a9b7f97 100644--- a/app/Exception/NotImplementedException.php+++ b/app/Exceptions/NotImplementedException.php@@ -1,11 +1,11 @@<?php-namespace FireflyIII\Exception;+namespace FireflyIII\Exceptions;/*** Class NotImplementedException*- * @package FireflyIII\Exception+ * @package FireflyIII\Exceptions*/class NotImplementedException extends \Exception{diff --git a/app/Exception/ValidationException.php b/app/Exceptions/ValidationException.phpsimilarity index 61%rename from app/Exception/ValidationException.phprename to app/Exceptions/ValidationException.phpindex 77f6de015e..71922fe9c1 100644--- a/app/Exception/ValidationException.php+++ b/app/Exceptions/ValidationException.php@@ -1,8 +1,8 @@<?php-namespace FireflyIII\Exception;+namespace FireflyIII\Exceptions;/**- * Class ValidationException+ * Class ValidationExceptions** @package FireflyIII\Exception*/diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.phpindex 2af08d0dd1..03930f56bd 100644--- a/app/Http/Controllers/AccountController.php+++ b/app/Http/Controllers/AccountController.php@@ -3,6 +3,7 @@use Auth;use Config;use FireflyIII\Http\Requests;+use FireflyIII\Http\Requests\AccountFormRequest;use Illuminate\Http\Request;use View;@@ -19,6 +20,22 @@ class AccountController extends ControllerView::share('title', 'Accounts');}+ /**+ * @param string $what+ *+ * @return \Illuminate\View\View+ */+ public function create($what = 'asset')+ {+ $subTitleIcon = Config::get('firefly.subTitlesByIdentifier.' . $what);+ $subTitle = 'Create a new ' . e($what) . ' account';++ //\FireflyIII\Forms\Tags::ffAmount('12');++ return view('accounts.create', compact('subTitleIcon', 'what', 'subTitle'));++ }+public function index($what = 'default'){$subTitle = Config::get('firefly.subTitlesByIdentifier.' . $what);@@ -29,4 +46,9 @@ class AccountController extends Controllerreturn view('accounts.index', compact('what', 'subTitleIcon', 'subTitle', 'accounts'));}+ public function store(AccountFormRequest $request)+ {++ }+}diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.phpnew file mode 100644index 0000000000..478bf550c4--- /dev/null+++ b/app/Http/Requests/AccountFormRequest.php@@ -0,0 +1,27 @@+<?php++namespace FireflyIII\Http\Requests;++use Auth;++/**+ * Class AccountFormRequest+ *+ * @package FireflyIII\Http\Requests+ */+class AccountFormRequest extends Request+{+ public function authorize()+ {+ // Only allow logged in users+ return Auth::check();+ }++ public function rules()+ {+ return [+ 'name' => 'required|between:1,100|uniqueForUser:accounts,name',+ 'openingBalance' => 'required|numeric'+ ];+ }+}\ No newline at end of filediff --git a/app/Http/routes.php b/app/Http/routes.phpindex b450730ae3..46d6a44e39 100644--- a/app/Http/routes.php+++ b/app/Http/routes.php@@ -18,6 +18,9 @@ Route::group(Route::get('/accounts/edit/{account}', ['uses' => 'AccountController@edit', 'as' => 'accounts.edit']);Route::get('/accounts/delete/{account}', ['uses' => 'AccountController@delete', 'as' => 'accounts.delete']);Route::get('/accounts/show/{account}/{view?}', ['uses' => 'AccountController@show', 'as' => 'accounts.show']);+ Route::post('/accounts/store', ['uses' => 'AccountController@store', 'as' => 'accounts.store']);+// Route::post('/accounts/update/{account}', ['uses' => 'AccountController@update', 'as' => 'accounts.update']);+// Route::post('/accounts/destroy/{account}', ['uses' => 'AccountController@destroy', 'as' => 'accounts.destroy']);/*** Bills Controllerdiff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.phpindex 88d9837a6b..692249373b 100644--- a/app/Providers/FireflyServiceProvider.php+++ b/app/Providers/FireflyServiceProvider.php@@ -3,9 +3,22 @@namespace FireflyIII\Providers;use Illuminate\Support\ServiceProvider;+use Validator;+use FireflyIII\Validation\FireflyValidator;+/**+ * Class FireflyServiceProvider+ *+ * @package FireflyIII\Providers+ */class FireflyServiceProvider extends ServiceProvider{+ public function boot() {+ Validator::resolver(function($translator, $data, $rules, $messages)+ {+ return new FireflyValidator($translator, $data, $rules, $messages);+ });+ }public function register(){$this->app->bind(@@ -29,6 +42,11 @@ class FireflyServiceProvider extends ServiceProviderreturn new \FireflyIII\Support\Steam;});+ $this->app->bind(+ 'expandedform', function () {+ return new \FireflyIII\Support\ExpandedForm;+ }+ );}}\ No newline at end of filediff --git a/app/Support/Amount.php b/app/Support/Amount.phpindex 81809ecc97..a9a1d12a32 100644--- a/app/Support/Amount.php+++ b/app/Support/Amount.php@@ -122,4 +122,12 @@ class Amountreturn $currency->code;}++ public function getDefaultCurrency()+ {+ $currencyPreference = Prefs::get('currencyPreference', 'EUR');+ $currency = TransactionCurrency::whereCode($currencyPreference->data)->first();++ return $currency;+ }}\ No newline at end of filediff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.phpnew file mode 100644index 0000000000..a6ecdd0a88--- /dev/null+++ b/app/Support/ExpandedForm.php@@ -0,0 +1,213 @@+<?php++namespace FireflyIII\Support;++use Amount;+use FireflyIII\Models\TransactionCurrency;+use Illuminate\Support\MessageBag;+use Input;+use Session;+use View;++/**+ * Class ExpandedForm+ *+ * @package FireflyIII\Support+ */+class ExpandedForm+{++ /**+ * @param $name+ * @param null $value+ * @param array $options+ *+ * @return string+ */+ public function balance($name, $value = null, array $options = [])+ {+ $label = $this->label($name, $options);+ $options = $this->expandOptionArray($name, $label, $options);+ $classes = $this->getHolderClasses($name);+ $value = $this->fillFieldValue($name, $value);+ $options['step'] = 'any';+ $defaultCurrency = isset($options['currency']) ? $options['currency'] : Amount::getDefaultCurrency();+ $currencies = TransactionCurrency::orderBy('code', 'ASC')->get();+ $html = View::make('form.balance', compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();++ return $html;+ }++ /**+ * @param $name+ * @param $options+ *+ * @return mixed+ */+ public function label($name, $options)+ {+ if (isset($options['label'])) {+ return $options['label'];+ }+ $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', 'budget_id' => 'Budget'+ , 'piggy_bank_id' => 'Piggy bank'];+++ return isset($labels[$name]) ? $labels[$name] : str_replace('_', ' ', ucfirst($name));++ }++ /**+ * @param $name+ * @param $label+ * @param array $options+ *+ * @return array+ */+ public function expandOptionArray($name, $label, array $options)+ {+ $options['class'] = 'form-control';+ $options['id'] = 'ffInput_' . $name;+ $options['autocomplete'] = 'off';+ $options['placeholder'] = ucfirst($label);++ return $options;+ }++ /**+ * @param $name+ *+ * @return string+ */+ public function getHolderClasses($name)+ {+ /*+ * Get errors, warnings and successes from session:+ */+ /** @var MessageBag $errors */+ $errors = Session::get('errors');++ /** @var MessageBag $successes */+ $successes = Session::get('successes');++ switch (true) {+ case (!is_null($errors) && $errors->has($name)):+ $classes = 'form-group has-error has-feedback';+ break;+ case (!is_null($successes) && $successes->has($name)):+ $classes = 'form-group has-success has-feedback';+ break;+ default:+ $classes = 'form-group';+ break;+ }++ return $classes;+ }++ /**+ * @param $name+ * @param $value+ *+ * @return mixed+ */+ public function fillFieldValue($name, $value)+ {+ if (Session::has('preFilled')) {+ $preFilled = \Session::get('preFilled');+ $value = isset($preFilled[$name]) && is_null($value) ? $preFilled[$name] : $value;+ }+ if (!is_null(Input::old($name))) {+ $value = Input::old($name);+ }++ return $value;+ }++ /**+ * @param $name+ * @param int $value+ * @param null $checked+ * @param array $options+ *+ * @return string+ */+ public function checkbox($name, $value = 1, $checked = null, $options = [])+ {+ $options['checked'] = $checked === true ? true : null;+ $label = $this->label($name, $options);+ $options = $this->expandOptionArray($name, $label, $options);+ $classes = $this->getHolderClasses($name);+ $value = $this->fillFieldValue($name, $value);++ unset($options['placeholder'], $options['autocomplete'], $options['class']);++ $html = View::make('form.checkbox', compact('classes', 'name', 'label', 'value', 'options'))->render();++ return $html;+ }++ /**+ * @param $name+ * @param null $value+ * @param array $options+ *+ * @return string+ */+ public function date($name, $value = null, array $options = [])+ {+ $label = $this->label($name, $options);+ $options = $this->expandOptionArray($name, $label, $options);+ $classes = $this->getHolderClasses($name);+ $value = $this->fillFieldValue($name, $value);+ $html = View::make('form.date', compact('classes', 'name', 'label', 'value', 'options'))->render();++ return $html;+ }++ /**+ * @param $type+ * @param $name+ *+ * @return string+ */+ public function optionsList($type, $name)+ {+ $previousValue = \Input::old('post_submit_action');+ $previousValue = is_null($previousValue) ? 'store' : $previousValue;+ $html = \View::make('form.options', compact('type', 'name', 'previousValue'))->render();++ return $html;+ }++ public function select($name, array $list = [], $selected = null, array $options = [])+ {+ $label = $this->label($name, $options);+ $options = $this->expandOptionArray($name, $label, $options);+ $classes = $this->getHolderClasses($name);+ $selected = $this->fillFieldValue($name, $selected);+ $html = \View::make('form.select', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render();++ return $html;+ }++ /**+ * @param $name+ * @param null $value+ * @param array $options+ *+ * @return string+ */+ public function text($name, $value = null, array $options = [])+ {+ $label = $this->label($name, $options);+ $options = $this->expandOptionArray($name, $label, $options);+ $classes = $this->getHolderClasses($name);+ $value = $this->fillFieldValue($name, $value);+ $html = View::make('form.text', compact('classes', 'name', 'label', 'value', 'options'))->render();++ return $html;++ }+}\ No newline at end of filediff --git a/app/Support/Facades/ExpandedForm.php b/app/Support/Facades/ExpandedForm.phpnew file mode 100644index 0000000000..008e85d7a7--- /dev/null+++ b/app/Support/Facades/ExpandedForm.php@@ -0,0 +1,23 @@+<?php++namespace FireflyIII\Support\Facades;++use Illuminate\Support\Facades\Facade;+/**+ * Class Amount+ *+ * @package FireflyIII\Support\Facades+ */+class ExpandedForm extends Facade+{+ /**+ * Get the registered name of the component.+ *+ * @return string+ */+ protected static function getFacadeAccessor()+ {+ return 'expandedform';+ }++}\ No newline at end of filediff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.phpnew file mode 100644index 0000000000..f934e870b9--- /dev/null+++ b/app/Validation/FireflyValidator.php@@ -0,0 +1,21 @@+<?php++namespace FireflyIII\Validation;++use Illuminate\Validation\Validator;+use DB;++class FireflyValidator extends Validator+{++ public function validateUniqueForUser($attribute, $value, $parameters)+ {+ $count = DB::table($parameters[0])->where($parameters[1],$value)->count();+ if($count == 0) {+ return true;+ }+ return false;++ }+}+diff --git a/bootstrap/app.php b/bootstrap/app.phpindex ebe5d21ae4..e3697dc4ad 100644--- a/bootstrap/app.php+++ b/bootstrap/app.php@@ -11,6 +11,8 @@|*/+use FireflyIII\Validation\FireflyValidator;+$app = new Illuminate\Foundation\Application(realpath(__DIR__.'/../'));diff --git a/config/app.php b/config/app.phpindex 377fc5eedf..3c67782ca7 100644--- a/config/app.php+++ b/config/app.php@@ -164,44 +164,45 @@ return ['aliases' => [- 'App' => 'Illuminate\Support\Facades\App',- 'Artisan' => 'Illuminate\Support\Facades\Artisan',- 'Auth' => 'Illuminate\Support\Facades\Auth',- 'Blade' => 'Illuminate\Support\Facades\Blade',- 'Bus' => 'Illuminate\Support\Facades\Bus',- 'Cache' => 'Illuminate\Support\Facades\Cache',- 'Config' => 'Illuminate\Support\Facades\Config',- 'Cookie' => 'Illuminate\Support\Facades\Cookie',- 'Crypt' => 'Illuminate\Support\Facades\Crypt',- 'DB' => 'Illuminate\Support\Facades\DB',- 'Eloquent' => 'Illuminate\Database\Eloquent\Model',- 'Event' => 'Illuminate\Support\Facades\Event',- 'File' => 'Illuminate\Support\Facades\File',- 'Hash' => 'Illuminate\Support\Facades\Hash',- 'Input' => 'Illuminate\Support\Facades\Input',- 'Inspiring' => 'Illuminate\Foundation\Inspiring',- 'Lang' => 'Illuminate\Support\Facades\Lang',- 'Log' => 'Illuminate\Support\Facades\Log',- 'Mail' => 'Illuminate\Support\Facades\Mail',- 'Password' => 'Illuminate\Support\Facades\Password',- 'Queue' => 'Illuminate\Support\Facades\Queue',- 'Redirect' => 'Illuminate\Support\Facades\Redirect',- 'Redis' => 'Illuminate\Support\Facades\Redis',- 'Request' => 'Illuminate\Support\Facades\Request',- 'Response' => 'Illuminate\Support\Facades\Response',- 'Route' => 'Illuminate\Support\Facades\Route',- 'Schema' => 'Illuminate\Support\Facades\Schema',- 'Session' => 'Illuminate\Support\Facades\Session',- 'Storage' => 'Illuminate\Support\Facades\Storage',- 'URL' => 'Illuminate\Support\Facades\URL',- 'Validator' => 'Illuminate\Support\Facades\Validator',- 'View' => 'Illuminate\Support\Facades\View',- 'Form' => 'Illuminate\Html\FormFacade',- 'Html' => 'Illuminate\Html\HtmlFacade',- 'Preferences' => 'FireflyIII\Support\Facades\Preferences',- 'Navigation' => 'FireflyIII\Support\Facades\Navigation',- 'Amount' => 'FireflyIII\Support\Facades\Amount',- 'Steam' => 'FireflyIII\Support\Facades\Steam',+ 'App' => 'Illuminate\Support\Facades\App',+ 'Artisan' => 'Illuminate\Support\Facades\Artisan',+ 'Auth' => 'Illuminate\Support\Facades\Auth',+ 'Blade' => 'Illuminate\Support\Facades\Blade',+ 'Bus' => 'Illuminate\Support\Facades\Bus',+ 'Cache' => 'Illuminate\Support\Facades\Cache',+ 'Config' => 'Illuminate\Support\Facades\Config',+ 'Cookie' => 'Illuminate\Support\Facades\Cookie',+ 'Crypt' => 'Illuminate\Support\Facades\Crypt',+ 'DB' => 'Illuminate\Support\Facades\DB',+ 'Eloquent' => 'Illuminate\Database\Eloquent\Model',+ 'Event' => 'Illuminate\Support\Facades\Event',+ 'File' => 'Illuminate\Support\Facades\File',+ 'Hash' => 'Illuminate\Support\Facades\Hash',+ 'Input' => 'Illuminate\Support\Facades\Input',+ 'Inspiring' => 'Illuminate\Foundation\Inspiring',+ 'Lang' => 'Illuminate\Support\Facades\Lang',+ 'Log' => 'Illuminate\Support\Facades\Log',+ 'Mail' => 'Illuminate\Support\Facades\Mail',+ 'Password' => 'Illuminate\Support\Facades\Password',+ 'Queue' => 'Illuminate\Support\Facades\Queue',+ 'Redirect' => 'Illuminate\Support\Facades\Redirect',+ 'Redis' => 'Illuminate\Support\Facades\Redis',+ 'Request' => 'Illuminate\Support\Facades\Request',+ 'Response' => 'Illuminate\Support\Facades\Response',+ 'Route' => 'Illuminate\Support\Facades\Route',+ 'Schema' => 'Illuminate\Support\Facades\Schema',+ 'Session' => 'Illuminate\Support\Facades\Session',+ 'Storage' => 'Illuminate\Support\Facades\Storage',+ 'URL' => 'Illuminate\Support\Facades\URL',+ 'Validator' => 'Illuminate\Support\Facades\Validator',+ 'View' => 'Illuminate\Support\Facades\View',+ 'Form' => 'Illuminate\Html\FormFacade',+ 'Html' => 'Illuminate\Html\HtmlFacade',+ 'Preferences' => 'FireflyIII\Support\Facades\Preferences',+ 'Navigation' => 'FireflyIII\Support\Facades\Navigation',+ 'Amount' => 'FireflyIII\Support\Facades\Amount',+ 'Steam' => 'FireflyIII\Support\Facades\Steam',+ 'ExpandedForm' => 'FireflyIII\Support\Facades\ExpandedForm',],diff --git a/resources/views/accounts/create.blade.php b/resources/views/accounts/create.blade.phpnew file mode 100644index 0000000000..0b0df1b5d5--- /dev/null+++ b/resources/views/accounts/create.blade.php@@ -0,0 +1,60 @@+@extends('layouts.default')+@section('content')+{{-- Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $what) --}}+{!! Form::open(['class' => 'form-horizontal','id' => 'store','route' => 'accounts.store']) !!}+{!! Form::hidden('what',$what) !!}++@foreach ($errors->all() as $error)+ <p class="error">{{ $error }}</p>+@endforeach++<div class="row">+ <div class="col-lg-6 col-md-6 col-sm-12">+ <div class="panel panel-primary">+ <div class="panel-heading">+ <i class="fa {{{$subTitleIcon}}}"></i> Mandatory fields+ </div>+ <div class="panel-body">+ {!! ExpandedForm::text('name') !!}+ </div>+ </div>+ <p>+ <button type="submit" class="btn btn-lg btn-success">+ <i class="fa fa-plus-circle"></i> Store new {{{$what}}} account+ </button>+ </p>+ </div>++ <div class="col-lg-6 col-md-6 col-sm-12">+++ <div class="panel panel-default">+ <div class="panel-heading">+ <i class="fa fa-smile-o"></i> Optional fields+ </div>+ <div class="panel-body">+ @if($what == 'asset')+ {!! ExpandedForm::balance('openingBalance') !!}+ {!! ExpandedForm::date('openingBalanceDate', date('Y-m-d')) !!}+ {!! ExpandedForm::select('account_role',Config::get('firefly.accountRoles')) !!}+ @endif+ {!! ExpandedForm::checkbox('active','1',true) !!}+ </div>+ </div>+++ <!-- panel for options -->+ <div class="panel panel-default">+ <div class="panel-heading">+ <i class="fa fa-bolt"></i> Options+ </div>+ <div class="panel-body">+ {!! ExpandedForm::optionsList('create','account') !!}+ </div>+ </div>++ </div>+</div>++</form>+@stopdiff --git a/resources/views/form/amount.blade.php b/resources/views/form/amount.blade.phpnew file mode 100644index 0000000000..82e462b490--- /dev/null+++ b/resources/views/form/amount.blade.php@@ -0,0 +1,22 @@+<div class="{{{$classes}}}">+ <label for="{{{$options['id']}}}" class="col-sm-4 control-label">{{{$label}}}</label>+ <div class="col-sm-8">+ <div class="input-group">+ <div class="input-group-btn">+ <button type="button" class="btn btn-default dropdown-toggle amountCurrencyDropdown" data-toggle="dropdown" aria-expanded="false">+ <span id="amountCurrentSymbol">{{$defaultCurrency->symbol}}</span> <span class="caret"></span>+ </button>+ <ul class="dropdown-menu" role="menu">+ @foreach($currencies as $currency)+ <li><a href="#" class="currencySelect" data-id="{{{$currency->id}}}" data-field="amount" data-currency="{{{$currency->code}}}" data-symbol="{{{$currency->symbol}}}">{{{$currency->name}}}</a></li>+ @endforeach+ </ul>+ </div>+ {{Form::input('number', $name, $value, $options)}}+++ </div>+ @include('form.feedback')+ </div>+ {{Form::input('hidden','amount_currency_id',$defaultCurrency->id)}}+</div>\ No newline at end of filediff --git a/resources/views/form/balance.blade.php b/resources/views/form/balance.blade.phpnew file mode 100644index 0000000000..50a834ecb9--- /dev/null+++ b/resources/views/form/balance.blade.php@@ -0,0 +1,22 @@+<div class="{{{$classes}}}">+ <label for="{{{$options['id']}}}" class="col-sm-4 control-label">{{{$label}}}</label>+ <div class="col-sm-8">+ <div class="input-group">+ <div class="input-group-btn">+ <button type="button" class="btn btn-default dropdown-toggle balanceCurrencyDropdown" data-toggle="dropdown" aria-expanded="false">+ <span id="balanceCurrentSymbol">{{$defaultCurrency->symbol}}</span> <span class="caret"></span>+ </button>+ <ul class="dropdown-menu" role="menu">+ @foreach($currencies as $currency)+ <li><a href="#" class="currencySelect" data-id="{{{$currency->id}}}" data-field="balance" data-currency="{{{$currency->code}}}" data-symbol="{{{$currency->symbol}}}">{{{$currency->name}}}</a></li>+ @endforeach+ </ul>+ </div>+ {!! Form::input('number', $name, $value, $options) !!}++ </div>+ @include('form.feedback')+ </div>++ {!! Form::input('hidden','balance_currency_id',$defaultCurrency->id) !!}+</div>\ No newline at end of filediff --git a/resources/views/form/checkbox.blade.php b/resources/views/form/checkbox.blade.phpnew file mode 100644index 0000000000..038bac2dc5--- /dev/null+++ b/resources/views/form/checkbox.blade.php@@ -0,0 +1,11 @@+<div class="{{{$classes}}}">+ <label for="{{{$options['id']}}}" class="col-sm-4 control-label">{{{$label}}}</label>+ <div class="col-sm-8">+ <div class="checkbox">+ <label>+ {!! Form::checkbox($name, $value, $options['checked'], $options) !!}+ </label>+ </div>+ @include('form.feedback')+ </div>+</div>\ No newline at end of filediff --git a/resources/views/form/date.blade.php b/resources/views/form/date.blade.phpnew file mode 100644index 0000000000..71ab250e1a--- /dev/null+++ b/resources/views/form/date.blade.php@@ -0,0 +1,7 @@+<div class="{{{$classes}}}">+ <label for="{{{$options['id']}}}" class="col-sm-4 control-label">{{{$label}}}</label>+ <div class="col-sm-8">+ {!! Form::input('date', $name, $value, $options) !!}+ @include('form.feedback')+ </div>+</div>\ No newline at end of filediff --git a/resources/views/form/feedback.blade.php b/resources/views/form/feedback.blade.phpnew file mode 100644index 0000000000..d6f895fdf2--- /dev/null+++ b/resources/views/form/feedback.blade.php@@ -0,0 +1,12 @@+@if($errors->has($name))+ <span class="glyphicon glyphicon-remove form-control-feedback"></span>+ <p class="text-danger">{{{$errors->first($name)}}}</p>+@endif+@if(Session::has('warnings') && Session::get('warnings')->has($name))+ <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>+ <p class="text-warning">{{{Session::get('warnings')->first($name)}}}</p>+@endif+@if(Session::has('successes') && Session::get('successes')->has($name))+ <span class="glyphicon glyphicon-ok form-control-feedback"></span>+ <p class="text-success">{{{Session::get('successes')->first($name)}}}</p>+@endif\ No newline at end of filediff --git a/resources/views/form/integer.blade.php b/resources/views/form/integer.blade.phpnew file mode 100644index 0000000000..cfd93a09c2--- /dev/null+++ b/resources/views/form/integer.blade.php@@ -0,0 +1,9 @@+<div class="{{{$classes}}}">+ <label for="{{{$options['id']}}}" class="col-sm-4 control-label">{{{$label}}}</label>+ <div class="col-sm-8">+ <div class="input-group">+ {!! Form::input('number', $name, $value, $options) !!}+ @include('form.feedback')+ </div>+ </div>+</div>\ No newline at end of filediff --git a/resources/views/form/options.blade.php b/resources/views/form/options.blade.phpnew file mode 100644index 0000000000..7c84250eea--- /dev/null+++ b/resources/views/form/options.blade.php@@ -0,0 +1,69 @@+@if($type == 'create')+ <div class="form-group">+ <label for="{{{$name}}}_store" class="col-sm-4 control-label">Store</label>+ <div class="col-sm-8">+ <div class="radio">+ <label>+ {!! Form::radio('post_submit_action', 'store', $previousValue == 'store', ['id' => $name . '_store']) !!}+ Store {{{$name}}}+ </label>+ </div>+ </div>+ </div>+@endif+@if($type == 'update')+ <div class="form-group">+ <label for="{{{$name}}}_update" class="col-sm-4 control-label">Update</label>+ <div class="col-sm-8">+ <div class="radio">+ <label>+ {!! Form::radio('post_submit_action', 'update', $previousValue == 'update' || $previousValue == 'store', ['id' => $name . '_update']) !!}+ Update {{{$name}}}+ </label>+ </div>+ </div>+ </div>+@endif++<div class="form-group">+ <label for="{{{$name}}}_validate_only" class="col-sm-4 control-label">Validate only</label>+ <div class="col-sm-8">+ <div class="radio">+ <label>+ {!! Form::radio('post_submit_action', 'validate_only', $previousValue == 'validate_only', ['id' => $name . '_validate_only']) !!}+ Only validate, do not save+ </label>+ </div>+ </div>+</div>++@if($type == 'create')+ <div class="form-group">+ <label for="{{{$name}}}_return_to_form" class="col-sm-4 control-label">+ Return here+ </label>+ <div class="col-sm-8">+ <div class="radio">+ <label>+ {!! Form::radio('post_submit_action', 'create_another', $previousValue == 'create_another', ['id' => $name . '_create_another']) !!}+ After storing, return here to create another one.+ </label>+ </div>+ </div>+ </div>+@endif++@if($type == 'update')+ <div class="form-group">+ <label for="{{{$name}}}_return_to_edit" class="col-sm-4 control-label">+ Return here+ </label>+ <div class="col-sm-8">+ <div class="radio"><label>+ {!! Form::radio('post_submit_action', 'return_to_edit', $previousValue == 'return_to_edit', ['id' => $name . '_return_to_edit']) !!}+ After updating, return here.+ </label>+ </div>+ </div>+ </div>+@endif\ No newline at end of filediff --git a/resources/views/form/select.blade.php b/resources/views/form/select.blade.phpnew file mode 100644index 0000000000..6b5e8a2012--- /dev/null+++ b/resources/views/form/select.blade.php@@ -0,0 +1,8 @@+<div class="{{{$classes}}}">+ <label for="{{{$options['id']}}}" class="col-sm-4 control-label">{{{$label}}}</label>+ <div class="col-sm-8">+ {!! Form::select($name, $list, $selected , $options ) !!}+ @include('form.feedback')++ </div>+</div>\ No newline at end of filediff --git a/resources/views/form/tags.blade.php b/resources/views/form/tags.blade.phpnew file mode 100644index 0000000000..d9d0c31bd2--- /dev/null+++ b/resources/views/form/tags.blade.php@@ -0,0 +1,7 @@+<div class="{{{$classes}}}">+ <label for="{{{$options['id']}}}" class="col-sm-4 control-label">{{{$label}}}</label>+ <div class="col-sm-8">+ {!! Form::input('text', $name, $value, $options) !!}+ @include('form.feedback')+ </div>+</div>\ No newline at end of filediff --git a/resources/views/form/text.blade.php b/resources/views/form/text.blade.phpnew file mode 100644index 0000000000..d9d0c31bd2--- /dev/null+++ b/resources/views/form/text.blade.php@@ -0,0 +1,7 @@+<div class="{{{$classes}}}">+ <label for="{{{$options['id']}}}" class="col-sm-4 control-label">{{{$label}}}</label>+ <div class="col-sm-8">+ {!! Form::input('text', $name, $value, $options) !!}+ @include('form.feedback')+ </div>+</div>\ No newline at end of file