@php // If $bundles is set, loop through each bundle and render the UI for each $bundleList = isset($bundles) && is_array($bundles) && count($bundles) > 0 ? $bundles : [null]; $isGuest = !auth()->check(); $readonly = $isGuest ? 'readonly' : null; $disabled = $isGuest ? 'disabled' : null; @endphp @foreach ($bundleList as $bundleIdx => $bundleData) @php // Use bundle data if available, else fallback to default $devicesData = $bundleData['devices'] ?? ($devices ?? []); // For backward compatibility, if $selectedDevices is set, use it $selectedDevices = []; if (isset($bundleData['devices'])) { foreach ($bundleData['devices'] as $dIdx => $d) { $selectedDevices[$dIdx] = [ 'option' => $d['master_device_id'] ?? '', 'price' => $d['price'] ?? '', ]; } } elseif (isset($selectedDevices)) { $selectedDevices = $selectedDevices; } @endphp
POS Bundle #{{ $bundleIdx + 1 }}
@if (!empty($devicesData) && count($devicesData) > 0) @foreach ($devices as $idx => $device) @if (!empty($device['active']))
{!! html()->label( $device['label'] . (!empty($device['required']) ? ' *' : ''), 'bundle_' . $bundleIdx . '_device_' . $idx . '_option', )->toHtml() !!}
{!! html()->label( 'Unit Price /month ' . (!empty($device['required'] && !$isGuest) ? ' *' : ''), )->toHtml() !!} {!! html()->text( 'bundles[' . $bundleIdx . '][device][' . $idx . '][price]', old( 'bundles.' . $bundleIdx . ".device.{$idx}.price", $selectedDevices[$idx]['price'] ?? ($device['price'] ?? 'FREE'), ), )->class('form-control device-price hardware-price-input')->id('bundle_' . $bundleIdx . '_device_' . $idx . '_price')->attribute('readonly', $isGuest ? 'readonly' : '') !!}
@if (!$isGuest)
@endif
@endif @endforeach @else

No devices found.

@endif
@endforeach