// Screen: Inventory — stock table with flags function Inventory({ scope, density }) { const { useState, useMemo } = React; const [filter, setFilter] = useState('all'); const [query, setQuery] = useState(''); const rows = useMemo(() => { let r = INVENTORY; if (scope !== 'all') r = r.filter(x => x.store.toLowerCase() === scope); if (filter === 'flagged') r = r.filter(x => x.status === 'low' || x.status === 'reorder'); if (filter === 'compounding') r = r.filter(x => x.vendor !== 'McKesson'); if (query) r = r.filter(x => (x.drug + x.ndc).toLowerCase().includes(query.toLowerCase())); return [...r].sort((a, b) => a.daysSupply - b.daysSupply); }, [scope, filter, query]); const flagged = INVENTORY.filter(x => x.status === 'low' || x.status === 'reorder').length; return (
setQuery(e.target.value)}>
Sorted by days of supply, ascending · synced 6:58a
{rows.map(x => ( ))} {rows.length === 0 ? ( ) : null}
Item NDC / item no. Store On hand Par Days supply Vendor Status
{x.drug}
{x.pkg}
{x.ndc} {x.store} {x.onHand.toLocaleString()} {x.par.toLocaleString()} {x.daysSupply}d {x.vendor}
No items match.
); } Object.assign(window, { Inventory });