@extends('layouts.admin') @section('title', 'Order #' . ($order->order_number ?? $order->id)) @section('header', 'Order Details') @php $currencySymbol = App\Models\AppSetting::getValue('currency_symbol', '?'); $currencyDecimals = App\Models\AppSetting::currencyDecimals(); $currencyStep = number_format(1 / pow(10, $currencyDecimals), $currencyDecimals, '.', ''); $formatRule = fn ($type, $value) => $type === 'fixed' ? $currencySymbol . number_format((float) $value, $currencyDecimals) : number_format((float) $value, 2) . '%'; $serviceType = $order->service_type ?? 'food'; $isParcelOrder = $serviceType === 'parcel'; @endphp @section('content')
Order Status
@foreach($timeline as $step)
@if($step['completed']) @else @endif
{{ $step['label'] }}
@if($step['timestamp'])
{{ \Carbon\Carbon::parse($step['timestamp'])->format('h:i A') }}
@endif
@if(!$loop->last)
@endif @endforeach
@if(in_array($order->status, ['pending', 'confirmed', 'preparing', 'ready_for_pickup', 'picked_up', 'on_the_way']))
@csrf @method('PUT')
@endif
@if($isParcelOrder && $order->parcelOrder)
Parcel Details
Package
{{ ucfirst($order->parcelOrder->package_type ?? 'Parcel') }}
Weight
{{ $order->parcelOrder->weight_kg }} kg
Delivery Option
{{ ucfirst(str_replace('_', ' ', $order->parcelOrder->delivery_option ?? 'standard')) }}
Pickup Address
{{ $order->parcelOrder->pickup_address['address'] ?? $order->parcelOrder->pickup_address['line1'] ?? 'N/A' }}
Drop Address
{{ $order->parcelOrder->drop_address['address'] ?? $order->parcelOrder->drop_address['line1'] ?? 'N/A' }}
Receiver
{{ $order->parcelOrder->receiver_name ?? 'N/A' }} {{ $order->parcelOrder->receiver_phone ? '(' . $order->parcelOrder->receiver_phone . ')' : '' }}
Contents
{{ $order->parcelOrder->content ?? 'N/A' }}
@endif
Order Items
@php $displayItems = []; if ($order->orderItems && $order->orderItems->count() > 0) { $displayItems = $order->orderItems->map(function ($item) { $qty = (int) ($item->quantity ?? 1); $unitPrice = (float) ($item->unit_price ?? $item->price ?? 0); $totalPrice = (float) ($item->total_price ?? ($unitPrice * $qty)); return [ 'name' => optional($item->menuItem)->name ?? $item->item_name ?? 'Item', 'quantity' => $qty, 'unit_price' => $unitPrice, 'total_price' => $totalPrice, ]; })->all(); } elseif (is_array($order->items)) { $displayItems = collect($order->items)->map(function ($item) { if (! is_array($item)) { return null; } $qty = (int) ($item['quantity'] ?? $item['qty'] ?? 1); $unitPrice = (float) ($item['unit_price'] ?? $item['price'] ?? 0); $totalPrice = (float) ($item['total_price'] ?? $item['total'] ?? ($unitPrice * $qty)); if ($unitPrice <= 0 && $qty > 0 && $totalPrice > 0) { $unitPrice = $totalPrice / $qty; } return [ 'name' => $item['name'] ?? $item['item_name'] ?? $item['title'] ?? 'Item', 'quantity' => $qty, 'unit_price' => $unitPrice, 'total_price' => $totalPrice, ]; })->filter()->all(); } @endphp @forelse($displayItems as $item) @empty @endforelse @if((float) ($order->discount ?? 0) > 0) @endif
Item Quantity Unit Price Total
{{ $item['name'] }} {{ $item['quantity'] }} {{ $currencySymbol }}{{ number_format($item['unit_price'], App\Models\AppSetting::currencyDecimals()) }} {{ $currencySymbol }}{{ number_format($item['total_price'], App\Models\AppSetting::currencyDecimals()) }}
No items found for this order
Subtotal: {{ $currencySymbol }}{{ number_format($order->subtotal ?? $order->total, App\Models\AppSetting::currencyDecimals()) }}
Delivery Fee: {{ $currencySymbol }}{{ number_format($order->delivery_fee ?? 0, App\Models\AppSetting::currencyDecimals()) }}
Platform Charge: {{ $currencySymbol }}{{ number_format($order->platform_fee ?? 0, App\Models\AppSetting::currencyDecimals()) }}
Taxes & Charges: {{ $currencySymbol }}{{ number_format($order->tax ?? 0, App\Models\AppSetting::currencyDecimals()) }}
Coupon Discount: -{{ $currencySymbol }}{{ number_format($order->discount, App\Models\AppSetting::currencyDecimals()) }}
Total Bill Payable: {{ $currencySymbol }}{{ number_format($order->total, App\Models\AppSetting::currencyDecimals()) }}
Customer Information
{{ $order->customer_name ?? 'Guest' }}
Customer

{{ $order->customer_phone ?? 'N/A' }}
{{ $order->customer_email ?? 'N/A' }}
{{ $order->delivery_address ?? $order->customer_address ?? 'N/A' }}
@if($order->scheduled_time)
Scheduled for {{ $order->scheduled_time->format('F d, Y \a\t h:i A') }}
@endif @if($order->special_instructions)
Special instructions
{{ $order->special_instructions }}
@endif
{{ $isParcelOrder ? 'Service Information' : 'Store Information' }}
@if($isParcelOrder)
Parcel Delivery
Pickup and drop order
@else
@if($order->restaurant && $order->restaurant->logo_image) @else
@endif
{{ $order->restaurant->name ?? 'N/A' }}
{{ $order->restaurant->phone ?? '' }}

