@extends('layouts.app') @section('content')

Detalles de la Orden #{{ $order->order_number }}

@if($order->status === 'draft')
@csrf
@endif Editar @if($order->status === 'confirmed')
@php // Determinar el tipo de documento preestablecido desde la app $predefinedType = $order->order_type ?? null; $showBoth = !$predefinedType; // Si no hay tipo preestablecido, mostrar ambas opciones @endphp @if($showBoth || $predefinedType === 'invoice')
@csrf
@endif @if($showBoth || $predefinedType === 'note')
@csrf
@endif @if($predefinedType) Tipo preestablecido desde App: {{ $predefinedType === 'invoice' ? 'Factura' : 'Nota de Entrega' }} @endif
@endif
Información del Cliente
Cliente: {{ $order->client->business_name }}
Documento: {{ $order->client->document_type }}: {{ $order->client->document_number }}
Email: {{ $order->client->email }}
Teléfono: {{ $order->client->phone }}
Información de la Orden
Número: {{ $order->order_number }}
Fecha: {{ $order->order_date->format('d/m/Y') }}
Entrega: {{ $order->delivery_date ? $order->delivery_date->format('d/m/Y') : 'N/A' }}
Estado: {{ $order->status_text }}
Vendedor: {{ $order->salesman->name ?? 'N/A' }}

Productos
@foreach($order->details as $detail) @endforeach
Producto Cantidad Precio Unitario Descuento % Subtotal
{{ $detail->product->name }} {{ number_format($detail->quantity, 2) }} {{ number_format($detail->unit_price, 2) }} {{ number_format($detail->discount_percentage, 2) }}% {{ number_format($detail->subtotal, 2) }}
Subtotal: {{ number_format($order->subtotal, 2) }}
Descuento: {{ number_format($order->discount_amount, 2) }}
Impuestos: {{ number_format($order->tax_amount, 2) }}
Total: {{ number_format($order->total_amount, 2) }}
@if($order->notes)
Notas

{{ $order->notes }}

@endif
@push('scripts') @endpush @endsection