@extends('layouts.clinic-admin') @section('title', 'Clinic Admin Dashboard') @section('content')

Your Clinic Information

@if(Auth::user()->clinic)

{{ Auth::user()->clinic->name }}

@if(Auth::user()->clinic->address)

{{ Auth::user()->clinic->address }}

@endif @if(Auth::user()->clinic->phone)

{{ Auth::user()->clinic->phone }}

@endif @if(Auth::user()->clinic->email)

{{ Auth::user()->clinic->email }}

@endif
@else

No clinic assigned

@endif

Total Nurses

{{ \App\Models\User::where('clinic_id', Auth::user()->clinic_id)->where('role', 'nurse')->where('is_active', true)->count() }}

Active Zones

{{ \App\Models\Zone::where('clinic_id', Auth::user()->clinic_id)->where('is_active', true)->count() }}

Expectant Mothers

{{ \App\Models\ExpectantMother::where('clinic_id', Auth::user()->clinic_id)->count() }}

Clinic Change Requests

{{ \App\Models\ClinicChangeRequest::where('requested_clinic_id', Auth::user()->clinic_id)->where('status', 'PENDING')->count() }}

@php // Get unassigned mothers count $unassignedMothersCount = \App\Models\ExpectantMother::where('clinic_id', Auth::user()->clinic_id) ->whereDoesntHave('currentAssignment') ->count(); // Get pending auto-assignment count $pendingAssignmentCount = \App\Models\ExpectantMother::where('clinic_id', Auth::user()->clinic_id) ->where('zone_assignment_pending', true) ->count(); // Get recent registrations (last 7 days) $recentMothers = \App\Models\ExpectantMother::where('clinic_id', Auth::user()->clinic_id) ->where('created_at', '>=', now()->subDays(7)) ->orderBy('created_at', 'desc') ->limit(5) ->get(); @endphp @if($unassignedMothersCount > 0)

Action Required: Unassigned Mothers

You have {{ $unassignedMothersCount }} expectant {{ Str::plural('mother', $unassignedMothersCount) }} who {{ $unassignedMothersCount === 1 ? 'has' : 'have' }} not been assigned to any zone yet.

@if($pendingAssignmentCount > 0)

{{ $pendingAssignmentCount }} {{ Str::plural('mother', $pendingAssignmentCount) }} failed auto-assignment and need manual assignment.

@endif

Please assign them to zones so nurses can provide proper care and monitoring.

Assign Zones Now
@endif @if($recentMothers->count() > 0)

Recent Registrations (Last 7 Days)

{{ $recentMothers->count() }} New
@foreach($recentMothers as $mother)

{{ $mother->mother_full_name }}

{{ $mother->series_number }} {{ $mother->created_at->diffForHumans() }}

@if($mother->currentAssignment) Assigned @else Unassigned Assign Zone @endif
@endforeach
@endif
@endsection