@props(['loading' => false])
@php // Calculate low stock by checking inventory quantities against item reorder points $lowStockCount = $loading ? 0 : \App\Models\Warehouse\Item::whereHas('inventories', function($query) { $query->whereColumn('quantity_available', '<=', 'items.reorder_point'); })->count(); @endphp
@php $pendingCount = $loading ? 0 : \App\Models\Warehouse\IncomingOperation::where('status', 'pending_inspection')->count(); @endphp
@php $todayIncoming = $loading ? 0 : \App\Models\Warehouse\IncomingOperation::whereDate('created_at', today())->count(); @endphp
@php $todayOutgoing = $loading ? 0 : \App\Models\Warehouse\OutgoingTransaction::whereDate('created_at', today())->count(); @endphp
@php $activeSuppliers = $loading ? 0 : \App\Models\Warehouse\Supplier::where('status', 'active')->count(); @endphp