@php $filterList = is_array($filterStatus) ? $filterStatus : [$filterStatus]; // Allow caller to supply a different collection (e.g. inProgressOrders // without the 7-day cutoff). Falls back to $orders for compatibility. $sourceOrders = $ordersSource ?? $orders; $filtered = $sourceOrders->filter(fn($o) => in_array($o->status, $filterList) || ($filterStatus === 'in_process' && in_array($o->status, ['collected', 'in_process', 'resulted'])) || ($filterStatus === 'validated' && $o->status === 'validated')); @endphp
| Patient | Visit No. | Dept | Test / Panel | Sample | Urgency | Ordered | Status | Actions |
|---|---|---|---|---|---|---|---|---|
|
{{ $o->patient->full_name ?? '' }} {{ $o->patient->mrn ?? '' }} |
{{ $o->visit->visit_number ?? '' }} | {{ $o->visit->department->name ?? '-' }} | {{ $o->test_name }} | {{ $o->sample_type ?? $o->labTest->sample_type ?? '-' }} | {{ ucfirst($o->urgency) }} | {{ $o->created_at->format('d M H:i') }} | {{ ucfirst(str_replace('_',' ',$o->status)) }} @if($o->result && $o->result->is_critical)CRITICAL@endif |
@if(auth()->user()->hasAnyRole('Lab User','Super Admin','Hospital Admin'))
{{-- Ordered: Collect Sample --}}
@if($o->status === 'ordered')
@endif
{{-- Collected: Start Processing --}}
@if($o->status === 'collected')
@endif
{{-- Enter/Edit Result --}}
@if(in_array($o->status, ['ordered', 'collected', 'in_process', 'resulted']))
{{ $o->status === 'resulted' ? 'Edit Result' : 'Enter Result' }}
@endif
{{-- Reject (any non-final status) --}}
@if(!in_array($o->status, ['validated', 'rejected', 'cancelled']))
@endif
@endif {{-- /Lab User guard --}}
{{-- Print | available to all authorised roles --}}
@if($o->status === 'validated')
Print
@endif
|
| No orders in this stage. | ||||||||