<div class="cp-curriculum__accordion accordion-content-wrapper" id="chaptersAccordion" role="tablist" aria-multiselectable="true">
    @foreach($course->chapters as $chapter)
        @if((!empty($chapter->chapterItems) and count($chapter->chapterItems)) or (!empty($chapter->quizzes) and count($chapter->quizzes)))
            <div class="cp-curriculum__chapter accordion-row">
                <div class="cp-curriculum__chapter-head" role="tab" id="chapter_{{ $chapter->id }}">
                    <button type="button" class="cp-curriculum__chapter-toggle js-chapter-collapse-toggle"
                            data-toggle="collapse" data-target="#collapseChapter{{ $chapter->id }}"
                            data-parent="#chaptersAccordion" aria-expanded="false" aria-controls="collapseChapter{{ $chapter->id }}">
                        <span class="cp-curriculum__chapter-icon" aria-hidden="true">
                            <i data-feather="grid" width="20" height="20"></i>
                        </span>
                        <span class="cp-curriculum__chapter-title">{{ $chapter->title }}</span>
                        <span class="cp-curriculum__chapter-badges">
                            <span class="cp-badge">{{ $chapter->getTopicsCount(true) }} {{ trans('public.parts') }}</span>
                            <span class="cp-badge cp-badge--muted">{{ convertMinutesToHourAndMinute($chapter->getDuration()) }} {{ trans('public.hr') }}</span>
                        </span>
                        <i class="collapse-chevron-icon cp-curriculum__chevron" data-feather="chevron-down" width="20" height="20"></i>
                    </button>
                </div>
                <div id="collapseChapter{{ $chapter->id }}" class="collapse" role="tabpanel" aria-labelledby="chapter_{{ $chapter->id }}">
                    <div class="cp-curriculum__chapter-body panel-collapse">
                        @if(!empty($chapter->chapterItems) and count($chapter->chapterItems))
                            @foreach($chapter->chapterItems 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')
                                    @include('web.default.course.tabs.contents.files', ['file' => $chapterItem->file, 'accordionParent' => 'chaptersAccordion'])
                                @elseif($chapterItem->type == \App\Models\WebinarChapterItem::$chapterTextLesson and !empty($chapterItem->textLesson) and $chapterItem->textLesson->status == 'active')
                                    @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')
                                    @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')
                                    @include('web.default.course.tabs.contents.quiz', ['quiz' => $chapterItem->quiz, 'accordionParent' => 'chaptersAccordion'])
                                @endif
                            @endforeach
                        @endif
                    </div>
                </div>
            </div>
        @endif
    @endforeach
</div>
