@foreach($order->orderItems as $item)
{{ $item->item_name ?? $item->item->title ?? __('ecommerce::ecommerce.product_label') }}
x {{ $item->qty }}
{{ number_format($item->subtotal, 2) }}
@endforeach
@php
$savedAddress = $order->address;
$addrRaw = $order->addressInOrder;
$addr = is_string($addrRaw) ? json_decode($addrRaw, true) : (is_array($addrRaw) ? $addrRaw : []);
$countryName = $savedAddress?->country?->title
?? ($addr['country_name'] ?? null)
?? (isset($addr['country_id']) ? \App\Domain\AppBase\Models\Location\Country::find($addr['country_id'])?->title : null);
$cityName = $savedAddress?->city?->title
?? ($addr['city_name'] ?? null)
?? (isset($addr['city_id']) ? \App\Domain\AppBase\Models\Location\City::find($addr['city_id'])?->title : null);
$districtName = $savedAddress?->district_name
?: ($savedAddress?->distract?->title
?? ($addr['district_name'] ?? null)
?? (isset($addr['distract_id']) ? \App\Domain\AppBase\Models\Location\Distract::find($addr['distract_id'])?->title : null));
$streetAddress = $savedAddress?->address ?? ($addr['address'] ?? null);
$addressTitle = is_array($savedAddress?->title)
? ($savedAddress->title[app()->getLocale()] ?? reset($savedAddress->title))
: ($savedAddress?->title ?? (is_array($addr['title'] ?? null) ? ($addr['title'][app()->getLocale()] ?? reset($addr['title'])) : ($addr['title'] ?? null)));
$hasAddressInfo = $savedAddress || !empty($addr) || $countryName || $cityName || $streetAddress;
@endphp
@if($hasAddressInfo)
{{ $order->client_name ?? $order->user?->name ?? 'User' }}
@if($addressTitle)
{{ $addressTitle }}
@endif
@if($order->client_phone ?? $order->user?->phone)
{{ $order->client_phone ?? $order->user?->phone }}
@endif
{{ implode(' - ', array_filter([$countryName, $cityName, $districtName, $streetAddress])) }}
@else
@lang('ecommerce::ecommerce.no_address_found')
@endif