// Manual New Rx entry — blank-start path (V5). Scripted: verbal order for Curtis Dunbar. function ManualEntryForm({ onClose, onSent, nav, showToast }) { const { useState } = React; const [phase, setPhase] = useState('form'); // form | processing | paid const [source, setSource] = useState('verbal'); // verbal | hardcopy | transfer const [takenBy, setTakenBy] = useState('C. Schaffner, PharmD'); const [query, setQuery] = useState(''); const [patient, setPatient] = useState(null); const [open, setOpen] = useState(false); const [drug, setDrug] = useState(''); const [prescriber, setPrescriber] = useState(''); const [sigInput, setSigInput] = useState(''); const [payer, setPayer] = useState('cash'); const normSig = sigInput.trim().replace(/\s+/g, ' ').toUpperCase(); const sigText = SIG_CODES[normSig] || null; const matches = query.trim().length >= 2 && !patient ? PATIENT_DIR.filter(p => p.name.toLowerCase().indexOf(query.trim().toLowerCase()) !== -1).slice(0, 5) : []; const pickPatient = (p) => { setPatient(p); setQuery(p.name); setOpen(false); setPayer(p.plan.id); }; const clearPatient = () => { setPatient(null); setPayer('cash'); }; const a = MANUAL_RX.adj; const gp = a.copay + a.reimb - a.acq; const total = a.copay + a.reimb; const margin = (gp / total * 100).toFixed(1) + '%'; const money = (n) => '$' + n.toFixed(2); const submit = () => { if (phase !== 'form') return; if (!patient) return showToast('Select a patient first.'); if (!(source === 'verbal' && patient.name === 'Curtis Dunbar')) { return showToast('Demo supports the scripted path — verbal order for Curtis Dunbar.'); } if (normSig !== '1C TID X10D') { return showToast('Enter the verbal sig as a code (e.g. 1C TID x10D) so it expands.'); } setPhase('processing'); window.setTimeout(() => setPhase('paid'), 1000); }; return (