'use client'; import { useTranslations } from 'next-intl'; import { Button } from '@/components/ui/shared/Button'; import { PatientSearchCombobox } from '@/components/ui/patient/PatientSearchCombobox'; import { usePatientSearchQuery } from '@/lib/hooks/usePatientSearchQuery'; import type { Patient } from '@/types/patient'; interface NewTreatmentPatientPickerProps { creating?: boolean; onSelectWalkIn: () => void | Promise; onSelectPatient: (patient: Patient) => void | Promise; onCancel: () => void; } export function NewTreatmentPatientPicker({ creating = false, onSelectWalkIn, onSelectPatient, onCancel, }: NewTreatmentPatientPickerProps) { const t = useTranslations('treatment'); const tCommon = useTranslations('common'); const tPatients = useTranslations('patients'); const { search, setSearch, patients, loading } = usePatientSearchQuery(!creating); return (

{t('newTreatmentPatientPrompt')}

{ if (creating) return; void onSelectPatient(patient); }} placeholder={tPatients('searchPlaceholder')} emptyResultsMessage={tPatients('noResults')} />
); }