@extends('layouts.dashboard') @section('title', __('My Orders')) @section('page_title', __('My Orders')) @section('content') @include('partials.how-it-works', ['key' => 'student.orders'])

{{ __('My Orders') }}

{{ __('Your course & bundle purchases. Membership invoices live under') }} {{ __('My Membership') }}.

@php $paymentBadges = [ 'paid' => 'bg-success-subtle text-success-emphasis', 'pending' => 'bg-warning-subtle text-warning-emphasis', 'failed' => 'bg-danger-subtle text-danger-emphasis', 'refunded' => 'bg-secondary-subtle text-secondary-emphasis', ]; $refundBadges = [ 'pending' => 'bg-warning-subtle text-warning-emphasis', 'approved' => 'bg-info-subtle text-info-emphasis', 'completed' => 'bg-success-subtle text-success-emphasis', 'rejected' => 'bg-danger-subtle text-danger-emphasis', ]; @endphp @forelse ($orders as $order) @php $refund = $order->latestRefund; // A free enrollment has a zero total, so there is nothing to refund. $refundable = $order->payment_status === 'paid' && (float) $order->total > 0; @endphp
{{ __('Order #:no', ['no' => $order->order_no]) }} {{ $order->created_at->format('M d, Y') }}
{{ money($order->total) }} {{ status_label($order->payment_status) }}
{{-- Course/bundle lines only — membership lines (if any, from old mixed checkouts) stay under My Membership. --}} @foreach ($order->items->filter(fn ($i) => $i->course_id || $i->bundle_id) as $item) @php $course = $item->course; $bundle = $item->bundle; $title = $course?->title ?? $bundle?->title ?? __('Item'); $thumb = $course?->thumbnailUrl() ?? placeholder_image('Course', 120, 80); @endphp
{{ $title }}
@if($bundle && !$course)
{{ __('Bundle') }}
@endif
{{ money($item->price) }}
@endforeach
@if($order->items->contains(fn ($i) => $i->membership_plan_id))
{{ __('This order also includes a membership — see') }} {{ __('My Membership') }}.
@endif @php $lastPayment = $order->payments->sortByDesc('id')->first(); $unpaid = $order->payment_status !== 'paid' && ! in_array($order->payment_status, ['refunded'], true) && (float) $order->total > 0; $awaiting = $unpaid && $lastPayment && $lastPayment->payment_status === 'pending' && $lastPayment->gateway === 'manual'; @endphp @if($awaiting)
{{ __('Waiting for our team to confirm your payment') }}@if($lastPayment->payer_reference) ({{ __('reference') }} {{ $lastPayment->payer_reference }})@endif.
@elseif($unpaid && $lastPayment && in_array($lastPayment->payment_status, ['failed', 'cancelled'], true))
{{ __('Your last payment was not completed.') }}@if($lastPayment->reject_reason) {{ $lastPayment->reject_reason }}@endif {{ __('Pay again') }}
@endif
{{ __('Invoice') }} @if ($refund)
{{ __('Refund:') }} {{ status_label($refund->status) }}
@elseif ($refundable) @else @endif
@if (! $refund && $refundable)
@csrf @error('reason')
{{ $message }}
@enderror
@endif
@empty
{{ __('No orders yet') }}

{{ __('When you purchase a course or bundle, it will show up here. Membership purchases show under My Membership.') }}

{{ __('Browse courses') }}
@endforelse @if ($orders->hasPages())
{{ $orders->links() }}
@endif @endsection