@if ($order)

{{ $order->show_formatted_order_number }}
@php $tokenNumber = $order->kot->whereNotNull('token_number')->first()?->token_number; @endphp @if ($tokenNumber)
@lang('modules.order.tokenNumber') {{ $tokenNumber }}
@endif
@if ($order->order_type == 'pickup') @elseif($order->order_type == 'delivery') @else @endif {{ Str::title($order->orderType?->order_type_name ?? $order->custom_order_type_name ?? $order->order_type) }}
@if($order->order_type == 'pickup')
@lang('modules.order.pickupDate') {{ \Carbon\Carbon::parse($order->pickup_date)->format(dateFormat() . ' ' . timeFormat()) }}
@else
{{ $order->date_time->timezone(timezone())->format(dateFormat() . ' ' . timeFormat()) }}
@endif

@if ($order->order_type == 'dine_in') @if (!is_null($order->table))
!user_can('Update Order'), ])>

{{ $order->table->table_code ?? '--' }}

@if(user_can('Update Order')) @endif
@elseif(user_can('Update Order')) @lang('modules.order.setTable') @endif @endif
@if ($order->customer_id)
{{ $order->customer ? ($order->customer->name ? $order->customer->name : __('modules.customer.walkin')) : '--' }}
@if(user_can('Update Order')) @endif
@elseif(user_can('Update Order')) + @lang('modules.order.addCustomerDetails') @endif
{{ $order->date_time->timezone(timezone())->format(dateFormat() . ' ' . timeFormat()) }}
@if ($order->order_type == 'delivery')
@if ($order->deliveryPlatform)
@if ($order->deliveryPlatform->logo_url) {{ $order->deliveryPlatform->name }} @endif {{ $order->deliveryPlatform->name }}
@endif @if ($order->deliveryExecutive)
@lang('modules.order.deliveryExecutive')
{{ $order->deliveryExecutive->name }}
@else @foreach ($deliveryExecutives as $deliveryExecutive) @endforeach @endif
@endif @if(!user()->hasRole('Waiter_' . user()->restaurant_id))
@if (user_can('Update Order'))
@foreach ($users as $item) @endforeach
@elseif($selectWaiter)
@lang('modules.order.waiter'): {{ optional($users->firstWhere('id', $selectWaiter))->name ?? __('modules.order.selectWaiter') }}
@endif
@endif
$order->status == 'draft', 'bg-yellow-100 text-yellow-800 dark:bg-yellow-700 dark:text-yellow-400 border border-yellow-400' => $order->status == 'kot', 'bg-blue-100 text-blue-800 dark:bg-gray-700 dark:text-blue-400 border border-blue-400' => $order->status == 'billed' || $order->status == 'out_for_delivery', 'bg-green-100 text-green-800 dark:bg-gray-700 dark:text-green-400 border border-green-400' => $order->status == 'paid' || $order->status == 'delivered', 'bg-red-100 text-red-800 dark:bg-gray-700 dark:text-red-400 border border-red-400' => $order->status == 'canceled' || $order->status == 'payment_due', 'bg-orange-100 text-orange-800 dark:bg-gray-700 dark:text-orange-400 border border-orange-400' => $order->status == 'pending_verification', ])> @lang('modules.order.' . $order->status) @if($order->placed_via) $order->placed_via === 'pos', 'bg-emerald-100 text-emerald-800 dark:bg-emerald-700 dark:text-emerald-400 border border-emerald-400' => $order->placed_via === 'shop', 'bg-amber-100 text-amber-800 dark:bg-amber-700 dark:text-amber-400 border border-amber-400' => $order->placed_via === 'kiosk', ])> @if($order->placed_via === 'pos') @elseif($order->placed_via === 'shop') @elseif($order->placed_via === 'kiosk') @endif {{ __('app.via_' . $order->placed_via) }} {{ module_enabled('Kiosk') && class_exists(\Modules\Kiosk\Entities\Kiosk::class) && ($order->kiosk) ? ' : ' . $order->kiosk->code : '' }} @endif
@if ($orderProgressStatus === 'cancelled')

@lang('modules.order.info_cancelled')

