Add grade/Klasse system: assign class levels to users, questions, and quizzes
- users.grade: set per child in admin (Klasse 1–10) - quizzes.grade, questions.grade: optional target class (null = all) - Children only see content matching their grade or without grade set - Admin views show grade badge in user list, quiz list, questions list - Quiz create/edit and user create/edit have Klasse dropdown
This commit is contained in:
@@ -67,6 +67,7 @@
|
||||
<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-center px-4 py-3 font-medium text-slate-600">Klasse</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 hidden sm:table-cell">Aktiv</th>
|
||||
<th class="px-4 py-3"></th>
|
||||
@@ -78,6 +79,7 @@
|
||||
<td class="px-4 py-3 text-slate-700 max-w-xs">
|
||||
<span class="line-clamp-2">{{ $q->question_text }}</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center text-xs text-slate-500">{{ $q->grade ? "Kl.".$q->grade : "–" }}</td>
|
||||
<td class="px-4 py-3 text-center">{{ $q->difficultyStars() }}</td>
|
||||
<td class="px-4 py-3 text-center hidden sm:table-cell">{{ $q->active ? '✅' : '⏸️' }}</td>
|
||||
<td class="px-4 py-3 text-right whitespace-nowrap">
|
||||
|
||||
@@ -21,6 +21,15 @@
|
||||
<label class="block text-sm font-medium text-slate-700 mb-1">Beschreibung (optional)</label>
|
||||
<textarea name="description" 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('description') }}</textarea>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-slate-700 mb-1">Zielklasse <span class="text-slate-400 font-normal">(leer = für alle Kinder)</span></label>
|
||||
<select name="grade" class="w-full border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-violet-500 outline-none">
|
||||
<option value="">Alle Klassen</option>
|
||||
@for($g=1;$g<=10;$g++)
|
||||
<option value="{{ $g }}" {{ old('grade','')==$g?'selected':'' }}>Klasse {{ $g }}</option>
|
||||
@endfor
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="w-full bg-violet-600 hover:bg-violet-700 text-white py-2 rounded-lg font-medium text-sm">Erstellen & Fragen hinzufügen →</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -25,6 +25,15 @@
|
||||
<label class="block text-sm font-medium text-slate-700 mb-1">Beschreibung</label>
|
||||
<textarea name="description" 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">{{ $quiz->description }}</textarea>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-slate-700 mb-1">Zielklasse <span class="text-slate-400 font-normal">(leer = für alle Kinder)</span></label>
|
||||
<select name="grade" class="w-full border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-violet-500 outline-none">
|
||||
<option value="">Alle Klassen</option>
|
||||
@for($g=1;$g<=10;$g++)
|
||||
<option value="{{ $g }}" {{ old('grade',$quiz->grade)==$g?'selected':'' }}>Klasse {{ $g }}</option>
|
||||
@endfor
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="checkbox" name="active" id="active" value="1" {{ $quiz->active?'checked':'' }} class="w-4 h-4 text-violet-600">
|
||||
<label for="active" class="text-sm text-slate-700">Quiz aktiv (für Kinder sichtbar)</label>
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
@forelse($quizzes as $quiz)
|
||||
<tr class="hover:bg-slate-50">
|
||||
<td class="px-4 py-3 text-slate-600">{{ $quiz->subject->icon }} {{ $quiz->subject->name }}</td>
|
||||
<td class="px-4 py-3 font-medium text-slate-800">{{ $quiz->title }}</td>
|
||||
<td class="px-4 py-3 font-medium text-slate-800">{{ $quiz->title }}
|
||||
@if($quiz->grade)<span class="ml-2 text-xs bg-indigo-100 text-indigo-700 px-2 py-0.5 rounded-full">Kl.{{ $quiz->grade }}</span>@endif
|
||||
</td>
|
||||
<td class="px-4 py-3 text-center">
|
||||
<span class="{{ $quiz->questions_count < 10 ? 'text-amber-600' : 'text-green-600' }} font-medium">
|
||||
{{ $quiz->questions_count }}/10
|
||||
|
||||
@@ -22,6 +22,15 @@
|
||||
<input name="password" type="password" required class="w-full border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-violet-500 focus:border-transparent outline-none">
|
||||
@error('password')<p class="text-red-500 text-xs mt-1">{{ $message }}</p>@enderror
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-slate-700 mb-1">Klasse</label>
|
||||
<select name="grade" class="w-full border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-violet-500 outline-none">
|
||||
<option value="">– Keine Klasse –</option>
|
||||
@for($g=1;$g<=10;$g++)
|
||||
<option value="{{ $g }}" {{ old('grade','')==$g?'selected':'' }}>Klasse {{ $g }}</option>
|
||||
@endfor
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="w-full bg-violet-600 hover:bg-violet-700 text-white py-2 rounded-lg font-medium text-sm">Konto erstellen</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -23,6 +23,15 @@
|
||||
<label class="block text-sm font-medium text-slate-700 mb-1">🪙 Münzen</label>
|
||||
<input name="points" type="number" min="0" value="{{ old('points',$user->points) }}" 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">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-slate-700 mb-1">Klasse</label>
|
||||
<select name="grade" class="w-full border border-slate-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-violet-500 outline-none">
|
||||
<option value="">– Keine Klasse –</option>
|
||||
@for($g=1;$g<=10;$g++)
|
||||
<option value="{{ $g }}" {{ old('grade',$user->grade)==$g?'selected':'' }}>Klasse {{ $g }}</option>
|
||||
@endfor
|
||||
</select>
|
||||
</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>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<tr>
|
||||
<th class="text-left px-4 py-3 font-medium text-slate-600">Name</th>
|
||||
<th class="text-left px-4 py-3 font-medium text-slate-600">E-Mail</th>
|
||||
<th class="text-center px-4 py-3 font-medium text-slate-600">Klasse</th>
|
||||
<th class="text-right px-4 py-3 font-medium text-slate-600">🪙 Münzen</th>
|
||||
<th class="text-right px-4 py-3 font-medium text-slate-600">Antworten</th>
|
||||
<th class="px-4 py-3"></th>
|
||||
@@ -21,7 +22,8 @@
|
||||
<tr class="hover:bg-slate-50">
|
||||
<td class="px-4 py-3 font-medium text-slate-800">{{ $u->name }}</td>
|
||||
<td class="px-4 py-3 text-slate-500">{{ $u->email }}</td>
|
||||
<td class="px-4 py-3 text-right font-bold text-amber-600">{{ $u->points }}</td>
|
||||
<td class="px-4 py-3 text-center text-sm text-slate-500">{{ $u->grade ? "Klasse ".$u->grade : "–" }}</td>
|
||||
<td class="px-4 py-3 text-right font-bold text-amber-600">{{ $u->points }}</td>
|
||||
<td class="px-4 py-3 text-right text-slate-500">{{ $u->attempts_count }}</td>
|
||||
<td class="px-4 py-3 text-right whitespace-nowrap">
|
||||
<a href="{{ route('admin.users.edit',$u) }}" class="text-violet-600 hover:underline mr-3">Bearbeiten</a>
|
||||
|
||||
Reference in New Issue
Block a user