{% extends "./layout/default.twig" %}
{% block content %}
    {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
    <div class="row">
        <div class="col-lg-12 col-md-12 col-sm-12">
            <p>
                <a href="{{ route('piggy-banks.create') }}" class="btn btn-success"><i class="fa fa-sort-amount-asc fa-fw"></i> {{ 'new_piggy_bank'|_ }}</a>
            </p>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12 col-md-12 col-sm-12">
            <div class="panel panel-default">
                <div class="panel-heading">{{ 'piggyBanks'|_ }}</div>
                {% include 'list/piggy-banks.twig' %}
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12 col-md-12 col-sm-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <i class="fa fa-fw fa-money"></i> {{ 'account_status'|_ }}
                </div>
                <table class="table table-striped">
                    <tr>
                        <th>{{ 'account'|_ }}</th>
                        <th>{{ 'balance'|_ }}</th>
                        <th>{{ 'left_for_piggy_banks'|_ }}</th>
                        <th>{{ 'sum_of_piggy_banks'|_ }}</th>
                        <th>{{ 'saved_so_far'|_ }}</th>
                        <th>{{ 'left_to_save'|_ }}</th>
                    </tr>
                    {% for id,info in accounts %}
                        <tr>
                            <td><a href="{{ route('accounts.show',id) }}">{{ info.name }}</a></td>
                            <td>{{ info.balance|formatAmount }}</td>
                            <td>{{ info.leftForPiggyBanks|formatAmount }}</td>
                            <td>{{ info.sumOfTargets|formatAmount }}</td>
                            <td>{{ info.sumOfSaved|formatAmount }}</td>
                            <td>{{ info.leftToSave|formatAmount }}</td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
    </div>
{% endblock %}
{% block scripts %}
    <script src="js/jquery-ui.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="js/piggy-banks.js"></script>
{% endblock %}
