Phase 8: Project Management, find bar, presence and motion
The Project Management screen (/pm, view only) with Overview, Projects & units, Bottlenecks & aging, Hours vs target, Quality & issues and Find jobs, the period picker, health per unit and per project, drill down, Excel (CSV) per table and for all, and the PESCO production status report PDF with the controlled-copy stamp; every export logged as "report exported". The find bar on every home screen: the full search set, the dropdowns, quick flags with Mine, the flag kinds, Board and List with sorts, filters saved per browser; every filter applied by the server on the list and the boards, with facets. Presence in packets with role, lock and revoke drop; the motion switch with reduced motion honoured, card glides, glow and count-up; Back restores the scroll spot; sheet placement and the iPad layout pass. The data book compared page by page with the old build and six layout differences fixed. Tests for the PM aggregates, search, filters, presence and exports; Playwright scenarios for the PM screen, the find bar and presence at desktop and iPad viewports. Docs updated; PLAN.md questions 38 to 42. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
@@ -12,9 +12,9 @@ from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||
|
||||
from fastapi import APIRouter, Depends, Query, Request
|
||||
|
||||
from ..domain import packets
|
||||
from ..text import clean_text
|
||||
from ..domain import packets, search
|
||||
from .deps import Db, Principal, current_principal, get_db, settings_of
|
||||
from .packets import FIND
|
||||
|
||||
router = APIRouter(prefix="/api/warehouse", tags=["warehouse"])
|
||||
|
||||
@@ -141,21 +141,22 @@ def board(
|
||||
request: Request,
|
||||
p: Principal = Depends(current_principal), # noqa: B008
|
||||
d: Db = Depends(get_db), # noqa: B008
|
||||
q: str = Query("", max_length=200),
|
||||
find: dict[str, Any] = FIND,
|
||||
project_id: int | None = Query(None),
|
||||
unit_id: int | None = Query(None),
|
||||
dept: str = Query("", max_length=10),
|
||||
) -> dict[str, Any]:
|
||||
"""The warehouse board. The find bar values narrow the cards of every column and the shorts list; the KPIs
|
||||
follow the project and unit only."""
|
||||
conn = d.conn
|
||||
pp = packets.policy_principal_for(conn, p)
|
||||
tz = _tz(request)
|
||||
filters: dict[str, Any] = {
|
||||
"q": clean_text(q, 200),
|
||||
"project_id": project_id,
|
||||
"unit_id": unit_id,
|
||||
"dept": dept.strip() or None,
|
||||
"limit": BOARD_LIMIT,
|
||||
}
|
||||
parsed = search.parse_filters(
|
||||
{**find, "project_id": project_id, "unit_id": unit_id},
|
||||
pp,
|
||||
screen="warehouse",
|
||||
today=datetime.now(tz).date(),
|
||||
)
|
||||
filters: dict[str, Any] = {**search.board_filters(parsed), "limit": BOARD_LIMIT}
|
||||
|
||||
columns: dict[str, list[dict[str, Any]]] = {st: [] for st in (*STAGES, "released")}
|
||||
for card in packets.list_cards(conn, pp, {**filters, "status": "warehouse"}):
|
||||
@@ -182,4 +183,9 @@ def board(
|
||||
for sr in packets.rows(conn, SHORTS_SQL, (list(by_id),)):
|
||||
shorts.append(_short_row(sr, by_id[int(sr["packet_id"])], today, now))
|
||||
|
||||
return {"kpis": _kpis(conn, filters), "columns": columns, "shorts": shorts}
|
||||
return {
|
||||
"kpis": _kpis(conn, filters),
|
||||
"columns": columns,
|
||||
"shorts": shorts,
|
||||
"facets": search.facets(conn, project_id=project_id, unit_id=unit_id),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user