<div class="accordion accordion-bordered mt-3 col-xl-6 " id="accordionCredito">
    <div class="card accordion-item active">
        <h2 class="accordion-header" id="headingOne">
            <button type="button" class="accordion-button" data-bs-toggle="collapse"
                data-bs-target="#accordionCreditoTip" aria-expanded="false" aria-controls="accordionCreditoTip">
                <h4><?= lang("Presupuestos.credito") ?></h4>
            </button>
        </h2>

        <div id="accordionCreditoTip" class="accordion-collapse collapse show" data-bs-parent="#accordionCredito">
            <div class="accordion-body">

                <div class="col-xl-12">
                    <div class="table-responsive text-nowrap">
                        <table class="table table-bordered">
                            <tbody>
                                <tr>
                                    <td><?= lang('Presupuestos.clienteId') ?></td>
                                    <td>
                                    <button type="button" class="btn btn-label-primary waves-effect" 
                                        onclick="window.open('<?= route_to('editarCliente', $presupuestoEntity->cliente_id) ?>', '_blank');">
                                        Ir a cliente</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Facturas sin pagar: </td>
                                    <td class="right">
                                        <span class="autonumeric autonumeric-currency">
                                            <?= $credito['total_facturas_sin_pagar'] ?>
                                        </span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Facturas pagadas: </td>
                                    <td class="right">
                                        <span class="autonumeric autonumeric-currency">
                                            <?= $credito['total_facturas_pagadas'] ?>
                                        </span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Pagos vencidos: </td>
                                    <td class="right">
                                        <span class="autonumeric autonumeric-currency">
                                            <?= $credito['total_facturas_vencidas'] ?>
                                        </span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Pedidos produccion: </td>
                                    <td class="right">
                                        <span class="autonumeric autonumeric-currency">
                                            <?= $credito['total_pedidos_produccion'] ?>
                                        </span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Pedidos finalizados: </td>
                                    <td class="right">
                                        <span class="autonumeric autonumeric-currency">
                                            <?= $credito['total_pedidos_finalizados'] ?>
                                        </span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Pendiente ERP antiguo: </td>
                                    <td class="right">
                                        <span class="autonumeric autonumeric-currency">
                                            <?= $credito['pendiente_old_erp'] ?>
                                        </span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Total pendiente: </td>
                                    <td class="right">
                                        <span class="autonumeric autonumeric-currency">
                                            <?= $credito['total_pendiente'] ?>
                                        </span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>Límite crédito: </td>
                                    <td class="right">
                                        <span class="autonumeric autonumeric-currency">
                                            <?= $credito['limite_credito'] ?>
                                        </span>
                                    </td>
                                </tr>
                                <tr>
                                    <td><span class="fw-bold">Margen disponible:</span></td>
                                    <td class="right">
                                        <span class="autonumeric autonumeric-currency fw-bold
                                            <?= $credito['margen_disponible'] < 0 ? 'text-danger' : 'text-success' ?>">
                                            <?= $credito['margen_disponible'] ?>
                                        </span>
                                    </td>
                                </tr>
                            </tbody>
                        </table>

                    </div>
                </div>

            </div> <!-- //.accordion-body -->
        </div> <!-- //.accordion-collapse -->
    </div> <!-- //.accordion-item -->
</div> <!-- //.accordion -->