@extends('layouts.admin') @section('title', '題庫管理') @section('content') {{-- Tab 切換:公用 / 私有 --}}
公用題庫 {{ number_format($publicCount) }} 私有題庫 {{ number_format($privateCount) }}
{{-- 篩選 --}}
@php $typeLabel = fn($t) => match($t) { 'multiple_choice' => '選擇題', 'true_false' => '是非題', 'fill_blank' => '填充題', 'essay' => '問答題', default => '簡答題' }; $diffColor = fn($d) => match($d) { 1 => 'bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400', 3 => 'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400', default => 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400' }; $diffLabel = fn($d) => match($d) { 1 => '簡單', 3 => '困難', default => '中等' }; $currentUser = auth()->user(); $curSort = request('sort', 'id'); $curDir = request('dir', 'desc'); $sortUrl = function($col) use ($curSort, $curDir) { $dir = ($curSort === $col && $curDir === 'desc') ? 'asc' : 'desc'; return request()->fullUrlWithQuery(['sort' => $col, 'dir' => $dir, 'page' => null]); }; $sortIcon = function($col) use ($curSort, $curDir) { if ($curSort !== $col) return '↕'; return $curDir === 'desc' ? '↓' : '↑'; }; @endphp {{-- 上方分頁 --}} @include('components.pagination-bar', ['paginator' => $questions]) {{-- 主要區塊 --}}
{{-- ===== 批量操作列 ===== --}}
已選
{{-- 歸類到科目 --}}
| {{-- 設為公開/私有 --}} @if($tab === 'private') @else @endif | {{-- 批量產生 AI 詳解 --}} | {{-- 批量刪除 --}} {{-- 清除 --}}
{{-- ===== 題目列表 ===== --}}
{{-- 勾選 --}} {{-- 序號 --}} {{-- 年份 --}} {{-- 考試分類 --}} {{-- 考試科目 --}} {{-- 題目 --}} {{-- 題型 --}} {{-- 提供者 --}} {{-- AI --}} {{-- 更新 --}} {{-- 操作 --}} @forelse($questions as $q) @empty @endforelse
序號 {{ $sortIcon('id') }} 年份 考試分類 考試科目 題目 題型 {{ $sortIcon('question_type') }} 提供者 AI 更新 {{ $sortIcon('updated_at') }} 操作
{{ $q->id }} @if($q->exam && $q->exam->year) {{ $q->exam->year - 1911 }} @else - @endif @if($q->exam) @php $titleParts = explode(' - ', $q->exam->title); $examName = count($titleParts) >= 2 ? $titleParts[1] : $q->exam->examCategory?->name; $nameParts = $examName ? explode('_', $examName, 2) : []; @endphp @if(count($nameParts) >= 2) {{ $nameParts[0] }} {{ $nameParts[1] }} @elseif($examName) {{ Str::limit($examName, 18) }} @else - @endif @else - @endif @if($q->subject) {{ Str::limit($q->subject->name, 10) }} @else - @endif @if($q->image_path)@endif{{ Str::limit($q->question_text, 55) }} @if($q->correct_answer)

答:{{ Str::limit($q->correct_answer, 20) }}

@endif
{{ $typeLabel($q->question_type) }} {{ $q->creator->name ?? '-' }} @if($q->ai_explanation) @else @endif {{ $q->updated_at->format('m/d H:i') }}
查看 編輯
@csrf @method('DELETE')
@if($tab === 'public')

公用題庫尚無題目

將私有題目設為公開,或在匯入時將考試設為公開

@else

私有題庫尚無題目

建立考試並新增題目,題目預設為私有

@endif
{{-- Hidden forms for bulk actions --}}
{{-- 下方分頁 --}}
@include('components.pagination-bar', ['paginator' => $questions])
@endsection