@extends('layouts.app') @section('title', $exam->title) @section('content')

{{ $exam->title }}

@php $statusLabel = $exam->status_label; @endphp @if($statusLabel !== '未排程') {{ $statusLabel }} @endif
@if($exam->description)

{{ $exam->description }}

@endif @if($exam->start_time || $exam->end_time)
@if($exam->start_time)開始:{{ $exam->start_time->format('Y-m-d H:i') }}@endif @if($exam->start_time && $exam->end_time)~@endif @if($exam->end_time)結束:{{ $exam->end_time->format('Y-m-d H:i') }}@endif
@endif
@if($exam->subject){{ $exam->subject->name }}@endif @if($exam->examCategory){{ $exam->examCategory->name }}@endif @if($exam->year){{ $exam->year }} 年@endif {{ $exam->visibility_label }}
@if($exam->subjects->isNotEmpty())
包含考科: @foreach($exam->subjects as $sub) {{ $sub->name }} @endforeach
@endif @if($exam->participants->isNotEmpty())
參與者: @foreach($exam->participants as $p) @if($p->participant_type === 'class') @php $cls = \App\Models\SchoolClass::with('grade')->find($p->participant_id); @endphp @if($cls){{ $cls->grade->name ?? '' }} {{ $cls->name }}@endif @else @php $roleName = \App\Models\Role::where('slug', $p->participant_id)->value('name'); @endphp {{ $roleName ?? $p->participant_id }} @endif @endforeach
@endif

建立者:{{ $exam->creator->name ?? '-' }} @if($exam->school) | 學校:{{ $exam->school->name }} @endif @if($exam->schoolClass) | 班級:{{ $exam->schoolClass->name }} @endif

{{ $exam->questions->count() }}

題目數

{{ $exam->questions->sum('points') ?: $exam->questions->count() }}

總分

@php $types = $exam->questions->groupBy('question_type')->map->count(); @endphp

{{ $types->count() }}

題型

@php $bankYears = \App\Models\Exam::where('is_imported', true)->whereNotNull('year')->select('year')->distinct()->pluck('year')->map(fn($y) => (int)$y - 1911)->sort()->values(); @endphp
已選
@csrf
@foreach(['A','B','C','D'] as $opt)
{{ $opt }}
@endforeach

題目列表 ({{ $exam->questions->count() }} 題)

@csrf
@if($exam->questions->isNotEmpty())
已選
@endif @forelse($exam->questions as $index => $question)
{{ $index + 1 }} {{ match($question->question_type) { 'multiple_choice' => '選擇題', 'true_false' => '是非題', 'fill_blank' => '填充題', 'essay' => '問答題', default => '簡答題' } }} {{ $question->difficulty_label }} {{ $question->points ?? 1 }} 分

{!! nl2br(e($question->question_text)) !!}

@if($question->image_path)
題目圖片
@endif @if($question->options)
@foreach($question->options as $key => $opt) {{ $key }}. {{ $opt }} @if($question->correct_answer === $key) ✓ @endif @endforeach
@endif @if($question->correct_answer && !$question->options)

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

@endif
@csrf @method('DELETE')
@csrf @method('PUT')
@if($question->question_type === 'multiple_choice')
@foreach(['A','B','C','D'] as $opt) @endforeach
@endif
@empty

此考試還沒有題目

展開上方「新增題目」區塊,從題庫選題或手動新增

@endforelse
返回列表
@endsection