@foreach ($slots as $slot)
@php
$slotKey = $slot['key'];
$selectedProductId = $choices[$slotKey] ?? $slot['product_ids'][0];
@endphp
@if (($slot['mode'] ?? 'fixed') === 'choice')
@include('shared/select', [
'name' => 'pack_choices['.$slotKey.']',
'label' => __('pack::lang.data.choose_product'),
'options' => collect($slot['product_ids'])->mapWithKeys(fn ($productId) => [$productId => optional($products->get($productId))->name ?? '#'.$productId])->toArray(),
'value' => $selectedProductId,
'attributes' => ['data-pack-choice' => $slotKey],
])
@else
{{ optional($products->get($selectedProductId))->name ?? '#'.$selectedProductId }}
@endif
@foreach ($slot['product_ids'] as $productId)
@endforeach