@forelse($orders as $order)
@php
$simpleStatus = match($order->status) {
'accepted','preparing','ready' => 'accepted',
'served','completed' => 'completed',
default => $order->status,
};
$isDelivery = in_array($order->order_type, ['delivery','home_delivery']);
$isTakeaway = $order->order_type === 'takeaway';
if ($order->table) {
$locName = $order->table->table_name; $locType = 'Dine In';
$sourceLabel = $order->table->table_name; $sourceClass = 'table';
} elseif ($isDelivery) {
$locName = 'Home Delivery'; $locType = 'Delivery';
$sourceLabel = 'Home Delivery'; $sourceClass = 'delivery';
} else {
$locName = 'Take Away'; $locType = 'Take Away';
$sourceLabel = 'Take Away'; $sourceClass = 'takeaway';
}
$statusLabels = [
'pending' => 'Pending',
'accepted' => 'Accepted',
'completed' => 'Completed',
'rejected' => 'Rejected',
'cancelled' => 'Cancelled',
];
@endphp
{{ $statusLabels[$simpleStatus] ?? ucfirst($simpleStatus) }}
{{-- Location --}}
{{-- Special instruction --}}
@if($order->special_instruction)
{{-- Action footer --}}
@empty
@endforelse
{{-- Phone filter empty fallback --}}
{{ $sourceLabel }}
{{-- Header: order # | status badge --}}
{{ $order->order_number }}
{{ $order->created_at->format('h:i A') }} · {{ $order->created_at->diffForHumans(null, true) }} ago
{{ $locName }}
{{ $locType }}
{{-- Delivery address --}}
@if($isDelivery && $order->delivery_address)
{{ Str::limit($order->delivery_address, 65) }}
@endif
{{-- Customer phone + name --}}
@if($order->customer_phone)
{{ $order->customer_phone }}
@if($order->customer_name)
· {{ $order->customer_name }}
@endif
@endif
{{-- Items --}}
{{ $order->items->count() }} Item{{ $order->items->count() !== 1 ? 's' : '' }}
@forelse($order->items->take(3) as $item)
{{ $item->quantity }}×{{ $item->item_name }}
₹{{ number_format($item->total_price) }}
@empty
No items recorded
@endforelse
@if($order->items->count() > 3)
+{{ $order->items->count() - 3 }} more
@endif
Note: {{ $order->special_instruction }}
@endif
{{-- Rejection reason --}}
@if($order->status === 'rejected' && $order->rejection_reason)
Rejected: {{ $order->rejection_reason }}
@endif
{{-- Total --}}
₹{{ number_format($order->total_amount) }}
{{ ucwords(str_replace('_',' ',$order->order_type)) }}
@if($order->status === 'pending')
@elseif(in_array($order->status, ['accepted','preparing','ready']))
View
@elseif(in_array($simpleStatus, ['rejected','cancelled']))
{{-- Rejected / Cancelled: View + Delete --}}
View
@else
View Details
@endif
{{ request()->anyFilled(['status','table_id','phone']) ? 'No orders match these filters' : 'All caught up!' }}
{{ request()->anyFilled(['status','table_id','phone']) ? 'Try adjusting the filters above.' : 'New orders will appear here automatically.' }}
@if(request()->anyFilled(['status','table_id','phone']))
✕ Clear Filters
@endif
📵
No orders match that phone number
Try a different number.