{{-- New-Unity ERP | Finance/Resources/Views/cxc/show.blade.php | v2.1 | 27/07/2026 --}} {{-- v2.1 — Security: @can ajustado a finance.cxc.pay / finance.cxc.send-statement. --}} {{-- v2.0 — CxC Fase 2: pago AJAX con validación en tiempo real, saldo restante, badge SALDADA. --}} {{-- v1.0 — CxC Fase 1: detalle de factura, historial de pagos, formulario de pago y estado de cuenta. --}} @extends('layouts.vertical') @section('title', __('finance.invoice-detail')) @section('content') @php $status = $invoice->status_cxc; $balance = $invoice->cxc_balance; $paid = $invoice->cxc_paid_amount; $folio = ($invoice->serie ?? '') . ($invoice->folio ?? $invoice->id); $customer = $invoice->customer; @endphp

{{ __('finance.invoice-detail') }} — {{ $folio }} {{ $customer?->commercial_name ?: $customer?->name }}

{{-- Flash (fallback para POST tradicional) --}} @if(session('success')) @endif
{{-- Columna principal --}}
{{-- Encabezado factura --}}
{{ $folio }} @switch($status) @case('overdue') {{ __('finance.overdue') }} @break @case('partial') {{ __('finance.partial') }} @break @case('paid') {{ __('finance.paid') }} @break @default {{ __('finance.pending') }} @endswitch

{{ __('finance.col-customer') }}

{{ $customer?->commercial_name ?: $customer?->name }}

@if($customer?->rfc)

RFC: {{ $customer->rfc }}

@endif

{{ __('finance.col-date') }}

{{ $invoice->fecha_emision ? \Carbon\Carbon::parse($invoice->fecha_emision)->format('d/m/Y') : '—' }}

{{ __('finance.col-due') }}

{{ $invoice->expiration_date ? \Carbon\Carbon::parse($invoice->expiration_date)->format('d/m/Y') : '—' }}

{{-- Historial de pagos --}}
{{ __('finance.payment-history') }}
@forelse($invoice->arPayments as $pago) @empty @endforelse
{{ __('finance.payment-date') }} {{ __('finance.amount') }} {{ __('finance.payment-method') }} {{ __('finance.reference') }} {{ __('finance.notes') }} {{ __('finance.actions') }}
{{ $pago->payment_date->format('d/m/Y') }} ${{ number_format($pago->amount, 2) }} {{ \App\Modules\Finance\Models\ArPayment::methodLabel($pago->payment_method) }} {{ $pago->reference ?: '—' }} {{ $pago->notes ?: '—' }} {{ $pago->user?->name }}
{{ __('finance.no-payments') }}
{{-- Columna lateral --}}
{{-- Registrar pago --}} @if($balance > 0) @can('finance.cxc.pay')
{{ __('finance.register-payment') }}
{{-- Alerta de errores AJAX --}}
{{ __('finance.total-payment-badge') }}
@endcan @else
{{ __('finance.invoice-settled') }}
@endif {{-- Estado de cuenta --}} @if($customer)
{{ __('finance.statement') }}
{{ __('finance.download-statement') }} @can('finance.cxc.send-statement')
@csrf
@endcan
@endif {{-- Volver --}} {{ __('finance.back-to-cxc') }}
@endsection @section('scripts') @endsection