@extends('layouts.user') @section('title') My Inventory @endsection @section('content') @php // Helper to build URLs that preserve all current filters except the ones being replaced. $filterUrl = function (array $replace = []) { $params = array_merge(request()->except('page'), $replace); return route('inventory.index', array_filter($params, fn($v) => $v !== null && $v !== '')); }; @endphp
{{-- ── Header ────────────────────────────────────────────────── --}}

My Inventory

{{ number_format($ownerships->total()) }} {{ $ownerships->total() === 1 ? 'item' : 'items' }} matching filters

{{-- ── Stat ribbon ────────────────────────────────────────────── --}}
Store value
${{ number_format($stats['total_value'], 2) }}
Total items
{{ number_format($stats['total_count']) }}
Available
{{ number_format($stats['available_count']) }}
Listed
{{ number_format($stats['listed_count']) }}
{{-- ── Filter rail (anchor-based, no submit-button conflict) ───── --}}
{{-- Search is its own tiny form preserving everything via hidden inputs --}}
@if($filters['q'] !== '') @endif
{{-- Sort dropdown (anchor links) --}}
@if($filters['q'] !== '' || $filters['status'] !== 'all' || $filters['sort'] !== 'newest')
Filtered @if($filters['status'] !== 'all')Status: {{ ucfirst($filters['status']) }}@endif @if($filters['q'] !== '')Search: "{{ $filters['q'] }}"@endif @if($filters['sort'] !== 'newest')Sort: {{ $sortLabels[$filters['sort']] ?? $filters['sort'] }}@endif Clear all
@endif {{-- ── List ───────────────────────────────────────────────────── --}}
@forelse($ownerships as $ownership) @php $pendingSell = $ownership->sells?->where('status', 0)->first(); $isListed = (bool) $pendingSell; @endphp
{{ $ownership->product?->name }}
{{ $ownership->product?->market?->name }} · Qty {{ $ownership->quantity }}
${{ number_format($ownership->value, 2) }}
@if($ownership->quantity > 1)
${{ number_format($ownership->value * $ownership->quantity, 2) }} total
@endif
@empty
@if($filters['q'] !== '' || $filters['status'] !== 'all')

No inventory matches these filters.

Clear all filters @else

No inventory yet.

Start bidding @endif
@endforelse
@include('partials.paginator', ['paginator' => $ownerships, 'perPageOptions' => $perPageOptions])
@include('partials.pilot-managed-modal') @endsection