{{ __('Detalle de Factura') }} {{ $invoice->number }}

@if (session('status'))
{{ session('status') }}
@endif

FACTURA

{{ $invoice->number }}

@php $statusConfig = match($invoice->status) { 'paid' => ['class' => 'bg-green-500/10 text-green-500 border-green-500/20', 'label' => 'PAGADO'], 'partially_paid' => ['class' => 'bg-blue-500/10 text-blue-400 border-blue-500/20', 'label' => 'PAGO PARCIAL'], default => ['class' => 'bg-orange-500/10 text-orange-400 border-orange-500/20', 'label' => 'PENDIENTE DE PAGO'], }; @endphp {{ $statusConfig['label'] }}

Emitido: {{ $invoice->issue_date }}

Cliente

{{ $invoice->serviceOrder->customer->name }}

{{ $invoice->serviceOrder->customer->phone }}

Vehículo

{{ $invoice->serviceOrder->vehicle->make }} {{ $invoice->serviceOrder->vehicle->model }}

{{ $invoice->serviceOrder->vehicle->license_plate }}

Concepto: Orden de Trabajo #{{ $invoice->service_order_id }}
@money($invoice->total)
@php $totalConfirmed = $invoice->payments->where('status', 'confirmado')->sum('amount'); $totalPending = $invoice->payments->where('status', 'pendiente')->sum('amount'); $totalAll = $invoice->payments->whereIn('status', ['confirmado', 'pendiente'])->sum('amount'); @endphp
Total Factura @money($invoice->total)
Pagos Confirmados @money($totalConfirmed)
@if($totalPending > 0)
Pagos Pendientes @money($totalPending)
@endif
Saldo Pendiente @money($invoice->total - $totalConfirmed)

Historial de Pagos

Ver todos los pagos →
@forelse($invoice->payments->sortByDesc('created_at') as $payment)

@money($payment->amount)

@php $paymentStatusConfig = match($payment->status) { 'confirmado' => ['class' => 'bg-green-500/10 text-green-500 border-green-500/20', 'label' => 'CONFIRMADO'], 'rechazado' => ['class' => 'bg-red-500/10 text-red-500 border-red-500/20', 'label' => 'RECHAZADO'], default => ['class' => 'bg-yellow-500/10 text-yellow-500 border-yellow-500/20', 'label' => 'PENDIENTE'], }; @endphp {{ $paymentStatusConfig['label'] }}
{{ $payment->method }} {{ $payment->payment_date?->format('d/m/Y H:i') ?? $payment->payment_date }} @if($payment->reference) Ref: {{ $payment->reference }} @endif
@if($payment->notes)

{{ $payment->notes }}

@endif @if($payment->isConfirmed() && $payment->confirmed_at)

Confirmado el {{ $payment->confirmed_at->format('d/m/Y H:i') }}

@endif
@if($payment->isPending())
@csrf @method('PATCH')
@csrf @method('PATCH')
@elseif($payment->isConfirmed())
@else
@endif
@empty

No se han registrado pagos para esta factura.

@endforelse
@if($invoice->status != 'paid')

Registrar Pago

@csrf

El pago quedará pendiente de confirmación.

@else

Factura Pagada

Esta factura se encuentra totalmente solventada.

Descargar PDF
@endif