{{-- 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)
{{ $label }}
{{ $c[$key] }}
@endforeach
{{-- FIELDS --}}
{!! $newBtn('fields', 'Field') !!}
Field Tracks Questions Scope
@forelse ($d['fields'] as $f)
@php
[$bl, $bc] = $badge($f);
$eu = $editUrl('fields', $f);
@endphp
@if ($eu){{ $f['name'] }} @else{{ $f['name'] }} @endif
{{ $f['tracks'] }}
{{ $f['questions'] }}
{{ $bl }}
@empty
No fields.
@endforelse
{{-- TRACKS --}}
{!! $newBtn('tracks', 'Track') !!}
Track Skills Questions Scope
@forelse ($d['tracks'] as $t)
@php
[$bl, $bc] = $badge($t);
$eu = $editUrl('tracks', $t);
@endphp
@if ($eu){{ $t['name'] }} @else{{ $t['name'] }} @endif
{{ $t['skills'] }}
{{ $t['questions'] }}
{{ $bl }}
@empty
No tracks.
@endforelse
{{-- SKILLS --}}
{!! $newBtn('skills', 'Skill') !!}
Skill Questions Scope
@forelse ($d['skills'] as $s)
@php
[$bl, $bc] = $badge($s);
$eu = $editUrl('skills', $s);
@endphp
@if ($eu){{ $s['name'] }} @else{{ $s['name'] }} @endif
{{ $s['questions'] }}
{{ $bl }}
@empty
No skills.
@endforelse
{{-- QUESTIONS --}}
{{ $c['questions'] }} in your curriculum — {{ $d['ownQuestionCount'] }} created by your org; the rest public AGS content.
{!! $newBtn('questions', 'Question') !!}
# Question (yours) Status QA
@forelse ($d['ownQuestions'] as $q)
{{ $q['id'] }}
{{ $q['question'] }}
{{ $q['status'] }}
{{ str_replace('_', ' ', $q['qa']) }}
@empty
Your org hasn't created any questions yet — use “+ New Question”.
@endforelse
{{-- QA REVIEW --}}
@forelse ($d['qaReview'] as $q)
#{{ $q['id'] }}
{{ $q['question'] }}
{{ str_replace('_', ' ', $q['qa']) }}
Approve
Revise
Flag
@empty
Nothing awaiting QA — all your questions are approved.
@endforelse