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

{% block breadcrumbs %}
    {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute.getName) }}
{% endblock %}

{% block content %}
    {% if piggyBanks.count == 0 %}
        {% include 'partials.empty' with {what: 'default', type: 'piggies',route: route('piggy-banks.create')} %}
    {% else %}
        <div class="row">
            <div class="col-lg-12 col-md-12 col-sm-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">{{ 'piggyBanks'|_ }}</h3>
                    </div>
                    <div class="box-body no-padding">
                        {% include 'list/piggy-banks' %}
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-lg-12 col-md-12 col-sm-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">{{ 'account_status'|_ }}</h3>
                    </div>
                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th>{{ 'account'|_ }}</th>
                                <th style="text-align:right;" class="hidden-sm hidden-xs">{{ 'balance'|_ }}</th>
                                <th style="text-align:right;">{{ 'left_for_piggy_banks'|_ }}</th>
                                <th style="text-align:right;" class="hidden-sm hidden-xs">{{ 'sum_of_piggy_banks'|_ }}</th>
                                <th style="text-align:right;" class="hidden-sm hidden-xs">{{ 'saved_so_far'|_ }}</th>
                                <th style="text-align:right;" class="hidden-sm hidden-xs">{{ 'left_to_save'|_ }}</th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for id,info in accounts %}
                                <tr>
                                    <td><a href="{{ route('accounts.show',id) }}" title="{{ info.name }}">{{ info.name }}</a></td>
                                    <td style="text-align:right;" class="hidden-sm hidden-xs">{{ info.balance|formatAmount }}</td>
                                    <td style="text-align:right;">{{ info.leftForPiggyBanks|formatAmount }}</td>
                                    <td style="text-align:right;" class="hidden-sm hidden-xs">{{ info.sumOfTargets|formatAmount }}</td>
                                    <td style="text-align:right;" class="hidden-sm hidden-xs">{{ info.sumOfSaved|formatAmount }}</td>
                                    <td style="text-align:right;" class="hidden-sm hidden-xs">{{ info.leftToSave|formatAmount }}</td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    {% endif %}
{% endblock %}
{% block scripts %}
    <script src="js/lib/jquery-ui.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="js/ff/piggy-banks/index.js"></script>
{% endblock %}
