@extends('front_end.layouts.home') @php $showRightSidebar = false; @endphp @section('title', 'Purchase History') @section('left_sidebar') @include('front_end.pages.courses.courses_left_sidebar') @endsection @section('content')

Purchase History

Your course purchase transactions

@if($enrollments->count() > 0)
@foreach($enrollments as $enrollment) @endforeach
Date Course Transaction ID Payment Method Amount Status Actions
{{ $enrollment->created_at->format('M d, Y') }} {{ $enrollment->created_at->format('h:i A') }}
{{ $enrollment->transaction_id }} @if($enrollment->payment_method == 'credit_card') Credit Card @elseif($enrollment->payment_method == 'paypal') PayPal @elseif($enrollment->payment_method == 'bank_transfer') Bank Transfer @elseif($enrollment->price_paid == 0) Free Enrollment @else {{ ucfirst(str_replace('_', ' ', $enrollment->payment_method ?? 'Other')) }} @endif @if($enrollment->price_paid > 0) ${{ number_format($enrollment->price_paid, 2) }} @else Free @endif Completed @if($enrollment->created_at->diffInDays(now()) <= 30) @endif

Showing {{ $enrollments->firstItem() ?? 0 }}-{{ $enrollments->lastItem() ?? 0 }} of {{ $enrollments->total() }} transactions

{{ $enrollments->links('pagination::bootstrap-5') }}

{{ $enrollments->total() }}

Total Purchases

${{ number_format($enrollments->sum('price_paid'), 2) }}

Total Spent

@php $totalSavings = 0; foreach($enrollments as $enrollment) { if($enrollment->course->price > 0) { $regularPrice = $enrollment->course->price; $paidPrice = $enrollment->price_paid; $totalSavings += ($regularPrice - $paidPrice); } } @endphp

${{ number_format($totalSavings, 2) }}

Total Savings

@else

No Purchase History

You haven't made any course purchases yet.

Browse Courses
@endif
@push('scripts') @endpush @endsection