// MasterData.jsx — Machinery master data: Machines + Categories tabs. // (Customers → Customer page · Operators/Riggers → Employees page.) // Admin: full CRUD. Other roles: view-only. function MasterDataPage({ role }) { const [tab, setTab] = React.useState('machines'); const [adding, setAdding] = React.useState(false); const isAdmin = role === 'Admin'; return (
Machinery — the fleet master: every crane, its plate, category and live availability. {isAdmin ? 'You can add, edit and remove records.' : 'View-only — only Admin can edit master data.'}
{tab === 'machines' ? (

Fleet Machines

Plate numbers, categories and live availability
{isAdmin ? : Admin only}
{[...MACHINES].sort((a, b) => { const order = { available: 0, occupied: 1, unavailable: 2 }; return (order[a.status] ?? 3) - (order[b.status] ?? 3); }).map(m => ( ))}
IDStatusMachinePlateCategoryTonnage / Reach
{m.id} {m.status} {m.name} {m.plate} {m.category} {m.tonnage} {isAdmin ? : null}
) : null} {tab === 'categories' ? (

Machine Categories

Used for grouping in bookings list and analytics
{isAdmin ? : Admin only}
{CATEGORIES.map(c => { const count = MACHINES.filter(m => m.category === c.name).length; return ( ); })}
ColorNameMachines in fleet
{c.name} {count} machine{count === 1 ? '' : 's'} {isAdmin ? : null}
) : null}
); } Object.assign(window, { MasterDataPage });