@foreach ($items as $index => $item)
@php $packageContents = $packageContentsByProductId[(int) ($item['id'] ?? 0)] ?? []; $hasDiscount = isset($item["price_afterdiscount"]) && (int) $item["price_afterdiscount"] > 0 && (int) $item["price_afterdiscount"] < (int) $item["price"]; $displayPrice = $hasDiscount ? (int) $item["price_afterdiscount"] : (int) $item["price"]; $qty = (int) ($item['quantity'] ?? 0); $lineTotal = max(0, $displayPrice) * max(0, $qty); @endphp
{{ $item[

{{ $item["name"] }}

@if ($packageContents !== [])
@foreach ($packageContents as $row) @php $packageQty = (int) ($row['quantity'] ?? 0) * (int) ($item['quantity'] ?? 0); $productName = (string) ($row['product_name'] ?? ''); $variantName = (string) ($row['variant_name'] ?? ''); @endphp {{ $packageQty }}x {{ $productName }}@if ($variantName !== '') ({{ $variantName }})@endif @endforeach
@endif

Harga

Rp{{ number_format($displayPrice, 0, ",", ".") }} @if ($hasDiscount) Rp{{ number_format($item["price"], 0, ",", ".") }} @endif

Total: Rp{{ number_format($lineTotal, 0, ",", ".") }}

{{ $qty }}
@endforeach