Multi account piggy banks.

This commit is contained in:
James Cole
2024-12-14 17:32:03 +01:00
parent fb6c67fa04
commit 6a62f781e9
24 changed files with 572 additions and 404 deletions

View File

@@ -25,9 +25,9 @@
<td style="text-align: right;">
{% if event.amount < 0 %}
<span class="text-danger money-negative">{{ trans('firefly.removed_amount', {amount: formatAmountByAccount(event.piggyBank.account, event.amount, false)})|raw }}</span>
<span class="text-danger money-negative">{{ trans('firefly.removed_amount', {amount: formatAmountBySymbol(event.amount,event.piggyBank.transactionCurrency.symbol, false)})|raw }}</span>
{% else %}
<span class="text-success money-positive">{{ trans('firefly.added_amount', {amount: formatAmountByAccount(event.piggyBank.account, event.amount, false)})|raw }}</span>
<span class="text-success money-positive">{{ trans('firefly.added_amount', {amount: formatAmountBySymbol(event.amount, event.piggyBank.transactionCurrency.symbol, false)})|raw }}</span>
{% endif %}
</td>
</tr>

View File

@@ -14,16 +14,16 @@
<h3 class="box-title">{{ trans('firefly.add_money_to_piggy', {name: piggyBank.name}) }}</h3>
</div>
<div class="box-body">
{% if maxAmount > 0 %}
<p>
{{ 'max_amount_add'|_ }}: {{ formatAmountByCurrency(currency,maxAmount) }}.
</p>
{% if total > 0 %}
<div class="input-group">
<div class="input-group-addon">{{ currency.symbol|raw }}</div>
<input step="any" class="form-control" id="amount" autocomplete="off" name="amount" max="{{ maxAmount|round(2) }}"
type="number"/>
</div>
{% for account in accounts %}
<strong>{{ account.account.name }} ({{ 'max_amount_add'|_ }}: {{ formatAmountByCurrency(piggyBank.transactionCurrency, account.max_amount) }})</strong>
<div class="input-group">
<div class="input-group-addon">{{ piggyBank.transactionCurrency.symbol|raw }}</div>
<input step="any" min="0" class="form-control" id="amount_{{ account.account.id }}" autocomplete="off" name="amount[{{ account.account.id }}]" max="{{ account.max_amount|round(piggyBank.transactionCurrency.decimal_places) }}" type="number"/>
</div>
{% endfor %}
<p>
&nbsp;
</p>

View File

@@ -5,19 +5,17 @@
</button>
<h4 class="modal-title">{{ trans('firefly.add_money_to_piggy_title', {name: piggyBank.name}) }}</h4>
</div>
{% if maxAmount > 0 %}
{% if total > 0 %}
<form style="display: inline;" id="add" action="{{ route('piggy-banks.add', piggyBank.id) }}" method="POST">
<div class="modal-body">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<p>
{{ 'max_amount_add'|_ }}: {{ formatAmountByCurrency(currency,maxAmount) }}.
</p>
{% for account in accounts %}
<strong>{{ account.account.name }} ({{ 'max_amount_add'|_ }}: {{ formatAmountByCurrency(piggyBank.transactionCurrency, account.max_amount) }})</strong>
<div class="input-group">
<div class="input-group-addon">{{ currency.symbol|raw }}</div>
<input step="any" class="form-control" id="amount" autocomplete="off" name="amount" max="{{ maxAmount|round(currency.decimal_places) }}" type="number"/>
<div class="input-group-addon">{{ piggyBank.transactionCurrency.symbol|raw }}</div>
<input step="any" min="0" class="form-control" id="amount_{{ account.account.id }}" autocomplete="off" name="amount[{{ account.account.id }}]" max="{{ account.max_amount|round(piggyBank.transactionCurrency.decimal_places) }}" type="number"/>
</div>
{% endfor %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ 'close'|_ }}</button>

View File

