@extends('layouts.app') @section('title', 'Factura ' . $invoice->document_number . ' — ' . \App\Models\Setting::get('app_name', 'TI Manager')) @section('content')

Detalles del Documento

Número de Factura

{{ $invoice->document_number }}

Fecha de Emisión

{{ $invoice->issue_date ? $invoice->issue_date->format('d/m/Y') : 'N/A' }}

Valor Total

${{ number_format($invoice->total_amount, 0) }}

Saldo Pendiente

@php $totalPaidAmount = $invoice->payments()->where('status', 'Aprobado')->sum('amount'); $balance = max(0, $invoice->total_amount - $totalPaidAmount); @endphp

${{ number_format($balance, 0) }}

Estado

@php $color = $invoice->status === 'Pagado' ? ['bg' => 'rgba(145, 200, 73, 0.1)', 'color' => '#91c849'] : ['bg' => 'rgba(239, 68, 68, 0.1)', 'color' => '#ef4444']; @endphp {{ $invoice->status }}

Vista Previa del PDF

Pagos y Comprobantes

@if($invoice->status === 'Sin Pagar')

Esta factura tiene un saldo pendiente de pago.

@if(auth()->user()->isClient())

(Sube tu comprobante de transferencia)

@else

(Añadir un pago al historial)

@endif
@else

Factura Pagada

@endif
@if(count($invoice->payments) > 0)

Historial de Pagos

@foreach($invoice->payments as $payment)
${{ number_format($payment->amount, 0) }}
{{ $payment->created_at->format('d/m/Y H:i') }}
@php $pColor = $payment->status === 'Aprobado' ? '#91c849' : ($payment->status === 'Rechazado' ? '#ef4444' : '#f59e0b'); @endphp {{ $payment->status }}
@if($payment->receipt_path) @else
Abono en efectivo / transferencia directa
@endif @if($payment->notes)
"{{ $payment->notes }}"
@endif @if(auth()->user()->isAdmin())
@if($payment->status === 'Pendiente')
@csrf @method('PUT')
@csrf @method('PUT')
@endif
@csrf @method('DELETE')
@endif
@endforeach
@endif
@endsection