@extends('student.layouts.app') @section('styles') @endsection @section('title', __('dashboard.Materials') ) @section('content') @php $isArabic = app()->getLocale() === 'ar'; $mediaType = determineFileType($material->type); $supportsResume = in_array($mediaType, ['video', 'audio'], true); $typeLabels = [ 'image' => $isArabic ? 'صورة تعليمية' : 'Image', 'video' => $isArabic ? 'فيديو' : 'Video', 'audio' => $isArabic ? 'ملف صوتي' : 'Audio', 'pdf' => $isArabic ? 'ملف PDF' : 'PDF', 'file' => $isArabic ? 'ملف' : 'File', ]; $materialTypeLabel = $typeLabels[$mediaType] ?? ($isArabic ? 'محتوى تعليمي' : 'Learning content'); $materialDescription = filled($material->description) ? $material->description : ($isArabic ? 'تم تجهيز هذه المادة ضمن المقرر لتكمل متابعة الدرس الحالي.' : 'This material is available as part of the current lesson.'); $currentMaterialIndex = $courseMaterials->search(fn ($item) => (int) $item->id === (int) $material->id); $previousMaterial = $currentMaterialIndex !== false && $currentMaterialIndex > 0 ? $courseMaterials[$currentMaterialIndex - 1] : null; $nextMaterial = $currentMaterialIndex !== false && $currentMaterialIndex < ($courseMaterials->count() - 1) ? $courseMaterials[$currentMaterialIndex + 1] : null; $currentPosition = $currentMaterialIndex !== false ? $currentMaterialIndex + 1 : 1; $materialCount = $courseMaterials->count(); $downloadUrl = \Illuminate\Support\Facades\Storage::url($material->material); @endphp
@include('student.courses.inc.overview', ['course' => $course]) @include('student.courses.inc.tabs', ['course' => $course])
{{ $isArabic ? 'المواد التعليمية' : 'Materials' }} {{ $materialTypeLabel }} {{ $isArabic ? 'المادة' : 'Item' }} {{ $currentPosition }}/{{ max($materialCount, 1) }}

{{ $material->title }}

{{ $materialDescription }}

{{ $isArabic ? 'تنزيل المادة' : 'Download material' }}
@if ($material->lesson?->title) {{ $material->lesson->title }} @endif @if ($course->teacher?->name) {{ $course->teacher->name }} @endif {{ $material->created_at?->diffForHumans() }}
@switch($mediaType) @case('image') @include('student.courses.inc.course-images', ['material' => $material]) @break @case('video') @include('student.courses.inc.course-video', ['material' => $material])
{{ $isArabic ? 'نسبة المشاهدة' : 'Watch progress' }} 0%
{{ $isArabic ? 'سيتم استئناف المشاهدة تلقائياً من آخر نقطة وصلت إليها.' : 'Playback will automatically resume from your last saved position.' }}
@break @case('audio')
@include('student.courses.inc.course-audio', ['material' => $material])
{{ $isArabic ? 'سيتم استئناف الاستماع تلقائياً من آخر نقطة وصلت إليها.' : 'Playback will automatically resume from your last saved position.' }}
@break @case('pdf')
@include('student.courses.inc.course-file-view', ['material' => $material])
@break @default
@include('student.courses.inc.course-text', ['material' => $material])
@endswitch
@endsection @section('scripts') @if ($supportsResume) @else @endif @endsection