@extends('layouts.app') @section('content')
@if($quote->status === 'Cancelada')
CANCELADA
@endif
{{-- ENCABEZADO --}}
{{-- Columna izquierda: Resumen rápido de la orden --}}
Orden #{{ $quote->quote_number }} Creada el {{ $quote->created_at ? $quote->created_at->format('d/m/Y H:i') : '—' }}
Estado @switch($quote->status) @case('Pendiente') Pendiente @break @case('Pagada') Pagada @break @case('Cancelada') Cancelada @break @default {{ $quote->status ?? 'Sin definir' }} @endswitch
Importe total ${{ number_format($quote->total, 2) }}
Pagado ${{ number_format($pagosCabecera, 2) }}
Saldo @if($saldoCabecera > 0) ${{ number_format($saldoCabecera, 2) }} @else ${{ number_format($saldoCabecera, 2) }} @endif
{{-- Prioridad del evento --}} @if($quote->event_priority)
Prioridad del evento: @switch($quote->event_priority) @case('alta') 🔴 Urgente @break @case('media') 🟠 Con poco tiempo @break @case('baja') 🟢 Con tiempo @break @default ⚪ No especificada @endswitch
@endif
{{-- Columna derecha: Datos del evento / entrega --}}
Fecha de Entrega {{ $quote->delivery_date ? \Carbon\Carbon::parse($quote->delivery_date)->format('d/m/Y') : 'No especificada' }}
Lugar de entrega {{ $quote->delivery_type }}
¿Cómo nos encontró? {{ $quote->customer_source }}
Anticipo sugerido ${{ number_format($anticipoCalc, 2) }}
{{-- DATOS DEL CLIENTE Y RESUMEN --}}
Orden para:

{{ $customerName }}

@if($direccion)

Dirección de entrega {{ $direccion }}

@if($mapsLink)

📍 Ver ubicación en Google Maps

@endif @endif {{-- WhatsApp --}}

WhatsApp @if($waDigits && strlen($waDigits) >= 10) {{ $waPretty }} @else @endif

Correo electrónico {{ $customerModel->email ?? 'No proporcionado' }}

Resumen de la orden:
@if($quote->dynamic_info) @endif
Importe total: ${{ number_format($quote->total, 2) }}
Dinámica / Evento: {{ $quote->dynamic_info }}
{{-- TABLA DE PRODUCTOS --}}
@foreach ($quote->items as $item) @endforeach
Producto / Servicio Cantidad Precio Unitario Total
{{ $item->inventory->name }} {{ $item->quantity }} ${{ number_format($item->unit_price, 2) }} ${{ number_format($item->total_price, 2) }}
{{-- DISEÑO APROBADO + TOTALES DESGLOSADOS --}}
{{-- Etiquetas de totales --}} {{-- Valores de totales --}}

Diseño aprobado

@if($fileUrl && ($isImage || $isPdf)) @if($isImage)
Diseño aprobado
@else Ver diseño en PDF @endif @else No tiene diseño aprobado registrado. @endif

Sub Total:

Descuento:

Adicional por prioridad:

Envío:

Base sin IVA:

IVA:

Gran Total:

Pagos / Anticipo:

Saldo:

${{ number_format($subtotal, 2, '.', ',') }}

${{ number_format($descuento, 2, '.', ',') }}

${{ number_format($extra, 2, '.', ',') }}

${{ number_format($envio, 2, '.', ',') }}

${{ number_format($baseSinIVA, 2, '.', ',') }}

${{ number_format($iva, 2, '.', ',') }}

${{ number_format($totalConIVA, 2, '.', ',') }}

@if($pagos > 0)

${{ number_format($pagos, 2, '.', ',') }}

@else

${{ number_format(0, 2, '.', ',') }}

@endif @if($saldo > 0)

${{ number_format($saldo, 2, '.', ',') }}

@else

${{ number_format($saldo, 2, '.', ',') }}

@endif

{{-- NOTAS --}}
Notas de la orden {{ $quote->notes ?: 'Sin notas adicionales.' }}
{{-- Botón Confirmar Orden por WhatsApp --}} {{-- --}} {{-- Descargar PDF --}} Descargar PDF
@if ($quote->status === 'Cancelada')
@else {{-- Cancelar orden --}} @endif {{-- Editar --}} {{-- status === 'Cancelada') style="pointer-events: none; opacity: 0.5;" @endif> Editar --}}
{{-- Estados de pago --}} @if ($quote->status === 'Pagada') @elseif ($quote->status === 'Pendiente') @elseif ($quote->status !== 'Cancelada') @endif
{{-- ================= MODAL COMPLETAR PAGO ================= --}} {{-- ================= MODAL CONVERTIR EN ORDEN ================= --}} {{-- ================= MODAL CANCELAR ORDEN ================= --}} {{-- ================= MODAL REABRIR ORDEN ================= --}} @endsection @push('scripts') @endpush