@php
use Carbon\Carbon;
$tf = $timeFormat ?? '24';
$systemTz = $systemTimezone ?? 'Asia/Jerusalem'; // القدس
$displayTz = $displayTimezone ?? $systemTz;
$tzLabel = ($tzMode ?? 'system') === 'jordan'
? 'الأردن (' . ($displayTz ?? 'Asia/Amman') . ')'
: 'القدس (' . $systemTz . ')';
@endphp
تقرير اللايفات
منظومة اللايفات العامة
من {{ $start }} إلى {{ $end }}
— صيغة الوقت: {{ $tf === '12' ? '12 ساعة (ص/م)' : '24 ساعة' }}
— التوقيت: {{ $tzLabel }}
@foreach($streams as $date => $items)
@php
$day = Carbon::parse($date)->startOfDay();
$dateText = $day->format('Y-m-d');
@endphp
{{ $dateText }} ({{ $items->count() }} بث)
| العضو |
الوقت |
الفترة |
النوع |
الحالة |
المدة |
@foreach($items as $live)
@php
$u = $live->user ?? null;
$name = $u ? ($u->name ?: $u->username) : ('عضو #' . ($live->user_id ?? ''));
$hours = round(($live->duration_hours ?? 0) + (($live->duration_minutes ?? 0)/60), 2);
$typeLabel = match($live->type) {
'guests' => 'قستات',
'tours' => 'تحديات',
'both' => 'قستات + تحديات',
default => (string) $live->type,
};
$statusLabel = match($live->status) {
'confirmed' => 'مؤكد',
'missed_excuse' => 'مع عذر',
'missed_no_excuse' => 'بدون عذر',
'pending_excuse' => 'بانتظار عذر',
'pending_proof' => 'بانتظار إثبات',
'scheduled' => 'غير مؤكد',
default => (string) $live->status,
};
$isProactive = str_contains((string)($live->description ?? ''), '[PROACTIVE_SCHEDULE_ID=');
$periodCell = $isProactive ? 'ProActive' : ($live->slot_label ?: '—');
$memberText = $isProactive ? 'ما تنسو تقارير (ProActive)' : $name;
if ($live->is_sahra && !$isProactive) {
$memberText .= ' 🔥 سهرة';
}
// ✅ الوقت (PDF) بدون +2 + تحويل القدس/عمان + ص/م
$timeText = '—';
if ($live->scheduled_date && $live->scheduled_time) {
try {
$datePart = Carbon::parse($live->scheduled_date, $systemTz)->toDateString();
$dt = Carbon::parse($datePart . ' ' . $live->scheduled_time, $systemTz)->setTimezone($displayTz);
if (($tf ?? '24') === '12') {
$ampm = $dt->format('A');
$ampmAr = $ampm === 'AM' ? 'ص' : 'م';
$timeText = $dt->format('h:i') . ' ' . $ampmAr;
} else {
$timeText = $dt->format('H:i');
}
} catch (\Throwable $e) {
$timeText = '—';
}
}
// في الـ PDF نخلي عمود النوع موجود دائمًا (حتى ما يختل الجدول)
$typeCell = $isProactive ? '—' : $typeLabel;
@endphp
| {{ $memberText }} |
{{ $timeText }} |
{{ $periodCell }} |
{{ $typeCell }} |
{{ $statusLabel }} |
{{ $hours }} ساعة |
@endforeach
@endforeach