@if($orderID && $orderType == 'dine_in') {{-- Show order type as read-only when order is already dine_in --}}
@lang('modules.order.orderType'): {{ Str::headline($orderTypes->firstWhere('type', 'dine_in')->order_type_name ?? 'Dine In') }}
@else {{-- Show order type radio buttons for new orders or non-dine-in orders --}}
@foreach ($orderTypes as $type) @endforeach
@endif @if($customerName || $customerMobile)
Customer:
@if($customerName)
{{ $customerName }}
@endif @if($customerMobile)
{{ $customerMobile }}
@endif
@endif @if($orderNote)
@lang('modules.order.orderNote'):

{{ $orderNote }}

@endif
@if(!isOrderPrefixEnabled()) @lang('modules.order.orderNumber') #{{ $orderNumber }} @else {{ $formattedOrderNumber }} @endif
@if ($orderType == 'dine_in')
@if (!is_null($tableNo)) {{ $tableNo }} @if (user_can('Update Order')) @endif @elseif(user_can('Update Order')) @lang('modules.order.setTable') @endif
@endif
@if ($orderType == 'dine_in')
@lang('modules.order.noOfPax')
@if (user_can('Update Order') && !auth()->user()->roles->pluck('display_name')->contains('Waiter'))
@foreach ($users as $item) @endforeach
@elseif($selectWaiter)
@lang('modules.order.waiter'): {{ optional($users->firstWhere('id', $selectWaiter))->name }}
@endif @elseif ($orderType == 'delivery' && user_can('Update Order'))
@foreach ($deliveryExecutives as $item) @endforeach
@elseif ($orderType == 'pickup')
@endif
@if ((is_object($orderStatus) ? $orderStatus->value : $orderStatus) === 'cancelled') @else
@php $statuses = match ($orderType) { 'delivery' => ['placed', 'confirmed', 'preparing', 'out_for_delivery', 'delivered'], 'pickup' => ['placed', 'confirmed', 'preparing', 'ready_for_pickup', 'delivered'], default => ['placed', 'confirmed', 'preparing', 'served'], }; $currentIndex = array_search((is_object($orderStatus) ? $orderStatus->value : $orderStatus), $statuses); $currentIndex = $currentIndex !== false ? $currentIndex : 0; $nextIndex = min($currentIndex + 1, count($statuses) - 1); @endphp

{{ __('modules.order.orderStatus') }}

