Reimplemented forms, added an overdue fix.

This commit is contained in:
James Cole
2015-02-08 01:15:15 +01:00
parent 3d01669cea
commit 434b4ded4a
24 changed files with 616 additions and 44 deletions

View 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

View 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>

View 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>

View 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>

View 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>

View 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

View 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>

View 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

View 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>

View 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>

View 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>