50 lines
3.0 KiB
PHP
50 lines
3.0 KiB
PHP
@extends('layouts.admin')
|
|
@section('title','Frage bearbeiten')
|
|
@section('content')
|
|
<div class="max-w-2xl">
|
|
<a href="{{ route('admin.questions.index') }}" class="text-sm text-slate-500 hover:text-slate-700 mb-4 inline-block">← Zurück</a>
|
|
<div class="bg-white rounded-xl shadow-sm border border-slate-200 p-6">
|
|
<h2 class="font-semibold text-slate-800 mb-5">Frage bearbeiten</h2>
|
|
<form method="POST" action="{{ route('admin.questions.update',$question) }}" class="space-y-5">
|
|
@csrf @method('PUT')
|
|
<div class="grid grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-slate-700 mb-1">Fach</label>
|
|
<select name="subject_id" required class="w-full border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-violet-500 outline-none">
|
|
@foreach($subjects as $s)<option value="{{ $s->id }}" {{ $s->id==$question->subject_id?'selected':'' }}>{{ $s->icon }} {{ $s->name }}</option>@endforeach
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-slate-700 mb-1">Schwierigkeit</label>
|
|
<select name="difficulty" required class="w-full border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-violet-500 outline-none">
|
|
@foreach([1=>'⭐ Leicht (5 Münzen)',2=>'⭐⭐ Mittel (10 Münzen)',3=>'⭐⭐⭐ Schwer (20 Münzen)'] as $v=>$l)
|
|
<option value="{{ $v }}" {{ $question->difficulty==$v?'selected':'' }}>{{ $l }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-slate-700 mb-1">Frage</label>
|
|
<textarea name="question_text" required rows="2" class="w-full border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-violet-500 outline-none">{{ old('question_text',$question->question_text) }}</textarea>
|
|
</div>
|
|
@if($question->type==='multiple_choice')
|
|
<div>
|
|
<label class="block text-sm font-medium text-slate-700 mb-2">Antwortmöglichkeiten</label>
|
|
@foreach($question->answerOptions as $i=>$opt)
|
|
<div class="flex items-center gap-3 mb-2">
|
|
<input type="radio" name="correct" value="{{ $i }}" {{ $opt->is_correct?'checked':'' }} class="accent-violet-600">
|
|
<input type="text" name="options[]" value="{{ $opt->text }}" class="flex-1 border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-violet-500 outline-none">
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
<div class="flex items-center gap-3">
|
|
<input type="checkbox" name="active" id="active" value="1" {{ $question->active?'checked':'' }} class="accent-violet-600">
|
|
<label for="active" class="text-sm font-medium text-slate-700">Frage aktiv</label>
|
|
</div>
|
|
<button type="submit" class="w-full bg-violet-600 hover:bg-violet-700 text-white py-2 rounded-lg font-medium text-sm">Speichern</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
@endsection
|