@foreach ($statuses as $index => $status)
@switch($status) @case('placed') @break @case('confirmed') @break @case('preparing') @break @case('out_for_delivery') @case('ready_for_pickup') @break @case('delivered') @case('served') @break @endswitch
{{ __('modules.order.' . App\Enums\OrderStatus::from($status)->label()) }}
@endforeach
@if (user_can('Update Order'))
@if ((is_object($orderStatus) ? $orderStatus->value : $orderStatus) === 'placed') {{ __('modules.order.cancelOrder') }} @endif @if ($currentIndex < count($statuses) - 1) {{ __('modules.order.moveTo') }} {{ __('modules.order.' . App\Enums\OrderStatus::from($statuses[$nextIndex])->label()) }} @endif
@endif
@lang('modules.order.foodStatusLabel'): $orderDetail->food_status === 'pending_confirmation', 'bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400' => $orderDetail->food_status === 'in_kitchen', 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400' => $orderDetail->food_status === 'food_ready', 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400' => $orderDetail->food_status === 'served', 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400' => $orderDetail->food_status === 'cancelled', 'bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-400' => in_array($orderDetail->food_status, ['no_kot', 'unknown']) ])> {{ $orderDetail->food_status_text }}
@lang('modules.order.orderStatus'): @php // Map order status to order_status enum for display $statusForDisplay = match($orderDetail->status) { 'draft', 'kot' => $orderDetail->order_status ?? 'placed', 'billed', 'payment_due' => $orderDetail->order_status ?? 'confirmed', 'paid', 'ready' => $orderDetail->order_status ?? 'served', 'canceled' => 'cancelled', default => $orderDetail->order_status ?? $orderDetail->status }; @endphp
@endif @php // Collect all order_item_ids that belong to any KOT $allKotOrderItemIds = []; foreach ($kotList as $kot) { $kotOrderItemIds = $kot->items->pluck('order_item_id')->filter()->toArray(); $allKotOrderItemIds = array_merge($allKotOrderItemIds, $kotOrderItemIds); } $allKotOrderItemIds = array_unique($allKotOrderItemIds); @endphp @foreach ($kotList as $kot) @php // Get order_item_ids that belong to this KOT via kot_items relationship $kotOrderItemIds = $kot->items->pluck('order_item_id')->filter()->toArray(); // Get kitchen place name $kitchenPlaceName = $kot->kotPlace ? $kot->kotPlace->name : 'Default Kitchen'; @endphp
@lang('menu.kot') #{{ $kot->kot_number }} - {{ $kitchenPlaceName }}
{{ $kot->created_at->timezone(timezone())->translatedFormat('d F, h:i A') }}
@if (user_can('Delete Order')) @endif @forelse ($orderItemList as $key => $item) @php // Extract order_item_id from key format: "order_item_{id}" $orderItemId = null; if (preg_match('/order_item_(\d+)/', $key, $matches)) { $orderItemId = (int)$matches[1]; } // Only show items that belong to this KOT via order_item_id $belongsToKot = $orderItemId && in_array($orderItemId, $kotOrderItemIds); // Find the KOT item for this order item in this KOT $kotItem = $belongsToKot ? $kot->items->firstWhere('order_item_id', $orderItemId) : null; // Use KOT item quantity if available, otherwise fall back to order item quantity $displayQty = $kotItem ? $kotItem->quantity : ($orderItemQty[$key] ?? 1); @endphp @continue(!$belongsToKot) @php $itemName = $item->item_name; $itemVariation = (isset($orderItemVariation[$key]) ? $orderItemVariation[$key]->variation : ''); // Get menu item object $menuItemObj = isset($orderItemVariation[$key]) && $orderItemVariation[$key] ? $orderItemVariation[$key]->menuItem : (isset($orderItemList[$key]) ? $orderItemList[$key] : null); // Get original base price (before promotion and modifiers) $originalBasePrice = isset($orderItemVariation[$key]) && $orderItemVariation[$key] ? $orderItemVariation[$key]->price : ($menuItemObj ? $menuItemObj->price : 0); // Get promotional price (applies promotion if available) - pass branch ID for correct promotion lookup $promotionalBasePrice = $menuItemObj ? $menuItemObj->getPromotionalPrice($originalBasePrice, branch()?->id) : $originalBasePrice; // Add modifier prices $modifierPrice = $this->orderItemModifiersPrice[$key] ?? 0; // Final display price (with promotion and modifiers) - use the method for consistency $displayPrice = $this->getItemDisplayPrice($key); // Check if there's a discount (promotional base price differs from original base price) $hasDiscount = $menuItemObj && abs($promotionalBasePrice - $originalBasePrice) > 0.01; // Calculate original total price for strikethrough (original base + modifiers) $originalTotalPrice = $originalBasePrice + $modifierPrice; // Total amount per line - calculate based on KOT item quantity $totalAmount = $displayPrice * $displayQty; @endphp @if (user_can('Delete Order')) @endif @empty @endforelse
@lang('modules.menu.itemName') @lang('modules.order.qty') @lang('modules.order.price') @lang('modules.order.amount') @lang('app.action')
{{ $itemName }}
{{ $itemVariation }}
@if (!empty($itemModifiersSelected[$key]))
@foreach ($itemModifiersSelected[$key] as $modifierOptionId)
{{ $this->modifierOptions[$modifierOptionId]->name }} {{ currency_format($this->modifierOptions[$modifierOptionId]->price , restaurant()->currency_id) }}
@endforeach
@endif @if($hasDiscount && $menuItemObj) @php $promotion = $menuItemObj->getActivePromotion(branch()?->id); $discountPercent = $promotion && $promotion->discount_type === 'percent' ? number_format($promotion->discount_value, 0) : 0; @endphp
@if($discountPercent > 0) {{ $discountPercent }}% OFF @else @lang('app.discount') @endif
@endif
@if($hasDiscount)
{{ currency_format($originalTotalPrice, restaurant()->currency_id) }} {{ currency_format($displayPrice, restaurant()->currency_id) }}
@else {{ currency_format($displayPrice, restaurant()->currency_id) }} @endif
{{ currency_format($totalAmount, restaurant()->currency_id) }}
@lang('messages.noItemAdded')
@endforeach {{-- Display items that are not part of any KOT (new orders before KOT creation) --}} @php $hasNonKotItems = false; foreach ($orderItemList as $key => $item) { // Extract order_item_id from key format: "order_item_{id}" $orderItemId = null; if (preg_match('/order_item_(\d+)/', $key, $matches)) { $orderItemId = (int)$matches[1]; } // Check if this order item belongs to any KOT if ($orderItemId && !in_array($orderItemId, $allKotOrderItemIds)) { $hasNonKotItems = true; break; } } @endphp @if($hasNonKotItems)
@if (user_can('Delete Order')) @endif @forelse ($orderItemList as $key => $item) @php // Extract order_item_id from key format: "order_item_{id}" $orderItemId = null; if (preg_match('/order_item_(\d+)/', $key, $matches)) { $orderItemId = (int)$matches[1]; } // Skip items that are part of any KOT $belongsToAnyKot = $orderItemId && in_array($orderItemId, $allKotOrderItemIds); @endphp @if($belongsToAnyKot) @continue @endif @php $itemName = $item->item_name; $itemVariation = (isset($orderItemVariation[$key]) ? $orderItemVariation[$key]->variation : ''); // Get menu item object $menuItemObj = isset($orderItemVariation[$key]) && $orderItemVariation[$key] ? $orderItemVariation[$key]->menuItem : (isset($orderItemList[$key]) ? $orderItemList[$key] : null); // Get original base price (before promotion and modifiers) $originalBasePrice = isset($orderItemVariation[$key]) && $orderItemVariation[$key] ? $orderItemVariation[$key]->price : ($menuItemObj ? $menuItemObj->price : 0); // Get promotional price (applies promotion if available) - pass branch ID for correct promotion lookup $promotionalBasePrice = $menuItemObj ? $menuItemObj->getPromotionalPrice($originalBasePrice, branch()?->id) : $originalBasePrice; // Add modifier prices $modifierPrice = $this->orderItemModifiersPrice[$key] ?? 0; // Final display price (with promotion and modifiers) - use the method for consistency $displayPrice = $this->getItemDisplayPrice($key); // Check if there's a discount (promotional base price differs from original base price) $hasDiscount = $menuItemObj && abs($promotionalBasePrice - $originalBasePrice) > 0.01; // Calculate original total price for strikethrough (original base + modifiers) $originalTotalPrice = $originalBasePrice + $modifierPrice; // Total amount per line (what customer pays) $totalAmount = $orderItemAmount[$key]; @endphp @if (user_can('Delete Order')) @endif @empty @endforelse
@lang('modules.menu.itemName') @lang('modules.order.qty') @lang('modules.order.price') @lang('modules.order.amount') @lang('app.action')
{{ $itemName }}
{{ $itemVariation }}
@if (!empty($itemModifiersSelected[$key]))
@foreach ($itemModifiersSelected[$key] as $modifierOptionId)
{{ $this->modifierOptions[$modifierOptionId]->name }} {{ currency_format($this->modifierOptions[$modifierOptionId]->price , restaurant()->currency_id) }}
@endforeach
@endif @if($hasDiscount && $menuItemObj) @php $promotion = $menuItemObj->getActivePromotion(branch()?->id); $discountPercent = $promotion && $promotion->discount_type === 'percent' ? number_format($promotion->discount_value, 0) : 0; @endphp
@if($discountPercent > 0) {{ $discountPercent }}% OFF @else @lang('app.discount') @endif
@endif
@if($hasDiscount)
{{ currency_format($originalTotalPrice, restaurant()->currency_id) }} {{ currency_format($displayPrice, restaurant()->currency_id) }}
@else {{ currency_format($displayPrice, restaurant()->currency_id) }} @endif
{{ currency_format($totalAmount, restaurant()->currency_id) }}
@lang('messages.noItemAdded')
@endif
@if (count($orderItemList) > 0 && user_can('Update Order'))
@lang('modules.order.addDiscount')
@endif
@lang('modules.order.totalItem')
{{ array_sum(array_filter($orderItemQty ?? [])) }}
@lang('modules.order.subTotal')
{{ currency_format($subTotal, restaurant()->currency_id) }}
@if ($discountAmount)
@lang('modules.order.discount') @if ($discountType == 'percent') ({{ $discountValue }}%) @endif
-{{ currency_format($discountAmount, restaurant()->currency_id) }}
@endif @foreach ($extraCharges as $charge)
{{ $charge->charge_name }} @if ($charge->charge_type == 'percent') ({{ $charge->charge_value }}%) @endif @if (user_can('Update Order')) @endif
{{ currency_format($charge->getAmount($subTotal - ($discountAmount ?? 0)), restaurant()->currency_id) }}
@endforeach @if ($tipAmount > 0)
@lang('modules.order.tip')
{{ currency_format($tipAmount, restaurant()->currency_id) }}
@endif @if ($orderType === 'delivery' && !is_null($deliveryFee))
@lang('modules.delivery.deliveryFee')
@if ($deliveryFee > 0) {{ currency_format($deliveryFee, restaurant()->currency_id) }} @else @lang('modules.delivery.freeDelivery') @endif
@endif @if ($taxMode == 'order') @foreach ($taxes as $item)
{{ $item->tax_name }} ({{ $item->tax_percent }}%)
{{ currency_format(($item->tax_percent / 100) * ($subTotal - ($discountAmount ?? 0)), restaurant()->currency_id) }}
@endforeach @else @php // Show item-wise tax breakdown above total tax $taxTotals = []; foreach ($orderItemTaxDetails as $item) { $qty = $item['qty'] ?? 1; if (!empty($item['tax_breakup'])) { foreach ($item['tax_breakup'] as $taxName => $taxInfo) { if (!isset($taxTotals[$taxName])) { $taxTotals[$taxName] = [ 'percent' => $taxInfo['percent'], 'amount' => 0 ]; } $taxTotals[$taxName]['amount'] += $taxInfo['amount'] * $qty; } } } @endphp @foreach ($taxTotals as $taxName => $taxInfo)
{{ $taxName }} ({{ $taxInfo['percent'] }}%)
{{ currency_format($taxInfo['amount'], restaurant()->currency_id) }}
@endforeach
@lang('modules.order.totalTax')
{{ currency_format($totalTaxAmount, restaurant()->currency_id) }}
@endif
@lang('modules.order.total')
{{ currency_format($total, restaurant()->currency_id) }}
@if (user_can('Update Order')) @php $currentOrder = $orderDetail; $validationMessage = $this->getButtonValidationMessage($currentOrder); @endphp @if ($this->isNewOrder()) {{-- New Order Buttons --}}
@if ($this->isQSRModeEnabled()) {{-- QSR Mode: Show only Bill & Payment button --}}

Quick Service Mode: Direct bill and payment

@else {{-- Standard Mode: Show Send to Kitchen, Bill, Bill & Payment --}}
@if ($this->shouldShowSendToKitchen()) @endif @if ($this->shouldShowBill()) @endif @if ($this->shouldShowBillAndPayment()) @endif
@endif
@elseif ($currentOrder) {{-- Existing Order Buttons --}} @if ($currentOrder->status == 'kot')
@if ($this->shouldShowBill()) @endif @if ($this->shouldShowBillAndPayment()) @endif @if ($this->shouldShowNewKot() && in_array('KOT', restaurant_modules())) New KOT @endif @if (user_can('Delete Order')) @endif
@elseif (in_array($currentOrder->status, ['billed', 'payment_due'])) {{-- Billed Order Actions --}}
@if ($validationMessage)

{{ $validationMessage }}

@endif

@lang('modules.order.billedOrderActions')

@lang('modules.order.billedOrderDescription')

@if ($this->shouldShowAddPayment())
@if ($validationMessage)
{{ $validationMessage }}
@else
@lang('modules.order.addPaymentDescription')
@endif
@endif {{-- New KOT button should remain visible even after payment --}} @if ($this->shouldShowNewKot() && in_array('KOT', restaurant_modules())) New KOT @endif
@endif @endif @endif @if ($orderType == 'delivery' && $orderDetail->delivery_address)
@if ($orderDetail->customer)
{{ $orderDetail->customer->name }}
@endif
@lang('modules.customer.address')
@if ($orderDetail->customer_lat && $orderDetail->customer_lng && branch()->lat && branch()->lng) @lang('modules.order.viewOnMap') @endif
{!! nl2br(e($orderDetail->delivery_address)) !!}
@endif

@lang('modules.order.cancelOrder')

This action cannot be undone

@lang('modules.order.cancelOrderMessage')

Please select a reason for cancellation

@foreach ($cancelReasons as $reason) @endforeach
{{ __('app.cancel') }} @lang('modules.order.cancelOrder')
@lang('modules.order.deleteOrder')? @lang('modules.order.deleteOrderMessage') {{ __('app.cancel') }} @lang('modules.order.deleteOrder')