diff --git a/app/admin_routes.py b/app/admin_routes.py
index 0dc033f..eb3b20f 100644
--- a/app/admin_routes.py
+++ b/app/admin_routes.py
@@ -76,6 +76,31 @@ async def crates(ident=Depends(require_token), db=Depends(get_db)):
return {"ok": True, "crates": [dict(r) for r in rows.mappings()]}
+@router.get("/storemap")
+async def storemap(ident=Depends(require_token), db=Depends(get_db)):
+ """Top-down store map: room + racks + crates at their real positions, with live item counts.
+ Powers the clickable store-navigator (the WowPlatter 'Search' workstation, RecordGod-side)."""
+ sp = (await db.execute(text(
+ "SELECT * FROM virtual_space WHERE visible='y' ORDER BY (is_default='y') DESC LIMIT 1"
+ ))).mappings().first()
+ space = {"room_width": float(sp["room_width"] or 12), "room_depth": float(sp["room_depth"] or 12)} if sp else {"room_width": 12, "room_depth": 12}
+ ctypes = {r["id"]: {"w": float(r["width"] or 0.35), "d": float(r["depth"] or 0.5)}
+ for r in (await db.execute(text("SELECT id, width, depth FROM virtual_crate_type"))).mappings()}
+ crates = [dict(r) for r in (await db.execute(text("""
+ SELECT c.id, c.name, c.label_text, c.crate_purpose, c.crate_type_id,
+ c.pos_x::float AS x, c.pos_z::float AS z, c.rotation_y::float AS rot,
+ (SELECT count(*) FROM inventory i WHERE i.crate_id = c.id AND i.in_stock) AS items
+ FROM virtual_crate c WHERE c.visible='y'
+ """))).mappings()]
+ racks = [dict(r) for r in (await db.execute(text("""
+ SELECT r.pos_x::float AS x, r.pos_z::float AS z, r.rotation_y::float AS rot,
+ rt.width::float AS w, rt.depth::float AS d
+ FROM virtual_rack r LEFT JOIN virtual_rack_type rt ON rt.id = r.rack_type_id
+ WHERE r.visible='y'
+ """))).mappings()]
+ return {"ok": True, "space": space, "crate_types": ctypes, "crates": crates, "racks": racks}
+
+
@router.get("/reports")
async def reports(ident=Depends(require_token), db=Depends(get_db)):
summary = dict((await db.execute(text("""
diff --git a/site/admin.html b/site/admin.html
index 26106ce..bdfcf2c 100644
--- a/site/admin.html
+++ b/site/admin.html
@@ -67,6 +67,7 @@
🛒 Orders