// Stocks.jsx — Master Data › Stocks. Workshop parts & consumables inventory. // Admin/Mechanic: edit. Other roles: view-only. function StocksPage({ role }) { const canEdit = role === 'Admin' || role === 'Mechanic'; const [q, setQ] = React.useState(''); const [cat, setCat] = React.useState('All'); const cats = ['All', ...Array.from(new Set(STOCKS.map(s => s.category)))]; const rows = STOCKS.filter(s => (cat === 'All' || s.category === cat) && (q === '' || (s.item + ' ' + s.sku + ' ' + s.supplier).toLowerCase().includes(q.toLowerCase())) ); const low = STOCKS.filter(s => s.qty <= s.reorder); return (
Stocks — workshop store: parts, lubricants, filters and rigging consumables. Items at or below their re-order level are flagged. {canEdit ? 'You can adjust quantities and add items.' : 'View-only.'}
{[ { label: 'Line items', value: STOCKS.length, danger: false }, { label: 'Categories', value: cats.length - 1, danger: false }, { label: 'Below re-order', value: low.length, danger: low.length > 0 }, ].map(t => (
{t.label}
{t.value}
))}

Inventory

{rows.length} of {STOCKS.length} items
{canEdit ? : View only}
setQ(e.target.value)}/>
{cats.map(c => ( ))}
{rows.map(s => { const isLow = s.qty <= s.reorder; return ( ); })}
IDItemSKUCategoryOn handRe-orderLocationSupplier
{s.id} {s.item} {s.sku} {s.category} {s.qty} {s.unit} {isLow ? Low : null} {s.reorder} {s.unit} {s.location} {s.supplier} {canEdit ? : null}
); } Object.assign(window, { StocksPage });