@extends('layouts.app')
@section('title','Ngân hàng câu hỏi')
@section('content')
<div class="d-flex justify-content-between align-items-center mb-4"><div><h3 class="fw-bold mb-1">Ngân hàng câu hỏi</h3><div class="text-muted">Câu hỏi được quản lý theo chủ đề</div></div><div><a href="{{ route('question-topics.index') }}" class="btn btn-outline-primary">Chủ đề</a> <a href="{{ route('question-bank.create') }}" class="btn btn-primary">Thêm câu hỏi</a></div></div>
@if(session('success'))<div class="alert alert-success">{{ session('success') }}</div>@endif
<div class="card shadow-sm mb-4"><div class="card-body"><form method="GET"><div class="row g-2"><div class="col-md-4"><input name="keyword" value="{{ request('keyword') }}" class="form-control" placeholder="Tìm mã hoặc nội dung..."></div><div class="col-md-3"><select name="topic_id" class="form-select"><option value="">Tất cả chủ đề</option>@foreach($topics as $topic)<option value="{{ $topic->id }}" {{ request('topic_id')==$topic->id?'selected':'' }}>{{ $topic->name }}</option>@endforeach</select></div><div class="col-md-2"><select name="difficulty" class="form-select"><option value="">Tất cả mức độ</option><option>Dễ</option><option>Trung bình</option><option>Khó</option></select></div><div class="col-md-3"><button class="btn btn-outline-primary">Lọc</button></div></div></form></div></div>
<div class="card shadow-sm"><div class="card-body"><table class="table table-hover"><thead><tr><th>Mã</th><th>Chủ đề</th><th>Nội dung</th><th>Mức độ</th><th>Điểm</th><th class="text-end">Thao tác</th></tr></thead><tbody>@forelse($questions as $q)<tr><td><strong>{{ $q->code }}</strong></td><td>{{ $q->topic->name ?? '' }}</td><td>{{ \Illuminate\Support\Str::limit($q->question_text,100) }}</td><td>{{ $q->difficulty }}</td><td>{{ $q->default_score }}</td><td class="text-end"><a href="{{ route('question-bank.show',$q->id) }}" class="btn btn-sm btn-outline-primary">Xem</a> <a href="{{ route('question-bank.edit',$q->id) }}" class="btn btn-sm btn-outline-warning">Sửa</a></td></tr>@empty<tr><td colspan="6" class="text-center text-muted">Chưa có câu hỏi.</td></tr>@endforelse</tbody></table>{{ $questions->links() }}</div></div>
@endsection
