@if ($question->type === 'mcq' && $question->mcq)
@foreach ($question->mcq->choices as $choiceIndex => $choice)
{{ $choice }}
@endforeach
@elseif ($question->type === 'true_false' && $question->trueFalse)
{{ $isArabic ? 'صح' : 'True' }}
{{ $isArabic ? 'خطأ' : 'False' }}
@elseif (in_array($question->type, ['essay', 'paragraph'], true))
@elseif ($question->type === 'match' && $question->match)
@php
$groupA = is_array($question->match->group_a)
? $question->match->group_a
: (json_decode($question->match->group_a ?? '[]', true) ?: []);
$groupB = is_array($question->match->group_b)
? $question->match->group_b
: (json_decode($question->match->group_b ?? '[]', true) ?: []);
$savedPairs = is_array($storedAnswer)
? $storedAnswer
: (json_decode($storedAnswer ?? '[]', true) ?: []);
@endphp
@foreach ($groupA as $item)
{{ $item }}
{{ $isArabic ? 'اختر المطابقة' : 'Choose match' }}
@foreach ($groupB as $matchChoice)
{{ $matchChoice }}
@endforeach
@endforeach
@elseif ($question->type === 'audio_text' && $question->audioText)
@if ($question->media_path)
{{ $isArabic ? 'استمع أولاً' : 'Listen first' }}
@endif
@elseif ($question->type === 'text_audio' && $question->textAudio)
{{ $isArabic ? 'ارفع إجابتك كملف صوتي. الأنواع المدعومة: mp3, wav, ogg, m4a, webm.' : 'Upload your answer as an audio file. Supported formats: mp3, wav, ogg, m4a, webm.' }}
@if (filled($storedAnswer))
{{ $isArabic ? 'إجابة صوتية محفوظة' : 'Saved audio answer' }}
@endif
@elseif ($question->type === 'fill_blank' && $question->fillBlank)
@php
$templateText = $question->fillBlank->template_text ?? '';
$segments = preg_split('/\[blank\]/', $templateText) ?: [$templateText];
$savedFillAnswers = is_array($storedAnswer) ? $storedAnswer : (json_decode($storedAnswer ?? '[]', true) ?: []);
@endphp
@foreach ($segments as $segmentIndex => $segment)
{{ $segment }}
@if (! $loop->last)
@endif
@endforeach
@else
{{ $isArabic ? 'نوع هذا السؤال غير مدعوم حالياً في الواجهة الجديدة.' : 'This question type is not yet supported in the new interface.' }}
@endif