@extends('layouts.main_dashboard.app') @section('title', __('dashboard.Questions') . ' | ' . __('dashboard.View Question')) @section('content') @php $teacherName = trim(($question->user->first_name ?? '') . ' ' . ($question->user->last_name ?? '')); $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) ?? []); $matchMap = is_array($question->match?->match) ? $question->match->match : (json_decode($question->match->match ?? '[]', true) ?? []); $fillBlankPreview = preg_replace('/\[blank\]/', '________', $question->fillBlank->template_text ?? ''); @endphp

{{ __('dashboard.Question Bank') }}

{{ __('dashboard.View Question') }}

{{ $question->question_text }}

{{ __('dashboard.Subject') }}

{{ $question->subject->name ?? '-' }}

{{ __('dashboard.Lesson') }}

{{ $question->lesson->title ?? '-' }}

{{ __('dashboard.Type') }}

{{ ucwords(str_replace('_', ' ', $question->type)) }}

{{ __('dashboard.Score') }}

{{ $question->score ?? '-' }}

{{ __('dashboard.Question Details') }}

@if($question->difficultyLevel) {{ $question->difficultyLevel->name }} @endif

{{ __('dashboard.Question Text') }}

{{ $question->question_text }}

@if($question->type === 'true_false')

{{ __('dashboard.Correct Answer') }}

{{ ($question->trueFalse->correct_answer ?? false) ? __('dashboard.True') : __('dashboard.False') }}
@elseif($question->type === 'mcq')

{{ __('dashboard.Choices') }}

@foreach(json_decode($question->mcq->choices ?? '[]', true) ?? [] as $index => $choice)
{{ $choice }}
@endforeach
@elseif($question->type === 'essay')

{{ __('dashboard.Essay Text') }}

{{ $question->essay->essay_text ?? '' }}
@elseif($question->type === 'paragraph')

{{ __('dashboard.Paragraph Text') }}

{{ $question->paragraph->paragraph_text ?? '' }}
@elseif($question->type === 'match')

{{ __('dashboard.Group A') }}

@foreach($groupA as $item)
{{ $item }}
@endforeach

{{ __('dashboard.Matching Answers') }}

@foreach($groupB as $item)
{{ $item }} -> {{ $matchMap[$item] ?? '-' }}
@endforeach
@elseif($question->type === 'audio_text')

{{ app()->getLocale() === 'ar' ? 'نوع الإجابة' : 'Answer Mode' }}

{{ app()->getLocale() === 'ar' ? 'الطالب يستمع ثم يكتب الإجابة نصاً' : 'Student listens then answers in text' }}

{{ app()->getLocale() === 'ar' ? 'الإجابة المرجعية' : 'Reference Answer' }}

{{ $question->audioText->reference_answer ?? '—' }}
@elseif($question->type === 'text_audio')

{{ app()->getLocale() === 'ar' ? 'نوع الإجابة' : 'Answer Mode' }}

{{ app()->getLocale() === 'ar' ? 'الطالب يقرأ السؤال ثم يرفع إجابة صوتية' : 'Student reads the prompt then uploads an audio answer' }}

{{ app()->getLocale() === 'ar' ? 'الإجابة المرجعية' : 'Reference Answer' }}

{{ $question->textAudio->reference_answer ?? '—' }}
@elseif($question->type === 'fill_blank')

{{ app()->getLocale() === 'ar' ? 'نص السؤال' : 'Blank Template' }}

{{ $fillBlankPreview }}

{{ app()->getLocale() === 'ar' ? 'الإجابة المرجعية' : 'Reference Answer' }}

{{ $question->fillBlank->reference_answer ?? '—' }}
@endif
@endsection