@if(!$local_id)
Selecciona un local para comenzar
@else
{{-- ══════════ CUADRE DEL LOCAL ══════════ --}}
@php
$acum = $this->cuadreAcumulado;
$dia = $this->cuadreDia;
@endphp
@if($acum)
{{-- Recibido (Mayoreo → Local) --}}
Recibido (Mayoreo)
{{ number_format($acum['kg_recibidos'], 2) }}
kg acumulados
{{-- Vendido (Salidas) --}}
Total Salidas
{{ number_format($acum['kg_salidas'], 2) }}
kg vendidos
{{-- Devoluciones --}}
Devoluciones
+{{ number_format($acum['devoluciones'], 2) }}
kg reingresados
{{-- Disponible --}}
@php $disp = $acum['disponible']; @endphp
Disponible Hoy
{{ number_format(abs($disp), 2) }}
{{ $disp >= 0 ? 'kg en stock' : 'kg de déficit' }}
{{-- Mini resumen del día --}}
@if($dia)
Hoy {{ \Carbon\Carbon::parse($fecha)->format('d/m/Y') }}
Entró (Mayoreo):
{{ number_format($dia['recibido'], 2) }} kg
Salidas:
{{ number_format($dia['salidas'], 2) }} kg
Devoluciones:
+{{ number_format($dia['devol'], 2) }} kg
@endif
@endif
{{-- ══════════ LAYOUT: 2 COLUMNAS ══════════ --}}
{{-- ══ COLUMNA IZQUIERDA: FORMULARIO ══ --}}
{{-- CLIENTE — Búsqueda + Crear (ARRIBA, siempre visible) --}}
{{-- Icono buscar o limpiar --}}
{{-- Dropdown --}}
Sin resultados
{{-- Botón Nuevo Cliente --}}
@error('cliente_id')
{{ $message }} @enderror
{{-- Tabs: PESAJE | ADICIONAL | DEVOLUCIÓN --}}
{{-- ════ TAB: PESAJE ════ --}}
@if($activeTab === 'pesaje')
{{-- Tara + Cantidad --}}
{{-- Preview Tara --}}
Tara Total =
{{ number_format(floatval($default_tara) * intval($default_cantidad), 2) }} kg
({{ $default_tara }} × {{ $default_cantidad }})
{{-- Peso (principal) --}}
@error('peso')
{{ $message }} @enderror
{{-- Preview neto --}}
@if($peso && floatval($peso) > 0)
Neto estimado:
{{ number_format(floatval($peso) - (floatval($default_tara) * intval($default_cantidad)), 2) }} kg
@endif
@endif
{{-- ════ TAB: ADICIONAL ════ --}}
@if($activeTab === 'adicional')
@endif
{{-- ════ TAB: DEVOLUCIÓN ════ --}}
@if($activeTab === 'devolucion')
@endif
{{-- /card formulario --}}
{{-- /col izquierda --}}
{{-- ══ COLUMNA DERECHA: HISTORIAL DEL DÍA ══ --}}
Movimientos — {{ \Carbon\Carbon::parse($fecha)->format('d/m/Y') }}
{{ $this->movimientosDia->count() }} registros
| Tipo |
Cliente |
Bruto |
Tara |
Jabas |
Neto ± |
Hora |
|
@forelse($this->movimientosDia as $mov)
@php
$isPesaje = $mov->tipo_operacion === 'pesaje';
$isAdicional = $mov->tipo_operacion === 'adicional';
$isDevol = $mov->tipo_operacion === 'devolucion';
$neto = $mov->peso_neto ?? $mov->peso_total;
@endphp
|
@if($isPesaje)
Pesaje
@elseif($isAdicional)
Adicional
@else
Devol.
@endif
|
{{ $mov->cliente?->nombre ?? '—' }}
|
{{ $mov->peso_bruto ? number_format($mov->peso_bruto, 2) : '—' }}
|
@if($mov->tara_total)
{{ number_format($mov->tara_total, 2) }}
@if($mov->tara_unitaria && $mov->cantidad_jabas)
({{ $mov->tara_unitaria }}×{{ $mov->cantidad_jabas }})
@endif
@else
—
@endif
|
{{ $mov->cantidad_jabas ?? '—' }}
|
{{ $isDevol ? '+' : '-' }}{{ number_format($neto, 2) }}
|
{{ $mov->created_at->format('H:i') }}
|
|
@empty
|
Sin movimientos registrados hoy
|
@endforelse
@if($this->movimientosDia->count() > 0)
@php
$totalSalidas = $this->movimientosDia->whereIn('tipo_operacion', ['pesaje','adicional'])->sum('peso_neto');
$totalDevolDia = $this->movimientosDia->where('tipo_operacion','devolucion')->sum('peso_neto');
@endphp
| Total del Día |
-{{ number_format($totalSalidas, 2) }}
@if($totalDevolDia > 0)
/ +{{ number_format($totalDevolDia, 2) }}
@endif
|
|
@endif
{{-- /col derecha --}}
{{-- /grid --}}
@endif{{-- /if local_id --}}
{{-- ══════════ MODAL NUEVO CLIENTE ══════════ --}}
@if($showClienteModal)