@extends('layouts.main_dashboard.app') @section('title', __('dashboard.Class Schedule')) @section('page_heading', __('dashboard.Class Schedule')) @section('page_subtitle', app()->getLocale() === 'ar' ? 'إدارة جدول الصف أسبوعيًا مع عرض أوضح للفترات والإجراءات المباشرة.' : 'Manage the class weekly schedule with a clearer view of periods and direct actions.') @section('skip_page_hero', true) @php $isArabic = app()->getLocale() === 'ar'; $weekDays = ['Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']; $dayLabels = collect($weekDays)->mapWithKeys(fn ($day) => [$day => __('dashboard.' . $day)]); $usedDays = collect($weekDays)->filter(fn ($day) => $groupedByDay->get($day, collect())->isNotEmpty())->count(); $freeSlots = (count($periodRange) * count($weekDays)) - $summary['total_entries']; $filtersApplied = collect($filters)->filter(fn ($value) => filled($value))->count(); $copyRoute = $otherClasses->isNotEmpty() ? route('admin.schedules.copy', [$schoolClass->id, $otherClasses->first()->id]) : null; @endphp @section('content')

{{ $isArabic ? 'إدارة جدول الصف' : 'Class schedule management' }}

{{ $schoolClass->name }}

{{ $isArabic ? 'اعرض الفترات الأسبوعية، راجع المواد والمعلمين، ثم نفّذ التعديل أو النسخ من واجهة عملية ومباشرة.' : 'Review weekly periods, inspect courses and teachers, then update or copy the schedule from a direct workspace.' }}

{{ $isArabic ? 'إجمالي الإدخالات' : 'Total entries' }}

{{ $summary['total_entries'] }}

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

{{ $isArabic ? 'ملخص الجدول' : 'Schedule summary' }}

{{ $isArabic ? 'نظرة سريعة' : 'Quick overview' }}

{{ $isArabic ? 'حالة الجدول الحالي قبل التعديل أو النسخ إلى صف آخر.' : 'Current schedule status before editing or copying to another class.' }}

{{ $isArabic ? 'المواد المغطاة' : 'Covered courses' }}

{{ $summary['courses'] }}

{{ $isArabic ? 'الدروس المستخدمة' : 'Used lessons' }}

{{ $summary['lessons'] }}

{{ $isArabic ? 'الأيام المفعلة' : 'Active days' }}

{{ $usedDays }}

{{ $isArabic ? 'فترات شاغرة' : 'Free slots' }}

{{ max(0, $freeSlots) }}

{{ $isArabic ? 'تصفية الجدول' : 'Filter schedule' }}

{{ $isArabic ? 'اعرض يومًا أو فترة أو مادة أو معلمًا محددًا للوصول بسرعة إلى الإدخالات المطلوبة.' : 'Filter by day, period, subject, teacher, or search term to focus the schedule.' }}

{{ __('dashboard.Reset filters') }}
@if($filtersApplied > 0)
{{ $isArabic ? 'فلاتر نشطة' : 'Active filters' }} @if($filters['day_of_week']) {{ $dayLabels[$filters['day_of_week']] }} @endif @if($filters['period']) {{ __('dashboard.Period') }} {{ $filters['period'] }} @endif @if($filters['search']) {{ $filters['search'] }} @endif
@endif

{{ $isArabic ? 'المصفوفة الأسبوعية' : 'Weekly matrix' }}

{{ $isArabic ? 'توزيع الفترات على أيام الأسبوع' : 'Periods distributed across the week' }}

{{ $isArabic ? 'شبكة سريعة توضح ما إذا كانت كل فترة مشغولة أو فارغة.' : 'A quick matrix showing whether each period is occupied or empty.' }}

@if($schedules->isEmpty())

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

{{ $isArabic ? 'لا توجد حصص مطابقة للنطاق الحالي.' : 'No schedule entries match the current scope.' }}

@else
@foreach($weekDays as $day) @endforeach @foreach($periodRange as $period) @foreach($weekDays as $day) @php $entries = $groupedByDay->get($day, collect())->where('period', $period); @endphp @endforeach @endforeach
{{ __('dashboard.Period') }}{{ $dayLabels[$day] }}

{{ __('dashboard.Period') }} {{ $period }}

@if($entries->isEmpty())
{{ __('dashboard.No class') }}
@else
@foreach($entries as $entry)

{{ $entry->course?->name ?? __('dashboard.No Course') }}

{{ \Illuminate\Support\Carbon::parse($entry->start_time)->format('H:i') }} - {{ \Illuminate\Support\Carbon::parse($entry->end_time)->format('H:i') }}

@if($entry->lesson)

{{ $entry->lesson->title }}

@endif
@endforeach
@endif
@endif

{{ $isArabic ? 'الإدارة التنفيذية' : 'Execution list' }}

{{ $isArabic ? 'جميع حصص الصف الحالية' : 'All current class entries' }}

{{ $isArabic ? 'القائمة التالية مناسبة للتعديل والحذف السريع لكل حصة.' : 'Use this list for quick editing and deletion of each entry.' }}

@if($schedules->isEmpty())
{{ $isArabic ? 'لا توجد إدخالات معروضة حاليًا.' : 'No visible entries right now.' }}
@else
@foreach($schedules as $entry) @endforeach
{{ $isArabic ? 'اليوم' : 'Day' }} {{ __('dashboard.Period') }} {{ $isArabic ? 'المساق' : 'Course' }} {{ $isArabic ? 'الدرس' : 'Lesson' }} {{ __('dashboard.Time') }} {{ __('dashboard.Actions') }}
{{ $dayLabels[$entry->day_of_week] ?? $entry->day_of_week }} {{ $entry->period }}

{{ $entry->course?->name ?? __('dashboard.No Course') }}

{{ $entry->lesson?->title ?? '-' }} {{ \Illuminate\Support\Carbon::parse($entry->start_time)->format('H:i') }} - {{ \Illuminate\Support\Carbon::parse($entry->end_time)->format('H:i') }}
{{ __('dashboard.Edit') }}
@csrf @method('DELETE')
@endif
@if($otherClasses->isNotEmpty()) @push('scripts') @endpush @endif @endsection