{{-- resources/views/components/admin/questions/row.blade.php --}} @props([ 'question', 'skillId' => null, 'showCheckbox' => false, 'showSource' => true, 'showAuthor' => true, 'actions' => ['view' => true, 'duplicate' => true, 'delete' => true, 'generate' => false], ]) @php use Illuminate\Support\Str; $qid = $question->id; @endphp @if($showCheckbox)
@endif {{-- Question Details --}}
{{ Str::limit(strip_tags($question->question ?? ''), 60) }} @if($question->is_diagnostic) SENTINEL @endif @if(($question->source ?? null) === 'auto:sentinel') auto @endif
@if(!empty($question->correct_answer)) Answer: {{ Str::limit($question->correct_answer, 40) }} @endif
ID: {{ $qid }} @if($question->type) {{ $question->type->description ?? $question->type->type }} @endif @if($question->is_diagnostic) diagnostic @endif
{{-- Skill & Difficulty --}}
@if($question->skill)
Skill - {{ Str::limit($question->skill->id . ': ' . $question->skill->skill ?? 'Unknown', 25) }}
@if($question->skill->tracks && $question->skill->tracks->count())
@foreach($question->skill->tracks->take(2) as $track) {{ Str::limit($track->track, 15) }}@if($track->level) (L{{ $track->level->level }}) @endif @endforeach @if($question->skill->tracks->count() > 2) +{{ $question->skill->tracks->count() - 2 }} @endif
@endif @else No skill assigned @endif @php $diffLabel = optional($question->difficulty)->short_description ?? optional($question->difficulty)->description ?? null; $diffText = $diffLabel ?: 'No difficulty set'; $diffClass = 'bg-secondary'; if ($diffLabel) { $l = strtolower($diffLabel); $diffClass = str_contains($l, 'easy') ? 'bg-success' : (str_contains($l, 'medium') ? 'bg-warning' : 'bg-danger'); } @endphp
{{ $diffText }}
{{-- Status --}} @php $statusName = $question->status->status ?? 'Unknown'; // simple mapping (tweak as you like) $map = [ 'Public' => 'success', 'Draft' => 'secondary', 'Only Me' => 'dark', 'Restricted' => 'warning', 'Draft' => 'danger', ]; $cls = $map[$statusName] ?? 'info'; @endphp {{ $statusName }} {{-- QA Status --}} @php $qaMap = [ 'approved' => ['success','check-circle'], 'flagged' => ['danger','flag'], 'needs_revision' => ['warning','edit'], 'unreviewed' => ['info','clock'], 'ai_generated' => ['primary','robot'], ]; [$c,$i] = $qaMap[$question->qa_status ?? ''] ?? ['secondary','question']; $qaLabel = $question->qa_status ? ucfirst(str_replace('_',' ',$question->qa_status)) : 'Unknown'; @endphp {{ $qaLabel }} {{-- Source --}} @if($showSource) @php $author = $question->author; $name = $author->name ?? 'Unknown'; @endphp
{{ $name }}
{{ optional($question->created_at)->format('M j, Y') }}
{{ $question->source ?? 'Unknown' }} @endif {{-- Actions --}}
@if(!empty($actions['view'])) @endif @if(!empty($actions['duplicate'])) {{-- This will be auto-replaced to "Generate" by sanitizeRows() --}} @endif @if(!empty($actions['delete'])) @endif @if(!empty($actions['generate']) && $skillId) @endif