Currencies can now be enabled and disabled.

This commit is contained in:
James Cole
2018-11-10 10:04:46 +01:00
parent daa8aa5c9d
commit e491dda229
25 changed files with 457 additions and 51 deletions

View File

@@ -624,14 +624,21 @@ return [
'update_currency' => 'Update currency',
'new_default_currency' => ':name is now the default currency.',
'cannot_delete_currency' => 'Cannot delete :name because it is still in use.',
'cannot_disable_currency' => 'Cannot disable :name because it is still in use.',
'deleted_currency' => 'Currency :name deleted',
'created_currency' => 'Currency :name created',
'could_not_store_currency' => 'Could not store the new currency.',
'updated_currency' => 'Currency :name updated',
'ask_site_owner' => 'Please ask :owner to add, remove or edit currencies.',
'currencies_intro' => 'Firefly III supports various currencies which you can set and enable here.',
'make_default_currency' => 'make default',
'make_default_currency' => 'Make default',
'default_currency' => 'default',
'currency_is_disabled' => 'Disabled',
'enable_currency' => 'Enable',
'disable_currency' => 'Disable',
'currencies_default_disabled' => 'Most of these currencies are disabled by default. To use them, you must enable them first.',
'currency_is_now_enabled' => 'Currency ":name" has been enabled',
'currency_is_now_disabled' => 'Currency ":name" has been disabled',
// forms:
'mandatoryFields' => 'Mandatory fields',

View File

@@ -30,6 +30,7 @@ return [
'credit_card_limit' => 'Credit card limit',
'automatch' => 'Match automatically',
'skip' => 'Skip',
'enabled' => 'Enabled',
'name' => 'Name',
'active' => 'Active',
'amount_min' => 'Minimum amount',

View File

@@ -130,7 +130,8 @@ return [
// currencies
'currencies_index_intro' => 'Firefly III supports multiple currencies, which you can change on this page.',
'currencies_index_default' => 'Firefly III has one default currency. You can always switch of course using these buttons.',
'currencies_index_default' => 'Firefly III has one default currency.',
'currencies_index_buttons' => 'Use these buttons to change the default currency or enable other currencies.',
// create currency
'currencies_create_code' => 'This code should be ISO compliant (Google it for your new currency).',

View File

@@ -19,6 +19,7 @@
{{ ExpandedForm.text('symbol',null,{'maxlength' : 8}) }}
{{ ExpandedForm.text('code',null,{'maxlength' : 3}) }}
{{ ExpandedForm.integer('decimal_places',null,{'maxlength' : 2,'min': 0,'max': 12}) }}
{{ ExpandedForm.checkbox('enabled',null) }}
</div>
</div>
</div>

View File

@@ -10,11 +10,15 @@
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'currencies'|_ }}</h3>
<a class="btn btn-success pull-right" href="{{ route('currencies.create') }}">{{ 'create_currency'|_ }}</a>
</div>
<div class="box-body">
<p class="text-info">
{{ 'currencies_intro'|_ }}
</p>
<p class="text-info">
{{ 'currencies_default_disabled'|_ }}
</p>
{% if currencies|length > 0 %}
<div style="padding-left:8px;">
{{ currencies.render|raw }}
@@ -41,15 +45,42 @@
</div>
</td>
{% endif %}
<td>{{ currency.name }} ({{ currency.code }}) ({{ currency.symbol|raw }})</td>
<td>{{ currency.decimal_places }}</td>
<td class="defaultCurrency">
{% if currency.id == defaultCurrency.id %}
<span class="label label-success">{{ 'default_currency'|_ }}</span>
{% else %}
<a class="btn btn-info btn-xs"
href="{{ route('currencies.default',currency.id) }}">{{ 'make_default_currency'|_ }}</a>
<td>
{% if currency.enabled == false %}
<span class="text-muted">
{% endif %}
{{ currency.name }} ({{ currency.code }}) ({{ currency.symbol|raw }})
{% if currency.id == defaultCurrency.id %}
<span class="label label-success" id="default-currency">{{ 'default_currency'|_ }}</span>
{% endif %}
{% if currency.enabled == false %}
</span>
<br><small class="text-danger">{{ 'currency_is_disabled'|_ }}</small>
{% endif %}
</td>
<td>{{ currency.decimal_places }}</td>
<td class="buttons">
<div class="btn-group">
{% if currency.id != defaultCurrency.id %}
<a class="btn btn-default"
href="{{ route('currencies.default',currency.id) }}">
<i class="fa fa-fw fa-star"></i>
{{ 'make_default_currency'|_ }}</a>
{% endif %}
{% if currency.enabled %}
<a class="btn btn-default"
href="{{ route('currencies.disable',currency.id) }}">
<i class="fa fa-fw fa-square-o"></i>
{{ 'disable_currency'|_ }}</a>
{% endif %}
{% if not currency.enabled %}
<a class="btn btn-default"
href="{{ route('currencies.enable',currency.id) }}">
<i class="fa fa-fw fa-check-square-o"></i>
{{ 'enable_currency'|_ }}</a>
{% endif %}
</div>
</td>
</tr>
{% endfor %}

View File

@@ -24,7 +24,7 @@
{{ 'to_get_started'|_ }}
</p>
{{ ExpandedForm.text('bank_name') }}
{{ ExpandedForm.balance('bank_balance') }}
{{ ExpandedForm.balanceAll('bank_balance') }}
<p class="text-success">
{{ 'currency_not_present'|_ }}