@@ -17,7 +17,7 @@
<div class="box-body">
{{ ExpandedForm.text('name') }}
{{ ExpandedForm.amountNoCurrency('target_amount') }}
{{ CurrencyForm.currencyList('transaction_ currency_id', null, {helpText:'piggy_default_currency'|_}) }}
{{ CurrencyForm.currencyList('transaction_currency_id', null, {helpText:'piggy_default_currency'|_}) }}
{{ AccountForm.assetLiabilityMultiAccountList('accounts', preFilled.accounts, {label: 'saveOnAccounts'|_, helpText: 'piggy_account_currency_match'|_ }) }}
</div>

View File

@@ -22,8 +22,9 @@
<div class="box-body">
{{ ExpandedForm.text('name') }}
{{ AccountForm.assetAccountList('account_id', null, {label: 'saveOnAccount'|_ }) }}
{{ ExpandedForm.amountNoCurrency('targetamount') }}
{{ ExpandedForm.amountNoCurrency('target_amount') }}
{{ CurrencyForm.currencyList('transaction_currency_id', null, {helpText:'piggy_default_currency'|_}) }}
{{ AccountForm.assetLiabilityMultiAccountList('accounts', preFilled.accounts, {label: 'saveOnAccounts'|_, helpText: 'piggy_account_currency_match'|_ }) }}
</div>
</div>

View File

@@ -14,15 +14,17 @@
</div>
<div class="box-body">
<p>
{{ 'max_amount_remove'|_ }}: {{ formatAmountByCurrency(currency, repetition.currentamount) }}.
</p>
{% for account in accounts %}
<p>
{{ account.account.name }}: {{ 'max_amount_remove'|_ }}: {{ formatAmountByCurrency(piggyBank.transactionCurrency, account.saved_so_far) }}.
</p>
<div class="input-group">
<div class="input-group-addon">{{ piggyBank.transactionCurrency.symbol|raw }}</div>
<input step="any" class="form-control" id="amount_{{ account.account.id }}" autocomplete="off" name="amount[{{ account.account.id }}]" max="{{ account.saved_so_far }}"
type="number">
</div>
{% endfor %}
<div class="input-group">
<div class="input-group-addon">{{ currency.symbol|raw }}</div>
<input step="any" class="form-control" id="amount" autocomplete="off" name="amount" max="{{ repetition.currentamount }}"
type="number"/>
</div>
<p>
&nbsp;
</p>

View File

@@ -10,15 +10,16 @@
</div>
<div class="modal-body">
{% for account in accounts %}
<p>
{{ 'max_amount_remove'|_ }}: {{ formatAmountByCurrency(currency, repetition.currentamount) }}.
{{ account.account.name }}: {{ 'max_amount_remove'|_ }}: {{ formatAmountByCurrency(piggyBank.transactionCurrency, account.saved_so_far) }}.
</p>
<div class="input-group">
<div class="input-group-addon">{{ currency.symbol|raw }}</div>
<input step="any" class="form-control" id="amount" autocomplete="off" name="amount" max="{{ repetition.currentamount }}"
<div class="input-group-addon">{{ piggyBank.transactionCurrency.symbol|raw }}</div>
<input step="any" class="form-control" id="amount_{{ account.account.id }}" autocomplete="off" name="amount[{{ account.account.id }}]" max="{{ account.saved_so_far }}"
type="number">
</div>
{% endfor %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ 'close'|_ }}</button>

View File

@@ -33,8 +33,12 @@
<div class="box-body no-padding">
<table class="table table-responsive table-hover" id="piggyDetails">
<tr>
<td style="width:40%;">{{ 'account'|_ }}</td>
<td><a href="{{ route('accounts.show', piggyBank.account_id) }}">{{ piggyBank.account.name }}</a></td>
<td style="width:40%;">{{ 'saveOnAccounts'|_ }}</td>
<td>
{% for account in piggy.accounts %}
<a href="{{ route('accounts.show', account.id) }}">{{ account.name }}</a><br>
{% endfor %}
</td>
</tr>
{% if piggy.object_group_title %}
<tr>