<table class="table table-hover">
    <thead>
    <tr>
        <th>{{ 'budgets'|_ }}</th>
        {% for account in report.accounts %}
            {% if account.sum != 0 %}
                <th class="hidden-xs" style="text-align: right;"><a href="{{ route('accounts.show',account.id) }}"
                                                                    title="{{ account.iban|default(account.name) }}">{{ account.name }}</a></th>
            {% endif %}
        {% endfor %}
        <th style="text-align: right;">{{ 'sum'|_ }}</th>
    </tr>
    </thead>
    <tbody>

    {% for budget in report.budgets %}
        {% if budget.spent|length > 0 %}
            <tr>
                <td>
                    <a href="{{ route('budgets.show', [budget.budget_id]) }}">{{ budget.budget_name }}</a>
                </td>
                {% for account in report.accounts %}
                    {% if budget.spent[account.id] %}
                        <td style="text-align: right;">
                            {{ formatAmountBySymbol(budget.spent[account.id].spent, budget.spent[account.id].currency_symbol, budget.spent[account.id].currency_decimal_places) }}
                            <span data-location="budget-entry"
                               data-budget-id="{{ budget.budget_id }}"
                               data-account-id="{{ account.id }}"
                               data-currency-id="{{ budget.spent[account.id].currency_id }}"
                               class="fa fa-fw fa-info-circle text-muted firefly-info-button"></span>
                        </td>
                    {% else %}
                        {% if report.accounts[account.id].sum != 0 %}
                            <td>&nbsp;</td>
                        {% endif %}
                    {% endif %}

                {% endfor %}
                <td style="text-align: right;">
                    {% for sum in report.sums[budget.budget_id] %}
                        {{ formatAmountBySymbol(sum.sum, sum.currency_symbol, sum.currency_decimal_places) }}
                        <br/>
                    {% endfor %}
                </td>
            </tr>
        {% endif %}
    {% endfor %}
    </tbody>
    <tfoot>
    <tr>
        <td><em>{{ 'sum'|_ }}</em></td>
        {% for account in report.accounts %}
            {% if account.sum != 0 %}
                <td style="text-align: right;">
                    {{ formatAmountBySymbol(account.sum, account.currency_symbol, account.currency_decimal_places) }}
                </td>
            {% endif %}
        {% endfor %}
    </tr>
    </tfoot>
</table>
