@extends('layouts.app') @section('title', 'جدول المواعيد') @section('page_title', 'جدول المواعيد') @php $days = ['السبت','الأحد','الإثنين','الثلاثاء','الأربعاء','الخميس','الجمعة']; // Week starts Saturday, ends Friday $fmt12 = function($t) { if (!$t) return ''; [$hh,$mm] = explode(':', $t); $ampm = ((int)$hh) < 12 ? 'صباحًا' : 'مساءً'; $h12 = ((int)$hh) % 12; if ($h12 === 0) { $h12 = 12; } return sprintf('%02d:%s %s', $h12, $mm, $ampm); }; // Build 15-min time options once for the whole page $timeOptions = []; for ($h = 0; $h < 24; $h++) { for ($m = 0; $m < 60; $m += 15) { $timeOptions[] = sprintf('%02d:%02d', $h, $m); } } @endphp @section('content') @if($errors->any())
حدثت أخطاء:
@endif @if(session('status'))
{{ session('status') }}
@endif
ساعات العمل الأسبوعية
@php $byDay = $schedules->keyBy('weekday'); $slotDefault = config('appointments.slot_minutes', 15); // Get last schedule for auto-fill $lastSchedule = $schedules->sortBy('created_at')->last(); @endphp
الأسبوع يبدأ بالسبت وينتهي بالجمعة. سيتم ملء الحقول تلقائياً بناءً على آخر جدول.
@csrf
@for($i=6;$i>=0;$i--) {{-- Start with Saturday (6) to Friday (5) --}} @php $dayIndex = ($i + 1) % 7; @endphp @php $row = $byDay->get($dayIndex); $enabled = (bool) $row; $startSel = $row->start_time ?? ($lastSchedule ? $lastSchedule->start_time : null); $endSel = $row->end_time ?? ($lastSchedule ? $lastSchedule->end_time : null); @endphp @endfor
اليوم من إلى يوم إجازة
{{ $days[$dayIndex] }}
@push('scripts') @endpush
إضافة فترة عمل أسبوعية
@csrf
الجدول الأسبوعي الحالي
@forelse($schedules as $sch) @empty @endforelse
اليوم الوقت مدة الحجز الحالة فترات الراحة
{{ $days[$sch->weekday] ?? $sch->weekday }} {{ $fmt12($sch->start_time) }} - {{ $fmt12($sch->end_time) }} {{ $sch->slot_minutes }} د {{ $sch->is_active ? 'مفعل':'متوقف' }} @if($sch->breaks->count()) @foreach($sch->breaks as $br) {{ $fmt12($br->start_time) }} - {{ $fmt12($br->end_time) }}
@csrf @method('DELETE')
@endforeach @else - @endif
@csrf
@csrf @method('DELETE')
لا توجد جداول بعد
استثناءات الأيام
@csrf
@forelse($exceptions as $ex) @empty @endforelse
التاريخ الحالة الوقت ملاحظة
{{ $ex->date->format('Y-m-d') }} {{ $ex->is_working ? 'يوم عمل':'إجازة' }} @if($ex->start_time && $ex->end_time) {{ $fmt12($ex->start_time) }} - {{ $fmt12($ex->end_time) }} @else - @endif {{ $ex->note }}
@csrf @method('DELETE')
لا توجد استثناءات
@endsection