@php
$currencySymbol = App\Models\AppSetting::getValue('currency_symbol', '?');
$decimals = App\Models\AppSetting::currencyDecimals();
$orderItems = [];
if ($order->items) {
if (is_string($order->items)) {
$orderItems = json_decode($order->items, true) ?: [];
} elseif (is_array($order->items)) {
$orderItems = $order->items;
}
}
if (empty($orderItems) && method_exists($order, 'orderItems')) {
$orderItems = $order->orderItems?->toArray() ?? [];
}
@endphp
{{ $restaurant->name }}
{{ $restaurant->address }}
KOT BILL
Order #{{ $order->order_number }}
Date{{ optional($order->created_at)->format('d M Y h:i A') }}
Customer{{ $order->customer_name ?? 'Guest' }}
Type{{ ucfirst($order->order_type ?? 'delivery') }}
Payment{{ $order->payment_label ?? ucfirst($order->payment_method ?? 'cod') }}
@forelse($orderItems as $item)
@php
$name = $item['name'] ?? $item['item_name'] ?? data_get($item, 'menu_item.name') ?? $item['title'] ?? 'Item';
$qty = (int) ($item['quantity'] ?? $item['qty'] ?? 1);
$price = (float) ($item['unit_price'] ?? $item['price'] ?? 0);
$total = (float) ($item['total_price'] ?? $item['total'] ?? ($price * $qty));
if ($price <= 0 && $qty > 0 && $total > 0) {
$price = $total / $qty;
}
@endphp
{{ $qty }} x {{ $name }}
{{ $currencySymbol }}{{ number_format($total, $decimals) }}
{{ $currencySymbol }}{{ number_format($price, $decimals) }} each
@empty
No items found
@endforelse
Subtotal{{ $currencySymbol }}{{ number_format($order->subtotal, $decimals) }}
Delivery{{ $currencySymbol }}{{ number_format($order->delivery_fee, $decimals) }}
Platform{{ $currencySymbol }}{{ number_format($order->platform_fee ?? 0, $decimals) }}
Tax{{ $currencySymbol }}{{ number_format($order->tax, $decimals) }}
@if((float) $order->discount > 0)
Discount-{{ $currencySymbol }}{{ number_format($order->discount, $decimals) }}
@endif
Total{{ $currencySymbol }}{{ number_format($order->total, $decimals) }}
Thank you