@if($unit->children && $unit->children->count() > 0) {{-- Unit with children - Accordion style --}}
{{-- Level indicator --}}
@if($level > 0) @endif
{{-- Unit icon and content --}}
@if($level == 0)
{{ $loop->iteration }}
@else @endif
{{ $unit->title }}
{{ $unit->type_label }} {{ $unit->children->count() > 0 ? $unit->children->count() . ' lessons' : 'No lessons' }} @if($unit->materials && $unit->materials->count() > 0) {{ $unit->materials->count() }} materials @endif
{{-- Action buttons --}}
@if(has_feature('courses.content.nested_units')) @endif
{{-- Include materials partial for units with children --}} @include('admin.course_content.partials.unit-materials', ['unit' => $unit]) {{-- Show children units --}} @foreach($unit->children as $child) @include('admin.course_content.partials.unit-tree', ['unit' => $child, 'level' => $level + 1]) @endforeach
@else {{-- Unit without children - Expandable with no content area --}}
{{-- Level indicator --}}
@if($level > 0) @endif
{{-- Unit icon and content --}}
@if($level == 0)
{{ $loop->iteration }}
@else @endif
{{ $unit->title }}
{{ $unit->type_label }} @if($unit->materials && $unit->materials->count() > 0) {{ $unit->materials->count() }} materials @endif {{ $unit->access_type_label }}
{{-- Action buttons --}}
@if(has_feature('courses.content.nested_units')) @endif
{{-- Show materials section if there are materials OR if there are children (to show "no materials" message) --}} @if(($unit->materials && $unit->materials->count() > 0) || ($unit->children && $unit->children->count() > 0)) @include('admin.course_content.partials.unit-materials', ['unit' => $unit]) @endif {{-- Show general empty state only if no materials and no children --}} @if((!$unit->materials || $unit->materials->count() == 0) && (!$unit->children || $unit->children->count() == 0))
No content available

This unit doesn't have any sub-units or materials yet.

@if(has_feature('courses.content.nested_units')) @endif
@endif
@endif