// 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 (
| ID | Item | SKU | Category | On hand | Re-order | Location | Supplier | |
|---|---|---|---|---|---|---|---|---|
| {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} |