@if ($order->cancelReason || $order->cancel_reason_text)
@if ($order->cancelReason)
@lang('modules.settings.kotCancelReasons'): {{ $order->cancelReason->reason }}
@endif @if ($order->cancel_reason_text)
@lang('modules.settings.enterCancelReason'):
{{ $order->cancel_reason_text }}
@endif
@endif
@else
@php $statuses = match ($order->order_type) { 'delivery' => ['placed', 'confirmed', 'preparing', 'food_ready','picked_up', 'out_for_delivery', 'reached_destination', 'delivered'], 'pickup' => ['placed', 'confirmed', 'preparing', 'ready_for_pickup', 'delivered'], default => ['placed', 'confirmed', 'preparing', 'food_ready', 'served'], }; $currentIndex = array_search($orderProgressStatus, $statuses); $currentIndex = $currentIndex !== false ? $currentIndex : 0; $nextIndex = min($currentIndex + 1, count($statuses) - 1); @endphp

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

$orderProgressStatus === 'delivered' || $orderProgressStatus === 'served' || $orderProgressStatus === 'food_ready', 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300 border border-gray-400' => $orderProgressStatus === 'placed', 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300 border border-blue-400' => $orderProgressStatus !== 'delivered' && $orderProgressStatus !== 'served' && $orderProgressStatus !== 'placed', ])> {{ App\Enums\OrderStatus::from($orderProgressStatus)->translatedLabel() }}
@foreach ($statuses as $index => $status)
{!! App\Enums\OrderStatus::from($status)->icon() !!}
@endforeach
@if(user_can('Update Order'))
@if($orderProgressStatus === 'placed') {{ __('modules.order.cancelOrder') }} @endif @if($currentIndex < count($statuses) - 1) {{ __('modules.order.moveTo') }} {{ App\Enums\OrderStatus::from($statuses[$nextIndex])->translatedLabel() }} @endif
@endif
@endif @if ($showKotAlert)
@lang('modules.order.kotNotCreated')

@lang('modules.order.kotNotCreatedMessage')

