/* ========================================================== YAPPY. — e-Prescription document + simulated email Used by the Doctor panel (preview/issue) and the customer order page (view). Prototype: watermarked, not a valid Rx. ========================================================== */ function RxDocument({ rx, compact }) { const d = rx.doctor || {}; const blank = (v, l = 'Not set') => v ? v : {l}; const cell = { padding: '8px 10px', borderBottom: '1px solid #d9cbb0', verticalAlign: 'top', textAlign: 'left' }; return (
{/* header */}
{blank(d.name ? 'Dr. ' + d.name : '', 'Doctor name not set')}
{blank(d.qual, 'Qualification not set')}
Reg. No: {blank(d.reg)} · {blank(d.council, 'Council not set')}
YAPPY.
{d.clinic || 'Clinic TBC'}
{d.phone || 'Contact TBC'}
{/* meta */}
Rx ID: {rx.id}Date: {rx.date}Consultation: Tele-consultation ({rx.mode || 'Video'})
{/* patient */}
Patient: {rx.patient.name} Age / Sex: {rx.patient.age || '—'} / {rx.patient.sex || '—'} Mobile: {rx.patient.phone} Email: {rx.patient.email || '—'}
{/* clinical */}
{rx.complaints &&
Chief complaints: {rx.complaints}
} {rx.history &&
Relevant history / allergies: {rx.history}
} {rx.diagnosis &&
Provisional diagnosis: {rx.diagnosis}
}
{/* Rx table */}
℞
{['#', 'Product', 'Instructions', 'Duration', 'Qty'].map((h) => )} {rx.items.map((it, i) => ( ))}
{h}
{i + 1} YAPPY. {PRODUCTS[it.sku].name}.
{PACK.descriptor} · {PRODUCTS[it.sku].pct} variant
{it.instructions || '—'} {it.duration || '—'} {it.qty} pouch{it.qty > 1 ? 'es' : ''}
{rx.advice &&
Advice: {rx.advice}
} {rx.followup &&
Follow-up: {rx.followup}
} {/* signature */}
Issued following a tele-consultation. Valid for the patient named above only. Final format to be aligned with applicable telemedicine practice guidelines.
{rx.issued ? 'Digital signature — integration TBC' : 'Signed on issue'}
{d.name ? 'Dr. ' + d.name : 'Doctor'}{d.reg ? ' · Reg. ' + d.reg : ''}
); } function EmailPreview({ rx, onClose }) { return (
e.stopPropagation()} role="dialog" aria-label="Email preview" style={{ background: '#fff', color: '#0E2A17', width: 'min(720px,100%)', maxHeight: '92vh', overflow: 'auto', borderRadius: 18, boxShadow: '0 30px 80px rgba(0,0,0,.35)' }}>
Email preview · simulated — not sent
From: Yappy Care <care@yappy.demo>
To: {rx.patient.name} <{rx.patient.email || 'no email'}>
Subject: Your Yappy prescription · {rx.id}
Attachment: 📎 {rx.id}.pdf
YAPPY.
Hi {rx.patient.name.split(' ')[0]},

Thanks for your consultation. Your prescription from {rx.doctor?.name ? 'Dr. ' + rx.doctor.name : 'our doctor'} is attached{rx.orderRef ? <> and has been added to order {rx.orderRef} — we’ll start preparing it now : ''}.

The world is loud. Find your quiet.
); } Object.assign(window, { RxDocument, EmailPreview });