@extends('layouts.app') @push('styles') @include('dashboard.styles') @endpush @section('content')

Clinic Leader Dr.

Clinic's dashboard

@php $mode = $viewMode ?? 'none'; $isPeriod = in_array($mode, ['monthly', 'quarterly', 'yearly']); $heroCards = $mode === 'daily' ? $dailyChecks : ($isPeriod ? $monthlyChecks : []); $hasData = ($mode === 'daily' && !empty($dailyChecks)) || ($isPeriod && !empty($monthlyChecks)); $heroValue = $hasData ? ($heroCards[0]['value'] ?? 0) : null; $clinicLabel = $clinicConnection ?? 'Clinic'; $periodLabel = $hasData ? ($mode === 'daily' ? ($dailyDurationSummary['dateLabel'] ?? '') : ($selectedMonthLabel ?? $selectedQuarter ?? '')) : 'Select a view to load data'; $modeLabel = $hasData ? ucfirst($mode) : ''; @endphp

Pulse across reception, labs, and follow-ups tailored for {{ $clinicLeader }}.

Daily check Monthly report Mobile friendly
Live spotlight
{{ $heroValue !== null ? $heroValue : '—' }}
@if($hasData)
patients • {{ $modeLabel }} • {{ $clinicLabel }} • {{ $periodLabel }}
@else
Choose Daily, Monthly, Quarterly, or Yearly and apply filters to load data.
@endif
@php $selectedClinic = $clinicConnection ?? config('database.default'); $currentYear = now()->year; $selectedYearUi = request('year', $currentYear); $quarters = [ "{$currentYear}-Q1" => "Q1 ({$currentYear} Jan-Mar)", "{$currentYear}-Q2" => "Q2 ({$currentYear} Apl-Jun)", "{$currentYear}-Q3" => "Q3 ({$currentYear} Jul-Sep)", "{$currentYear}-Q4" => "Q4 ({$currentYear} Oct-Dec)", ]; @endphp
@php $clinicParam = $selectedClinic; $exportMonthKey = ($viewMode === 'quarterly') ? ($monthInputValue ?? $selectedMonth) : ($selectedMonth ?? $monthInputValue); $exportQuarterKey = $selectedQuarter ?? ($periodKey ?? ''); @endphp
@if (!empty($dailyChecks))

Daily report

Service summary (day)

@endif

Daily snapshot

Time-in-clinic

{{ $dailyDurationSummary['dateLabel'] }}
Average stay
{{ $dailyDurationSummary['average'] }} mins
Median {{ $dailyDurationSummary['median'] }} mins
90th percentile
{{ $dailyDurationSummary['p90'] }} mins
Long wait >90 mins: {{ $dailyDurationSummary['longWaitRate'] }}%
Long-wait patients
{{ $dailyDurationSummary['longWaiters'] }}
Reception → last counselling/dispensing touch
Calculation: start at reception check-in (`created_at` in followup_generals); end at the latest same-day touch in counsellor_records, consumptions, or any lab module. Averages/median/p90 and long-wait (>90 mins) use those intervals per unique PID.

Daily MDs

MD workload (day)

Daily report

Service populated hours (day)

Daily report

Data entry workload (day)

Daily report

Data entry populated hours (day)

@if (!empty($monthlyChecks))

{{ $viewMode === 'quarterly' ? 'Quarterly report' : 'Monthly report' }}

{{ $viewMode === 'quarterly' ? 'Service summary (Quarter)' : 'Service summary' }}

@endif

{{ $viewMode === 'quarterly' ? 'Quarterly report' : 'Monthly report' }}

Planned vs unplanned

Appointments

{{ $viewMode === 'quarterly' ? 'Quarterly report' : 'Monthly report' }}

Service populated hours

@if (!empty($monthlyClerkSummary))

Monthly report

Data entry workload (month)

Monthly report

Data entry populated hours (month)

@endif @if (!empty($consultationSummary) && $isPeriod)

Monthly report

Visits by age & status

Monthly report

Key populations

@if (!empty($programCategories))

Monthly report

Program workloads

PHA, PrEP, PMTCT, ANC, FP, NCD, TB, Feeding, Cervical Ca
@endif @if (!empty($diseaseCategories))

Monthly report

General diseases ({{ $selectedMonthLabel }})

From patient diagnosis
@endif

Monthly report

MD workload ({{ $selectedMonthLabel }})

@endif
@endsection @push('scripts') @endpush