@extends('layouts.main_dashboard.app') @section('title', __('dashboard.All Courses')) @section('page_heading', __('dashboard.All Courses')) @section('page_subtitle', app()->getLocale() === 'ar' ? 'إدارة جميع المساقات وربطها بالمادة والصف والمعلم من شاشة أكثر وضوحًا.' : 'Manage all courses and their subject, class, and teacher links from a clearer screen.') @section('skip_page_hero', true) @php $isArabic = app()->getLocale() === 'ar'; $filtersOpenByDefault = request()->hasAny(['subject_id', 'school_class_id', 'teacher']); $coursesCollection = $courses->getCollection(); $assignedTeachers = $coursesCollection->filter(fn ($course) => filled(optional($course->teacher)->name))->count(); $assignedClasses = $coursesCollection->filter(fn ($course) => filled(optional($course->schoolClass)->name))->count(); $unassignedTeachers = $coursesCollection->count() - $assignedTeachers; @endphp @section('content')

{{ __('dashboard.All Courses') }}

{{ $isArabic ? 'راجع جميع المساقات مع المادة المرتبطة والصف والمعلم الحالي وإجراءات الإدارة الأساسية.' : 'Review all courses with their subject, class, current teacher, and core management actions.' }}

{{ $isArabic ? 'إجمالي المساقات' : 'Total courses' }}

{{ $courses->total() }}

{{ __('dashboard.Add New Course') }}

{{ $isArabic ? 'سجل المساقات' : 'Courses registry' }}

{{ __('dashboard.Courses') }}

{{ $isArabic ? 'عرض موحد للمساقات مع الربط الأكاديمي والتشغيلي.' : 'A unified view of courses with their academic and operational links.' }}

{{ $isArabic ? 'داخل الصفحة' : 'Visible now' }}

{{ $coursesCollection->count() }}

{{ $isArabic ? 'بمعلم معيّن' : 'With teacher' }}

{{ $assignedTeachers }}

{{ $isArabic ? 'بصف معيّن' : 'With class' }}

{{ $assignedClasses }}

{{ $isArabic ? 'بدون معلم' : 'Without teacher' }}

{{ $unassignedTeachers }}

{{ $isArabic ? 'تصفية المساقات' : 'Filter courses' }}

{{ $isArabic ? 'ابحث بحسب المادة أو الصف أو المعلم لتقليل نطاق العرض.' : 'Filter by subject, class, or teacher to narrow the list.' }}

{{ __('dashboard.Reset') }}
@if($courses->isEmpty())

{{ __('dashboard.No data found') }}

{{ $isArabic ? 'لا توجد مساقات مطابقة للفلاتر الحالية.' : 'No courses match the current filters.' }}

@else
@foreach($courses as $course) @endforeach
{{ $isArabic ? 'المساق' : 'Course' }} {{ $isArabic ? 'المادة المرتبطة' : 'Linked subject' }} {{ $isArabic ? 'الصف' : 'Class' }} {{ $isArabic ? 'المعلم' : 'Teacher' }} {{ __('dashboard.Actions') }}
@if($course->image) {{ $course->name }} @else @endif

{{ $course->name }}

#{{ $course->id }}

{{ collect([$course->subject->grade->stage->name ?? null, $course->subject->grade->name ?? null, $course->subject->name ?? null])->filter()->implode(' / ') ?: '-' }} @if($course->schoolClass?->name) {{ $course->schoolClass->name }} @else {{ __('dashboard.Not assigned yet') }} @endif @if($course->teacher?->name) {{ $course->teacher->name }} @else {{ __('dashboard.Not assigned yet') }} @endif
{{ __('dashboard.View') }} {{ __('dashboard.Edit') }}
@csrf @method('DELETE')
@if ($courses->hasPages())
{{ $courses->appends(request()->query())->links('pagination::simple-tailwind') }}
@endif @endif
@endsection