@extends('layouts.app') @section('title', 'Préstamos') @section('content')

Mis Préstamos

@if(request()->hasAny(['search', 'modalidad', 'estado'])) @endif
@if($prestamos->isEmpty())

No hay préstamos registrados

Crea tu primer préstamo para comenzar

Crear Préstamo
@else
@foreach($prestamos as $prestamo)
{{ $prestamo->cliente_nombre_completo }}
{{ $prestamo->fecha_entrega->format('d/m/Y') }}
@php $cuotasPagadas = $prestamo->cuotas->where('pagado', true)->count(); $totalCuotas = $prestamo->cuotas->count(); $porcentajePago = $totalCuotas > 0 ? ($cuotasPagadas / $totalCuotas) * 100 : 0; @endphp
@if($cuotasPagadas == $totalCuotas) Completo @else {{ $cuotasPagadas }}/{{ $totalCuotas }} @endif
Monto
${{ number_format($prestamo->monto_credito, 0, ',', '.') }}
Total a Pagar
${{ number_format($prestamo->total_pagar, 0, ',', '.') }}
Modalidad
{{ $prestamo->modalidad_pago }}
Cuota
${{ number_format($prestamo->valor_cuota, 0, ',', '.') }}
@if($cuotasPagadas < $totalCuotas)
{{ number_format($porcentajePago, 1) }}% completado
@endif
@endforeach
@endif @endsection @push('scripts') @endpush