@section('title', 'Report Management - Head Nurse')

Report Management

Generate comprehensive reports for clinics, staff, and expectant mothers

@if (session()->has('success'))
{{ session('success') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif

Report Configuration

@if($preview)

{{ $preview['title'] }}

Generated: {{ now()->format('d M Y, h:i A') }}
@if($selectedReportType === 'expectant_mothers' && isset($preview['mothers']))

Total Mothers

{{ $preview['total'] }}

Active

{{ $preview['active'] }}

Registration Completed

{{ $preview['registered_completed'] }}

@foreach($preview['mothers'] as $mother) @endforeach
Series No. Full Name Clinic Zone Registered Date
{{ $mother->series_number }} {{ $mother->mother_full_name }} {{ $mother->clinic->name ?? 'N/A' }} {{ $mother->currentAssignment?->zone->zone_code ?? 'Unassigned' }} {{ $mother->created_at->format('d M Y') }}
@elseif($selectedReportType === 'nurses' && isset($preview['nurses']))

Total Nurses

{{ $preview['total'] }}

Active

{{ $preview['active'] }}

Inactive

{{ $preview['inactive'] }}

@foreach($preview['nurses'] as $nurse) @endforeach
Staff ID Name Email Clinic Status
{{ $nurse->staff_id }} {{ $nurse->name }} {{ $nurse->email }} {{ $nurse->clinic->name ?? 'N/A' }} {{ $nurse->is_active ? 'Active' : 'Inactive' }}
@elseif($selectedReportType === 'clinic_admins' && isset($preview['admins']))

Total Clinic Admins

{{ $preview['total'] }}

Active

{{ $preview['active'] }}

Inactive

{{ $preview['inactive'] }}

@foreach($preview['admins'] as $admin) @endforeach
Staff ID Name Email Clinic Status
{{ $admin->staff_id }} {{ $admin->name }} {{ $admin->email }} {{ $admin->clinic->name ?? 'N/A' }} {{ $admin->is_active ? 'Active' : 'Inactive' }}
@elseif($selectedReportType === 'staff_summary' && isset($preview['summary']))
@foreach($preview['summary'] as $item) @endforeach
Clinic Total Nurses Active Nurses Total Admins Active Admins
{{ $item['clinic']->name }} {{ $item['nurses'] }} {{ $item['active_nurses'] }} {{ $item['clinic_admins'] }} {{ $item['active_admins'] }}
@elseif($selectedReportType === 'mothers_summary' && isset($preview['summary']))

Total Mothers (System-wide)

{{ $preview['total_mothers'] }}

@foreach($preview['summary'] as $item) @endforeach
Clinic Total Mothers Active Mothers Assigned Unassigned
{{ $item['clinic']->name }} {{ $item['total_mothers'] }} {{ $item['active_mothers'] }} {{ $item['assigned_mothers'] }} {{ $item['unassigned_mothers'] }}
@elseif($selectedReportType === 'zone_distribution' && isset($preview['zones']))

Total Zones

{{ $preview['total_zones'] }}

Active Zones

{{ $preview['active_zones'] }}

Total Mothers

{{ $preview['zones']->sum(function($zone) { return $zone->motherAssignments->count(); }) }}

Total Nurses

{{ $preview['zones']->sum('active_nurses_count') }}

@foreach($preview['zones'] as $zone)

Zone {{ $zone->zone_code }} - {{ $zone->zone_name }}

@if($zone->is_active) Active @else Inactive @endif

Coverage Areas: @if($zone->coverage_areas && is_array($zone->coverage_areas) && count($zone->coverage_areas) > 0) {{ implode(', ', $zone->coverage_areas) }} @else Not specified @endif

Boundary Notes: {{ $zone->boundary_notes ?? 'No notes' }}

Assigned Nurses ({{ $zone->active_nurses_count ?? 0 }})

@if($zone->nurses && $zone->nurses->count() > 0)
@foreach($zone->nurses as $nurse)

{{ $nurse->name }}

{{ $nurse->staff_id ?? 'N/A' }}

@if($zone->currentNurse && $zone->currentNurse->id === $nurse->id) Current @endif
@endforeach
@else

No nurses assigned

@endif

Assigned Mothers ({{ $zone->motherAssignments->count() }})

@if($zone->motherAssignments && $zone->motherAssignments->count() > 0)
@foreach($zone->motherAssignments as $index => $assignment) @endforeach
No. Mother Name Series Number Assigned Nurse Assignment Type
{{ $index + 1 }} {{ $assignment->expectantMother->mother_full_name ?? 'N/A' }} {{ $assignment->expectantMother->series_number ?? 'N/A' }} {{ $assignment->nurse->name ?? 'Unassigned' }} {{ ucfirst($assignment->assignment_type ?? 'N/A') }}
@else

No mothers assigned

@endif
@endforeach
@elseif($selectedReportType === 'registration_trends' && isset($preview['mothers_trend']))

Mothers Registration Trend

@foreach($preview['mothers_trend'] as $trend) @endforeach
Month Registrations
{{ $trend->month }} {{ $trend->count }}

Nurses Registration Trend

@foreach($preview['nurses_trend'] as $trend) @endforeach
Month Registrations
{{ $trend->month }} {{ $trend->count }}
@elseif($selectedReportType === 'clinic_overview' && isset($preview['clinic']))

Total Nurses

{{ $preview['nurses'] }}

{{ $preview['active_nurses'] }} Active

Clinic Admins

{{ $preview['clinic_admins'] }}

Total Mothers

{{ $preview['mothers'] }}

{{ $preview['active_mothers'] }} Active

Total Zones

{{ $preview['zones'] }}

{{ $preview['active_zones'] }} Active

Clinic Information

Clinic Name

{{ $preview['clinic']->name }}

Clinic Code

{{ $preview['clinic']->clinic_code ?? 'N/A' }}

Address

{{ $preview['clinic']->address ?? 'N/A' }}

Phone

{{ $preview['clinic']->phone ?? 'N/A' }}

@else

Report preview will appear here

Click "Generate Preview" to see the report data

@endif
@endif

Available Reports

  • Expectant Mothers by Clinic: Detailed list of mothers registered in selected clinic or all clinics
  • Nurses by Clinic: Complete nurse roster with status and clinic assignment
  • Clinic Admins by Clinic: List of clinic administrators with their assigned clinics
  • Staff Summary: Overview of all staff (nurses and admins) across all clinics
  • Mothers Summary: Statistical overview of mothers across all clinics
  • Zone Distribution: Zone-wise distribution of mothers and nurses (requires clinic selection)
  • Registration Trends: Monthly registration trends for mothers and nurses
  • Comprehensive Clinic Overview: Complete overview of selected clinic including all statistics