{{-- School curriculum PARTS — tabbed by level: Fields / Tracks / Skills / Questions / QA Review, each with a count + CRUD into the scoped Content resources. Scoped to public + this org's own content. Vars: $d. --}} @php $c = $d['counts']; $canEditAll = $d['canEditAll'] ?? false; $res = [ 'fields' => \App\Filament\Resources\FieldResource::class, 'tracks' => \App\Filament\Resources\TrackResource::class, 'skills' => \App\Filament\Resources\SkillResource::class, 'questions' => \App\Filament\Resources\QuestionResource::class, ]; // Host-relative URLs (isAbsolute:false) so links work on localhost OR 127.0.0.1. $newUrl = fn (string $tab) => $res[$tab]::getUrl('create', [], false); $editUrl = function (string $tab, array $row) use ($res, $canEditAll) { return (($row['owned'] ?? false) || $canEditAll) ? $res[$tab]::getUrl('edit', ['record' => $row['id']], false) : null; }; $badge = function (array $r): array { if (empty($r['owned'])) { return ['Public', 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300']; } return ($r['status'] ?? '') === 'Published' ? ['Yours · Published', 'bg-success-100 text-success-700'] : ['Yours · Draft', 'bg-warning-100 text-warning-700']; }; $qaClass = [ 'approved' => 'bg-success-100 text-success-700', 'flagged' => 'bg-danger-100 text-danger-700', 'needs_revision' => 'bg-warning-100 text-warning-700', ]; $newBtn = fn (string $tab, string $label) => '+ New ' . $label . ''; @endphp
{{-- Tab headers with counts --}}
@foreach (['fields' => 'Fields', 'tracks' => 'Tracks', 'skills' => 'Skills', 'questions' => 'Questions', 'qa' => 'QA Review'] as $key => $label) @endforeach
{{-- FIELDS --}}
{!! $newBtn('fields', 'Field') !!}
@forelse ($d['fields'] as $f) @php [$bl, $bc] = $badge($f); $eu = $editUrl('fields', $f); @endphp @empty @endforelse
FieldTracksQuestionsScope
@if ($eu){{ $f['name'] }}@else{{ $f['name'] }}@endif {{ $f['tracks'] }} {{ $f['questions'] }} {{ $bl }}
No fields.
{{-- TRACKS --}}
{!! $newBtn('tracks', 'Track') !!}
@forelse ($d['tracks'] as $t) @php [$bl, $bc] = $badge($t); $eu = $editUrl('tracks', $t); @endphp @empty @endforelse
TrackSkillsQuestionsScope
@if ($eu){{ $t['name'] }}@else{{ $t['name'] }}@endif {{ $t['skills'] }} {{ $t['questions'] }} {{ $bl }}
No tracks.
{{-- SKILLS --}}
{!! $newBtn('skills', 'Skill') !!}
@forelse ($d['skills'] as $s) @php [$bl, $bc] = $badge($s); $eu = $editUrl('skills', $s); @endphp @empty @endforelse
SkillQuestionsScope
@if ($eu){{ $s['name'] }}@else{{ $s['name'] }}@endif {{ $s['questions'] }} {{ $bl }}
No skills.
{{-- QUESTIONS --}}
{{ $c['questions'] }} in your curriculum — {{ $d['ownQuestionCount'] }} created by your org; the rest public AGS content. {!! $newBtn('questions', 'Question') !!}
@forelse ($d['ownQuestions'] as $q) @empty @endforelse
#Question (yours)StatusQA
{{ $q['id'] }} {{ $q['question'] }} {{ $q['status'] }} {{ str_replace('_', ' ', $q['qa']) }}
Your org hasn't created any questions yet — use “+ New Question”.
{{-- QA REVIEW --}}
@forelse ($d['qaReview'] as $q)
#{{ $q['id'] }} {{ $q['question'] }} {{ str_replace('_', ' ', $q['qa']) }}
@empty
Nothing awaiting QA — all your questions are approved.
@endforelse