@php
$typeColor = match($lesson['type'] ?? 'text') {
'video' => 'bg-red-100 text-red-700',
'quiz' => 'bg-green-100 text-green-700',
'assignment' => 'bg-indigo-100 text-indigo-700',
'document' => 'bg-amber-100 text-amber-700',
default => 'bg-gray-100 text-gray-700',
};
@endphp
{{ ucfirst($lesson['type'] ?? 'Lesson') }}
@if(($lesson['duration_minutes'] ?? 0) > 0)
{{ $lesson['duration_minutes'] }} min
@endif
@if($lesson['is_free_preview'] ?? false)
Free Preview
@endif
{{ $lesson['title'] ?? 'Untitled Lesson' }}
@if(!empty($lesson['short_description']))
{{ $lesson['short_description'] }}
@endif
@if(!empty($lesson['description']))
{{ $lesson['description'] }}
@endif
@switch($lesson['type'] ?? 'text')
@case('video')
@php
$url = $lesson['content']['url'] ?? '';
$videoId = null;
if ($url) {
preg_match('/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/', $url, $matches);
$videoId = $matches[1] ?? null;
}
@endphp
@if($videoId)
@elseif($url)
@else
No video URL provided.
@endif
@break
@case('text')
@if(!empty($lesson['content']['content']))
{!! $lesson['content']['content'] !!}
@else
No content available for this lesson.
@endif
@break
@case('quiz')
@php
$questions = $lesson['content']['questions'] ?? [];
$settings = $lesson['content']['settings'] ?? [];
@endphp
@if(!empty($settings))
@if(($settings['passing_grade'] ?? 0) > 0)
Passing Grade: {{ $settings['passing_grade'] }}%
@endif
@if(($settings['max_attempts'] ?? 0) > 0)
Max Attempts: {{ $settings['max_attempts'] }}
@endif
@if(($settings['duration_minutes'] ?? 0) > 0)
Duration: {{ $settings['duration_minutes'] }} min
@endif
@endif
@if(count($questions) > 0)
@else
This quiz has no questions configured yet.
@endif
@break
@case('assignment')
@php
$instructions = $lesson['content']['instructions'] ?? ($lesson['content']['content'] ?? null);
$files = $lesson['content']['files'] ?? [];
$maxAttempts = $lesson['content']['max_attempts'] ?? 0;
$passingScore = $lesson['content']['passing_score'] ?? 0;
@endphp
@if($maxAttempts > 0 || $passingScore > 0)
@if($maxAttempts > 0)
Max Attempts: {{ $maxAttempts }}
@endif
@if($passingScore > 0)
Passing Score: {{ $passingScore }}%
@endif
@endif
@if($instructions)
Instructions
{!! $instructions !!}
@endif
@if(count($files) > 0)
@endif
Submit Your Work
Upload your completed assignment below.
@break
@case('document')
@if(!empty($lesson['content']['content']))
{!! $lesson['content']['content'] !!}
@endif
@php $files = $lesson['content']['files'] ?? []; @endphp
@if(count($files) > 0)
@endif
@break
@default
This lesson type ({{ $lesson['type'] ?? 'unknown' }}) is not supported yet.
@endswitch
@if(!empty($lesson['materials']) && count($lesson['materials']) > 0)