Improve account CRUD and tests.

This commit is contained in:
James Cole
2019-06-22 10:25:34 +02:00
parent 150818e673
commit 0f70cc5780
18 changed files with 480 additions and 255 deletions

View File

@@ -8,7 +8,7 @@
{{ Form.model(account, {'class' : 'form-horizontal','id' : 'update','url' : route('accounts.update',account.id) } ) }}
<input type="hidden" name="id" value="{{ account.id }}"/>
<input type="hidden" name="what" value="{{ what }}"/>
<input type="hidden" name="objectType" value="{{ objectType }}"/>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
@@ -18,11 +18,11 @@
</div>
<div class="box-body">
{{ ExpandedForm.text('name') }}
{% if account.accountType.type == 'Default account' or account.accountType.type == 'Asset account' or what == 'liabilities' %}
{% if account.accountType.type == 'Default account' or account.accountType.type == 'Asset account' or objectType == 'liabilities' %}
{{ ExpandedForm.currencyList('currency_id', null, {helpText:'account_default_currency'|_}) }}
{% endif %}
{% if what == 'liabilities' %}
{% if objectType == 'liabilities' %}
{{ ExpandedForm.select('liability_type_id', liabilityTypes) }}
{{ ExpandedForm.amountNoCurrency('opening_balance', null, {label:'debt_start_amount'|_, helpText: 'debt_start_amount_help'|_}) }}
{{ ExpandedForm.date('opening_balance_date', null, {label:'debt_start_date'|_}) }}
@@ -90,7 +90,7 @@
</div>
<div class="box-footer">
<button type="submit" class="btn pull-right btn-success">
{{ ('update_' ~ what ~ '_account')|_ }}
{{ ('update_' ~ objectType ~ '_account')|_ }}
</button>
</div>
</div>

View File

@@ -1,14 +1,14 @@
{% extends "./layout/default" %}
{% block breadcrumbs %}
{{ Breadcrumbs.render(Route.getCurrentRoute.getName, what) }}
{{ Breadcrumbs.render(Route.getCurrentRoute.getName, objectType) }}
{% endblock %}
{% block content %}
{% if accounts.count > 0 %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box" id="account-index-{{ what }}">
<div class="box" id="account-index-{{ objectType }}">
<div class="box-header with-border">
<h3 class="box-title">
{{ subTitle }}
@@ -17,8 +17,8 @@
<div class="btn-group">
<button class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown"><i class="fa fa-ellipsis-v"></i></button>
<ul class="dropdown-menu" role="menu">
<li><a href="{{ route('accounts.create', what) }}"><i
class="fa fa-plus fa-fw"></i> {{ ('make_new_' ~ what ~ '_account')|_ }}
<li><a href="{{ route('accounts.create', objectType) }}"><i
class="fa fa-plus fa-fw"></i> {{ ('make_new_' ~ objectType ~ '_account')|_ }}
</a></li>
</ul>
</div>
@@ -29,20 +29,20 @@
<div class="box-body table-responsive no-padding">
<div style="padding:8px;">
<a href="{{ route('accounts.create', what) }}" class="btn btn-success"><i class="fa fa-plus fa-fw"></i> {{ ('make_new_' ~ what ~ '_account')|_ }}</a>
<a href="{{ route('accounts.create', objectType) }}" class="btn btn-success"><i class="fa fa-plus fa-fw"></i> {{ ('make_new_' ~ objectType ~ '_account')|_ }}</a>
</div>
{% include 'list.accounts' %}
</div>
<div class="box-footer">
<a href="{{ route('accounts.create', what) }}" class="btn btn-success"><i class="fa fa-plus fa-fw"></i> {{ ('make_new_' ~ what ~ '_account')|_ }}</a>
<a href="{{ route('accounts.create', objectType) }}" class="btn btn-success"><i class="fa fa-plus fa-fw"></i> {{ ('make_new_' ~ objectType ~ '_account')|_ }}</a>
</div>
</div>
</div>
</div>
{% endif %}
{% if accounts.count == 0 and page == 1 %}
{% include 'partials.empty' with {what: what, type: 'accounts',route: route('accounts.create', [what])} %}
{% include 'partials.empty' with {objectType: objectType, type: 'accounts',route: route('accounts.create', [objectType])} %}
{% endif %}
{% endblock %}
@@ -52,7 +52,7 @@
{% block scripts %}
<script type="text/javascript">
var what = '{{ what|escape }}';
var objectType = '{{ objectType|escape }}';
</script>
<script type="text/javascript" src="v1/js/lib/bootstrap-sortable.js?v={{ FF_VERSION }}"></script>
{% endblock %}