{{-- resources/views/livewire/cxp/index.blade.php --}}
{{-- ── HEADER ──────────────────────────────────── --}}
💳 Cuentas por pagar
Facturas de proveedores · vencimientos · registro de pagos
{{-- ── MENSAJES ─────────────────────────────────── --}} @if($mensaje_exito)
✅ {{ $mensaje_exito }}
@endif @if($mensaje_error)
❌ {{ $mensaje_error }}
@endif {{-- ── KPIs ────────────────────────────────────── --}}
Total por pagar
₡{{ number_format($totales->total_pendiente ?? 0, 0) }}
⏰ Vence en 7 días
₡{{ number_format($totales->vence_7_dias ?? 0, 0) }}
🔴 Vencido
₡{{ number_format($totales->total_vencido ?? 0, 0) }}
✅ Pagado
₡{{ number_format($totales->total_pagado ?? 0, 0) }}
{{-- ── FILTROS ──────────────────────────────────── --}}
{{-- ── TABLA ────────────────────────────────────── --}}
@forelse($cxps as $cxp) @empty @endforelse
Proveedor Clave Hacienda Fecha Vence Total Pendiente IVA acreditado Estado Acciones
{{ $cxp->tercero?->nombre ?? $cxp->factura?->proveedor_nombre ?? '—' }}
{{ $cxp->tercero?->cedula_numero ?? $cxp->factura?->proveedor_cedula }}
{{ substr($cxp->factura?->clave_hacienda ?? '', 0, 12) }}…
{{ $cxp->fecha_emision->format('d M Y') }} @php $dias = now()->diffInDays($cxp->fecha_vencimiento, false); @endphp {{ $cxp->fecha_vencimiento->format('d M Y') }} @if($dias < 0) · {{ abs($dias) }}d vencida @elseif($dias <= 7) · {{ $dias }}d ⚠️ @endif ₡{{ number_format($cxp->monto_total, 2) }} ₡{{ number_format($cxp->monto_pendiente, 2) }} ₡{{ number_format($cxp->factura?->iva_acreditable ?? 0, 2) }} {{ match($cxp->estado) { 'pagado' => '✓ Pagado', 'vencido' => '🔴 Vencido', 'parcial' => '◑ Parcial', 'pendiente'=> '⏳ Pendiente', default => $cxp->estado, } }}
@if($cxp->estado !== 'pagado') @endif
No hay cuentas por pagar con los filtros seleccionados
@if($cxps->hasPages())
{{ $cxps->links() }}
@endif
{{-- ── MODAL REGISTRAR PAGO ─────────────────────── --}} @if($pagando_cxp_id) @php $cxp_modal = \App\Models\CuentaPorPagar::with('tercero','factura')->find($pagando_cxp_id); @endphp
💳 Registrar pago a proveedor
{{ $cxp_modal?->tercero?->nombre ?? $cxp_modal?->factura?->proveedor_nombre }} · Pendiente: ₡{{ number_format($cxp_modal?->monto_pendiente ?? 0, 2) }}
@if($pago_error)
❌ {{ $pago_error }}
@endif
@endif