@extends('admin.layouts.app') @section('title', __('admin.reports.title')) @section('breadcrumb') @endsection @section('content') @php $canViewFinancial = (bool) ($canViewFinancial ?? false); @endphp
{{-- Hidden form used by all Excel export buttons --}} {{-- Excel Export Section --}}
{{ __('admin.reports.export.title') }} {{ __('admin.reports.export.subtitle') }}
@php $exportTypes = [ 'appointments' => ['label' => __('admin.reports.export.types.appointments'), 'icon' => '๐Ÿ“…'], 'revenue' => ['label' => __('admin.reports.export.types.revenue'), 'icon' => '๐Ÿ’ฐ'], 'invoices' => ['label' => __('admin.reports.export.types.invoices'), 'icon' => '๐Ÿงพ'], 'patients' => ['label' => __('admin.reports.export.types.patients'), 'icon' => '๐Ÿ‘ค'], 'services' => ['label' => __('admin.reports.export.types.services'), 'icon' => '๐Ÿ”ง'], 'doctors' => ['label' => __('admin.reports.export.types.doctors'), 'icon' => '๐Ÿฉบ'], 'promotions' => ['label' => __('admin.reports.export.types.promotions'), 'icon' => '๐ŸŽ'], 'audit_logs' => ['label' => __('admin.reports.export.types.audit_logs'), 'icon' => '๐Ÿ“‹'], ]; if (! $canViewFinancial) { unset($exportTypes['revenue'], $exportTypes['invoices']); } @endphp @foreach ($exportTypes as $type => $meta)
@endforeach
@if ($canViewFinancial)
{{ __('admin.reports.metrics.total_revenue') }}

{{ number_format((float) ($revenueData['total_revenue'] ?? 0), 2) }}

@endif
{{ __('admin.reports.metrics.total_appointments') }}

{{ number_format((int) ($appointmentsData['total_appointments'] ?? 0)) }}

{{ __('admin.reports.metrics.active_doctors') }}

{{ number_format($doctorsBySpecialty->sum('doctors_count')) }}

{{ __('admin.reports.metrics.daily_workload_rows') }}

{{ number_format($dailyWorkloadBySpecialty->count()) }}

{{ __('admin.reports.sections.appointments_by_specialty') }}
@forelse($appointmentsBySpecialty as $row) @empty @endforelse
{{ __('admin.reports.specialty') }}{{ __('admin.reports.appointments') }}
{{ $row->specialty_name }}{{ number_format($row->appointments_count) }}
{{ __('admin.reports.no_data') }}
{{ __('admin.reports.sections.doctors_by_specialty') }}
@forelse($doctorsBySpecialty as $row) @empty @endforelse
{{ __('admin.reports.specialty') }}{{ __('admin.reports.doctors') }}
{{ $row->specialty_name }}{{ number_format($row->doctors_count) }}
{{ __('admin.reports.no_data') }}
@if ($canViewFinancial)
{{ __('admin.reports.sections.revenue_by_specialty') }}
@forelse($revenueBySpecialty as $row) @empty @endforelse
{{ __('admin.reports.specialty') }}{{ __('admin.reports.revenue') }}
{{ $row->specialty_name }}{{ number_format((float) $row->revenue_total, 2) }}
{{ __('admin.reports.no_data') }}
@endif
{{ __('admin.reports.sections.daily_workload_by_specialty') }}
@forelse($dailyWorkloadBySpecialty as $row) @empty @endforelse
{{ __('admin.reports.date') }} {{ __('admin.reports.specialty') }} {{ __('admin.reports.appointments') }} {{ __('admin.reports.minutes') }}
{{ \Carbon\Carbon::parse($row->workload_date)->format('Y-m-d') }} {{ $row->specialty_name }} {{ number_format($row->appointments_count) }} {{ number_format($row->total_minutes) }}
{{ __('admin.reports.no_data') }}
@endsection