mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Reimplemented forms, added an overdue fix.
This commit is contained in:
parent
3d01669cea
commit
434b4ded4a
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\Exception;
|
||||
namespace FireflyIII\Exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Class FireflyException
|
||||
*
|
||||
* @package FireflyIII\Exception
|
||||
* @package FireflyIII\Exceptions
|
||||
*/
|
||||
class FireflyException extends \Exception
|
||||
{
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
namespace FireflyIII\Exception;
|
||||
namespace FireflyIII\Exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Class NotImplementedException
|
||||
*
|
||||
* @package FireflyIII\Exception
|
||||
* @package FireflyIII\Exceptions
|
||||
*/
|
||||
class NotImplementedException extends \Exception
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace FireflyIII\Exception;
|
||||
namespace FireflyIII\Exceptions;
|
||||
|
||||
/**
|
||||
* Class ValidationException
|
||||
* Class ValidationExceptions
|
||||
*
|
||||
* @package FireflyIII\Exception
|
||||
*/
|
@ -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 Controller
|
||||
View::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 Controller
|
||||
return view('accounts.index', compact('what', 'subTitleIcon', 'subTitle', 'accounts'));
|
||||
}
|
||||
|
||||
public function store(AccountFormRequest $request)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
27
app/Http/Requests/AccountFormRequest.php
Normal file
27
app/Http/Requests/AccountFormRequest.php
Normal file
@ -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'
|
||||
];
|
||||
}
|
||||
}
|
@ -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 Controller
|
||||
|
@ -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 ServiceProvider
|
||||
return new \FireflyIII\Support\Steam;
|
||||
}
|
||||
);
|
||||
$this->app->bind(
|
||||
'expandedform', function () {
|
||||
return new \FireflyIII\Support\ExpandedForm;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -122,4 +122,12 @@ class Amount
|
||||
|
||||
return $currency->code;
|
||||
}
|
||||
|
||||
public function getDefaultCurrency()
|
||||
{
|
||||
$currencyPreference = Prefs::get('currencyPreference', 'EUR');
|
||||
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
|
||||
|
||||
return $currency;
|
||||
}
|
||||
}
|
213
app/Support/ExpandedForm.php
Normal file
213
app/Support/ExpandedForm.php
Normal file
@ -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;
|
||||
|
||||
}
|
||||
}
|
23
app/Support/Facades/ExpandedForm.php
Normal file
23
app/Support/Facades/ExpandedForm.php
Normal file
@ -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';
|
||||
}
|
||||
|
||||
}
|
21
app/Validation/FireflyValidator.php
Normal file
21
app/Validation/FireflyValidator.php
Normal file
@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
|
||||
*/
|
||||
|
||||
use FireflyIII\Validation\FireflyValidator;
|
||||
|
||||
$app = new Illuminate\Foundation\Application(
|
||||
realpath(__DIR__.'/../')
|
||||
);
|
||||
|
@ -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',
|
||||
|
||||
],
|
||||
|
||||
|
60
resources/views/accounts/create.blade.php
Normal file
60
resources/views/accounts/create.blade.php
Normal file
@ -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>
|
||||
@stop
|
22
resources/views/form/amount.blade.php
Normal file
22
resources/views/form/amount.blade.php
Normal file
@ -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>
|
22
resources/views/form/balance.blade.php
Normal file
22
resources/views/form/balance.blade.php
Normal file
@ -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>
|
11
resources/views/form/checkbox.blade.php
Normal file
11
resources/views/form/checkbox.blade.php
Normal file
@ -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>
|
7
resources/views/form/date.blade.php
Normal file
7
resources/views/form/date.blade.php
Normal file
@ -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>
|
12
resources/views/form/feedback.blade.php
Normal file
12
resources/views/form/feedback.blade.php
Normal file
@ -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
|
9
resources/views/form/integer.blade.php
Normal file
9
resources/views/form/integer.blade.php
Normal file
@ -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>
|
69
resources/views/form/options.blade.php
Normal file
69
resources/views/form/options.blade.php
Normal file
@ -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
|
8
resources/views/form/select.blade.php
Normal file
8
resources/views/form/select.blade.php
Normal file
@ -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>
|
7
resources/views/form/tags.blade.php
Normal file
7
resources/views/form/tags.blade.php
Normal file
@ -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>
|
7
resources/views/form/text.blade.php
Normal file
7
resources/views/form/text.blade.php
Normal file
@ -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>
|
Loading…
Reference in New Issue
Block a user