@extends('layouts.app') @section('title', 'Inventario | Veltrix v2') @section('page_title', 'Inventario') @section('page_subtitle', 'Gestion operativa en tiempo real') @section('page_icon', 'bx bxs-package') @section('content') @php $stats = is_array($inventoryStats ?? null) ? $inventoryStats : []; $productsTotal = (int) ($stats['products_total'] ?? (method_exists($inventario, 'total') ? $inventario->total() : count($inventario))); $lowStockCount = (int) ($stats['low_stock'] ?? 0); $stockValue = (float) ($stats['stock_value'] ?? 0); $lowStockRows = $lowStockProducts instanceof \Illuminate\Support\Collection ? $lowStockProducts : collect($lowStockProducts ?? []); $branchesRows = $branches instanceof \Illuminate\Support\Collection ? $branches : collect($branches ?? []); $movementsRows = $movementsModal instanceof \Illuminate\Support\Collection ? $movementsModal : collect($movementsModal ?? []); $transferHistoryRows = $transferHistory instanceof \Illuminate\Support\Collection ? $transferHistory : collect($transferHistory ?? []); $pendingAdjustmentsRows = $pendingAdjustments instanceof \Illuminate\Support\Collection ? $pendingAdjustments : collect($pendingAdjustments ?? []); $adjustmentHistoryRows = $adjustmentHistory instanceof \Illuminate\Support\Collection ? $adjustmentHistory : collect($adjustmentHistory ?? []); $variantsByProduct = is_array($productVariantsMap ?? null) ? $productVariantsMap : []; $activeUserBranchId = (int) ($userBranchId ?? 0); $branchCount = $branchesRows->count(); $canTransfer = $branchCount >= 2; $inventoryModalOld = trim((string) old('_inventory_modal', '')); $transferContext = $inventoryModalOld === 'transfer'; $adjustmentContext = $inventoryModalOld === 'adjustment_request'; $transferSelectedProduct = (int) ($transferContext ? old('producto_id', 0) : 0); $transferSelectedVariant = (int) ($transferContext ? old('variante_id', 0) : 0); $transferOrigin = (int) ($transferContext ? old('sucursal_origen_id', $activeUserBranchId > 0 ? $activeUserBranchId : 0) : ($activeUserBranchId > 0 ? $activeUserBranchId : 0)); $transferDestination = (int) ($transferContext ? old('sucursal_destino_id', 0) : 0); $transferQuantity = (string) ($transferContext ? old('cantidad', '1') : '1'); $transferObservation = (string) ($transferContext ? old('observacion', '') : ''); $adjustmentSelectedBranch = (int) ($adjustmentContext ? old('sucursal_id', $activeUserBranchId > 0 ? $activeUserBranchId : 0) : ($activeUserBranchId > 0 ? $activeUserBranchId : 0)); $adjustmentSelectedProduct = (int) ($adjustmentContext ? old('producto_id', 0) : 0); $adjustmentSelectedVariant = (int) ($adjustmentContext ? old('variante_id', 0) : 0); $adjustmentNewStock = (string) ($adjustmentContext ? old('stock_nuevo', '0') : '0'); $adjustmentReason = (string) ($adjustmentContext ? old('motivo', '') : ''); $autoOpenModalId = ''; if ($inventoryModalOld === 'transfer') { $autoOpenModalId = 'inventoryTransferModal'; } elseif ($inventoryModalOld === 'adjustment_request') { $autoOpenModalId = 'inventoryAdjustmentRequestModal'; } @endphp
Mueve inventario entre sedes con referencia automática.
Solicita cambios de stock por sucursal con motivo obligatorio.
Consulta kardex reciente de entradas, salidas y ajustes.
Revisa traslados entre origen y destino por fecha y referencia.
Aprueba o rechaza solicitudes pendientes con observación.
Consulta trazabilidad completa de ajustes aprobados o rechazados.
| Producto | Categoria | Stock | Costo prom. | Actualizado |
|---|---|---|---|---|
| {{ $row->producto?->nombre ?? 'N/A' }} | {{ $row->producto?->categoria?->nombre ?? 'N/A' }} | {{ number_format((float) $row->stock, 2) }} @if ($row->producto && (float) $row->stock <= (float) $row->producto->stock_minimo) Minimo @endif | {{ number_format((float) $row->costo_promedio, 2) }} | {{ optional($row->updated_at)->format('Y-m-d H:i') ?: 'N/A' }} |
| No hay registros de inventario para el contexto actual. | ||||