@if (isset($dynamicFields) && count($dynamicFields) > 0)
@foreach ($dynamicFields as $field) @php $fieldLabel = $field['label'] ? $field['label'] : ($field['name'] ? $field['name'] : ''); $fieldPlaceholder = $field['placeholder'] ? $field['placeholder'] : ($fieldLabel ? 'أدخل ' . $fieldLabel : ''); $fieldId = 'dynamic_field_' . $field['id']; $historyAnchorClass = $loop->first ? ' history-anchor' : ''; @endphp @if ($field['type'] === 'select')
@if ($fieldLabel && $fieldLabel !== '') @endif
@if ($loop->first) @include('user.product.partials._history-dropdown') @endif @if ($field['help_text']) {{ $field['help_text'] }} @endif
@elseif($field['type'] === 'textarea')
@if ($fieldLabel && $fieldLabel !== '') @endif
@if ($loop->first) @include('user.product.partials._history-dropdown') @endif @if ($field['help_text']) {{ $field['help_text'] }} @endif
@elseif( $field['type'] === 'radio' && isset($field['options']) && is_array($field['options']) && count($field['options']) > 0)
@if ($fieldLabel && $fieldLabel !== '') @endif
@foreach ($field['options'] as $optionIndex => $option) @php $optionValue = is_array($option) ? $option['value'] : $option; $optionLabel = is_array($option) ? $option['label'] : $option; $radioId = $fieldId . '_' . $optionIndex; @endphp
@endforeach
@if ($loop->first) @include('user.product.partials._history-dropdown') @endif @if ($field['help_text']) {{ $field['help_text'] }} @endif
@elseif( $field['type'] === 'checkbox' && isset($field['options']) && is_array($field['options']) && count($field['options']) > 0)
@if ($fieldLabel && $fieldLabel !== '') @endif
@foreach ($field['options'] as $optionIndex => $option) @php $optionValue = is_array($option) ? $option['value'] : $option; $optionLabel = is_array($option) ? $option['label'] : $option; $checkboxId = $fieldId . '_' . $optionIndex; $defaultValues = is_array($field['default_value']) ? $field['default_value'] : []; @endphp
@endforeach
@if ($loop->first) @include('user.product.partials._history-dropdown') @endif @if ($field['help_text']) {{ $field['help_text'] }} @endif
@elseif($field['type'] === 'file' || $field['type'] === 'image')
@if ($fieldLabel && $fieldLabel !== '') @endif
اختر ملف
{{ $fieldPlaceholder }}
@if ($loop->first) @include('user.product.partials._history-dropdown') @endif @if ($field['help_text']) {{ $field['help_text'] }} @endif
@else {{-- Regular input fields (text, number, email, etc.) --}}
@if ($fieldLabel && $fieldLabel !== '') @endif
first) @focus="openHistory" @click="openHistory" @endif {{ $field['required'] ? 'required' : '' }}>
@if ($loop->first) @include('user.product.partials._history-dropdown') @endif @if ($field['help_text']) {{ $field['help_text'] }} @endif
@endif @endforeach
@endif