@lang('modules.order.createKot')
@endif @endif
@if ($order)
@if (!in_array($order->status, ['paid', 'payment_due', 'canceled']) && user_can('Delete Order')) @endif @forelse ($order->items as $key => $item) @php $orderTypeId = $order->order_type_id; $selectedDeliveryApp = $order?->delivery_app_id; if ($orderTypeId) { $item->menuItem->setPriceContext($orderTypeId, $selectedDeliveryApp); if ($item->menuItemVariation) { $item->menuItemVariation->setPriceContext($orderTypeId, $selectedDeliveryApp); } foreach ($item->modifierOptions as $modifier) { $modifier->setPriceContext($orderTypeId, $selectedDeliveryApp); } } // Get prices with context applied $baseItemPrice = $item->menuItemVariation ? $item->menuItemVariation->price : $item->menuItem->price; $modifierTotal = $item->modifierOptions->sum('pivot.modifier_option_price'); $displayPrice = $baseItemPrice + $modifierTotal; @endphp @if (!in_array($order->status, ['paid', 'payment_due', 'canceled']) && user_can('Delete Order')) @endif @empty @endforelse
@lang('modules.menu.itemName') @lang('modules.order.qty') @lang('modules.order.amount') @lang('app.action')
{{ $item->menuItem ? $item->menuItem->item_name : '--' }}
{{ isset($item->menuItemVariation) ? $item->menuItemVariation->variation : '' }}
@if ($item->modifierOptions->isNotEmpty())
@foreach ($item->modifierOptions as $modifier)
{{ $modifier->name ?? $modifier->pivot->modifier_option_name }} {{ currency_format($modifier->pivot->modifier_option_price ?? $modifier->price , $currencyId) }}
@endforeach
@endif
{{ $item->quantity }} {{ currency_format($item->amount, $currencyId) }}
@lang('messages.noItemAdded')
@lang('modules.order.totalItem')
{{ count($order->items) }}
@lang('modules.order.subTotal') @php $stampDiscountAmount = (float)($order->stamp_discount_amount ?? 0); $hasFreeStampItems = $order->items()->where('is_free_item_from_stamp', true)->exists(); @endphp @if($stampDiscountAmount > 0 || $hasFreeStampItems) @lang('app.stampDiscount') @if($stampDiscountAmount > 0) (-{{ currency_format($stampDiscountAmount, $currencyId ?? restaurant()->currency_id) }}) @elseif($hasFreeStampItems) (@lang('app.freeItem')) @endif @endif
{{ currency_format($order->sub_total, $currencyId) }}
@if ($order->loyalty_points_redeemed > 0 && $order->loyalty_discount_amount > 0)
@lang('app.loyaltyDiscount') ({{ number_format($order->loyalty_points_redeemed) }} @lang('app.points'))
-{{ currency_format($order->loyalty_discount_amount, $currencyId ?? restaurant()->currency_id) }}
@endif @if (!is_null($order->discount_amount) && $order->loyalty_points_redeemed == 0)
@lang('modules.order.discount') @if ($order->discount_type == 'percent') ({{ rtrim(rtrim(number_format($order->discount_value, 2), '0'), '.') }}%) @endif
-{{ currency_format($order->discount_amount, $currencyId) }}
@endif @php // Calculate net for charges $net = $order->sub_total - ($order->discount_amount ?? 0); @endphp @foreach ($order->charges as $item)
{{ $item->charge->charge_name }} @if ($item->charge->charge_type == 'percent') ({{ $item->charge->charge_value }}%) @endif @if (!in_array($order->status, ['paid', 'payment_due', 'canceled'])) @endif
@php // Calculate discounted subtotal for charges (after both regular and loyalty discounts) $chargeBase = $order->sub_total - ($order->discount_amount ?? 0) - ($order->loyalty_discount_amount ?? 0); @endphp {{ currency_format($item->charge->getAmount($chargeBase), $currencyId) }}
@endforeach @if ($order->tip_amount > 0)
@lang('modules.order.tip')
{{ currency_format($order->tip_amount, $currencyId) }}
@endif @if ($order->order_type === 'delivery' && !is_null($order->delivery_fee))
@lang('modules.delivery.deliveryFee')
@if($order->delivery_fee > 0) {{ currency_format($order->delivery_fee, $currencyId) }} @else @lang('modules.delivery.freeDelivery') @endif
@endif @if ($taxMode == 'order') @php // Calculate net for display $net = $order->sub_total - ($order->discount_amount ?? 0); // Use saved tax_base from database $taxBase = $order->tax_base ?? ($net + $order->charges->sum(fn($charge) => $charge->charge->getAmount($net))); @endphp @foreach ($order->taxes as $item) @if($item->tax)
{{ $item->tax->tax_name }} ({{ $item->tax->tax_percent }}%)
@php // Step 1: Calculate discounted subtotal (after both regular and loyalty discounts) // Loyalty points are always removed from subtotal before calculating tax $discountedSubtotal = $order->sub_total - ($order->discount_amount ?? 0) - ($order->loyalty_discount_amount ?? 0); // Step 2: Calculate service charges on discounted subtotal $serviceTotal = 0; if ($order->charges && $order->charges->count() > 0) { foreach ($order->charges as $chargeRelation) { $charge = $chargeRelation->charge; if ($charge) { $chargeAmount = $charge->getAmount((float)$discountedSubtotal); $serviceTotal += (float)$chargeAmount; } } } // Step 3: Calculate tax_base based on Tax Calculation Base setting // Check if service charges should be included in tax base $restaurant = restaurant(); $includeChargesInTaxBase = false; if ($restaurant && isset($restaurant->include_charges_in_tax_base)) { $includeChargesInTaxBase = (bool)$restaurant->include_charges_in_tax_base; } // Tax base = (subtotal - discounts) + service charges (if enabled) $taxBase = $includeChargesInTaxBase ? ($discountedSubtotal + $serviceTotal) : $discountedSubtotal; $taxBase = max(0, (float)$taxBase); // Step 4: Calculate tax on tax_base $taxAmount = ($item->tax->tax_percent / 100) * $taxBase; @endphp {{ currency_format($taxAmount, restaurant()->currency_id) }}
@endif @endforeach @else @if($order->total_tax_amount > 0) @php $taxTotals = []; $totalTax = 0; foreach ($order->items as $item) { $qty = $item->quantity ?? 1; $taxBreakdown = is_array($item->tax_breakup) ? $item->tax_breakup : (json_decode($item->tax_breakup, true) ?? []); foreach ($taxBreakdown as $taxName => $taxInfo) { if (!isset($taxTotals[$taxName])) { $taxTotals[$taxName] = [ 'percent' => $taxInfo['percent'] ?? 0, 'amount' => ($taxInfo['amount'] ?? 0) * $qty ]; } else { $taxTotals[$taxName]['amount'] += ($taxInfo['amount'] ?? 0) * $qty; } } $totalTax += $item->tax_amount ?? 0; } @endphp @foreach ($taxTotals as $taxName => $taxInfo)
{{ $taxName }} ({{ $taxInfo['percent'] }}%) {{ currency_format($taxInfo['amount'], $currencyId) }}
@endforeach
@lang('modules.order.totalTax')
{{ currency_format($totalTax, $currencyId) }}
@endif @endif
@lang('modules.order.total')
{{ currency_format($order->total, $currencyId) }}
@lang('modules.order.balanceReturn')
@php $totalBalance = $order->payments->sum('balance'); @endphp {{ currency_format($totalBalance > 0 ? $totalBalance : 0, $currencyId) }}
@if ($order->status == 'kot' && !is_null($order->table_id)) @endif @if (($order->status == 'billed' || $order->status == 'payment_due') && user_can('Update Order')) @endif
@lang('app.print') @if (in_array($order->status, ['billed', 'payment_due', 'paid']) && user_can('Update Order')) @endif @if (!in_array($order->status, ['paid', 'payment_due', 'canceled']) && user()->hasRole('Admin_'. user()->restaurant_id)) @endif
@if ($order->payments->count())
@foreach ($order->payments as $key => $item) @endforeach
@lang('modules.order.amount') @lang('modules.order.paymentMethod') @lang('app.dateTime')
{{ currency_format($item->amount, $currencyId) }}
@if($order->status !== 'pending_verification' && user_can('Update Order'))
{{ ucwords(str_replace('_', ' ', $item->payment_method)) }}
@else
$item->payment_method == 'due', 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-400 border border-gray-400' => $item->payment_method != 'due', ])> @php $icons = [ 'cash' => '', 'upi' => '', 'card' => '' ]; @endphp {!! $icons[$item->payment_method] ?? '' !!} {{ ucwords(str_replace('_', ' ', $item->payment_method)) }}
@endif
@if ($item->payment_method == 'due' && user_can('Update Order')) @lang('modules.order.addPayment') @elseif ($order->status == 'pending_verification' && user_can('Update Order')) @lang('modules.order.confirmPayment') @lang('modules.order.reportUnpaid') @else {{ $item->created_at->timezone(timezone())->translatedFormat(dateFormat() . ' ' . timeFormat()) }} @endif
@endif @if ($order->order_type == 'delivery' && $order->delivery_address)
@lang('modules.customer.address')
@if($order->customer_lat && $order->customer_lng && branch()->lat && branch()->lng) @lang('modules.order.viewOnMap') @endif
{!! nl2br(e($order->delivery_address)) !!}
@endif @endif
{{ __('app.close') }}
@if ($order) @lang('modules.table.availableTables') @livewire('pos.setTable')

@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')

@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.deleteOrderItem')? @lang('modules.order.deleteOrderItemMessage') {{ __('app.cancel') }} @if ($itemToDelete) {{ __('Delete') }} @endif
@lang('modules.order.changeTable')

@lang('modules.order.confirmTableChange')

@lang('modules.order.currentTable'): {{ $order->table->table_code ?? '--' }}

@if($pendingTable)

@lang('modules.order.changeTo'): {{ $pendingTable->table_code }}

@endif

@lang('modules.order.tableChangeMessage')

@lang('modules.order.tableChangeWarning')

@lang('app.cancel') @lang('modules.order.changeTable')
@endif @script @endscript