@extends('layouts.app') @section('title', __('prescriptions::messages.prescriptions.new')) @php $activeField = \App\Modules\Patients\Enums\PatientSearchField::tryFrom($filters['search_field']) ?? $defaultSearchField; // Read by Clinic.searchField, so the box re-labels itself the moment the // pill changes rather than after a round trip. $searchRules = []; foreach ($searchFields as $searchField) { $searchRules[$searchField->value] = ['placeholder' => $searchField->placeholder()]; } @endphp @section('content')

{{ __('prescriptions::messages.prescriptions.choose_patient') }}

{{ __('prescriptions::messages.prescriptions.choose_patient_hint') }}

{{ __('common.cancel') }}
{{-- Outside the swapped region, so the caret stays in the box while the matches change underneath. --}}
@foreach ($searchFields as $searchField) @endforeach
{{-- Hidden, not deleted: the pills above already say "search by", and the placeholder repeats it. It stays in the markup so a screen reader still gets the field a name rather than reading the hint as one. --}}
@forelse ($matches as $match)
{{ $match->name }} {{ $match->mrn }}@if ($match->phone) · {{ $match->phone }}@endif
{{-- Starts the draft and lands on it: the next thing to do is add the medicines, and this is the click that gets there. --}}
@csrf
@empty
{{-- Two different nothings: nobody has typed yet, or they typed and nobody matched. The second needs to say so — silence reads as a broken search. --}}

{{ $searched ? __('prescriptions::messages.prescriptions.no_patient_match') : __('prescriptions::messages.prescriptions.start_typing') }}

{{ $searched ? __('prescriptions::messages.prescriptions.no_patient_match_hint') : __('prescriptions::messages.prescriptions.start_typing_hint') }}

@endforelse
@endsection