@php $layout = $isMobile ? 'layouts.mobile' : 'layouts.desktop'; @endphp @extends($layout) @section('title', 'Purchase History - Gletra Elite') @section('content')
@if(!$isMobile)
@include('customer.partials.sidebar')
@endif
@php $currentStatus = $status ?? request('status'); $orderTabs = [ '' => ['label' => 'All', 'count' => $statusCounts['all'] ?? 0], 'pending' => ['label' => 'Pending', 'count' => $statusCounts['pending'] ?? 0], 'processing' => ['label' => 'Processing', 'count' => $statusCounts['processing'] ?? 0], 'shipped' => ['label' => 'Shipped', 'count' => $statusCounts['shipped'] ?? 0], 'delivered' => ['label' => 'Delivered', 'count' => $statusCounts['delivered'] ?? 0], 'on_hold' => ['label' => 'Hold', 'count' => $statusCounts['on_hold'] ?? 0], 'cancelled' => ['label' => 'Cancelled', 'count' => $statusCounts['cancelled'] ?? 0], ]; @endphp

My Orders

Track, manage and reorder your purchases.

@if($orders->count() > 0)
Your Orders

{{ $orders->total() }} order{{ $orders->total() !== 1 ? 's' : '' }} in your history

Secure
@foreach($orders as $order) @php $firstItem = $order->orderItems->first(); $image = $firstItem && $firstItem->product ? $firstItem->product->getPrimaryImage() : null; $itemCount = $order->orderItems->count(); $status = strtolower($order->order_status); if ($status === 'on_hold' || $order->vendor_status === 'hold') { $status = 'on_hold'; } $statusStyles = [ 'delivered' => ['bg' => '#dcfce7', 'text' => '#15803d', 'icon' => 'bi-check-circle-fill', 'label' => 'Delivered'], 'shipped' => ['bg' => '#dbeafe', 'text' => '#1d4ed8', 'icon' => 'bi-truck', 'label' => 'Shipped'], 'processing' => ['bg' => '#e0e7ff', 'text' => '#4338ca', 'icon' => 'bi-gear-fill', 'label' => 'Processing'], 'confirmed' => ['bg' => '#e0e7ff', 'text' => '#4338ca', 'icon' => 'bi-check2-circle', 'label' => 'Confirmed'], 'accepted' => ['bg' => '#e0e7ff', 'text' => '#4338ca', 'icon' => 'bi-check2-circle', 'label' => 'Accepted'], 'pending' => ['bg' => '#fef3c7', 'text' => '#b45309', 'icon' => 'bi-clock-fill', 'label' => 'Pending'], 'on_hold' => ['bg' => '#fef9c3', 'text' => '#a16207', 'icon' => 'bi-pause-circle-fill', 'label' => 'On Hold'], 'cancelled' => ['bg' => '#fee2e2', 'text' => '#b91c1c', 'icon' => 'bi-x-circle-fill', 'label' => 'Cancelled'], 'returned' => ['bg' => '#fce7f3', 'text' => '#be185d', 'icon' => 'bi-arrow-return-left', 'label' => 'Returned'], 'refunded' => ['bg' => '#f3e8ff', 'text' => '#7e22ce', 'icon' => 'bi-cash-coin', 'label' => 'Refunded'], ]; $st = $statusStyles[$status] ?? ['bg' => '#f1f5f9', 'text' => '#475569', 'icon' => 'bi-circle-fill', 'label' => ucfirst(str_replace('_', ' ', $status))]; @endphp @endforeach
Order Details Date Amount Status Actions
@if($image) Product @else
@endif @if($itemCount > 1) +{{ $itemCount - 1 }} @endif
#{{ $order->order_number }}
@if($firstItem && $firstItem->product) {{ Str::limit($firstItem->product->name, 32) }} @else Order items @endif
@if($itemCount > 1)
{{ $itemCount }} items
@endif
{{ $order->created_at->format('d M, Y') }}
{{ $order->created_at->format('h:i A') }}
₹{{ number_format($order->total, 2) }}
{{ $st['label'] }}
View
@if($orders->hasPages()) @endif
@else

No orders found

@if($currentStatus) No {{ str_replace('_', ' ', $currentStatus) }} orders right now. @else You have not placed any orders yet. @endif

Start Shopping
@endif
Financial Volume

₹{{ number_format(\App\Models\Order::where('user_id', auth()->id())->sum('total'), 2) }}

Lifetime expenditure volume.

Acquisition Count

{{ \App\Models\Order::where('user_id', auth()->id())->count() }}

Total manifests generated.

Trust Integrity

ELITE

Priority processing logic active.

@endsection