fix(nav): store view shows functional racks only (rack_purpose<>prop), truncate labels
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
53b1a64a48
commit
fb533a7701
@ -44,6 +44,7 @@ async def store_layout(space_id: int | None = None, ident=Depends(require_token)
|
||||
AND i.in_stock) AS items
|
||||
FROM virtual_rack r LEFT JOIN virtual_rack_type rt ON rt.id = r.rack_type_id
|
||||
WHERE r.visible = 'y' AND r.space_id = :s
|
||||
AND coalesce(rt.rack_purpose, 'stock') <> 'prop' -- functional racks only; props = 3D scenery
|
||||
"""), {"s": space_id})).mappings()]
|
||||
return {"ok": True, "space": dict(space) if space else None, "racks": racks}
|
||||
|
||||
|
||||
@ -140,9 +140,9 @@ function drawStore(){
|
||||
const corners=[[-hw,-hd],[hw,-hd],[hw,hd],[-hw,hd]].map(([px,pz])=>[cx+px*cos-pz*sin, cy+px*sin+pz*cos]);
|
||||
g.beginPath(); g.moveTo(corners[0][0],corners[0][1]); corners.slice(1).forEach(c=>g.lineTo(c[0],c[1])); g.closePath();
|
||||
g.fillStyle=r.items? '#8bc34a':'#cfe3b0'; g.fill(); g.strokeStyle='#558b2f'; g.lineWidth=1.5; g.stroke();
|
||||
g.fillStyle='#1b1b22'; g.font='bold 11px system-ui'; g.textAlign='center'; g.textBaseline='middle';
|
||||
g.fillText(r.name||('Rack '+r.id), cx, cy);
|
||||
g.fillStyle='#3a3a3a'; g.font='9px system-ui'; g.fillText((r.items||0)+' items', cx, cy+13);
|
||||
g.fillStyle='#1b1b22'; g.font='bold 10px system-ui'; g.textAlign='center'; g.textBaseline='middle';
|
||||
const lbl=(r.name||('Rack '+r.id)); g.fillText(lbl.length>15?lbl.slice(0,14)+'…':lbl, cx, cy-(r.items?5:0));
|
||||
if(r.items){ g.fillStyle='#3a3a3a'; g.font='9px system-ui'; g.fillText(r.items+' items', cx, cy+7); }
|
||||
ST.hit.push({type:'rack', id:r.id, cx, cy, r:Math.max(hw,hd)+4});
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user