@extends('layouts.app') @section('title', 'تقويم مواعيد الدوام - DOTS HR Pro') @push('styles') @endpush @section('content') @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif {{-- تحذير في حال عدم وجود مواعيد دوام --}} @if($shifts->count() === 0)
لا توجد مواعيد دوام محددة!

يجب أولاً إنشاء مواعيد الدوام (صباحي، مسائي، رمضان...) قبل تحديد فترات التقويم.

إنشاء مواعيد الدوام
@endif {{-- بطاقة الفترة الحالية --}} @php $today = now()->toDateString(); $currentPeriod = $periods->first(function($p) use ($today) { return $p->is_active && $p->start_date->format('Y-m-d') <= $today && $p->end_date->format('Y-m-d') >= $today; }); @endphp @if($currentPeriod)

الفترة الحالية: {{ $currentPeriod->name }}

{{ $currentPeriod->start_date->format('Y/m/d') }} — {{ $currentPeriod->end_date->format('Y/m/d') }} · {{ $currentPeriod->days_count }} يوم · {{ $currentPeriod->workShift->name }}

ساعات العمل
{{ \Carbon\Carbon::parse($currentPeriod->workShift->start_time)->format('h:i A') }} - {{ \Carbon\Carbon::parse($currentPeriod->workShift->end_time)->format('h:i A') }}
{{ $currentPeriod->workShift->total_hours }} ساعة
@endif {{-- الإحصائيات --}}
{{ $periods->count() }}
إجمالي الفترات
{{ $periods->where('is_active', true)->count() }}
فترات فعّالة
{{ $shifts->count() }}
مواعيد الدوام
{{ $periods->where('is_recurring', true)->count() }}
فترات متكررة
{{-- شريط الفلترة --}} {{-- التقويم الزمني --}} @if($periods->count() > 0)

{{ $year }}

@php $months = ['يناير','فبراير','مارس','أبريل','مايو','يونيو','يوليو','أغسطس','سبتمبر','أكتوبر','نوفمبر','ديسمبر']; $currentMonth = now()->month; $currentYear = now()->year; $yearStart = \Carbon\Carbon::create($year, 1, 1); $yearEnd = \Carbon\Carbon::create($year, 12, 31); $totalDays = $yearStart->diffInDays($yearEnd) + 1; @endphp
@foreach($months as $i => $m)
{{ $m }}
@endforeach
@for($i = 0; $i < 12; $i++)
@endfor
{{-- خط اليوم --}} @if($year == $currentYear) @php $todayOffset = now()->startOfDay()->diffInDays($yearStart); $todayPercent = ($todayOffset / $totalDays) * 100; @endphp
@endif {{-- أشرطة الفترات --}} @foreach($periods as $period) @php $barStart = max($period->start_date, $yearStart); $barEnd = min($period->end_date, $yearEnd); if ($barStart > $yearEnd || $barEnd < $yearStart) continue; $offsetDays = $yearStart->diffInDays($barStart); $widthDays = $barStart->diffInDays($barEnd) + 1; $rightPercent = ($offsetDays / $totalDays) * 100; $widthPercent = ($widthDays / $totalDays) * 100; @endphp
{{ $period->name }} {{ \Carbon\Carbon::parse($period->workShift->start_time)->format('h:iA') }}-{{ \Carbon\Carbon::parse($period->workShift->end_time)->format('h:iA') }}
@endforeach
اضغط على أي فترة في التقويم لتعديلها
@endif {{-- بطاقات الفترات --}} @if($periods->count() > 0)

قائمة الفترات

@foreach($periods as $period) @php $isCurrentPeriod = $period->is_active && $period->start_date->format('Y-m-d') <= $today && $period->end_date->format('Y-m-d') >= $today; @endphp
{{ $period->name }} @if($period->is_recurring) @endif
@if($isCurrentPeriod) الحالي @elseif($period->is_active) فعّال @else معطّل @endif
من
{{ $period->start_date->format('Y/m/d') }}
إلى
{{ $period->end_date->format('Y/m/d') }}
موعد الدوام: {{ $period->workShift->name }} {{ \Carbon\Carbon::parse($period->workShift->start_time)->format('h:i A') }} - {{ \Carbon\Carbon::parse($period->workShift->end_time)->format('h:i A') }}
@if($period->department)
القسم: {{ $period->department->name }}
@else
يطبّق على جميع الأقسام
@endif
{{ $period->days_count }} يوم {{ $period->workShift->total_hours }} ساعة/يوم @if($period->description) {{ Str::limit($period->description, 30) }} @endif
@csrf @method('PATCH')
@csrf @method('DELETE')
@endforeach
@else @if($shifts->count() > 0)

لا توجد فترات دوام محددة

حدد فترات الدوام الرسمي على مدار السنة (مثل: الدوام الصيفي، دوام رمضان)

@endif @endif {{-- نصيحة --}}
كيف يعمل تقويم الدوام؟ حدد فترات زمنية مختلفة واربط كل فترة بموعد دوام معين. مثلاً: "الدوام الصيفي" من يونيو لأغسطس بساعات عمل مختلفة، و"دوام رمضان" بساعات مخفضة. النظام يتعرف تلقائياً على الفترة الحالية ويستخدمها كمرجع لحساب الحضور والانصراف. يمكنك تعطيل أو تفعيل أي فترة بدون حذفها.
{{-- Modal إضافة/تعديل --}} @if($shifts->count() > 0) @endif @endsection