@props([ 'title' => 'Test Form', 'subtitle' => '', 'record' => null, 'testResult' => null, 'test' => '', 'isReadOnly' => false, ]) @php // Get patient data from health record $expectantMother = $record->mother->expectantMother ?? null; $fullName = $expectantMother->mother_full_name ?? $record->mother->name ?? 'N/A'; $icNumber = $expectantMother->ic_number ?? 'N/A'; // Get CURRENT color code from expectant mother $colorCode = $expectantMother->current_color_code ?? $expectantMother->color_code ?? 'white'; $colorCodeDisplay = ucfirst($colorCode); $badgeColors = [ 'red' => 'bg-red-100 text-red-700 border-red-200', 'yellow' => 'bg-yellow-100 text-yellow-700 border-yellow-200', 'green' => 'bg-green-100 text-green-700 border-green-200', 'white' => 'bg-white border-gray-300 text-gray-700', ]; $colorCodeClass = $badgeColors[$colorCode] ?? $badgeColors['white']; // Get existing test data if editing $testData = $testResult ? $testResult->test_data : []; @endphp @if(!$isReadOnly) {{-- Nurse View: Use Nurse Layout --}} @extends('layouts.nurse') @section('content')

{{ $title }}

@if($subtitle)

{{ $subtitle }}

@endif

Patient Name

{{ $fullName }}

IC Number

{{ $icNumber }}

Color Code

{{ $colorCodeDisplay }}
@if(in_array($record->status, ['completed', 'reviewed']))

Record {{ ucfirst($record->status) }} - Read Only Mode

You are viewing this test in read-only mode. Editing is disabled to maintain data integrity.

@endif
status, ['completed', 'reviewed'])) onsubmit="event.preventDefault(); alert('This record is {{ ucfirst($record->status) }}. Editing is not allowed.'); return false;" data-readonly="true" @endif> @csrf {{ $slot }}

Nurse Information & Signature

Any nurse can fill this test. Please enter your name.

Required - Sign above

@if(in_array($record->status, ['completed', 'reviewed'])) @endif
Back to Record @if(in_array($record->status, ['completed', 'reviewed']))
View Only ({{ ucfirst($record->status) }})
@else
@php // Define all available test types in order $allTestTypes = [ 'immunization', 'antenatal_blood', 'medical_checkup', 'ogtt', 'blood_sugar_monitoring', 'blood_pressure_monitoring', 'pre_eclampsia', 'weight_monitoring', 'ultrasound_examination', 'antenatal_color_code', 'vte_risk_assessment', 'antenatal_visits' ]; $currentTestIndex = array_search($test, $allTestTypes); $nextTestKey = ($currentTestIndex !== false && isset($allTestTypes[$currentTestIndex + 1])) ? $allTestTypes[$currentTestIndex + 1] : null; @endphp @if($nextTestKey) @endif
@endif
@endsection @else {{-- Mother View: Content Only (will be included in show-test.blade.php) --}}
{{ $slot }}
@if($testResult && ($testResult->nurse_name || $testResult->signature_data))

Nurse Information

@if($testResult->nurse_name)
{{ $testResult->nurse_name }}
@endif @if($testResult->signature_data)
Nurse Signature
@endif
@endif
Back to Health Record
@endif