@extends('layouts.app') @section('title', __('My Orders')) @php /* * Use the currency selected in Payment Settings throughout * this page and its financial partials. */ $displayCurrency = currency_code( $currency ?? default_currency() ); $search = trim( (string) ($search ?? request('q', '')) ); $paymentStatus = (string) ( $paymentStatus ?? request('payment_status', 'all') ); $orderStatus = (string) ( $orderStatus ?? request('order_status', 'all') ); $sort = (string) ( $sort ?? request('sort', 'latest') ); if ( ! in_array( $sort, ['latest', 'oldest', 'total_high', 'total_low'], true ) ) { $sort = 'latest'; } $allowedPerPage = [10, 20, 30, 50]; $perPage = (int) ( $perPage ?? request('per_page', 10) ); if (! in_array($perPage, $allowedPerPage, true)) { $perPage = 10; } $dateFrom = trim( (string) request('date_from', '') ); $dateTo = trim( (string) request('date_to', '') ); $hasFilters = $search !== '' || $paymentStatus !== 'all' || $orderStatus !== 'all' || $sort !== 'latest' || $perPage !== 10 || $dateFrom !== '' || $dateTo !== ''; $pendingPaymentStatus = \App\Models\Order::PAYMENT_PENDING; $receivedPaymentStatus = \App\Models\Order::PAYMENT_RECEIVED; @endphp @section('content')
{{-- Page Header --}}

{{ __('My Orders') }}

{{ __( 'Track and manage all your orders in one place.' ) }}

@if( \Illuminate\Support\Facades\Route::has( 'account.dashboard' ) ) {{ __('Back to Account') }} @endif
{{-- Statistics --}} @include('account.orders.partials.stats-grid', [ 'stats' => $stats ?? [], 'currency' => $displayCurrency, 'displayCurrency' => $displayCurrency, ]) {{-- Filters --}}
{{-- Search --}}
{{-- Payment Status --}}
{{-- Order Status --}}
{{-- Sort --}}
{{-- Results Per Page --}}
{{-- Filter Actions --}}
@if($hasFilters) @endif
{{-- Date From --}}
{{-- Date To --}}
{{-- Results Information --}}
{{ number_format($orders->total()) }} {{ trans_choice( 'order found|orders found', $orders->total() ) }} @if($orders->total() > 0) ({{ number_format( $orders->firstItem() ?? 0 ) }}–{{ number_format( $orders->lastItem() ?? 0 ) }}) @endif
{{-- Orders List --}} @if($orders->isNotEmpty())
@foreach($orders as $order) @include( 'account.orders.partials.order-card', [ 'order' => $order, 'currency' => $displayCurrency, 'displayCurrency' => $displayCurrency, ] ) @endforeach
{{-- Pagination --}} @if($orders->hasPages())
{{ __( 'Showing :first to :last of :total orders', [ 'first' => $orders->firstItem() ?? 0, 'last' => $orders->lastItem() ?? 0, 'total' => $orders->total(), ] ) }}
{{ $orders ->withQueryString() ->links( 'pagination::bootstrap-5' ) }}
@endif @else
@if($hasFilters) {{ __('No orders match your filters') }} @else {{ __('No orders yet') }} @endif

@if($hasFilters) {{ __( 'Try adjusting your search or filter criteria.' ) }} @else {{ __('Start shopping to see your orders here.') }} @endif

@if($hasFilters) {{ __('Clear Filters') }} @elseif( \Illuminate\Support\Facades\Route::has( 'storefront.products.index' ) ) {{ __('Browse Products') }} @endif
@endif
@endsection @once @push('styles') @endpush @endonce