@php $openConsultation = $workspaceVisit->appointment?->consultation ?? $workspaceVisit->consultations->firstWhere('status', '!=', \App\Models\Consultation::STATUS_COMPLETED); $canRequestLabs = ($canConsult ?? false) && $openConsultation; $visitLabRequests = $workspaceVisit->consultations ->flatMap(fn ($c) => $c->investigationRequests) ->sortByDesc('id') ->values(); @endphp

Orders

Lab and imaging requests for this visit.

@if ($canRequestLabs) @endif
@if (! $openConsultation)

Start the encounter to order lab / imaging from this visit.

@endif
@if ($workspaceVisit->appointment) Appointment @endif
@if ($canRequestLabs && ($investigationTypes ?? collect())->isNotEmpty())

Request investigations

Select tests to send to the lab for this visit.

@csrf
@foreach ($investigationTypes as $type) @endforeach
@endif