@if(!empty($localAssets)) @else @endif
{{ $exam->title }}{{ $showAnswers ? ' - 含詳解' : '' }}
Ctrl+P 或點按鈕 → 目的地選「另存為 PDF」→ 儲存
下載 PDF

{{ $exam->title }}

@if($exam->subject)考科:{{ $exam->subject->name ?? '' }} @endif @if($exam->examCategory)分類:{{ $exam->examCategory->name ?? '' }} @endif @if($exam->year)年度:{{ $exam->year }} @endif 共 {{ $exam->questions->count() }} 題 總分:{{ $exam->questions->sum('points') ?: $exam->questions->count() }} 分
@if(!$showAnswers)
姓名:________________  座號:________            得分:________
@endif @php $typeNames = [ 'multiple_choice' => '選擇題', 'true_false' => '是非題', 'fill_blank' => '填充題', 'essay' => '問答題', 'short_answer' => '簡答題', ]; $sectionLabels = ['一', '二', '三', '四', '五', '六', '七', '八']; $grouped = $exam->questions->groupBy('question_type'); $sectionIndex = 0; $questionNumber = 0; @endphp @foreach($grouped as $type => $questions) @php $typeName = $typeNames[$type] ?? '其他'; $count = $questions->count(); $pointsPer = $questions->first()->points ?? 1; $allSamePoints = $questions->every(fn($q) => ($q->points ?? 1) === $pointsPer); $label = $sectionLabels[$sectionIndex] ?? ($sectionIndex + 1); $sectionIndex++; @endphp
{{ $label }}、{{ $typeName }} 共 {{ $count }} 題@if($allSamePoints),每題 {{ $pointsPer }} 分@endif
@foreach($questions as $question) @php $questionNumber++; @endphp

{{ $questionNumber }}. {!! nl2br(e(preg_replace('/[\s\x{00A0}]+$/u', '', $question->question_text))) !!}

@if($question->question_type === 'multiple_choice' && $question->options) @foreach($question->options as $key => $optionText)

({{ $key }}) {{ $optionText }}@if($showAnswers && $question->correct_answer === $key) ✓@endif

@endforeach @elseif($question->question_type === 'true_false')

○ 對

✕ 錯

@else @if(!$showAnswers) @for($i = 0; $i < ($question->question_type === 'essay' ? 5 : 2); $i++)
@endfor @endif @endif @if($showAnswers)
@if($question->correct_answer)

正確答案:{{ $question->correct_answer }}

@endif @if($question->ai_explanation)
@endif
@endif
@endforeach @endforeach @if(!$showAnswers)

答案欄

@foreach($exam->questions->chunk(5) as $chunk) @foreach($chunk as $q) @endforeach @for($i = $chunk->count(); $i < 5; $i++) @endfor @endforeach
{{ $loop->parent->index * 5 + $loop->index + 1 }}
@endif @if($showAnswers) @endif