<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 panel">
    {% set tipoUsuario = app.session.get('rol') %}
    {% set abonado = 0 %}
    {% set restan = 0 %}
    {% if lista is defined and lista != null %}
        {% for l in lista %}
            {% set abonado = abonado + l.monto %}
        {% endfor %}
    {% endif %}
    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 alert-success text-center" style="font-size: larger;">
        CONCEPTO: {{p.descripcion}}
        <input type="hidden" value="{{p.idePag}}" id="ideAbonoAPagar">
    </div>
    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 alert-info text-center" style="font-size: larger;">
        TOTAL A PAGAR: ${{p.monto | number_format(2,".",",") }}
        <input type="hidden" value="{{p.monto}}" id="totalAPagarAbono">
    </div>
    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 alert-warning text-center" style="font-size: larger;">
        {% set restan = (p.monto - abonado) %}
        <strong>RESTAN: ${{ restan | number_format(2,".",",") }}</strong>
        <input type="hidden" value="{{p.monto - abonado}}" id="totalRestaAbono">
    </div>
</div>
<table class="table table-condensed table-striped">
    <thead>
        <tr>
            <th>#</th>
            <th>FECHA</th>
            <th>MONTO</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        {% if lista is defined and lista != null %}
            {% set totalAbono = 0 %}
            {% for l in lista %}
                <tr>
                    <td>{{loop.index}}</td>
                    <td>{{l.fecMov | date('d-m-Y') }}</td>
                    <td>${{l.monto | number_format(2,".",",") }}</td>
                    <td>
                        {% if loop.last %}
                            <div class="btn-group">
                                {% if tipoUsuario == 99 or tipoUsuario == 4 %}
                                    <a id="btnEliminarPago" class="btn btn-xs btn-danger" data-toggle="modal" data-backdrop="static" data-keyboard="false" data-target="#myModalEliminarPagosColegiatura" onclick="detallesPagoAEliminar({{p.cveAlu.ideAlu}}, '{{p.numRecibo}}',{{p.cveIng}} )">
                                        <i class="fa fa-trash fw fa-sm"></i>
                                    </a>
                                {% endif %}
                                <a id="btnGenerarComprobanteAbono" class="btn btn-xs btn-success" href="{{path('imprimir_pagos_bachi',{ideAlu:a.ideAlu,ideIng:l.ideIng})}}" target="_blank">
                                    <i class="fa fa-print fa-fw"></i> {{l.numRecibo}}
                                </a>
                            </div>
                        {% else %}
                            <div class="btn-group">
                                {% if tipoUsuario == 99 or tipoUsuario == 4 %}
                                    <a id="btnEliminarPago" class="btn btn-xs btn-danger" data-toggle="modal" data-backdrop="static" data-keyboard="false" data-target="#myModalEliminarPagosColegiatura" onclick="detallesPagoAEliminar({{p.cveAlu.ideAlu}}, '{{p.numRecibo}}',{{p.cveIng}} )">
                                        <i class="fa fa-trash fw fa-sm"></i>
                                    </a>
                                {% endif %}
                                <a id="btnGenerarComprobanteAbono" class="btn btn-xs btn-default" href="{{path('imprimir_pagos_bachi',{ideAlu:a.ideAlu,ideIng:l.ideIng})}}" target="_blank">
                                    <i class="fa fa-print fa-fw"></i> {{l.numRecibo}}
                                </a>
                            </div>
                        {% endif %}
                    </td>
                </tr>
                {% set totalAbono = totalAbono + l.monto %}
            {% endfor %}
            <tr>
                <td colspan="2">TOTAL</td>
                <td>${{totalAbono | number_format(2,".",",")}}</td>
            </tr>
        {% endif %}
    </tbody>
</table>