@extends('layout.online_learning.online_learning_app') @push('style') @vite(['resources/css/layout/banner_main.css', 'resources/css/landing.css', 'resources/css/animate.css', 'resources/css/students/student.css', 'resources/css/unit/unit_detail.css']) @endpush @php use App\Enums\TypeExerciseStudentEnum; $domain = url('/'); $type_teacher_course = 2; $slides = json_decode($lessonOnlineLearningData->lesson_file); $link_youtubes = json_decode($lessonOnlineLearningData->lesson_video); if ($slides !== null) { $paths = []; $fileExtensions = []; foreach ($slides as $index => $slide) { $paths[$index] = 'http://docs.google.com/gview?url=' . Storage::url($slide) . '&embedded=true'; $fileExtensions[$index] = strtolower(pathinfo($slide, PATHINFO_EXTENSION)); } } if ($link_youtubes !== null) { $embed_links = []; foreach ($link_youtubes as $index => $link_youtube) { preg_match( '/(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:watch\?(?:.*&)?v=|embed\/|v\/|.+?\/))([^\s&]+)/', $link_youtube, $matches, ); $video_id = $matches[1] ?? ''; // Tạo URL nhúng $embed_links[$index] = $video_id; } } foreach ($listLessonOnlineLearning as $index => $listLesson) { if ($listLesson->id === $lessonOnlineLearningData->lesson_id) { if (count($listLessonOnlineLearning) === 1) { $prevUnit = null; $nextUnit = null; } else { if ($index === 0) { $prevUnit = null; $nextUnit = $listLessonOnlineLearning[$index + 1]; } elseif ($index === count($listLessonOnlineLearning) - 1) { $prevUnit = $listLessonOnlineLearning[$index - 1]; $nextUnit = null; } else { $prevUnit = $listLessonOnlineLearning[$index - 1]; $nextUnit = $listLessonOnlineLearning[$index + 1]; } } } } function getByType($type, $getBestPointHistory) { return collect($getBestPointHistory)->where('type', $type)->first(); } @endphp @section('content')
@include('custom_errors.session-errors')
@if ($prevUnit) Bài Trước @else Bài Trước @endif @if ($nextUnit) Bài Sau @else Bài Sau @endif
Bài giảng bằng Powerpoint
@if ($slides === null)
Không có slide bài giảng
@else {{-- --}}
is_slide_viewed }}> @if (strtolower(pathinfo($slides[0], PATHINFO_EXTENSION)) === 'pdf') @include('open_viewpdf.open_pdf', ['filePath' => Storage::url($slides[0])]) @elseif (strtolower(pathinfo($slides[0], PATHINFO_EXTENSION)) === 'pptx') @else @endif
@if (count($slides) > 1) @endif @endif
Video bài giảng
is_video_viewed }}> @if ($link_youtubes === null)
Không có video bài giảng
@else
@if (!empty($link_youtubes) && is_array($link_youtubes)) {{-- --}}
@endif
    @if (!empty($videos) && is_array($videos)) @foreach ($videos as $index => $video)
  • @endforeach @endif @if (!empty($link_youtubes) && is_array($link_youtubes)) @foreach ($embed_links as $index => $path)
  • @endforeach @endif
@endif
Bài tập
@if ( $teacherCourseDetail->teacher_course_exercise || $teacherCourseDetail->teacher_course_test || $teacherCourseDetail->teacher_course_exam)
Thời gian
Deadline
Điểm cao nhất
{{-- Exercise --}} @if ($teacherCourseDetail->teacher_course_exercise)
Bài tập về nhà
{{ $teacherCourseDetail->teacher_course_exercise->time }} phút
{{ getFormatDate($teacherCourseDetail->teacher_course_exercise->deadline) }}
{{ getByType(TypeExerciseStudentEnum::EXERCISE, $getBestPointHistory)->best_score ?? 0 }} / {{ getByType(TypeExerciseStudentEnum::EXERCISE, $getBestPointHistory)->total_question ?? $teacherCourseDetail->teacher_course_exercise->question_number }}
@if (checkLimitDoExercise($lessonOnlineLearningData->lesson_id, TypeExerciseStudentEnum::EXERCISE)) Đã hoàn thành @elseif (checkTimeDeadline($teacherCourseDetail->teacher_course_exercise->deadline)) Quá ngày thực hiện @else Làm bài @endif
{{-- @endif --}}
Bạn cần thực hiện các bài test này trước khi qua bài mới
@endif {{-- Test --}} @if ($teacherCourseDetail->teacher_course_test)
Bài kiểm tra
{{ $teacherCourseDetail->teacher_course_test->time }} phút
{{ getFormatDate($teacherCourseDetail->teacher_course_test->deadline) }}
{{ getByType(TypeExerciseStudentEnum::TEST, $getBestPointHistory)->best_score ?? 0 }} / {{ getByType(TypeExerciseStudentEnum::TEST, $getBestPointHistory)->total_question ?? $teacherCourseDetail->teacher_course_test->question_number }}
@if (checkLimitDoExercise($lessonOnlineLearningData->lesson_id, TypeExerciseStudentEnum::TEST)) Đã hoàn thành @elseif (checkTimeDeadline($teacherCourseDetail->teacher_course_test->deadline)) Quá ngày thực hiện @else Làm bài @endif
@endif {{-- Exam --}} @if ($teacherCourseDetail->teacher_course_exam)
Thi học kỳ
{{ $teacherCourseDetail->teacher_course_exam->time }} phút
{{ getFormatDate($teacherCourseDetail->teacher_course_exam->deadline) }}
{{ getByType(TypeExerciseStudentEnum::EXAM, $getBestPointHistory)->best_score ?? 0 }} / {{ getByType(TypeExerciseStudentEnum::EXAM, $getBestPointHistory)->total_question ?? $teacherCourseDetail->teacher_course_exam->question_number }}
@if (checkLimitDoExercise($lessonOnlineLearningData->lesson_id, TypeExerciseStudentEnum::EXAM)) Đã hoàn thành @elseif (checkTimeDeadline($teacherCourseDetail->teacher_course_exam->deadline)) Quá ngày thực hiện @else Làm bài @endif
@endif
@else
Không có bài tập
@endif
@if ($prevUnit) Bài Trước @else Bài Trước @endif @if ($nextUnit) Bài Sau @else Bài Sau @endif
@endsection @push('script') @vite(['resources/js/unit.js', 'resources/js/unit/check_slide_video_progress.js']) @endpush