@props(['form', 'tone' => 'dark', 'defaults' => [], 'product' => null, 'ctaLabel' => null, 'action' => null, 'showHeader' => true]) @php $layout = app(\App\Support\Storefront\FormLayout::class); $defaults = collect($defaults); if ($product) { $defaults->put('product', $defaults->get('product') ?: $product->title); if (blank($defaults->get('details'))) { $defaults->put('details', 'Interested in custom branding for '.$product->title.'.'); } if (blank($defaults->get('grade')) && $product->grade) { $defaults->put('grade', $product->grade); } } if ($form) { $isNewsletter = $form->title === 'Newsletter' || $form->handle === 'newsletter'; $isQuote = $product || in_array($form->handle, ['rfq', 'inline-quote'], true); $isContact = $form->handle === 'contact'; $steps = $layout->steps($form->fields, (bool) $form->multi_step); $stepCount = count($steps); $prefix = 'tf-'.$form->handle; $eyebrow = match (true) { $isNewsletter => 'Stay close', $isQuote => 'Custom branded quote', $isContact => 'Get in touch', default => config('app.name'), }; $badgeIcon = match (true) { $isNewsletter => 'mail-plus', $isQuote => 'pen-tool', $isContact => 'messages-square', default => 'clipboard-list', }; $subtitle = $form->description ?: match (true) { $isNewsletter => 'New canvas drops, event offers and care tips. No spam, unsubscribe anytime.', $isQuote => 'Tell us about your ring and your brand. We reply with pricing, lead time and a mockup plan.', $isContact => 'Sizing, freight or an order question — we usually reply the same business day.', default => null, }; $submitLabel = $isNewsletter ? 'Subscribe' : ($ctaLabel ?: 'Submit request'); $valueFor = fn ($field) => old($field->name, $defaults->get($field->name)); } @endphp @if($form)
@csrf @if($product) @endif @foreach($form->fields->where('type', 'hidden') as $field) @endforeach @if($showHeader)

{{ $eyebrow }}

{{ $ctaLabel ?: ($isContact ? 'Send us a message' : ($form->title ?? 'Request')) }}

@if($subtitle)

{{ $subtitle }}

@endif
@endif @if($errors->any()) @endif @if($stepCount > 1)
    @foreach($steps as $index => $step)
  1. @endforeach

Step 1 of {{ $stepCount }}: {{ $steps[0]['title'] }}

@endif
@foreach($steps as $index => $step)
{{ $step['title'] }}
@foreach($step['fields'] as $field) @php $id = $prefix.'-'.$field->name; $error = $errors->first($field->name); $value = $valueFor($field); $describedBy = trim(($field->help_text ? $id.'-help ' : '').$id.'-error'); @endphp @if($field->type === 'consent')

{{ $error }}

@elseif($layout->presentsAsChoices($field)) @php $multiple = $field->type === 'multi_select'; $selected = collect($multiple ? (array) ($value ?? []) : [$value])->map(fn ($v) => (string) $v); @endphp
required) data-required-group @endif role="{{ $multiple ? 'group' : 'radiogroup' }}" aria-labelledby="{{ $id }}-legend" aria-describedby="{{ $describedBy }}">

{{ $field->label }}@if($field->required) *@endif @if($multiple)Choose any@endif

@if($field->help_text)

{{ $field->help_text }}

@endif
@foreach(($field->options ?? []) as $option) @endforeach

{{ $error }}

@else
@if($field->type === 'textarea') @elseif($field->type === 'select' || $field->type === 'multi_select') @if($field->type === 'select')@endif @else required) @if($layout->autocomplete($field)) autocomplete="{{ $layout->autocomplete($field) }}" @endif @if($field->type === 'tel') inputmode="tel" @endif aria-describedby="{{ $describedBy }}" @if($error) aria-invalid="true" @endif class="tra-float-control"> @endif @if($field->type === 'textarea') @endif
@if($field->help_text)

{{ $field->help_text }}

@endif

{{ $error }}

@endif @endforeach @if($loop->last)
@endif
@endforeach
@if($stepCount > 1) @endif
@endif