@php
$columnCount = count($rowGroup['columns']); // Number of columns in this row group
$widthIndex = 0;
@endphp
@for($i = 0; $i < $columnCount; $i++)
@php
$inputs = $rowGroup['columns'][$i]['inputs'] ?? []; // Get the grouped inputs for this column
$currentWidth = $rowGroup['columns'][$i]['width'] ?? 100; // Use normalized width or default to 100
$widthIndex++;
@endphp
<{{$rowGroup['type_row']}} style="width: {{ $currentWidth }}%" class="input-group">
@if(!empty($rowGroup['columns'][$i]['sub_rows']))
@include('pdf.sub_rows', ['row' => $rowGroup['columns'][$i]])
@endif
@if(!empty($rowGroup['columns'][$i]['inputs']))
@php
$inputGroupChangType= $rowGroup['columns'][$i]['type'] == 'main-table-muilt-input' ? $rowGroup['columns'][$i]['inputs']['0']:$rowGroup['columns'][$i]['inputs'];
@endphp
@foreach($inputGroupChangType as $input)
@if(!isset($input['input_type']))
@continue;
@endif
@if($rowGroup['type_row'] == 'th' && count($rowGroup['columns']) == 1 && $input['input_type'] == 'label')
{{ $input['label'] ?? '' }}
@elseif($rowGroup['type_row'] === 'th')
{{ $input['label'] ?? '' }}
@elseif($input['input_type'] === 'label')
{{ $input['label'] ?? 'No label' }}
@elseif($input['input_type'] === 'radio' || $input['input_type'] === 'checkbox')
@if( $rowGroup['single_multi_input'] !== 'single_input')
{{ $input['label'] ?? '' }}
@elseif(count(explode(",",$input['answer'])) > 1 )
{{ $input['label'] ?? '' }}
@endif
@else
{{ $input['label'] ?? 'No label' }}
@if($input['input_type'] === 'text' || $input['input_type'] === 'date' || $input['input_type'] === 'number' || $input['input_type'] === 'textarea' || $input['input_type'] === 'file' || $input['input_type'] === 'time')
{{ $input['answer'] ?? $input['placeholder'] ?? 'No answer selected' }}
@endif
@endif
@endforeach
@endif
@endfor
{{$rowGroup['type_row']}}>