@extends('user.layouts.app') @section('content')
{{-- ── Hero ── --}}
@if($survey->category) {{ $survey->category }} @endif

{{ $survey->title }}

@if($survey->description)

{{ $survey->description }}

@endif
{{ format_currency($survey->reward) }} reward • ~{{ $survey->estimated_minutes }} min
{{-- Progress bar --}}
Progress 0 of {{ $survey->questions->count() }} answered
@if($errors->any())

Please fix the highlighted questions below.

{{ count($errors->messages()) }} {{ \Illuminate\Support\Str::plural('issue', count($errors->messages())) }} to address.

@endif {{-- ── Form ── --}}
@csrf @foreach($survey->questions as $i => $q) @php $key = 'q_'.$q->id; $hasError = $errors->has($key); $oldValue = old($key); @endphp
{{-- Question header --}}
{{ $i + 1 }}

{{ $q->question }} @if($q->required) * @endif

@if($q->type === 'checkbox')

Select all that apply

@endif
{{-- Input by type --}} @switch($q->type) @case('radio')
@foreach($q->options ?? [] as $opt) @endforeach
@break @case('checkbox') @php $oldArr = is_array($oldValue) ? $oldValue : []; @endphp
@foreach($q->options ?? [] as $opt) @php $checked = in_array($opt, $oldArr, true); @endphp @endforeach
@break @case('select') @break @case('text') @break @case('textarea') @break @case('rating')
@for($s = 1; $s <= 5; $s++) @endfor Tap a star to rate
@break @case('scale')
@for($n = 1; $n <= 10; $n++) @endfor
Not at all likely Extremely likely
@break @endswitch @if($hasError)

{{ $errors->first($key) }}

@endif
@endforeach {{-- Submit --}}

Reward on completion

{{ format_currency($survey->reward) }}

@endsection