@extends('Admin.layout') @section('content')

Overview

A snapshot of the ledger, updated today

{{-- Card 1: Patients — Today / Tomorrow new-patient counts --}}

Patients

{{ $totalPatientCount ?? 0 }}

This Week {{ $todayPatientCount ?? 0 }}
Last Week 0
{{-- Card 2: Follow Up — Today / Tomorrow follow-up counts --}}

Follow Up

{{ $totalFollowUpCount ?? 0}}

Today {{ $todayFollowUpCount ?? 0 }}
Tomorrow {{ $tomorrowFollowUpCount ?? 9 }}
{{-- Card 3: Medicines — In Stock / Low Stock counts --}}

Medicines

{{ $totalMedicineCount ?? 0 }}

In Stock {{ $inStockMedicineCount ?? 0 }}
Low {{ $lowStockMedicineCount ?? 0 }}
{{-- Card 4: Reviews — Positive / Negative counts --}}

Reviews

{{$totalReviewCount ?? 0}}

Displayed {{ $positiveReviewCount ?? 0 }}
Hidden {{ $negativeReviewCount ?? 0 }}
{{-- ============================================================ SECOND ROW — the ledger detail panels Upcoming Follow Ups / Low Medicine Stock / Recent Patients / Reviews Headers are centered; counts removed per request. ============================================================ --}}
{{-- Panel 1: Upcoming Follow Ups --}}
Upcoming Follow Ups

Patients due for a check-in soon

@forelse($upcomingFollowUps as $followup) @php $patientName = $followup->patient->patient_name ?? '-'; $initials = collect(explode(' ', $patientName)) ->filter() ->map(fn($name) => strtoupper(substr($name, 0, 1))) ->take(2) ->implode(''); // Check next_followup_date first, otherwise follow_up_date $date = \Carbon\Carbon::parse( $followup->next_followup_date ?? $followup->follow_up_date ); $days = now()->startOfDay()->diffInDays($date->startOfDay(), false); @endphp
{{ $initials }}

{{ $patientName }}

{{ $followup->remark ?? 'Follow up' }}

@if($days == 0) Today @elseif($days == 1) Tomorrow @elseif($days > 1) In {{ $days }} days @else Overdue @endif
@empty
No upcoming follow ups
@endforelse
Recent Patients

Newly registered or checked in

@forelse($recentPatients as $patient) @php $initials = strtoupper( substr($patient->first_name ?? $patient->patient_name, 0, 1) . substr($patient->last_name ?? '', 0, 1) ); @endphp
{{ $initials }}

{{ $patient->patient_name }}

New registration @if($patient->type ?? false) · {{ $patient->type }} @endif

@if($patient->created_at->diffInHours(now()) < 24) {{ $patient->created_at->diffForHumans() }} @else {{ $patient->created_at->format('d-m-Y') }} @endif
@empty
No recent patients found
@endforelse
Low Medicine Stock

Items nearing reorder level

@forelse($lowStockMedicines as $product) @php $available = $product->batches->sum('available_quantity'); $minimum = $product->minimum_stock; // Critical when stock reaches half or below minimum level $status = $available <= ($minimum / 2) ? 'Critical' : 'Low'; @endphp
{{ strtoupper(substr($product->product_name, 0, 1)) }}

{{ $product->product_name }}

{{ $available }} units left · reorder at {{ $minimum }}

@if($status == 'Critical') Critical @else Low @endif
@empty
No low stock medicines
@endforelse
{{-- Panel 4: Reviews --}}
Reviews

Latest patient feedback

@forelse($reviews as $review) @php $words = explode(' ', trim($review->name)); $initials = strtoupper( substr($words[0] ?? '', 0, 1) . substr($words[1] ?? '', 0, 1) ); @endphp
{{ $initials }}
@for($i = 1; $i <= 5; $i++) @if($i <= $review->rating) @else @endif @endfor

{{ $review->name }}

"{{ $review->message }}"

{{ number_format($review->rating, 1) }} {{ $review->created_at->diffForHumans() }}
@empty
No reviews found
@endforelse
@endsection