48 lines
2.4 KiB
PHP
48 lines
2.4 KiB
PHP
@extends('layouts.admin')
|
|
@section('title','Fragen')
|
|
@section('content')
|
|
<div class="flex flex-wrap gap-3 items-center justify-between mb-6">
|
|
<form method="GET" class="flex gap-2">
|
|
<select name="subject" class="border border-slate-300 rounded-lg px-3 py-2 text-sm">
|
|
<option value="">Alle Fächer</option>
|
|
@foreach($subjects as $s)<option value="{{ $s->id }}" {{ request('subject')==$s->id?'selected':'' }}>{{ $s->icon }} {{ $s->name }}</option>@endforeach
|
|
</select>
|
|
<button class="bg-slate-700 text-white px-4 py-2 rounded-lg text-sm">Filtern</button>
|
|
</form>
|
|
<a href="{{ route('admin.questions.create') }}" class="bg-violet-600 hover:bg-violet-700 text-white px-4 py-2 rounded-lg text-sm font-medium">+ Neue Frage</a>
|
|
</div>
|
|
<div class="bg-white rounded-xl shadow-sm border border-slate-200 overflow-hidden">
|
|
<table class="w-full text-sm">
|
|
<thead class="bg-slate-50 border-b border-slate-200">
|
|
<tr>
|
|
<th class="text-left px-4 py-3 font-medium text-slate-600">Frage</th>
|
|
<th class="text-left px-4 py-3 font-medium text-slate-600">Fach</th>
|
|
<th class="text-center px-4 py-3 font-medium text-slate-600">Schwierigkeit</th>
|
|
<th class="text-center px-4 py-3 font-medium text-slate-600">Aktiv</th>
|
|
<th class="px-4 py-3"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-slate-100">
|
|
@forelse($questions as $q)
|
|
<tr class="hover:bg-slate-50">
|
|
<td class="px-4 py-3 text-slate-700 max-w-xs truncate">{{ $q->question_text }}</td>
|
|
<td class="px-4 py-3"><span class="text-base">{{ $q->subject->icon }}</span> {{ $q->subject->name }}</td>
|
|
<td class="px-4 py-3 text-center">{{ $q->difficultyStars() }}</td>
|
|
<td class="px-4 py-3 text-center">{{ $q->active ? '✅' : '⏸️' }}</td>
|
|
<td class="px-4 py-3 text-right whitespace-nowrap">
|
|
<a href="{{ route('admin.questions.edit',$q) }}" class="text-violet-600 hover:underline mr-3">Bearbeiten</a>
|
|
<form method="POST" action="{{ route('admin.questions.destroy',$q) }}" class="inline" onsubmit="return confirm('Löschen?')">
|
|
@csrf @method('DELETE')
|
|
<button class="text-red-500 hover:underline">Löschen</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="5" class="px-4 py-8 text-center text-slate-400">Keine Fragen vorhanden.</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="mt-4">{{ $questions->links() }}</div>
|
|
@endsection
|