{{ $order->restaurant->address ?? 'N/A' }}, {{ $order->restaurant->city ?? '' }}
@endif
Delivery Driver
@if($order->driver)
{{ $order->driver->name }}
{{ $order->driver->phone }}

Vehicle: {{ $order->driver->vehicle_type ?? 'N/A' }} - {{ $order->driver->vehicle_number ?? 'N/A' }}
@else @if(in_array($order->status, ['confirmed', 'preparing', 'ready_for_pickup']))
@csrf
@else
No driver assigned yet
@endif @endif
Transaction Details
Payment Method
{{ ucfirst(str_replace('_', ' ', $order->payment_method ?? 'N/A')) }}
Payment Status
{!! $order->payment_status_badge !!}
Gateway Payment ID
{{ $order->payment_id ?: 'N/A' }}
Payment Source
{{ ucfirst(str_replace('_', ' ', $order->payment_source ?? 'N/A')) }}
Payment Gateway
{{ ucfirst(str_replace('_', ' ', $order->payment_gateway ?? $order->payment_method ?? 'N/A')) }}
Paid At
{{ $order->paid_at ? $order->paid_at->format('d M Y, h:i A') : 'N/A' }}
Delivery KM
{{ $deliveryDistanceKm !== null ? number_format($deliveryDistanceKm, 2) . ' km' : 'N/A' }}
@forelse($order->transactions as $transaction) @empty @endforelse
Transaction ID Type Method Status Amount Date
{{ $transaction->transaction_id ?? $transaction->razorpay_id ?? 'N/A' }} {{ ucfirst(str_replace('_', ' ', $transaction->type ?? 'payment')) }} {{ ucfirst(str_replace('_', ' ', $transaction->payment_method ?? $order->payment_method ?? 'N/A')) }} {{ ucfirst($transaction->status ?? 'N/A') }} {{ $currencySymbol }}{{ number_format((float) ($transaction->amount ?? 0), App\Models\AppSetting::currencyDecimals()) }} {{ optional($transaction->created_at)->format('d M Y, h:i A') }}
No transaction rows found for this order.
Payment Timeline
@forelse($order->paymentAttempts->sortByDesc('created_at') as $attempt) @if($attempt->collection_notes) @endif @empty @endforelse
Attempt Source Gateway Status Reference Collected By Amount Expires Created
#{{ $attempt->id }} {{ ucfirst(str_replace('_', ' ', $attempt->source)) }} {{ ucfirst($attempt->gateway) }} {{ ucfirst($attempt->status) }} {{ $attempt->transaction_id ?: ($attempt->payment_link_id ?: ($attempt->gateway_reference ?: 'N/A')) }} @if($attempt->payment_link) @endif {{ optional($attempt->driver ?? $attempt->creator)->name ?? 'Customer' }} {{ $currencySymbol }}{{ number_format((float) $attempt->amount, $currencyDecimals) }} {{ $attempt->expires_at ? $attempt->expires_at->format('d M Y, h:i A') : 'N/A' }} {{ optional($attempt->created_at)->format('d M Y, h:i A') }}
Notes: {{ $attempt->collection_notes }}
No payment attempts recorded for this order.
Refund Management
Payment Status: {!! $order->payment_status_badge !!}
Refund Status: {!! $order->refund_status_badge !!}
@if($order->refund_amount)
Refund Amount: {{ $currencySymbol }}{{ number_format($order->refund_amount, App\Models\AppSetting::currencyDecimals()) }}
@endif @if($order->refund_reason)
Refund Reason: {{ $order->refund_reason }}
@endif @if($order->payment_status === 'success' && $order->refund_status !== 'completed')
@csrf
Leave empty to refund the full order total.
@endif
Financial Breakdown
{{ $financials['source'] }}
Store Settlement
Food subtotal {{ $currencySymbol }}{{ number_format((float) $order->subtotal, $currencyDecimals) }}
Store commission ({{ $formatRule($financials['restaurant_commission_type'], $financials['restaurant_commission_value']) }}) -{{ $currencySymbol }}{{ number_format($financials['restaurant_commission'], $currencyDecimals) }}
GST on store commission-{{ $currencySymbol }}{{ number_format($financials['gst_on_commission'], $currencyDecimals) }}
Online payment gateway fee-{{ $currencySymbol }}{{ number_format($financials['payment_gateway_fee'], $currencyDecimals) }}
Net store earning {{ $currencySymbol }}{{ number_format($financials['restaurant_earning'], $currencyDecimals) }}
Driver Settlement
Delivery earning base{{ $currencySymbol }}{{ number_format($financials['driver_base'], $currencyDecimals) }}
Driver commission ({{ $formatRule($financials['driver_commission_type'], $financials['driver_commission_value']) }})-{{ $currencySymbol }}{{ number_format($financials['driver_commission'], $currencyDecimals) }}
Batch bonus+{{ $currencySymbol }}{{ number_format($financials['batch_bonus'], $currencyDecimals) }}
Net driver earning{{ $currencySymbol }}{{ number_format($financials['driver_earning'], $currencyDecimals) }}
Platform Allocation
Customer platform charge{{ $currencySymbol }}{{ number_format((float) $order->platform_fee, $currencyDecimals) }}
Branch commission{{ $currencySymbol }}{{ number_format($financials['branch_commission'], $currencyDecimals) }}
Admin earning{{ $currencySymbol }}{{ number_format($financials['admin_earning'], $currencyDecimals) }}
Restaurant payout: {{ $order->restaurant_payout_id ? '#' . $order->restaurant_payout_id : 'Pending' }} ยท Driver payout: {{ $order->driver_payout_id ? '#' . $order->driver_payout_id : 'Pending' }}
@endsection