@lang('modules.delivery.orderDetails')

← @lang('app.goBack')

{{ $order->show_formatted_order_number }}

{{ $order->date_time->timezone($restaurant->timezone)->format($dateFormat . ' ' . $timeFormat) }}
@lang('app.status'): {{ $order->order_status->translatedLabel() }}
{{ currency_format($order->total, $restaurant->currency_id) }}
!$this->isHistoryContext, ])>

@lang('modules.restaurant.restaurantDetails')

{{ $restaurant->name ?? '--' }}

@lang('modules.restaurant.phone'): {{ $restaurant->phone_code ? '+' . $restaurant->phone_code . ' ' : '' }}{{ $restaurant->phone_number ?? $restaurant->phone_number ?? '--' }}

@lang('modules.settings.branchName'): {{ $order->branch?->name ?? '--' }}

{{ $order->branch?->address ?? '--' }}

@lang('modules.delivery.openNavigation')
@if (!$this->isHistoryContext)

@lang('modules.customer.customerDetails')

{{ $order->customer?->name ?? '--' }}

@lang('modules.restaurant.phone'): {{ $order->customer?->phone_code ? '+' . $order->customer?->phone_code . ' ' : '' }}{{ $order->customer?->phone_number ?? $order->customer?->phone ?? '--' }}

{{ $order->customer?->latestDeliveryAddress?->address ?? $order->delivery_address ?? $order->customer?->delivery_address ?? '--' }}

@lang('modules.delivery.openNavigation')
@endif

@lang('modules.delivery.items')

    @foreach ($order->items as $item)
  • {{ $item->menuItem?->item_name ?? __('modules.menu.item') }} x {{ $item->quantity }} {{ currency_format($item->amount, $restaurant->currency_id) }}
  • @endforeach
@php $displayLoyaltyPointsRedeemed = (float) ($order->loyalty_points_redeemed ?? 0); $displayLoyaltyDiscountAmount = (float) ($order->loyalty_discount_amount ?? 0); $displayStampDiscountAmount = (float) ($order->stamp_discount_amount ?? 0); $hasFreeStampItems = $order->items()->where('is_free_item_from_stamp', true)->exists(); $chargeBase = (float) ($order->sub_total ?? 0) - (float) ($order->discount_amount ?? 0) - $displayLoyaltyDiscountAmount - $displayStampDiscountAmount; $chargeBase = max($chargeBase, 0); $taxBase = $order->tax_base ?? ($chargeBase + $order->charges->sum(fn($item) => $item->charge?->getAmount($chargeBase) ?? 0)); @endphp
@lang('modules.order.subTotal') {{ currency_format($order->sub_total, $restaurant->currency_id) }}
@if ($order->discount_amount && $order->discount_amount > 0)
@lang('modules.order.discount') -{{ currency_format($order->discount_amount, $restaurant->currency_id) }}
@endif @if(module_enabled('Loyalty') && $displayLoyaltyPointsRedeemed > 0 && $displayLoyaltyDiscountAmount > 0)
@lang('app.loyaltyDiscount') ({{ number_format($displayLoyaltyPointsRedeemed, 0) }} @lang('app.points')) -{{ currency_format($displayLoyaltyDiscountAmount, $restaurant->currency_id) }}
@endif @if(module_enabled('Loyalty') && ($displayStampDiscountAmount > 0 || $hasFreeStampItems))
@lang('app.stampDiscount') @if($hasFreeStampItems) (@lang('app.freeItem')) @endif @if($displayStampDiscountAmount > 0) -{{ currency_format($displayStampDiscountAmount, $restaurant->currency_id) }} @else -- @endif
@endif @foreach ($order->charges as $item)
{{ $item->charge->charge_name }} @if ($item->charge->charge_type === 'percent') ({{ $item->charge->charge_value }}%) @endif {{ currency_format($item->charge->getAmount($chargeBase), $restaurant->currency_id) }}
@endforeach @foreach ($order->taxes as $item)
{{ $item->tax->tax_name }} ({{ $item->tax->tax_percent }}%) {{ currency_format(($item->tax->tax_percent / 100) * $taxBase, $restaurant->currency_id) }}
@endforeach @if($order->tip_amount > 0)
@lang('modules.order.tip') {{ currency_format($order->tip_amount, $restaurant->currency_id) }}
@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, $restaurant->currency_id) }} @else @lang('modules.delivery.freeDelivery') @endif
@endif
@lang('modules.order.total') {{ currency_format($order->total, $restaurant->currency_id) }}
@php $currentStatus = $order->order_status->value; $allowedStatuses = match ($currentStatus) { 'confirmed', 'preparing', 'food_ready', 'ready_for_pickup' => ['picked_up'], 'picked_up' => ['out_for_delivery', 'reached_destination'], 'out_for_delivery' => ['reached_destination', 'delivered'], 'reached_destination' => ['delivered'], default => [], }; $statusButtons = [ [ 'value' => 'picked_up', 'label' => __('modules.delivery.pickedUp'), 'icon' => '', ], [ 'value' => 'out_for_delivery', 'label' => __('modules.delivery.outForDelivery'), 'icon' => '', ], [ 'value' => 'reached_destination', 'label' => __('modules.delivery.reachedDestination'), 'icon' => '', ], [ 'value' => 'delivered', 'label' => __('app.delivered'), 'icon' => '', ], ]; @endphp
@if ($order->orderCashCollection && $order->orderCashCollection->expected_amount > 0)

@lang('modules.delivery.cashOnDelivery')

@lang('modules.delivery.collectDueAmountMessage')

@lang('modules.delivery.dueAmount')
{{ currency_format($order->orderCashCollection->expected_amount, $restaurant->currency_id) }}
@if ($order->orderCashCollection->status === 'collected')
@lang('modules.delivery.dueAmountCollected')
@else

@lang('modules.delivery.collectAmountFromCustomer', ['amount' => currency_format($order->orderCashCollection->expected_amount, $restaurant->currency_id)])

@endif
@endif

@lang('modules.delivery.updateDeliveryStatus')

{{ $order->order_status->translatedLabel() }}
@foreach ($statusButtons as $status) @php $isActive = $currentStatus === $status['value']; $isEnabled = $isActive || in_array($status['value'], $allowedStatuses, true); @endphp @endforeach
@if ($showDeliveryConfirmationModal)

@lang('modules.delivery.confirmDueAmount')

@lang('modules.delivery.confirmDueAmountQuestion', ['amount' => currency_format($order->orderCashCollection?->expected_amount ?? 0, $restaurant->currency_id)])

@endif