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

@ -163,7 +163,16 @@ class ConfigServiceProvider extends ServiceProvider
'Session', 'Session',
'Route', 'Route',
'Config', 'Config',
'ExpandedForm' 'ExpandedForm' => [
'is_safe' => [
'date','text','select','balance','optionsList'
]
],
'Form' => [
'is_safe' => [
'input','select','checkbox'
]
],
], ],
/* /*

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( $functions[] = new Twig_SimpleFunction(
'env', function ($name, $default) { 'env', function ($name, $default) {

View File

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