@for ($i = 0; $i < 12; $i++)
@endfor

Order History

Your gaming journey through time

@if($orders->isEmpty())

No Orders Yet

Your gaming adventure awaits!

Start Your Journey
@else
Filter Orders

Find Your Orders

Click on categories to filter your order history

@php // Initialize game stats first $gameStats = []; foreach ($orders as $order) { $items = json_decode($order->cart_data, true); if (is_array($items)) { foreach ($items as $item) { $product = \App\Models\Product::find($item['id'] ?? null); if ($product && $product->game) { $gameStats[$product->game] = ($gameStats[$product->game] ?? 0) + 1; } } } } $totalCategories = count($gameStats) + 1; // +1 for "All Orders" @endphp

All Categories

{{ $totalCategories }} Categories Browse
Recently (All Orders)
Pending ({{ $orders->where('status', 'pending')->count() }})
Completed ({{ $orders->where('status', 'completed')->count() }})
Cancelled ({{ $orders->where('status', 'cancelled')->count() }})
@foreach ($orders as $index => $order) @php $items = json_decode($order->cart_data, true); $orderDate = $order->created_at; // Get primary game $primaryGame = ''; $gameColor = '#8b5cf6'; if (is_array($items) && count($items) > 0) { $gameProducts = []; foreach ($items as $item) { $product = \App\Models\Product::find($item['id'] ?? null); if ($product && $product->game) { $gameProducts[] = $product->game; } } if (!empty($gameProducts)) { $primaryGame = array_count_values($gameProducts); $primaryGame = array_key_first($primaryGame); // Set game colors $gameColors = [ 'Genshin' => '#f59e0b', 'Starrail' => '#ec4899', 'WutheringWave' => '#06b6d4' ]; $gameColor = $gameColors[$primaryGame] ?? '#8b5cf6'; } } $animationDelay = ($index % 9) * 0.1; @endphp

#{{ str_pad($order->id, 4, '0', STR_PAD_LEFT) }}

{{ $order->created_at->format('M j, Y') }}

@if($order->status === 'completed') Completed @elseif($order->status === 'cancelled') Cancelled @else Pending @endif
@if($primaryGame)
{{ $primaryGame }}
@endif
{{ $order->customer_name }}
{{ $order->phone }}
@if (is_array($items) && count($items) > 0) @php $totalQuantity = 0; foreach ($items as $item) { $totalQuantity += $item['quantity'] ?? 1; } @endphp
Quantity: {{ $totalQuantity }}
@endif
฿{{ number_format($order->total_amount ?? 0, 2) }}
{{ $order->created_at->diffForHumans() }}
@if ($order->payment_slip_path) @endif Details
@endforeach
@endif