@php
// Ensure categories is set and is a collection
if (!isset($categories) || !$categories) {
$categories = collect();
}
@endphp
@if($categories && $categories->count() > 0)
{{-- Category Navigation Tabs --}}
@if($categories->count() > 1)
@foreach($categories as $cat)
@php
try {
$stats = $this->getCategoryStats($cat);
} catch (\Exception $e) {
$stats = ['completed' => 0, 'total' => 0];
}
$isActive = isset($selectedCategoryId) && $selectedCategoryId == $cat->id;
@endphp
-
@endforeach
@endif
{{-- Selected Category Content --}}
@if(isset($category) && $category)
{{ $category->name ?? 'Training' }}
@if(isset($category->description) && $category->description)
{{ $category->description }}
@endif
@php
try {
$categoryStats = $this->getCategoryStats($category);
} catch (\Exception $e) {
$categoryStats = ['completed' => 0, 'total' => 0];
}
@endphp
@if($categoryStats['total'] > 0)
{{ $categoryStats['completed'] }} of {{ $categoryStats['total'] }} videos completed
@endif
@if(isset($videos) && $videos && $videos->count() > 0)
@foreach($videos as $video)
@if(isset($video) && $video && isset($video->id) && $video->id && isset($video->video_file_path) && $video->video_file_path)
{{ $video->title ?? 'Untitled Video' }}
@if($this->isCompleted($video->id))
Completed
@endif
@if($video->description)
{{ $video->description }}
@endif
@if(!$this->isCompleted($video->id))
@else
Completed
@endif
@endif
@endforeach
@else
No training videos available in this category at this time.
@endif
@else
Please select a training category.
@endif
@else
No training categories available for your user role.
@endif