@php // Get restaurant/branch name $restaurantName = 'Restaurant'; if ($order->restaurant && $order->restaurant->name) { $restaurantName = strtoupper($order->restaurant->name); } elseif ($order->branch && $order->branch->name) { $restaurantName = strtoupper($order->branch->name); } // Get phone $branchPhone = ''; if ($order->branch && $order->branch->phone) { $branchPhone = $order->branch->phone; } elseif ($order->restaurant && $order->restaurant->phone) { $branchPhone = $order->restaurant->phone; } @endphp
{{ $restaurantName }}
@if($branchPhone)
Tel: {{ $branchPhone }}
@endif
⚠️ ORDER UPDATE - CHANGES ONLY
Receipt #: {{ $order->order_number }}
Date: {{ $order->created_at ? \Carbon\Carbon::parse($order->created_at)->format('Y-m-d') : date('Y-m-d') }}
Time: {{ $order->created_at ? \Carbon\Carbon::parse($order->created_at)->format('H:i') : date('H:i') }}
@if($order->tables && $order->tables->count() > 0)
Table: @foreach($order->tables as $table) {{ $table->name }}@if($table->floor), {{ $table->floor->name }}@endif@if(!$loop->last), @endif @endforeach
@elseif($order->table)
Table: {{ $order->table->name }}@if($order->table->floor), {{ $order->table->floor->name }}@endif
@endif @if($order->order_type)
Type: {{ ucfirst(str_replace('_', ' ', $order->order_type)) }}
@endif @php // Extract order number (part after 2nd dash) $orderNumberParts = explode('-', $order->order_number ?? ''); $orderNumber = count($orderNumberParts) >= 3 ? end($orderNumberParts) : (strlen($order->order_number ?? '') >= 3 ? substr($order->order_number, -3) : 'N/A'); @endphp
Order #: {{ $orderNumber }}
@php // #region agent log $itemsCount = $items ? (is_countable($items) ? count($items) : $items->count()) : 0; $orderItemsCount = isset($order) && $order->items ? (is_countable($order->items) ? count($order->items) : $order->items->count()) : 0; file_put_contents('e:\laragon6\www\azan_pos_v2\.cursor\debug.log', json_encode(['sessionId'=>'debug-session','runId'=>'run1','hypothesisId'=>'B,D','location'=>'kot-update.blade.php:315','message'=>'View received items variable','data'=>['items_var_count'=>$itemsCount,'order_items_count'=>$orderItemsCount,'items_is_null'=>is_null($items),'items_is_empty'=>$itemsCount==0],'timestamp'=>time()*1000])."\n", FILE_APPEND); // #endregion @endphp @if($items && $items->count() > 0) @foreach($items as $index => $item) @php $changeType = $item->change_type ?? 'unknown'; $quantity = $item->quantity ?? 0; $isRemoved = $changeType === 'removed'; $isAdded = $changeType === 'added'; $isQuantityChanged = $changeType === 'quantity_changed'; $isIncreased = $isQuantityChanged && $quantity > 0; $isDecreased = $isQuantityChanged && $quantity < 0; @endphp @endforeach @else @endif
Item Qty Change
{{ $index + 1 }}- {{ $item->item_name ?? 'N/A' }}
@if($isRemoved)
[REMOVED]
@elseif($isAdded)
[NEW ADDED]
@elseif($isIncreased)
[INCREASED]
@elseif($isDecreased)
[DECREASED]
@endif @if($isQuantityChanged && isset($item->original_quantity) && isset($item->new_quantity))
({{ $item->original_quantity }} → {{ $item->new_quantity }})
@endif
@if($isRemoved) 0 @elseif($isAdded) {{ abs($quantity) }} @elseif($isQuantityChanged) @if($quantity > 0) +{{ abs($quantity) }} @else -{{ abs($quantity) }} @endif @else {{ $quantity }} @endif
No changes to display
This order has no pending changes.