@extends('layouts.admin') @section('title', ($patientProfile->user->name ?? 'Patient') . ' — Billing') @section('content')
← Billing dashboard

{{ $patientProfile->user->name ?? 'Patient' }}

{{ now()->format('F Y') }} billing period

@csrf
@if ($errors->any())
{{ $errors->first() }}
@endif @if ($period) @if (! $stediConfigured)
Stedi is not configured. Add STEDI_API_KEY before eligibility checks or claim release.
@endif

Minutes vs. next band

Claim readiness

@if ($status->color === 'green') Claim ready @elseif ($status->color === 'amber') {{ $status->hasResolvedCode ? 'Manual review needed' : 'Approaching threshold' }} @else No resolved code @endif

{{ $status->totalMinutes }} min

@if ($status->baseThresholdMinutes !== null)

Next minute band starts at {{ $status->baseThresholdMinutes }} min. Current minute signal: {{ $status->minuteColor }}.

@endif @if ($status->daysRemainingInMonth !== null)

{{ $status->daysRemainingInMonth }} day(s) remaining this month

@endif @if ($period->resolved_codes)
@foreach ($period->resolved_codes as $code) {{ $code['code'] }} ×{{ $code['units'] }} @endforeach
@endif

Stedi claim status

@if ($claim)
{{ $claim->statusLabel() }} Version {{ $claim->claim_version }}
Stedi claim ID
{{ $claim->external_claim_id ?? '—' }}
Control number
{{ $claim->clearinghouse_control_number ?? '—' }}
Transaction ID
{{ $claim->stedi_transaction_id ?? '—' }}
Idempotency key
{{ $claim->idempotency_key ?? '—' }}
Payload hash
{{ $claim->submitted_payload_hash ?? '—' }}
Last status
{{ $claim->last_status_at?->format('M j, g:ia') ?? '—' }}
Reason
{{ $claim->status_reason ?? '—' }}
@if ($claim->artifacts->isNotEmpty())

Lifecycle artifacts

@foreach ($claim->artifacts as $artifact)
{{ strtoupper($artifact->artifact_type) }} {{ str_replace('_', ' ', $artifact->status ?? 'received') }}

{{ $artifact->status_reason ?? 'No reason supplied.' }}

@if ($artifact->artifact_type === '835')

Paid ${{ number_format(($artifact->payment_amount_cents ?? 0) / 100, 2) }} · Adjusted ${{ number_format(($artifact->adjustment_amount_cents ?? 0) / 100, 2) }}

@endif
@endforeach
@endif @if ($claim->serviceLines->isNotEmpty())

Service-line payment status

@foreach ($claim->serviceLines as $line) @endforeach
Control Code Status Paid
{{ $line->provider_control_number ?? '—' }} {{ $line->procedure_code ?? '—' }} {{ str_replace('_', ' ', $line->status) }} ${{ number_format(($line->paid_amount_cents ?? 0) / 100, 2) }}
@endif @if (in_array($claim->status, [ App\Models\ClearinghouseClaim::STATUS_SUBMITTED_TO_STEDI, App\Models\ClearinghouseClaim::STATUS_ACCEPTED_277CA, App\Models\ClearinghouseClaim::STATUS_REJECTED_277CA, App\Models\ClearinghouseClaim::STATUS_PAID_835, App\Models\ClearinghouseClaim::STATUS_DENIED, ], true)) @can('correctClaim', [App\Models\BillingPeriod::class, $patientProfile])
@csrf
@endcan @endif @if ($claim->isVoidable()) @can('voidClaim', [App\Models\BillingPeriod::class, $patientProfile])
@csrf
@endcan @endif @else

No Stedi claim has been released for this billing period yet.

@endif

Stedi eligibility

Real-time 270/271 check for the current payer.

@if ($patientProfile->eligibility_status === 'active') Active @elseif ($patientProfile->eligibility_status) {{ ucfirst($patientProfile->eligibility_status) }} @else Not checked @endif
Payer ID
{{ $patientProfile->payer_id ?: '—' }}
Member ID
{{ $patientProfile->member_id ? 'on file' : '—' }}
Last checked
{{ $patientProfile->eligibility_checked_at?->format('M j, g:ia') ?? '—' }}
Environment
{{ config('stedi.env') }}
@can('checkEligibility', [App\Models\BillingPeriod::class, $patientProfile])
@csrf
@endcan

Payer transaction enrollment

Tracks payer readiness for eligibility, 837P, and ERA workflows.

@forelse ($payerEnrollments as $enrollment)

{{ $enrollment->transaction_type }}

{{ str_replace('_', ' ', $enrollment->status) }}
@if ($enrollment->status_reason)

{{ $enrollment->status_reason }}

@endif
@empty

No payer enrollment rows yet.

@endforelse

Manual billing review checklist

Release stays blocked until every required item is complete.

{{ $status->claimReady ? 'Ready' : 'Needs review' }}
@foreach ($status->readinessItems as $item)

{{ $item['label'] }}

{{ $item['passed'] ? 'OK' : 'Gap' }}
@if ($item['detail'])

{{ $item['detail'] }}

@endif
@endforeach
@can('previewClaim', [App\Models\BillingPeriod::class, $patientProfile]) @if ($status->claimReady) Preview Stedi claim @else Preview Stedi claim @endif @endcan @can('submitClaim', [App\Models\BillingPeriod::class, $patientProfile])
@csrf
@endcan

Contributing time logs

Every submitted log entry and its care-encounter pointer, for audit defensibility.

@forelse ($logs as $log) @empty @endforelse
Started Minutes Activity Provider Care encounter
{{ $log->started_at->format('M j, g:ia') }} {{ $log->duration_minutes }} {{ str_replace('_', ' ', $log->activity_type) }} {{ $log->provider->name ?? '—' }} {{ $log->careEncounter?->encounter_type ? str_replace('_', ' ', $log->careEncounter->encounter_type) : '—' }}
No submitted logs this period.
@push('scripts') @endpush @else

No billing period computed yet for this month.

@csrf
@endif
@endsection