Can create accounts.

This commit is contained in:
James Cole 2015-05-01 23:17:17 +02:00
parent 3e5e5b376f
commit 11baa968cd
10 changed files with 150 additions and 52 deletions

View File

@ -108,7 +108,7 @@ class ConfigServiceProvider extends ServiceProvider
| `Twig_Extension_Debug` is enabled automatically if twig.debug is TRUE.
|
*/
'enabled' => [
'enabled' => [
'TwigBridge\Extension\Loader\Facades',
'TwigBridge\Extension\Loader\Filters',
'TwigBridge\Extension\Loader\Functions',
@ -122,7 +122,7 @@ class ConfigServiceProvider extends ServiceProvider
'TwigBridge\Extension\Laravel\Translator',
'TwigBridge\Extension\Laravel\Url',
// 'TwigBridge\Extension\Laravel\Form',
// 'TwigBridge\Extension\Laravel\Form',
// 'TwigBridge\Extension\Laravel\Html',
// 'TwigBridge\Extension\Laravel\Legacy\Facades',
],
@ -154,8 +154,8 @@ class ConfigServiceProvider extends ServiceProvider
| in order to be marked as safe.
|
*/
'facades' => [
'Breadcrumbs' => [
'facades' => [
'Breadcrumbs' => [
'is_safe' => [
'renderIfExists'
]
@ -163,7 +163,16 @@ class ConfigServiceProvider extends ServiceProvider
'Session',
'Route',
'Config',
'ExpandedForm'
'ExpandedForm' => [
'is_safe' => [
'date','text','select','balance','optionsList'
]
],
'Form' => [
'is_safe' => [
'input','select','checkbox'
]
],
],
/*
@ -195,10 +204,10 @@ class ConfigServiceProvider extends ServiceProvider
|
*/
'functions' => [
'elixir',
'head',
'last',
],
'elixir',
'head',
'last',
],
/*
|--------------------------------------------------------------------------

View File

@ -71,6 +71,12 @@ class General extends Twig_Extension
}
);
$functions[] = new Twig_SimpleFunction(
'phpdate', function ($str) {
return date($str);
}
);
$functions[] = new Twig_SimpleFunction(
'env', function ($name, $default) {

View File

@ -2,60 +2,60 @@
{% block content %}
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName, what) }}
<form action="{{ route('accounts.store') }}" method="post" id="store" class="form-horizontal">
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<input type="hidden" name="what" value="{{ what }}" />
<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 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>
</div>
<div class="panel-body">
{{ ExpandedForm.text('name') }}
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="col-lg-6 col-md-6 col-sm-12">
@if(what == 'asset')
<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' %}
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-smile-o"></i> Optional fields
</div>
<div class="panel-body">
{{ ExpandedForm.balance('openingBalance') }}
{{ ExpandedForm.date('openingBalanceDate', date('Y-m-d')) }}
{{ ExpandedForm.select('accountRole',Config.get('firefly.accountRoles'), null, {'helpText' : 'Any extra options resulting from your choice can be set later.'}) }}
{{ ExpandedForm.balance('virtualBalance') }}
{{ ExpandedForm.balance('openingBalance') }}
{{ ExpandedForm.date('openingBalanceDate', phpdate('Y-m-d')) }}
{{ ExpandedForm.select('accountRole') }}
{{ ExpandedForm.balance('virtualBalance') }}
</div>
</div>
{% endif %}
<!-- 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>
@endif
<!-- 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 class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<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>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<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>
</form>
-->
{% endblock %}

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|raw }}</span> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
{% for currency in currencies %}
<li><a href="#" class="currencySelect" data-id="{{ currency.id }}" data-field="balance" data-currency="{{ currency.code }}" data-symbol="{{ currency.symbol }}">{{ currency.name }}</a></li>
{% endfor %}
</ul>
</div>
{{ Form.input('number', name, value, options) }}
</div>
{% include 'form/feedback.twig' %}
</div>
<input type="hidden" name="balance_currency_id" value="{{ defaultCurrency.id }}" />
</div>

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.input('date', name, value, options) }}
{% include 'form/help.twig' %}
{% include 'form/feedback.twig' %}
</div>
</div>

View File

@ -0,0 +1,4 @@
{% if errors.has(name) %}
<span class="form-control-feedback"><i class="fa fa-fw fa-remove"></i></span>
<p class="text-danger">{{ errors.first(name) }}</p>
{% endif %}

View File

@ -0,0 +1,3 @@
{% if options.helpText %}
<p class="help-block">{{ options.helpText }}</p>
{% endif %}

View File

@ -0,0 +1,30 @@
{% 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.checkbox('create_another', '1') }}
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.checkbox('return_to_edit', '1', Input.old('return_to_edit') == '1') }}
After updating, return here.
</label>
</div>
</div>
</div>
{% 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">
{{ Form.select(name, list, selected , options ) }}
{% include 'form/help.twig' %}
{% include 'form/feedback.twig' %}
</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.twig' %}
</div>
</div>