@extends('admin._layout') @section('title', 'التقارير') @push('head') @endpush @php $statusMeta = [ 'active' => ['label' => 'نشطة', 'color' => 'success', 'icon' => 'check'], 'trial' => ['label' => 'تجريبية', 'color' => 'warning', 'icon' => 'hourglass'], 'suspended' => ['label' => 'موقوفة', 'color' => 'danger', 'icon' => 'ban'], 'expired' => ['label' => 'منتهية', 'color' => 'secondary', 'icon' => 'calendar-x'], 'pending' => ['label' => 'معلّقة', 'color' => 'info', 'icon' => 'clock'], ]; @endphp @section('content') {{-- KPI strip — operational counts --}}
إجمالي الأطباء
{{ number_format($totals['doctors']) }}
إجمالي المستخدمين
{{ number_format($totals['users']) }}
إجمالي المرضى
{{ number_format($totals['patients']) }}
إجمالي المواعيد
{{ number_format($totals['appointments']) }}
{{-- KPI strip — clinical + financial --}}
السجلات الطبية
{{ number_format($totals['medical_records']) }}
الفواتير
{{ number_format($totals['invoices']) }}
إيرادات محصّلة
{{ number_format($totals['revenue'], 0) }}SAR
متبقي على الذمم
{{ number_format($totals['outstanding'], 0) }}SAR
{{-- Charts row --}}

الإيرادات والذمم — أعلى 10 عيادات

@if(empty($chartLabels))

لا توجد بيانات مالية بعد.

@else
@endif

توزيع الحالات

توزيع الباقات

@if(empty($planDistribution))

لا توجد بيانات.

@else
@endif
{{-- Top performers --}}

الأعلى إيرادات

@if(empty($topByRevenue))
لا توجد بيانات بعد.
@else
    @foreach($topByRevenue as $i => $r)
  • {{ $i + 1 }} {{ number_format($r['metrics']['revenue'], 0) }} SAR
  • @endforeach
@endif

الأعلى عدد مرضى

@if(empty($topByPatients))
لا توجد بيانات بعد.
@else
    @foreach($topByPatients as $i => $r)
  • {{ $i + 1 }} {{ number_format($r['metrics']['patients']) }}
  • @endforeach
@endif

الأعلى حجوزات

@if(empty($topByAppointments))
لا توجد بيانات بعد.
@else
    @foreach($topByAppointments as $i => $r)
  • {{ $i + 1 }} {{ number_format($r['metrics']['appointments']) }}
  • @endforeach
@endif

الأعلى ذمم متبقية

@if(empty($topByOutstanding))
لا توجد ذمم متبقية.
@else
    @foreach($topByOutstanding as $i => $r)
  • {{ $i + 1 }} {{ number_format($r['metrics']['outstanding'], 0) }} SAR
  • @endforeach
@endif
{{-- Per-clinic detailed table --}}

تفاصيل كل عيادة

{{ count($rows) }} عيادة
@if(empty($rows))

لا توجد بيانات

أضف عيادة للبدء.

@else
@foreach($rows as $row) @php $c = $row['clinic']; $m = $row['metrics']; $sm = $statusMeta[$c->status] ?? ['label' => $c->status, 'color' => 'secondary', 'icon' => 'circle']; $initials = collect(preg_split('/\s+/u', trim($c->name))) ->filter()->take(2) ->map(fn ($w) => mb_substr($w, 0, 1)) ->implode('') ?: '?'; @endphp @if($m['reachable'] ?? false) @else @endif @endforeach
العيادة الباقة الحالة أطباء مستخدمين مرضى مواعيد سجلات فواتير إيرادات متبقي
{{ $initials }}
{{ $c->name }}
{{ $c->owner_email }}
{{ $c->plan?->name ?? '—' }} {{ $sm['label'] }} {{ $m['doctors'] }} {{ $m['users'] }} {{ number_format($m['patients']) }} {{ number_format($m['appointments']) }} {{ number_format($m['medical_records']) }} {{ number_format($m['invoices']) }} {{ number_format($m['revenue'], 0) }} {{ number_format($m['outstanding'], 0) }} قاعدة البيانات غير متاحة @if(! empty($m['error'])) @endif
الإجمالي {{ number_format($totals['doctors']) }} {{ number_format($totals['users']) }} {{ number_format($totals['patients']) }} {{ number_format($totals['appointments']) }} {{ number_format($totals['medical_records']) }} {{ number_format($totals['invoices']) }} {{ number_format($totals['revenue'], 0) }} {{ number_format($totals['outstanding'], 0) }}
@endif
@endsection @push('scripts') @endpush