@extends('admin.layouts.app') @section('title', 'Order Details') @section('content')
Order Details
Back
Order Information
Order Number {{ $order->order_number }}
Order Date {{ $order->created_at->format('d/m/Y H:i:s') }}
Order Status {{ ucfirst($order->order_status) }}
Payment Status {{ ucfirst($order->payment_status) }}
Customer Information
Name {{ $order->customer_name }}
Email {{ $order->customer_email }}
Phone {{ $order->customer_phone }}
Address {{ $order->customer_address }}, {{ $order->city }}, {{ $order->postcode }}
Items Purchased
@php $courseNames = is_array($order->course_names) ? $order->course_names : json_decode($order->course_names, true); $courseIds = is_array($order->course_ids) ? $order->course_ids : json_decode($order->course_ids, true); // Try to find the actual items from the cart or database $items = []; if (is_array($courseNames)) { foreach ($courseNames as $index => $name) { $items[] = [ 'name' => $name, 'id' => $courseIds[$index] ?? null, 'price' => null, // We'll try to find it 'quantity' => 1, 'type' => 'course' ]; } } else { $items[] = [ 'name' => $courseNames ?? 'N/A', 'id' => null, 'price' => null, 'quantity' => 1, 'type' => 'course' ]; } @endphp @foreach($items as $index => $item) @php // Try to get the actual price from the database $actualPrice = null; $course = null; if ($item['id']) { $course = \App\Models\Course::find($item['id']); if ($course) { $actualPrice = $course->getDiscountedPrice(); } } // Check if this is a package (contains "PLATINUM", "GOLD", "SILVER" in name) $isPackage = stripos($item['name'], 'PLATINUM') !== false || stripos($item['name'], 'GOLD') !== false || stripos($item['name'], 'SILVER') !== false; // If it's a package, try to find it in the database if ($isPackage) { $package = \App\Models\Package::where('name', 'LIKE', '%' . $item['name'] . '%')->first(); if ($package) { $actualPrice = $package->getDiscountedPrice(); } } @endphp @endforeach @if($order->discount_amount > 0) @endif
# Item Name Type Quantity Unit Price Subtotal
{{ $index + 1 }} {{ $item['name'] }} @if($isPackage) PACKAGE @endif {{ $isPackage ? 'Package' : 'Course' }} {{ $item['quantity'] }} @if($actualPrice !== null) £{{ number_format($actualPrice, 2) }} @else Price not available @endif @if($actualPrice !== null) £{{ number_format($actualPrice * $item['quantity'], 2) }} @else - @endif
Total Amount £{{ number_format($order->total_amount, 2) }}
Discount -£{{ number_format($order->discount_amount, 2) }}
@if($order->notes)
Notes

{{ $order->notes }}

@endif
Update Status
@csrf
@if(isset($payment))
@endif
@if(isset($payment))
Payment Information
Transaction ID {{ $payment->transaction_id ?? 'N/A' }}
Payment Method {{ ucfirst($payment->payment_method ?? 'N/A') }}
Amount £{{ number_format($payment->amount ?? $order->total_amount, 2) }}
Status {{ ucfirst($payment->status) }}
Payment Date {{ $payment->payment_date ? \Carbon\Carbon::parse($payment->payment_date)->format('d/m/Y H:i') : 'N/A' }}
@endif
@endsection