Generar Cambio Venta REDES SOCIALES #{{$ventaId}}

@if (session()->has('success'))
{{ session('success') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif @if ($mensajeError)
{{ $mensajeError }}
@endif
@if ($step === 1)
Datos cliente
@csrf
@error('rut_add')

{{ $message }}

@enderror
@error('nombre_add')

{{ $message }}

@enderror
@error('fono_add')

{{ $message }}

@enderror
@error('email_add')

{{ $message }}

@enderror
Buscar producto orden
@foreach ($detallesArray as $item) @endforeach
ID SKU PRODUCTOS CANTIDAD SUBTOTAL
{{ $item['product_id'] }} {{ $item['sku'] }} {{ $item['product_name'] }} @if ($item['parent_kit_id']) (parte de kit SKU {{ $item['parent_kit_id'] }}) @endif {{ $item['qty'] }} {{Currency::currency('CLP')->format(round(($item['subtotal']))) }}

@elseif($step === 2)
@php $productosSession = session('productosCambioRedesSociales', []); $productosCambio = collect($productosSession)->where('estado_producto', 'CAMBIO'); @endphp @if ($productosCambio->count())
Realizar cambio por productos
@if ($mostrarResultados)
@foreach ($productosResultado as $pr)
SKU: {{ $pr['sku'] }}
{{ Str::limit($pr['nombre'], 37) }}

Stock: {{ $pr['stock'] }}

Retiro: {{ $pr['retiro'] }}

Precio: {{ Currency::currency("CLP")->format(round($pr['precio'])) }}

@endforeach
@endif @if (session()->has('NoStock'))
{{ session('NoStock') }}
@endif @if(session('productosParaCambioRedesSociales')) @foreach ($this->productosParaCambioRedesSociales as $index => $ppc) @endforeach
# SKU Producto Precio Cantidad Subtotal Accion
{{ $ppc['ID'] }} {{ $ppc['sku'] }} {{ $ppc['nombre'] }} {{ Currency::currency("CLP")->format(round($ppc['precio'])) }} {{ Currency::currency("CLP")->format(round($ppc['subtotal'])) }}
@endif

Total Agregado: {{ Currency::currency('CLP')->format(round($this->totalProductosParaCambio)) }}

@endif @if (count($productosSession))
Productos ingresados para cambio
@foreach ($productosSession as $producto)
{{ $producto['estado_producto'] }}
[{{ $producto['sku'] }}] {{ $producto['product_name'] ?? 'N/A' }} x{{ $producto['cambio'] ?? '-' }}
@endforeach

Total Cambio: {{ Currency::currency('CLP')->format(round($this->totalCambio)) }}

@endif
@php // Verifica si hay productos con estado 'CAMBIO' o 'MERMA' en la sesión $productosSession = session('productosCambioRedesSociales', []); $hayMerma = collect($productosSession)->contains(fn($p) => isset($p['estado_producto']) && $p['estado_producto'] === 'MERMA'); $hayCambio = collect($productosSession)->contains(fn($p) => isset($p['estado_producto']) && $p['estado_producto'] === 'CAMBIO'); @endphp

@if ($hayMerma || $hayCambio) @endif

@endif
@push('scripts') @endpush