From 61d1cf4bff263566c5c18922b74938b1bee4abc6 Mon Sep 17 00:00:00 2001 From: "n.siegfried" Date: Mon, 3 Aug 2026 15:17:51 -0700 Subject: [PATCH] Wave 2: form cleanups from the site comments, plus localization, project switcher and global search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Site comments (8/3) - BIM card: LOD removed, IFF # added next to the coordination status, and required once that status is "Signed off (IFF)" — an unnumbered sign-off isn't traceable. A LOD already stored on a package is preserved and shown as legacy, not blanked. - The blue "from SOP types" subtext under a field is now a SOP chip on the label with the detail in a tooltip. The chip stays visible rather than hover-only: field tablets have no hover, and "this came from the SOP" is the part that matters. The hint elements stay in the DOM (hidden) so the code writing to them keeps working; an observer mirrors their text into the tooltip. - Specification Section is no longer typed per package. Each WP type carries a spec section on the SOP; the field is read-only in the Creator and follows the type, with the SOP's spec folder linked underneath. This reads both spec comments as one intent — stop typing it, derive it. - Assignees and Distribution are multi-selects over the SOP project team, showing each person's job function, with the CM pre-added to Distribution (removable per package) and a free-text option for people with no account. The stored display strings are unchanged so print/export/dashboard keep working; account ids ride alongside for the notification work in wave 3. Localization + time - Per-user locale/timezone (Language & time in the user menu), an app-wide default in the admin console, then the browser. Timezones are validated against the server's zoneinfo and the picker is fed from it. Calendar dates are formatted from their parts so a due date never reads a day early in another zone. - Every displayed timestamp now goes through the shared helpers. Top-bar chrome - Project switcher beside the logo and a centered global search, injected into either generation of top bar; skipped in an iframe so the embedded Creator doesn't get a second one. Ctrl/Cmd-K focuses search. - GET /api/search covers work packages, projects and SOPs, scoped to the caller's projects, hiding archived packages, with LIKE wildcards escaped. Fixed along the way: showForm() cleared every card's inline display, which undid applyKind() — so the Package Type and BIM cards reappeared on an install-only project. Split out applyKindVisibility() and re-apply it there. Verified: 100 API checks on a fresh database (44 permissions + 22 password reset + 34 search/localization), 24 driven UI checks against the real Creator page in headless Chrome (SOP chips, both people pickers, spec auto-fill, critical tags, BIM suppression), and the chrome harness on both bar styles. Screenshots reviewed. Co-Authored-By: Claude Opus 5 (1M context) --- DEPLOYMENT.md | 32 ++ html/admin.html | 3 + html/admin.js | 95 ++++- html/auth-guard.js | 4 + html/field.html | 3 + html/field.js | 2 +- html/index.html | 3 + html/sw.js | 6 +- html/work-package-suite-app.js | 5 + html/work-package-suite-styles.css | 8 +- html/work-package-suite.html | 6 +- html/wp-chrome.css | 211 +++++++++++ html/wp-chrome.js | 335 ++++++++++++++++++ html/wp-creation-app.js | 278 ++++++++++++++- html/wp-creation-index.html | 20 +- html/wp-creation-styles.css | 53 +++ html/wp-format.js | 232 ++++++++++++ .../c93f2b1d7e04_user_locale_and_timezone.py | 29 ++ server/app.py | 140 ++++++++ server/models.py | 6 + server/notify.py | 10 +- 21 files changed, 1445 insertions(+), 36 deletions(-) create mode 100644 html/wp-chrome.css create mode 100644 html/wp-chrome.js create mode 100644 html/wp-format.js create mode 100644 server/alembic/versions/c93f2b1d7e04_user_locale_and_timezone.py diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index 2fc137d..84c25ee 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -346,6 +346,38 @@ hides the BIM/VDC section and every project is install-only (IWP). A SOP that already has BIM enabled keeps its data — it just stops being offered — so turning the flag off never deletes BIM types, gates, or sequence steps. +## Localization (dates, times, numbers) + +Three levels, most specific first — resolved in `html/wp-format.js`: + +1. **the user's own preference** — *Language & time* in the top-right menu + (`users.locale` / `users.timezone`, via `POST /api/auth/preferences`) +2. **the app default** — Admin console → Features → *Localization defaults* + (`default_locale` / `default_timezone`) +3. **the browser**, as before + +Timezone names are validated against the server's own `zoneinfo` database, and the +picker is fed from `GET /api/timezones` so it can only offer what will be accepted. +Calendar dates (a due date, a kitting date) are formatted from their parts and are +**never** shifted by a timezone — only real instants (MIMO windows, history, +notifications) are converted. Use the shared helpers (`wpFormatDate`, +`wpFormatDateTime`, `wpFormatTime`, `wpFormatNumber`) rather than +`toLocaleString()`, or a page will quietly ignore the preference. + +## Top-bar chrome (project switcher + search) + +`html/wp-chrome.js` + `wp-chrome.css` inject a project switcher and a centered +global search into whichever top bar a page has — the dark `.wp-appbar` or the +older `.header`. It is skipped inside an iframe, so the embedded WP creator does +not get a second bar. + +- Switching project reloads the current page with `?project=`; every page + already resolves its project from that parameter. +- Search calls `GET /api/search?q=`, which is **scoped to the caller's projects** + (`scope_to_access`) and hides archived work packages. LIKE wildcards in the query + are escaped, so searching `100%` matches a literal `100%`. Two-character minimum. +- Ctrl/Cmd-K focuses the field from anywhere. + ## Schema migrations (Alembic) Schema is managed by **Alembic** (`server/alembic/`). The API container runs diff --git a/html/admin.html b/html/admin.html index db918e7..ab0f2e3 100644 --- a/html/admin.html +++ b/html/admin.html @@ -9,6 +9,7 @@ +