@php
use App\Models\WaProduct;
$cur = $order->currency_code ?: 'INR';
$money = fn($minor) => WaProduct::formatCurrency((int) $minor, $cur);
$items = $order->renderable_items ?? ($order->items_json ?? []);
$cancelled = $order->status === 'cancelled';
$steps = ['new' => 'Placed', 'confirmed' => 'Confirmed', 'paid' => 'Paid', 'shipped' => 'Shipped'];
$order_idx = array_search($order->status, array_keys($steps), true);
if ($order_idx === false) {
$order_idx = 0;
}
$brand = $brand ?? '#075E54';
$shopName = $shopName ?? 'Store';
@endphp
@if (!empty($logo))

@else
{{ strtoupper(substr($shopName, 0, 1)) }}
@endif
{{ $shopName }}
{{ __('Order') }} #{{ $order->id }}
{{ ucfirst($order->status) }}
@if ($cancelled)
{{ __('This order was cancelled. Contact us if that\'s unexpected.') }}
@else
@foreach ($steps as $key => $label)
@if ($loop->index <= $order_idx)
@endif
{{ __($label) }}
@endforeach
@endif
@foreach ($items as $i)
@php
$qty = (int) ($i['qty'] ?? 1);
$pm = (int) ($i['price_minor'] ?? 0);
@endphp
@if (!empty($i['image']))

@else
@endif
{{ $i['name'] ?? '—' }}
{{ __('Qty') }} {{ $qty }} · {{ $money($pm) }}
{{ $money($pm * $qty) }}
@endforeach
@php
$shipping = (int) ($order->shipping_minor ?? 0);
$sub = (int) $order->total_minor - $shipping;
@endphp
{{ __('Subtotal') }}{{ $money($sub) }}
{{ __('Shipping') }}{{ $shipping > 0 ? $money($shipping) : __('Free') }}
{{ __('Total') }}{{ $order->total_display }}
@if ($order->customer_address)
{{ __('Delivery to') }}
{{ $order->customer_name }}
{{ $order->customer_address }}
@endif
@if (!empty($order->payment_link) && $order->status !== 'paid')
{{ __('Pay now') }}
@endif
@if (!empty($waNumber))
{{ __('Message us about this order') }}
@endif
{{ $footer ?? '© ' . date('Y') . ' ' . $shopName }}