{% trans_default_domain 'invoice' %}
{% set table_columns = 8 %}

{% if not table_selectable is defined %}
    {# This variable MUST be explicitly set to false to hide checkboxes         #}
    {# If you set this to false and you have a second listing that display them #}
    {# set explicitly to true in the second listing.                            #}
    {% set table_selectable = true %}
    {% set table_columns = table_columns + 1 %}
{% endif %}
{% if not paginatable is defined %}
    {% set paginatable = true %}
{% endif %}
{% if not sortable is defined %}
    {% set sortable = true %}
{% endif %}

{% if table_selectable %}
<div class="box pad">
    <div class="box-header">
        <i class="fa fa-list-ul"></i>
        <h3 class="box-title">Pagos Recibidos</h3>
        <!-- tools box -->
        &nbsp;&nbsp;
        {#<div class="btn-group">
            <button type="submit" name="autorizar" class="btn btn-default"
                    title="Autorizar"
                    data-confirm="{% trans %}Esta seguro de autorizar los comprobantes{% endtrans %}"><span
                        class="glyphicon glyphicon-upload"></span></button>
            <button type="submit" name="delete" class="btn btn-default"
                    title="{% trans %}list.bulk_delete{% endtrans %}"
                    data-confirm="{% trans %}list.bulk_delete_confirm{% endtrans %}"><span
                        class="glyphicon glyphicon-trash"></span></button>
            <button type="submit" name="print" class="btn btn-default" title="{% trans %}list.bulk_print{% endtrans %}">
                <span class="glyphicon glyphicon-print"></span></button>
            <button type="submit" name="pdf" class="btn btn-default" title="{% trans %}list.bulk_pdf{% endtrans %}">
                <span class="glyphicon glyphicon-download-alt"></span></button>
            <button type="submit" name="email" class="btn btn-default" title="{% trans %}list.bulk_email{% endtrans %}">
                <span class="glyphicon glyphicon-envelope"></span></button>
        </div>#}

        <!-- /. tools -->


    </div>
    <div class="box-body">

        {% endif %}

        <table class="table table-condensed table-striped align-middle" data-type="invoices">
            <thead>
            <tr>
                <th class="cell-size-medium">Empresa</th>
                <th class="cell-size-medium">Número de Comprobante</th>
                <th class="cell-size-medium">Fecha</th>
                <th class="cell-size-medium cell-align-right">Valor</th>
                <th class="cell-size-medium cell-align-right">Estado</th>
            </tr>
            </thead>
            <tbody>
            {% if pagos|length == 0 %}
                <tr>
                    <td colspan="{{ table_columns }}">No se encontro registros</td>
                </tr>
            {% endif %}
            {% for key, result in pagos %}
                {% set entity = result %}
                <tr data-link="{{ path('admin_pagos_edit', { 'id': entity.id }) }}">
                    <td class="cell-size-medium">{{ entity.empresa.razonsocial }}</td>
                    <td class="cell-size-medium">{{ entity.numerocomprobante }}</td>
                    <td class="cell-size-medium">{{ entity.createdate |date("d/m/Y") }}</td>
                    <td class="cell-size-medium cell-align-right">{{ entity.valor }}</td>
                    <td class="cell-size-medium cell-align-right">
                        {% if entity.cerrado == 1 %}
                            <span class="label closed">Autorizado</span>
                        {% else %}
                            <span class="label opened">Pendiente</span>
                        {% endif %}
                    </td>

                </tr>
            {% endfor %}
            </tbody>
        </table>
        {% if table_selectable %}
    </div>

    {#{% if paginatable %}
        <div class="box-footer clearfix">
            <div class="navigation">
                {{ knp_pagination_render(invoices) }}
            </div>
        </div>
    {% endif %}#}
</div>

{% endif %}

