{% extends './layout/default' %}

{% block breadcrumbs %}
    {{ Breadcrumbs.render(Route.getCurrentRoute.getName, piggyBank) }}
{% endblock %}

{% block content %}
    <form method="POST" action="{{ route('piggy-banks.add', piggyBank.id) }}" accept-charset="UTF-8" class="form-horizontal" id="store">
        <input name="_token" type="hidden" value="{{ csrf_token() }}">
        <div class="row">
            <div class="col-lg-12 col-md-12 col-sm-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">{{ trans('firefly.add_money_to_piggy', {name: piggyBank.name}) }}</h3>
                    </div>
                    <div class="box-body">
                        {% if total > 0 %}


                            {% 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>
                            <button type="submit" class="btn btn-success pull-right">
                                {{ 'add'|_ }}
                            </button>
                        {% else %}
                            <p class="text-danger">{{ 'no_money_for_piggy'|_ }}</p>
                        {% endif %}


                    </div>
                </div>
            </div>

        </div>
    </form>
{% endblock %}
