@extends('layouts.user') @section('title') {{ $tab === 'bids' ? 'Bids' : 'Sell Offs' }} History @endsection @section('content') @php $filterUrl = function (array $replace = []) use ($tab) { $params = array_merge(request()->except('page'), ['tab' => $tab], $replace); return route('history.index', array_filter($params, fn($v) => $v !== null && $v !== '')); }; $periodLabels = [ 'all' => 'All time', '7d' => 'Last 7 days', '30d' => 'Last 30 days', '90d' => 'Last 90 days', ]; $settled = $stats['won_count'] + $stats['lost_count']; $winRate = $settled > 0 ? round(($stats['won_count'] / $settled) * 100, 1) : null; @endphp
{{-- ── Header ────────────────────────────────────────────────── --}}
@if($tab === 'bids') {{-- Bids = money going out (you're paying to acquire) → up-right arrow --}} @else {{-- Sells = money coming in (you're receiving payment) → down-left arrow --}} @endif

Manual {{ $tab === 'bids' ? 'Bids' : 'Sell Offs' }} History

{{ number_format($rows->total()) }} {{ $tab === 'bids' ? 'bid' : 'sell' }}{{ $rows->total() === 1 ? '' : 's' }} matching filters

{{-- ── Tabs ───────────────────────────────────────────────────── --}} {{-- ── Stat ribbon ────────────────────────────────────────────── --}}
Total
{{ number_format($stats['total_count']) }}
Successful
{{ number_format($stats['won_count']) }}
Unsuccessful
{{ number_format($stats['lost_count']) }}
Pending
{{ number_format($stats['pending_count']) }}
@if($winRate !== null)
Win rate
{{ $winRate }}%
@endif
{{-- ── Filter rail (anchor-based) ─────────────────────────────── --}} @if($filters['q'] !== '' || $filters['status'] !== 'all' || $filters['period'] !== 'all')
Filtered @if($filters['status'] !== 'all')Status: {{ ucfirst($filters['status']) }}@endif @if($filters['period'] !== 'all')Period: {{ $periodLabels[$filters['period']] ?? $filters['period'] }}@endif @if($filters['q'] !== '')Search: "{{ $filters['q'] }}"@endif Clear all
@endif {{-- ── List ───────────────────────────────────────────────────── --}}
@forelse($rows as $row) @php $timeCol = $tab === 'bids' ? $row->bid_time : $row->sell_time; $evalTime = $tab === 'bids' ? \Carbon\Carbon::parse($row->bid_time)->addHour()->toIso8601String() : \Carbon\Carbon::parse($row->sell_time)->addHours(24)->toIso8601String(); $statusClass = $row->status === 1 ? 'win' : ($row->status === 2 ? 'loss' : 'pending'); @endphp
{{ strtoupper(substr($row->market?->name ?? '?', 0, 1)) }}
{{ $row->product?->name }}@if($row->quantity > 1) ×{{ $row->quantity }}@endif
{{ $row->market?->name }} · {{ \Carbon\Carbon::parse($timeCol)->diffForHumans(['parts' => 1, 'short' => true]) }}
${{ number_format($row->amount * $row->quantity, 2) }}
@if($row->status === 0) Pending @elseif($row->status === 1) Successful @elseif($row->status === 2) Unsuccessful @endif
@empty
@if($filters['q'] !== '' || $filters['status'] !== 'all' || $filters['period'] !== 'all')

No {{ $tab === 'bids' ? 'bids' : 'sells' }} match these filters.

Clear all filters @else

No manual {{ $tab === 'bids' ? 'bids' : 'sells' }} yet.

@endif
@endforelse
@include('partials.paginator', ['paginator' => $rows, 'perPageOptions' => $perPageOptions])
@endsection