{{-- The laboratory panel on the consultation screen. Contributed through the `encounter.sidebar` slot, so it appears only when the Laboratory module is installed, enabled and licensed. Its data comes from EncounterLabComposer. Shows results inline where they exist, because the question a clinician asks mid-consultation is "is it back yet, and what was it" — and making them open another screen to find out is how a result gets acted on tomorrow instead of now. --}} @php /* | The status and flag enums name a Bootstrap contextual colour, because | that is what they were written against and the order listing still reads | them. Mapped here rather than changed underneath everything else. */ $pill = static fn (string $tone): string => match ($tone) { 'success' => 'px-pill--green', 'warning' => 'px-pill--amber', 'danger' => 'px-pill--red', 'info' => 'px-pill--blue', 'primary' => 'px-pill--violet', default => 'px-pill--grey', }; @endphp @forelse ($encounterLabOrders as $order)
{{ $order->reference }} {{ $order->status->label() }}
@foreach ($order->items as $item) @php($result = $item->results->firstWhere('superseded_by_id', null))
{{ $item->test_name }} @if ($result?->isReleased()) {{ $result->printableValue($item->decimal_places) }} @if ($item->unit){{ $item->unit }}@endif @if ($result->flag && $result->flag->isAbnormal()) {{ $result->flag->mark() }} @endif @else {{-- Deliberately not the number. An unverified value is not a result, and showing it here would be the one place the release gate leaks. --}} {{ $item->status->label() }} @endif
@endforeach
@empty

{{ __('laboratory::messages.panel.none') }}

@endforelse @if ($encounterIsOpen && $patientUlid !== null) @can('create', \App\Modules\Laboratory\Models\LabOrder::class)
@csrf
@endcan @endif