@lang('survey_list')

@isset($breadcrumbs) @endisset
{{-- Survey Overview Card (Hero Section) --}}

{{ $record->name }}

@if($record->description)

{{ $record->description }}

@endif
{{-- Quick Stats --}}
Total Categories
{{ count($info) }}
Total Questions
{{ collect($info)->flatten()->count() }}
Linked Records
{{ count($survey_records) }}
{{-- Categories & Questions Section --}}

Categories And Questions

{{-- Loading Spinner Overlay --}}

Loading questions...

@forelse ($info as $categoryName => $questions) @php // Find the category object by name $category = $categories->firstWhere('name', $categoryName); @endphp
$record->id]) }}', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': '{{ csrf_token() }}' }, body: JSON.stringify({ category_id: this.categoryId, is_expanded: this.isExpanded }) }); const data = await response.json(); if (!data.success) { // Failed to save category state } } catch (error) { // Error saving category state } } }" data-category-id="{{ $category->id ?? null }}">
{{ count($questions) }} {{ count($questions) === 1 ? 'question' : 'questions' }}
@foreach ($questions as $question)

{{ $question->name }}

@if($question->description)

{{ $question->description }}

@endif
@if($question->contentType ?? null) {{ $question->contentType->name ?? 'N/A' }} @endif
@endforeach
@empty

No questions added yet. Add your first question below.

@endforelse {{-- Add Question Button --}}
{{-- Survey Records Section --}}

Survey Records

@forelse ($survey_records as $survey_record)
Record Type
{{ $survey_record['record_type'] }}
Record Name
{{ $survey_record['record_id'] }}
@empty

No records linked yet. Link a record below.

@endforelse {{-- Link Record Form --}}
@include('tenant.survey_records.form', [ 'survey' => $survey, 'recordType' => $recordType, ])
{{-- Add Question Modal --}}
{{-- Drag-Drop JavaScript for Categories --}}