@extends('layouts.app') @section('title', 'Historial de Inventario') @section('content')

Historial de Movimientos

Registro detallado de cambios en el inventario

Volver al Inventario
-
Mostrar
@if(request()->anyFilled(['search', 'tipo', 'fecha_inicio', 'fecha_fin'])) @endif
Fecha / Hora Usuario Producto Tipo Cambio Stock Detalles / Observación @php \Carbon\Carbon::setLocale('es'); @endphp @forelse($historial as $item)
{{ $item->fecha_movimiento ? $item->fecha_movimiento->translatedFormat('d M Y') : ($item->created_at ? $item->created_at->translatedFormat('d M Y') : 'N/A') }}
{{ $item->fecha_movimiento ? $item->fecha_movimiento->format('h:i A') : ($item->created_at ? $item->created_at->format('h:i A') : '00:00') }}
{{ substr($item->usuario->nombre ?? ($item->usuario->name ?? 'S'), 0, 1) }}
{{ $item->usuario->nombre ?? ($item->usuario->name ?? 'Sistema') }}
@if($item->producto)
{{ $item->producto->icono }}
{{ $item->producto->nombre }}
{{ $item->producto->codigo }}
@else Producto Eliminado @endif
@php $badges = [ 'carga_inicial' => 'bg-green-100 text-green-800 border-green-200', 'ajuste_rapido' => 'bg-blue-100 text-blue-800 border-blue-200', 'ajuste_auditoria' => 'bg-purple-100 text-purple-800 border-purple-200', 'merma' => 'bg-red-100 text-red-800 border-red-200', 'devolucion' => 'bg-teal-100 text-teal-800 border-teal-200' ]; $label = $tipos[$item->tipo_movimiento] ?? $item->tipo_movimiento; $class = $badges[$item->tipo_movimiento] ?? 'bg-slate-100 text-slate-800 border-slate-200'; @endphp {{ $label }} @if($item->cantidad > 0) +{{ $item->cantidad }} @elseif($item->cantidad < 0) {{ $item->cantidad }} @else - @endif
{{ $item->stock_anterior }} {{ $item->stock_nuevo }}
{{ $item->observacion }}
@empty No se encontraron registros en el historial con los filtros actuales. @endforelse
@if($historial->hasPages())
{{ $historial->links() }}
@endif @endsection