@extends('layouts.app') @section('title', 'لوحة الطبيب') @push('head') @endpush @php $initials = collect(preg_split('/\s+/u', trim($doctor->name))) ->filter()->take(2) ->map(fn ($w) => mb_substr($w, 0, 1)) ->implode('') ?: '؟'; @endphp @section('content')
{{ $initials }}

د. {{ $doctor->name }}

@if($doctor->specialization) {{ $doctor->specialization }} · @endif {{ now()->translatedFormat('l، j F Y') }} @if(! $is_self) · عرض كمشرف @endif
{{-- ============================================================ --}} {{-- KPI tiles --}} {{-- ============================================================ --}}
@php $tiles = [ ['icon' => 'ti-calendar-event', 'color' => 'primary', 'label' => 'مواعيد اليوم', 'value' => $kpis['appointments_today'] ?? 0, 'change' => $kpis['appointments_today_change'] ?? null], ['icon' => 'ti-user-check', 'color' => 'success', 'label' => 'مرضى اليوم', 'value' => $kpis['patients_seen'] ?? 0], ['icon' => 'ti-flask', 'color' => 'warning', 'label' => 'تحاليل قيد الانتظار', 'value' => $kpis['pending_labs'] ?? 0], ['icon' => 'ti-cash', 'color' => 'success', 'label' => 'إيرادات اليوم', 'value' => \App\Support\Currency::format($kpis['today_revenue'] ?? 0, 0)], ]; @endphp @foreach($tiles as $t)
{{ $t['label'] }}
{!! $t['value'] !!}
@if(isset($t['change']) && $t['change'] !== null) @php $arrow = $t['change'] > 0 ? '↑' : ($t['change'] < 0 ? '↓' : '·'); $cls = $t['change'] > 0 ? 'text-success' : ($t['change'] < 0 ? 'text-danger' : 'text-muted'); @endphp {{ $arrow }} {{ abs($t['change']) }}% مقارنة بالأمس @endif
@endforeach
{{-- All-time totals row --}}
إجمالي المرضى المعالجين
{{ number_format($totals['total_patients_seen']) }}
إجمالي الوصفات
{{ number_format($totals['total_prescriptions']) }}
إجمالي السجلات الطبية
{{ number_format($totals['total_records']) }}
إجمالي المواعيد
{{ number_format($totals['total_appointments']) }}
{{-- ============================================================ --}} {{-- Main row — appointments chart + today schedule --}} {{-- ============================================================ --}}

مواعيد د. {{ $doctor->name }} — آخر 30 يوم

@if(! empty($top_diagnoses))

أكثر التشخيصات هذا الشهر

@endif
@if($next_appointment && ($next_appointment['patient'] ?? null))
الموعد التالي
دقيقة
{{ $next_appointment['patient']['name'] }} · الساعة {{ $next_appointment['time'] }}
@endif

جدول اليوم

{{ count($today_schedule) }} موعد
@forelse($today_schedule as $a) @php $aStart = \Carbon\Carbon::parse(today()->toDateString().'T'.$a['time']); @endphp
{{ $a['time'] }} {{ $a['end_time'] }}
{{ $a['patient']['name'] }}
{{ $a['patient']['file_number'] ?? '' }} @if($a['patient']['phone'] ?? null) · {{ $a['patient']['phone'] }}@endif
{{ ['scheduled'=>'مجدول','confirmed'=>'مؤكد','checked_in'=>'وصل','in_progress'=>'قيد المعاينة','completed'=>'مكتمل','cancelled'=>'ملغي','no_show'=>'لم يحضر'][$a['status']] ?? $a['status'] }}
@empty
لا توجد مواعيد للدكتور اليوم
@endforelse
@endsection @push('scripts') @endpush