Produkty
@php
$items = $order->items ?? [];
@endphp
@if(count($items) > 0)
@foreach($items as $item)
@php
$imgUrl = null;
// 1. Try saved img from order item
if (!empty($item['img'])) {
$imgUrl = $item['img'];
}
// 2. Try product_image_snapshots by product_id
if (!$imgUrl && !empty($item['id'])) {
$snapshot = \DB::table('product_image_snapshots')
->where('product_id', $item['id'])
->orderBy('created_at', 'desc')
->first();
if ($snapshot && !empty($snapshot->path)) {
$imgUrl = asset('storage/' . $snapshot->path);
}
}
// 3. Fallback: try finding product by slug or id
if (!$imgUrl) {
$product = null;
if (isset($item['slug'])) {
$product = \App\Models\Product::where('slug', $item['slug'])->first();
} elseif (isset($item['id'])) {
$product = \App\Models\Product::find($item['id']);
}
if ($product && $product->main_img) {
$imgUrl = asset('storage/' . $product->main_img);
}
}
@endphp
@if($imgUrl)
![{{ $item['name'] ?? 'Produkt' }}]({{ $imgUrl }})
@else
📦 Brak zdjęcia
@endif
{{ $item['name'] ?? 'Produkt' }}
{{ number_format(($item['price'] ?? 0) / 100, 2) }} zł
@endforeach
@else
Brak informacji o produktach
@endif
Dane klienta
@php
$address = $order->shipping_address ?? [];
@endphp
Imię i nazwisko:
{{ $address['name'] ?? 'Brak' }}
Email:
{{ $address['email'] ?? 'Brak' }}
Telefon:
{{ $address['phone'] ?? 'Brak' }}
Dostawa
Metoda:
@if($order->shipping_method === 'inpost')
InPost Paczkomat
@elseif($order->shipping_method === 'cod')
Płatność przy odbiorze
@elseif($order->shipping_method === 'international_courier')
🌍 Kurier międzynarodowy
@else
Kurier
@endif
@if($order->shipping_method === 'inpost' && $order->parcel_locker_code)
Kod paczkomatu:
{{ $order->parcel_locker_code }}
@endif
@if(in_array($order->shipping_method, ['courier', 'cod', 'international_courier']))
Adres:
{{ $address['line1'] ?? '' }}
@if(!empty($address['line2']))
Adres 2:
{{ $address['line2'] }}
@endif
Kod pocztowy:
{{ $address['postal_code'] ?? '' }}
Miasto:
{{ $address['city'] ?? '' }}
@if($order->shipping_method === 'international_courier')
Kraj:
{{ $address['country'] ?? '' }}
@if(!empty($address['state']))
Województwo/Stan:
{{ $address['state'] }}
@endif
@endif
@endif
@if($order->cash_on_delivery)
Opłata COD:
{{ number_format($order->cod_fee, 2) }} PLN
@endif