/* ===== Rules configuration screen — matrix + constraint editor ===== */ const RulesScreen = ({ onOpenExcel }) => { const [matrix, setMatrix] = React.useState(window.Mojro.CAT_MATRIX); const [tab, setTab] = React.useState('matrix'); const cycleCell = (a, b) => { const cur = matrix[a][b]; const next = cur === 'allowed' ? 'warn' : cur === 'warn' ? 'blocked' : 'allowed'; setMatrix(m => ({ ...m, [a]: { ...m[a], [b]: next }, [b]: { ...m[b], [a]: next }, // symmetric })); }; return (
| {cats.map(c => ( |
{c.name}
|
))}
|
|---|---|---|
|
{a.name}
|
{cats.map(b => {
const s = matrix[a.id][b.id];
const isDiag = a.id === b.id;
return (
); })} | |
| SKU | Description | Orientation | Stackability | Category | Priority / stop | |
|---|---|---|---|---|---|---|
| {r.sku} | {r.desc} | {r.orient} | {r.stk} | c.name===r.cat)?.color+'22', color: window.Mojro.CATEGORIES.find(c=>c.name===r.cat)?.color, }}>{r.cat} | {r.pri} |