{{-- Renders one dynamic attribute as the control its type calls for. Nothing in here knows what a bedroom or a mileage is: the attribute record carries the type, the unit, the options and whether the category requires it, and this partial reads those. That is what lets a new vertical appear without a template change. --}} @php $name = 'attributes['.$attribute->code.']'; $id = 'attribute-'.$attribute->code; $required = (bool) $attribute->pivot->is_required; $error = $errors->first('attributes.'.$attribute->code); $label = $attribute->name.($attribute->unit ? ' ('.$attribute->unit.')' : ''); $limits = $attribute->validation ?? []; @endphp
in_array($attribute->type->value, ['textarea', 'multiselect'], true)])> @if ($attribute->type === \App\Enums\AttributeType::Boolean) {{-- A checkbox posts nothing when unticked, so a hidden field carries the "no" answer rather than leaving the attribute unanswered. --}} @else @switch($attribute->type) @case(\App\Enums\AttributeType::Select) @break @case(\App\Enums\AttributeType::MultiSelect) @php($selected = (array) ($value ?? []))
@foreach ($attribute->options->where('is_active', true) as $option) @endforeach
@break @case(\App\Enums\AttributeType::Textarea) @break @case(\App\Enums\AttributeType::Number) @case(\App\Enums\AttributeType::Decimal) @break @case(\App\Enums\AttributeType::Date) @break @default @endswitch @if ($attribute->help_text && ! $error)

{{ $attribute->help_text }}

@endif @endif @if ($error)

{{ $error }}

@endif