@extends('layouts.app') @section('title', __('laboratory::messages.orders.title')) @php use App\Modules\Laboratory\Enums\ItemStatus; use App\Modules\Laboratory\Enums\OrderPriority; use App\Modules\Laboratory\Enums\OrderStatus; use App\Modules\Laboratory\Models\LabOrder; /* | Ordered is "waiting to be drawn", collected is "on the bench but not | started" — grey and blue respectively, which is how a laboratory reads | its own queue. The brief lists "critical" among the statuses; it is not | one. A critical value is a property of a result, and an order carrying | one is usually also completed, so it is surfaced as its own marker | rather than by overwriting the status. */ $statusPill = static fn (OrderStatus $status): string => match ($status) { OrderStatus::Ordered => 'px-pill--grey', OrderStatus::Collected => 'px-pill--blue', OrderStatus::InProgress => 'px-pill--amber', OrderStatus::Completed => 'px-pill--green', OrderStatus::Cancelled => 'px-pill--red', }; $priorityPill = static fn (OrderPriority $priority): string => match ($priority) { OrderPriority::Routine => 'px-pill--grey', OrderPriority::Urgent => 'px-pill--amber', OrderPriority::Stat => 'px-pill--red', }; $cards = [ [ 'key' => 'pending', 'label' => __('laboratory::messages.orders.card_pending'), 'icon' => 'bi-inboxes-fill', 'tone' => 'blue', ], [ 'key' => 'processing', 'label' => __('laboratory::messages.orders.card_processing'), 'icon' => 'bi-arrow-repeat', 'tone' => 'violet', ], [ 'key' => 'completed', 'label' => __('laboratory::messages.orders.card_completed'), 'icon' => 'bi-check2-circle', 'tone' => 'green', ], [ 'key' => 'critical', 'label' => __('laboratory::messages.orders.card_critical'), 'icon' => 'bi-exclamation-octagon-fill', 'tone' => 'pink', ], ]; /* | Whether anything is actually narrowing the worklist. | | search_field is excluded: it always carries a value — the pill shown as | selected — so counting it would make a screen nobody has filtered offer | to clear filters that were never applied. It narrows nothing on its own; | it only says where the term beside it is aimed. */ $hasFilters = collect($filters) ->except(['search_field']) ->filter(fn ($v): bool => $v !== '') ->isNotEmpty(); @endphp @section('content') {{-- ── Page head ──────────────────────────────────────────────────────── --}}
{{ __('laboratory::messages.orders.subtitle') }}
{{ $card['label'] }}
{{ number_format($value) }}
@if ($delta !== 0) @endif {{ __('laboratory::messages.orders.vs_previous', [ 'delta' => $delta > 0 ? '+'.$delta : (string) $delta, ]) }}
{{ __('laboratory::messages.orders.title') }}
{{ __('laboratory::messages.orders.showing', [ 'from' => number_format($orders->firstItem() ?? 0), 'to' => number_format($orders->lastItem() ?? 0), 'total' => number_format($orders->total()), ]) }} @if ($filters['status'] === '') · {{ __('laboratory::messages.orders.open_only') }} @endif
{{ __('laboratory::messages.orders.empty_title') }}
{{ $hasFilters ? __('laboratory::messages.orders.empty_filtered') : __('laboratory::messages.orders.empty_text') }}
| {{ __('laboratory::messages.orders.patient') }} | {{ __('laboratory::messages.orders.ordered_by') }} | {{ __('laboratory::messages.orders.collected_at') }} | {{ __('laboratory::messages.orders.priority') }} | {{ __('laboratory::messages.orders.specimen') }} | {{ __('common.status') }} | {{ __('common.actions') }} |
|---|---|---|---|---|---|---|
|
@if ($patient !== null && Route::has('patients.show'))
{{ $patientName }}
@else
{{ $patientName }}
@endif
{{-- Fasting travels with the row because it is the
one thing that invalidates a sample if missed. --}}
@if ($order->fasting)
@endif
@foreach ($order->items->take(2) as $item)
{{ $item->test_name }}
@endforeach
@if ($order->items_count > 2)
+{{ $order->items_count - 2 }}
@endif
|
@php
/*
| The doctor if one is on record, otherwise whoever
| placed the order. Most orders here are raised by
| staff with no doctor profile, and naming nobody
| while the printed report names somebody is the
| worse of the two answers.
*/
$requestedBy = $doctor?->name ?? $order->orderedBy?->name;
@endphp
{{-- No avatar here.
A coloured disc adds nothing to a name already
written beside it, and this column is scanned for
the name. The patient column keeps its avatar,
where the initial is doing the work of telling one
row from another at a glance. --}}
{{ $requestedBy ?? '—' }}
@if ($doctor?->specialty)
{{ $doctor->specialty }}
@endif
|
@if ($specimen !== null) {{ $specimen->collected_at->format('d M') }} {{ $specimen->collected_at->format('H:i') }} @else {{ __('laboratory::messages.orders.awaiting_collection') }} @endif | @if ($order->priority === OrderPriority::Stat) @endif {{ $order->priority->label() }} | @if ($specimen !== null) {{ $specimen->specimen_type }} @else — @endif | {{ $order->status->label() }} | {{-- The actions sit on the row rather than behind a menu. There are at most three, they are the same three on every row, and hiding them behind a three-dot button cost a click and a guess for somebody working through a list of orders. --}}