@foreach($course->chapters as $chapter) @if((!empty($chapter->chapterItems) and count($chapter->chapterItems)) or (!empty($chapter->quizzes) and count($chapter->quizzes)))
@if(!empty($chapter->chapterItems) and count($chapter->chapterItems)) @php //$col = collect($chapter->chapterItems); //dd($col->sortByDesc('type')); $hasFile = false; $hasAssignment = false; $hasClassroomLearningGuide = false; $hasStudentHandbook = false; $hasAssessment = false; @endphp @foreach(collect($chapter->chapterItems)->sortByDesc('type') as $chapterItem) @if($chapterItem->type == \App\Models\WebinarChapterItem::$chapterSession and !empty($chapterItem->session) and $chapterItem->session->status == 'active') @include('web.default.course.tabs.contents.sessions' , ['session' => $chapterItem->session, 'accordionParent' => 'chaptersAccordion']) @elseif($chapterItem->type == \App\Models\WebinarChapterItem::$chapterFile and !empty($chapterItem->file) and $chapterItem->file->status == 'active') @if($chapterItem->file->upload_file_type == 1) @if(!$hasClassroomLearningGuide)
Classroom Learning Guide
@php $hasClassroomLearningGuide = true; @endphp @endif @include('web.default.course.tabs.contents.files' , ['file' => $chapterItem->file, 'accordionParent' => 'chaptersAccordion']) @elseif($chapterItem->file->upload_file_type == 2) @if(!$hasStudentHandbook)
Student Handbook
@php $hasStudentHandbook = true; @endphp @endif @include('web.default.course.tabs.contents.files' , ['file' => $chapterItem->file, 'accordionParent' => 'chaptersAccordion']) @elseif($chapterItem->file->upload_file_type == 3) @if(!$hasAssessment)
Trainer Assessment Guide
@php $hasAssessment = true; @endphp @endif @endif @elseif($chapterItem->type == \App\Models\WebinarChapterItem::$chapterTextLesson and !empty($chapterItem->textLesson) and $chapterItem->textLesson->status == 'active') @if($loop->first)
Text Lesson
@endif @include('web.default.course.tabs.contents.text_lessons' , ['textLesson' => $chapterItem->textLesson, 'accordionParent' => 'chaptersAccordion']) @elseif($chapterItem->type == \App\Models\WebinarChapterItem::$chapterAssignment and !empty($chapterItem->assignment) and $chapterItem->assignment->status == 'active') @if(!$hasAssignment)
Assessment
@php $hasAssignment = true; @endphp @endif @include('web.default.course.tabs.contents.assignment' ,['assignment' => $chapterItem->assignment, 'accordionParent' => 'chaptersAccordion']) @elseif($chapterItem->type == \App\Models\WebinarChapterItem::$chapterQuiz and !empty($chapterItem->quiz) and $chapterItem->quiz->status == 'active') @if($loop->first)
Quiz
@endif @include('web.default.course.tabs.contents.quiz' ,['quiz' => $chapterItem->quiz, 'accordionParent' => 'chaptersAccordion']) @endif @endforeach @endif
@endif @endforeach