@extends('layouts.app') @section('title', 'Insurance & Claims') @section('styles') @endsection @section('content')

Insurance & Claims

Track insured bills through submission and payment

{{-- Stats --}}

Total Claims

{{ number_format($stats['total_amount'] ?? 0) }}

Pending

{{ $stats['pending_count'] ?? 0 }}

Delivered

{{ $stats['delivered_count'] ?? 0 }}

Paid

KES {{ number_format($stats['paid_amount'] ?? 0) }}

Outstanding

KES {{ number_format($stats['outstanding'] ?? 0) }}

{{-- Filters --}}
@if(request()->hasAny(['company','from','to','status']))Clear@endif
{{-- Claims Table (shared across all tabs, filtered by JS) --}}
@forelse($claims as $cl) @php $isDelivered = $cl->delivered ?? false; $isPaid = $cl->paid ?? ($cl->status === 'paid'); $tabGroup = 'all'; if (in_array($cl->status, ['rejected','disputed'])) $tabGroup = 'rejected'; elseif ($isPaid) $tabGroup = 'paid'; elseif ($isDelivered) $tabGroup = 'delivered'; else $tabGroup = 'queue'; // Highlight rows that still have the placeholder insurer $isUnknownInsurer = ($cl->insuranceCompany?->code ?? '') === 'UNKNOWN'; $isRejected = in_array($cl->status, ['rejected','disputed']); $isAdmin = auth()->user()->hasAnyRole('Super Admin','Hospital Admin'); $canAssign = auth()->user()->hasAnyRole('Super Admin','Hospital Admin','Finance User'); @endphp @empty @endforelse
PatientInsurerSchemeClaim AmountDate BilledDeliveredPaid
{{ $cl->patient->full_name ?? '' }} @if($isUnknownInsurer) @if($canAssign) @else Unknown · Needs assignment @endif @else {{ $cl->insuranceCompany->name ?? '' }} @endif {{ $cl->scheme ?? $cl->member_number ?? '-' }} {{ number_format($cl->claim_amount) }} {{ $cl->submission_date?->format('d M Y') ?? $cl->created_at->format('d M Y') }} @if($isAdmin)
@csrf @method('PUT')
@csrf @method('PUT')
@else @if($isDelivered)Yes@elseNo@endif @endif
@if($isAdmin)
@csrf @method('PUT')
@csrf @method('PUT')
@else @if($isPaid)Paid@elseif($isRejected)Rejected@else@endif @endif
No claims found.
@if($claims->hasPages())
{{ $claims->links() }}
@endif
{{-- Reassign Insurer Modal --}} {{-- Pay Claim Modal --}} @endsection @section('scripts') @endsection