@if (! $cart->items->isEmpty())
@foreach ($cart->items as $item) @php $isHosting = $item->item_type === 'hosting'; $isPricedDomain = in_array($item->item_type, ['domain_register', 'domain_transfer'], true); $isDomain = str_starts_with((string) $item->item_type, 'domain_'); $product = $isHosting ? $pricing->findProductByPid((int) $item->api_pid, $cart->currency) : null; $cycles = $product['available_cycles'] ?? []; $preferredCycleKeys = ['monthly', 'annually', 'biennially', 'triennially']; $termCycles = array_intersect_key($cycles, array_flip($preferredCycleKeys)); // Preserve an existing non-standard term while hiding the old // quarterly/semiannual dropdown options for normal selection. if ($isHosting && $item->billing_cycle && isset($cycles[$item->billing_cycle]) && ! isset($termCycles[$item->billing_cycle])) { $termCycles = [$item->billing_cycle => $cycles[$item->billing_cycle]] + $termCycles; } if ($isHosting && count($termCycles) === 0) { $termCycles = $cycles; } $domainOptions = $isPricedDomain ? $pricing->domainBillingOptions($item->domain_name, $item->operation ?: 'register', $cart->currency) : []; $domainTypeLabel = match ($item->item_type) { 'domain_register' => 'Domain registration', 'domain_transfer' => 'Domain transfer', 'domain_existing' => 'Existing domain', default => 'Domain', }; @endphp
{{ $isDomain && $item->domain_name ? $item->domain_name : $item->name }} @if ($isDomain) {{ $domainTypeLabel }} @else {{ $item->billing_cycle ? $pricing->cycleLabel($item->billing_cycle) : 'Service' }} @endif @if ($isHosting && count($termCycles))
@csrf @method('PATCH')
@foreach ($termCycles as $cycleKey => $cyclePrice) @endforeach
@elseif ($isPricedDomain && count($domainOptions))
@csrf @method('PATCH')
@foreach ($domainOptions as $year => $priceRow) @endforeach
@endif
{{ $pricing->formatMoney($item->total, $item->currency) }}
@csrf @method('DELETE')
@endforeach
@endif