@extends('admin_base') @section('title', 'Order Details') @section('style') @endsection @section('content')

Order #{{ $order->order_number }}

Order Date
{{ $order->created_at->format('d M, Y h:i A') }}
Payment Info
{{ strtoupper($order->payment_method) }} - {{ ucfirst($order->payment_status ?? 'unpaid') }}
Order Status

Customer Information

@if($order->whatsapp) @endif @if($order->contact_email) @endif
Contact Details
Name {{ $order->contact_name }}
Phone {{ $order->contact_phone }}
WhatsApp {{ $order->whatsapp }}
Email {{ $order->contact_email }}
Shipping Address
Address {{ $order->address }}
City {{ $order->city }}
State {{ $order->state }}
Postal Code {{ $order->postal_code }}

Order Items

@php $groupedItems = $order->items->groupBy('product_id'); @endphp @foreach($groupedItems as $productId => $items) @php $firstItem = $items->first(); @endphp
{{ $firstItem->product->title }} {{ $firstItem->product->title }}
@foreach($items as $item)
{{ $item->variation->unit_value }}{{ $item->variation->unit_type }} ৳{{ number_format($item->getUnitPrice()) }} each
{{ $item->quantity }} × ৳{{ number_format($item->getTotal()) }}
@endforeach
@endforeach
Subtotal ৳{{ number_format($order->subtotal) }}
Delivery Charge ৳{{ number_format($order->delivery_charge) }}
@if($order->discount > 0)
Discount -৳{{ number_format($order->discount) }}
@if($order->coupon_code)

Coupon Code {{ $order->coupon_code }}

Type {{ ucfirst($order->coupon_type) }}

Value @if($order->coupon_type === 'percentage') {{ $order->coupon_value }}% @else ৳{{ number_format($order->coupon_value) }} @endif

@endif @endif
Total Amount ৳{{ number_format($order->total) }}

Payment Details

Payment Method {{ strtoupper($order->payment_method) }}
Status {{ ucfirst($order->payment_status ?? 'unpaid') }}
@if($order->payment_trxid)
Transaction {{ $order->payment_trxid }}
@endif

Order Timeline

@php $allEvents = collect(); // Add order statuses $order->statuses->each(function($status) use ($allEvents) { // Format the status text to be more user-friendly $statusText = match($status->status) { 'pending' => 'Order Placed', 'processing' => 'Processing Order', 'shipped' => 'Order Shipped', 'delivered' => 'Order Delivered', 'cancelled' => 'Order Cancelled', 'payment_pending' => 'Payment Pending', 'payment_verified' => 'Payment Verified', 'payment_rejected' => 'Payment Rejected', default => ucfirst($status->status) }; $allEvents->push([ 'type' => 'order', 'status' => $status->status, 'display_text' => $statusText, 'date' => $status->created_at, 'note' => null ]); }); // Add payment status if exists // Use new order payment fields if available if ($order->payment_status) { $paymentText = match($order->payment_status) { 'unpaid' => 'Payment Pending', 'paid' => 'Payment Verified', 'failed' => 'Payment Failed', 'cancelled' => 'Payment Cancelled', default => ucfirst($order->payment_status) . ' Payment' }; $allEvents->push([ 'type' => 'payment', 'status' => $order->payment_status, 'display_text' => $paymentText, 'date' => $order->created_at, 'note' => null ]); } // Sort all events by date, newest first $allEvents = $allEvents->sortByDesc('date'); @endphp @foreach($allEvents as $event)
@if($event['type'] === 'order') @else @php $icon = 'wallet'; if ($event['status'] === 'paid' || $event['status'] === 'verified') { $icon = 'check-circle'; } elseif ($event['status'] === 'failed' || $event['status'] === 'rejected' || $event['status'] === 'cancelled') { $icon = 'times-circle'; } @endphp @endif {{ $event['display_text'] }}

{{ $event['date']->format('d M, Y h:i A') }}

@if($event['note'])
{{ $event['note'] }}
@endif
@endforeach
@if(false) @endif @endsection @section('script') @endsection