@foreach($fieldGroups as $key => $group) @php $index = $loop->index; $filled = $this->isStepFilled($index); $isCurrent = $currentStep === $index; @endphp
@if($filled && !$isCurrent) @else {{ $loop->iteration }} @endif
{{ $group['label']['en'] ?? 'Step' }}
@if(!$loop->last)
@endif
@endforeach
@foreach($fieldGroups as $key => $group) @if($currentStep === $loop->index)

{{ $group['label']['en'] ?? 'Step' }}

@if(!empty($formData['id']))
ID: {{ $formData['id'] }}
@if(!empty($formData['has_errors']) && ($formData['percentage'] ?? 0) < 100) Has Error @else No Errors @endif
{{ $formData['percentage'] ?? 0 }}%
@endif
@foreach($group['fields'] as $field) @if($field && $this->isFieldVisible($field)) @php $fieldName = $field['name']; @endphp
@switch($field['type']) @case('select') @break @case('textarea') @break @case('file')
@error("uploads.$fieldName") {{ $message }} @enderror @if (!empty($formData[$fieldName]) && !($uploads[$fieldName] ?? false)) @php $file = $formData[$fieldName]; $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); @endphp
@if (in_array($ext, ['jpg', 'jpeg', 'png'])) Preview @elseif ($ext === 'pdf') View uploaded PDF @endif
@endif
@break @case('checkbox')
@foreach($field['options'] as $key => $label) @endforeach
@break @case('radio')
@foreach($field['options'] as $key => $optionLabel) @endforeach
@break @case('multiple_select')
@break @default {{-- Auto-date for cdp_ttp --}} @if($this->proj_name === 'cdp_ttp' && $fieldName === 'start_date')
@elseif($this->proj_name === 'cdp_ttp' && $fieldName === 'end_date')
@else {{-- Auto-save on change for other fields --}} @endif @endswitch @error('formData.' . $fieldName) {{ $message }} @enderror
@endif @endforeach
@if(!$loop->last) @else @endif
@endif @endforeach