<table class="table table-hover sortable">
    <thead>
    <tr>
        <th data-defaultsign="az">{{ 'name'|_ }}</th>
        <th data-defaultsign="_19" style="text-align: right;">{{ 'total'|_ }}</th>
        <th data-defaultsign="_19" class="hidden-xs" style="text-align: right;">{{ 'average'|_ }}</th>
        <th data-defaultsort="disabled"></th>
    </tr>
    </thead>
    <tbody>
    {% set sum = 0 %}
    {% for entry in entries %}
        {% set sum = sum + entry.sum %}
        {% if loop.index > listLength %}
            <tr class="overListLength">
        {% else %}
            <tr>
        {% endif %}
        <td data-value="{{ entry.name }}">
            <a href="{{ route('accounts.show',entry.id) }}">{{ entry.name }}</a>
            {% if entry.count > 1 %}
                <br/>
                <small>
                    {{ entry.count }} {{ 'transactions'|_|lower }}
                </small>
            {% endif %}
        </td>
        <td data-value="{{ entry.sum }}" style="text-align: right;">
            {{ (entry.sum)|formatAmount }}
        </td>
        <td class="hidden-xs" data-value="{{ entry.average }}" style="text-align: right;">
            {% if entry.count > 1 %}
                {{ entry.average|formatAmount }}
            {% else %}
                &mdash;
            {% endif %}
        </td>
        <td>
            <i class="fa fa-fw text-muted fa-info-circle firefly-info-button" data-location="{{ type }}"
               data-account-id="{{ entry.id }}"></i>
        </td>
        </tr>
    {% endfor %}
    </tbody>
    <tfoot>
    {% if entries|length > listLength %}
        <tr>
            <td colspan="4" class="active">
                <a href="#" class="listLengthTrigger">{{ trans('firefly.show_full_list',{number:incomeTopLength}) }}</a>
            </td>
        </tr>
    {% endif %}
    <tr>
        <td><em>{{ 'sum'|_ }}</em></td>
        <td style="text-align: right;">{{ (sum)|formatAmount }}</td>
    </tr>
    </tfoot>
</table>
