This commit is contained in:
Saufi
2026-05-19 09:53:36 +08:00
parent f39eca4b1c
commit b0eec13d5b
22 changed files with 1166 additions and 238 deletions

View File

@@ -52,10 +52,18 @@ class QuestionnaireSetController extends Controller
public function show(QuestionnaireSet $set): View
{
$set->load(['questions', 'creator']);
$set->load('creator');
$topLevel = $set->questions()
->whereNull('parent_id')
->with(['children' => fn($q) => $q->orderBy('sort_order')])
->orderBy('sort_order')
->get();
$totalCount = $set->questions()->count();
$usedInPrograms = $set->programs()->get();
return view('admin.questionnaires.show', compact('set', 'usedInPrograms'));
return view('admin.questionnaires.show', compact('set', 'topLevel', 'totalCount', 'usedInPrograms'));
}
public function edit(QuestionnaireSet $set): View