Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +7 -1
- VERSION +1 -1
- api/routes_customers.py +67 -0
- api/routes_geo.py +64 -2
- web/src/customer-grid/CustomerGrid.tsx +62 -8
- web/src/customer-grid/MapView.tsx +619 -292
- web/src/customer-grid/apiBridge.ts +31 -0
- web/src/customer-grid/map.css +38 -15
- web/src/customer-grid/types.ts +12 -0
- web/src/customer-grid/viewModes.tsx +12 -50
- web/src/index.css +161 -37
RELEASES.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
{
|
| 5 |
"version": "v45",
|
| 6 |
"sha": "0b2b501",
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "v46 (a8dc531)",
|
| 3 |
"releases": [
|
| 4 |
+
{
|
| 5 |
+
"version": "v46",
|
| 6 |
+
"sha": "a8dc531",
|
| 7 |
+
"date": "2026-08-23",
|
| 8 |
+
"subject": "release v46"
|
| 9 |
+
},
|
| 10 |
{
|
| 11 |
"version": "v45",
|
| 12 |
"sha": "0b2b501",
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
v46 (a8dc531)
|
api/routes_customers.py
CHANGED
|
@@ -913,3 +913,70 @@ def route_order_write(body: dict = Body(default=None),
|
|
| 913 |
"depot": defn["route"]["depot"],
|
| 914 |
"solvedAt": stamp}
|
| 915 |
return out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 913 |
"depot": defn["route"]["depot"],
|
| 914 |
"solvedAt": stamp}
|
| 915 |
return out
|
| 916 |
+
|
| 917 |
+
|
| 918 |
+
@router.delete("/customers/route-order/{field_key}")
|
| 919 |
+
def route_order_delete(field_key: str,
|
| 920 |
+
session: Session = Depends(module_gate(MODULE))):
|
| 921 |
+
"""Remove a Destination column and every visit number in it.
|
| 922 |
+
|
| 923 |
+
⛔⛔ WHY THIS DOOR HAD TO EXIST. `route_order_write` mints a TENANT-WIDE column and nothing
|
| 924 |
+
could ever remove it: the grid's own Delete is offered for a per-user `custom_` column
|
| 925 |
+
(`menuField.custom && !menuField.shared`) or for a `ut_*` definition field, and a route order
|
| 926 |
+
is neither — it is a SHARED column on a registry topic. So `Destination 1` was permanent for
|
| 927 |
+
the whole workspace, which is [[reachable-is-not-the-same-as-built]] from the other end:
|
| 928 |
+
`shared_overlay.drop_field` was complete and correct and no route on this topic called it.
|
| 929 |
+
|
| 930 |
+
⛔ CREATOR-OR-ADMIN, the same wall `routes_tables.delete_shared_field` applies and for the
|
| 931 |
+
same reason: writing a cell changes a value, dropping the column deletes that value for every
|
| 932 |
+
account at once. It is deliberately NOT the looser wall `route_order_write` uses for CREATE.
|
| 933 |
+
|
| 934 |
+
⛔ AND A CALLER WHO CANNOT SEE THE COLUMN GETS THE ANSWER A NONEXISTENT KEY GETS. The refusals
|
| 935 |
+
below would otherwise teach a stranger that a route order exists on this database and who
|
| 936 |
+
planned it, which is exactly what the per-field wall withholds — the choice already argued at
|
| 937 |
+
`route_order_write`'s `field_key_taken` and in `routes_shares._can_see_object`.
|
| 938 |
+
"""
|
| 939 |
+
from core import shared_overlay
|
| 940 |
+
import core.perm_scope as perm_scope
|
| 941 |
+
import aios_grid
|
| 942 |
+
|
| 943 |
+
key = str(field_key or "").strip()
|
| 944 |
+
all_defs = shared_fields(st=session.runtime) or {}
|
| 945 |
+
defn = all_defs.get(key) if isinstance(all_defs.get(key), dict) else None
|
| 946 |
+
unknown = err(404, "unknown_field",
|
| 947 |
+
"that column is not a route order column on this database")
|
| 948 |
+
if not defn:
|
| 949 |
+
raise unknown
|
| 950 |
+
# The wall FIRST, so a hidden column is indistinguishable from an absent one.
|
| 951 |
+
if key in perm_scope.hidden_keys(
|
| 952 |
+
session.user, MODULE,
|
| 953 |
+
_merge_shared_fields(list(aios_grid.FIELDS), all_defs), st=session.runtime):
|
| 954 |
+
raise unknown
|
| 955 |
+
# ⛔ KIND-CHECKED, NOT PREFIX-CHECKED. `ROUTE_KEY_PREFIX` is a naming convention and a
|
| 956 |
+
# convention is not a declaration (the comment on `ROUTE_KIND` says so); a door that deleted
|
| 957 |
+
# by prefix would happily drop a shared column somebody else's feature owns.
|
| 958 |
+
if defn.get("kind") != ROUTE_KIND:
|
| 959 |
+
raise err(400, "not_a_route_column",
|
| 960 |
+
"that column is shared but it is not a route order column, so this door will "
|
| 961 |
+
"not remove it")
|
| 962 |
+
owner = str(defn.get("createdBy") or "")
|
| 963 |
+
if not session.admin and owner != session.uname:
|
| 964 |
+
raise err(403, "forbidden",
|
| 965 |
+
f"a route order column can be removed by the person who planned it or by an "
|
| 966 |
+
f"administrator. This one was planned by {owner or 'somebody else'}, and "
|
| 967 |
+
f"removing it would delete the visit numbers for every account at once")
|
| 968 |
+
|
| 969 |
+
dropped = shared_overlay.drop_field(_shared_key(), key, st=session.runtime)
|
| 970 |
+
# ⭐⭐ THE GRANT DIES WITH THE COLUMN. `route_order_write` claims
|
| 971 |
+
# `shares.field_oid(SHARE_TOPIC, key)` on create, so skipping this would leave a grant record
|
| 972 |
+
# pointing at nothing — a ghost in every receiver's "Shared with me" that 404s on open, and
|
| 973 |
+
# worse, one that silently re-arms on the next column to take the key, because `drop_field`
|
| 974 |
+
# scrubs the cells precisely so the key CAN be re-used.
|
| 975 |
+
# ⚠ Same order and same tolerance as `routes_tables.delete_shared_field`: the column is
|
| 976 |
+
# already gone, so a failed release must not turn a completed delete into a 500.
|
| 977 |
+
try:
|
| 978 |
+
import core.shares as shares
|
| 979 |
+
shares.drop_objects([("field", shares.field_oid(SHARE_TOPIC, key))], st=session.runtime)
|
| 980 |
+
except Exception: # noqa: BLE001
|
| 981 |
+
pass
|
| 982 |
+
return {"ok": True, "field": key, "dropped": bool(dropped)}
|
api/routes_geo.py
CHANGED
|
@@ -12,6 +12,7 @@ them. That is the seam.
|
|
| 12 |
tiles AIOS_MAP_TILE_URL default https://tile.openstreetmap.org/{z}/{x}/{y}.png
|
| 13 |
geocode AIOS_GEOCODE_URL default https://nominatim.openstreetmap.org/search
|
| 14 |
routing AIOS_ROUTE_URL default https://router.project-osrm.org/route/v1/driving/
|
|
|
|
| 15 |
|
| 16 |
⛔ R3'S ON-DEMAND RULE, AND WHY IT IS STRUCTURAL HERE RATHER THAN A COMMENT.
|
| 17 |
R3 forbids geocoding a whole table automatically. Under R14 the reason moves from money to manners
|
|
@@ -61,6 +62,39 @@ _TILE_CREDIT_HREF_DEFAULT = "https://www.openstreetmap.org/copyright"
|
|
| 61 |
_GEOCODE_URL_DEFAULT = "https://nominatim.openstreetmap.org/search"
|
| 62 |
_ROUTE_URL_DEFAULT = "https://router.project-osrm.org/route/v1/driving/"
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
#: Both policies require a real, identifying User-Agent. A generic one is how a shared service
|
| 65 |
#: decides an application is a scraper, so this carries the product name and a contact URL.
|
| 66 |
_UA_DEFAULT = "AIOS-Loopable/1.0 (+https://runloopable.com)"
|
|
@@ -120,6 +154,17 @@ def provider_config():
|
|
| 120 |
"route": {
|
| 121 |
"available": True,
|
| 122 |
"attribution": _env("AIOS_ROUTE_ATTRIBUTION", "Routing by OSRM"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
},
|
| 124 |
}
|
| 125 |
|
|
@@ -334,7 +379,21 @@ def geo_route(body: dict = Body(...), session: Session = Depends(require_session
|
|
| 334 |
raise err(400, "bad_stop", "Every stop needs a latitude and longitude on the globe.")
|
| 335 |
pairs.append(f"{lon:.6f},{lat:.6f}")
|
| 336 |
|
| 337 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
_throttle(_env_int("AIOS_GEOCODE_MIN_INTERVAL_MS", _MIN_INTERVAL_MS_DEFAULT))
|
| 339 |
try:
|
| 340 |
r = requests.get(
|
|
@@ -383,5 +442,8 @@ def geo_route(body: dict = Body(...), session: Session = Depends(require_session
|
|
| 383 |
"km": round(float(top.get("distance") or 0.0) / 1000.0, 1),
|
| 384 |
"minutes": int(round(float(top.get("duration") or 0.0) / 60.0)),
|
| 385 |
"line": line,
|
| 386 |
-
|
|
|
|
|
|
|
|
|
|
| 387 |
}
|
|
|
|
| 12 |
tiles AIOS_MAP_TILE_URL default https://tile.openstreetmap.org/{z}/{x}/{y}.png
|
| 13 |
geocode AIOS_GEOCODE_URL default https://nominatim.openstreetmap.org/search
|
| 14 |
routing AIOS_ROUTE_URL default https://router.project-osrm.org/route/v1/driving/
|
| 15 |
+
walking AIOS_ROUTE_URL_WALKING default https://routing.openstreetmap.de/routed-foot/route/v1/driving/
|
| 16 |
|
| 17 |
⛔ R3'S ON-DEMAND RULE, AND WHY IT IS STRUCTURAL HERE RATHER THAN A COMMENT.
|
| 18 |
R3 forbids geocoding a whole table automatically. Under R14 the reason moves from money to manners
|
|
|
|
| 62 |
_GEOCODE_URL_DEFAULT = "https://nominatim.openstreetmap.org/search"
|
| 63 |
_ROUTE_URL_DEFAULT = "https://router.project-osrm.org/route/v1/driving/"
|
| 64 |
|
| 65 |
+
#: ⭐⭐ WALKING IS A DIFFERENT SERVER, NOT A DIFFERENT PATH SEGMENT, and that was MEASURED rather
|
| 66 |
+
#: than assumed. The obvious implementation is to swap `driving` for `foot` in the URL above,
|
| 67 |
+
#: because that is what the OSRM API signature says. It returns HTTP 200 and it is a LIE: the
|
| 68 |
+
#: public demo server has only the car profile loaded and serves it for every profile in the path.
|
| 69 |
+
#: Probed 2026-08-23 over the same two New York points, `/driving/` and `/foot/` both answered
|
| 70 |
+
#: 10571.1 m in 969.1 s — 39 km/h, which is nobody walking. A walking toggle built that way would
|
| 71 |
+
#: have shipped driving minutes under a walking label, on a screen a person plans a day from.
|
| 72 |
+
#: FOSSGIS runs a genuinely separate foot-profile instance: the same two points come back 8429.7 m
|
| 73 |
+
#: in 6745.8 s = 4.5 km/h. So the mode selects a BASE URL, and each one is overridable on its own.
|
| 74 |
+
_ROUTE_URL_WALKING_DEFAULT = "https://routing.openstreetmap.de/routed-foot/route/v1/driving/"
|
| 75 |
+
|
| 76 |
+
#: The travel modes this door answers, each mapped to the env var holding its base URL and the
|
| 77 |
+
#: env var holding its credit line. A mode whose base URL resolves empty is REPORTED as
|
| 78 |
+
#: unavailable rather than silently falling back to another profile's numbers.
|
| 79 |
+
_ROUTE_MODES = {
|
| 80 |
+
"driving": ("AIOS_ROUTE_URL", _ROUTE_URL_DEFAULT,
|
| 81 |
+
"AIOS_ROUTE_ATTRIBUTION", "Routing by OSRM"),
|
| 82 |
+
"walking": ("AIOS_ROUTE_URL_WALKING", _ROUTE_URL_WALKING_DEFAULT,
|
| 83 |
+
"AIOS_ROUTE_ATTRIBUTION_WALKING", "Walking routes by OSRM / FOSSGIS"),
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def _route_mode(raw):
|
| 88 |
+
"""Normalise the requested travel mode, defaulting to driving."""
|
| 89 |
+
mode = str(raw or "driving").strip().lower()
|
| 90 |
+
return mode if mode in _ROUTE_MODES else "driving"
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def route_mode_config(mode):
|
| 94 |
+
"""`(base_url, attribution)` for a travel mode, both environment-overridable."""
|
| 95 |
+
url_var, url_default, credit_var, credit_default = _ROUTE_MODES[mode]
|
| 96 |
+
return _env(url_var, url_default).strip(), _env(credit_var, credit_default)
|
| 97 |
+
|
| 98 |
#: Both policies require a real, identifying User-Agent. A generic one is how a shared service
|
| 99 |
#: decides an application is a scraper, so this carries the product name and a contact URL.
|
| 100 |
_UA_DEFAULT = "AIOS-Loopable/1.0 (+https://runloopable.com)"
|
|
|
|
| 154 |
"route": {
|
| 155 |
"available": True,
|
| 156 |
"attribution": _env("AIOS_ROUTE_ATTRIBUTION", "Routing by OSRM"),
|
| 157 |
+
# ⭐ THE CLIENT ASKS WHAT IS ANSWERABLE RATHER THAN OFFERING EVERY MODE AND HOPING.
|
| 158 |
+
# A picker that lists a mode this deployment has no router for spends a click to earn
|
| 159 |
+
# an error ([[permitted-is-not-answerable]]), so only the modes whose base URL is
|
| 160 |
+
# actually configured are named here, and the map disables the rest in place.
|
| 161 |
+
"modes": [
|
| 162 |
+
{"key": mode,
|
| 163 |
+
"label": "Walking" if mode == "walking" else "Driving",
|
| 164 |
+
"available": bool(route_mode_config(mode)[0]),
|
| 165 |
+
"attribution": route_mode_config(mode)[1]}
|
| 166 |
+
for mode in _ROUTE_MODES
|
| 167 |
+
],
|
| 168 |
},
|
| 169 |
}
|
| 170 |
|
|
|
|
| 379 |
raise err(400, "bad_stop", "Every stop needs a latitude and longitude on the globe.")
|
| 380 |
pairs.append(f"{lon:.6f},{lat:.6f}")
|
| 381 |
|
| 382 |
+
# ⭐ THE MODE PICKS THE SERVER. See `_ROUTE_URL_WALKING_DEFAULT` for why it is not a path
|
| 383 |
+
# segment: the demo car server answers `/foot/` with car numbers, so substituting the profile
|
| 384 |
+
# would have shipped a walking label over driving minutes.
|
| 385 |
+
mode = _route_mode(body.get("mode"))
|
| 386 |
+
base, credit = route_mode_config(mode)
|
| 387 |
+
if not base:
|
| 388 |
+
raise err(400, "route_mode_unavailable",
|
| 389 |
+
f"This deployment has no {'walking' if mode == 'walking' else 'driving'} "
|
| 390 |
+
f"routing service configured, so a {'walking' if mode == 'walking' else 'driving'} "
|
| 391 |
+
f"time cannot be worked out. The stop order and the straight-line estimate are "
|
| 392 |
+
f"still on the map.")
|
| 393 |
+
# ⚠ ONE throttle across BOTH routers, deliberately. The lock is process-wide and the two modes
|
| 394 |
+
# are two different operators, so this over-waits rather than under-waits when a person flips
|
| 395 |
+
# the toggle. That is the safe direction for a courtesy limit on a free shared service, and it
|
| 396 |
+
# keeps the single-timestamp invariant the module header argues for.
|
| 397 |
_throttle(_env_int("AIOS_GEOCODE_MIN_INTERVAL_MS", _MIN_INTERVAL_MS_DEFAULT))
|
| 398 |
try:
|
| 399 |
r = requests.get(
|
|
|
|
| 442 |
"km": round(float(top.get("distance") or 0.0) / 1000.0, 1),
|
| 443 |
"minutes": int(round(float(top.get("duration") or 0.0) / 60.0)),
|
| 444 |
"line": line,
|
| 445 |
+
# The mode rides the answer so the client cannot label a driving route as a walk when a
|
| 446 |
+
# request is in flight and the toggle moves underneath it.
|
| 447 |
+
"mode": mode,
|
| 448 |
+
"attribution": credit,
|
| 449 |
}
|
web/src/customer-grid/CustomerGrid.tsx
CHANGED
|
@@ -94,7 +94,7 @@ import { NAV_MINIMIZE_EVENT, ROWS_STALE_EVENT, TOAST_EVENT, VIEW_OPEN_EVENT,
|
|
| 94 |
WORKSPACE_STALE_EVENT, signal }
|
| 95 |
from "../apiContract";
|
| 96 |
import type { ViewOpenDetail } from "../apiContract";
|
| 97 |
-
import { addTableField, addTableRow, deleteTableField, deleteTableRow, fetchLinkTargets,
|
| 98 |
fetchRollupSources, patchTableField, enrichField } from "./apiBridge";
|
| 99 |
import type { LinkTarget, RollupSourceOffer } from "./apiBridge";
|
| 100 |
import SelectFromFile from "./SelectFromFile";
|
|
@@ -4394,10 +4394,6 @@ function CustomerGridSurface({
|
|
| 4394 |
// return first runs only once loading flips off, so the same mounted instance renders one
|
| 4395 |
// MORE hook than its loading render and React #310 takes down the whole surface. That is
|
| 4396 |
// exactly how v44 crashed Odoo customers for every mount that began on the spinner.
|
| 4397 |
-
const renameActiveView = useCallback(
|
| 4398 |
-
(name: string) => renameView(activeViewId, name),
|
| 4399 |
-
[activeViewId, renameView]
|
| 4400 |
-
);
|
| 4401 |
/**
|
| 4402 |
* I12 (contract C3) — freeze/unfreeze a view's DISPLAY MODE.
|
| 4403 |
*
|
|
@@ -5469,6 +5465,43 @@ function CustomerGridSurface({
|
|
| 5469 |
* ⚠ The VIEW config is scrubbed on the same terms as the overlay delete; a stale `colId` in
|
| 5470 |
* another view self-heals on its next autosave, the rule every other delete rides.
|
| 5471 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5472 |
const deleteDefinitionField = useCallback(
|
| 5473 |
(key: string) => {
|
| 5474 |
if (!isUserTable || key === lockedKey) return;
|
|
@@ -6380,9 +6413,6 @@ function CustomerGridSurface({
|
|
| 6380 |
<ModeSwitch
|
| 6381 |
mode={displayMode}
|
| 6382 |
onMode={setDisplayMode}
|
| 6383 |
-
viewName={activeView?.name}
|
| 6384 |
-
canRenameView={!!activeView && mayEditView(activeView, viewer)}
|
| 6385 |
-
onRenameView={renameActiveView}
|
| 6386 |
// I12 (C3) — a locked view's mode is frozen, so the switcher stops being a switcher.
|
| 6387 |
// The field pickers beside it stay: C3 freezes the MODE, and a kanban's stack field is
|
| 6388 |
// config, not mode ("filters/sorts/columns stay editable").
|
|
@@ -7391,6 +7421,12 @@ function CustomerGridSurface({
|
|
| 7391 |
}}
|
| 7392 |
onRouteFieldCreated={revealRouteField}
|
| 7393 |
routePanelOpen={routePanelOpen}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7394 |
selectedPids={selectedPids}
|
| 7395 |
onSelectPids={selectPids}
|
| 7396 |
onOpen={setDetailPid}
|
|
@@ -7852,6 +7888,24 @@ function CustomerGridSurface({
|
|
| 7852 |
deleteDefinitionField(menuField.key);
|
| 7853 |
setColumnMenu(null);
|
| 7854 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7855 |
: undefined
|
| 7856 |
}
|
| 7857 |
onDuplicate={
|
|
|
|
| 94 |
WORKSPACE_STALE_EVENT, signal }
|
| 95 |
from "../apiContract";
|
| 96 |
import type { ViewOpenDetail } from "../apiContract";
|
| 97 |
+
import { addTableField, addTableRow, deleteRouteOrderField, deleteTableField, deleteTableRow, fetchLinkTargets,
|
| 98 |
fetchRollupSources, patchTableField, enrichField } from "./apiBridge";
|
| 99 |
import type { LinkTarget, RollupSourceOffer } from "./apiBridge";
|
| 100 |
import SelectFromFile from "./SelectFromFile";
|
|
|
|
| 4394 |
// return first runs only once loading flips off, so the same mounted instance renders one
|
| 4395 |
// MORE hook than its loading render and React #310 takes down the whole surface. That is
|
| 4396 |
// exactly how v44 crashed Odoo customers for every mount that began on the spinner.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4397 |
/**
|
| 4398 |
* I12 (contract C3) — freeze/unfreeze a view's DISPLAY MODE.
|
| 4399 |
*
|
|
|
|
| 5465 |
* ⚠ The VIEW config is scrubbed on the same terms as the overlay delete; a stale `colId` in
|
| 5466 |
* another view self-heals on its next autosave, the rule every other delete rides.
|
| 5467 |
*/
|
| 5468 |
+
/**
|
| 5469 |
+
* ⭐⭐ OWNER ITEM 3 (2026-08-23) — A DESTINATION FIELD BECOMES DELETABLE.
|
| 5470 |
+
*
|
| 5471 |
+
* ⛔ WHY IT NEEDED A THIRD HANDLER. `deleteField` serves a PER-USER `custom_` column and
|
| 5472 |
+
* `deleteDefinitionField` serves a `ut_*` definition column; a route order is neither. It is a
|
| 5473 |
+
* TENANT-WIDE shared column on a registry topic, so both existing branches fell through to
|
| 5474 |
+
* `undefined` and the menu simply showed no Delete row at all. The column was permanent for the
|
| 5475 |
+
* whole workspace and nothing on the surface said so.
|
| 5476 |
+
*
|
| 5477 |
+
* ⚠ The local field list is trimmed only AFTER the server says the drop happened, and the two
|
| 5478 |
+
* stale signals fire because the values went with the definition (`shared_overlay.drop_field`
|
| 5479 |
+
* scrubs the cells so the key can be re-used).
|
| 5480 |
+
*/
|
| 5481 |
+
const deleteRouteField = useCallback(
|
| 5482 |
+
(key: string) => {
|
| 5483 |
+
if (key === lockedKey) return;
|
| 5484 |
+
void deleteRouteOrderField(key).then((ok) => {
|
| 5485 |
+
if (!ok) return; // the bridge has already said why
|
| 5486 |
+
setFields((current) => current.filter((item) => item.key !== key));
|
| 5487 |
+
const nextWidths = { ...(config.widths ?? {}) };
|
| 5488 |
+
delete nextWidths[key];
|
| 5489 |
+
updateConfig({
|
| 5490 |
+
...config,
|
| 5491 |
+
order: order.filter((k) => k !== key),
|
| 5492 |
+
visible: [...visible].filter((k) => k !== key),
|
| 5493 |
+
widths: nextWidths,
|
| 5494 |
+
sorts: (config.sorts ?? []).filter((s) => s.colId !== key),
|
| 5495 |
+
groupBy: config.groupBy === key ? null : config.groupBy,
|
| 5496 |
+
colorBy: config.colorBy === key ? null : config.colorBy,
|
| 5497 |
+
});
|
| 5498 |
+
signal(WORKSPACE_STALE_EVENT);
|
| 5499 |
+
signal(ROWS_STALE_EVENT);
|
| 5500 |
+
});
|
| 5501 |
+
},
|
| 5502 |
+
[lockedKey, config, order, visible, updateConfig, setFields]
|
| 5503 |
+
);
|
| 5504 |
+
|
| 5505 |
const deleteDefinitionField = useCallback(
|
| 5506 |
(key: string) => {
|
| 5507 |
if (!isUserTable || key === lockedKey) return;
|
|
|
|
| 6413 |
<ModeSwitch
|
| 6414 |
mode={displayMode}
|
| 6415 |
onMode={setDisplayMode}
|
|
|
|
|
|
|
|
|
|
| 6416 |
// I12 (C3) — a locked view's mode is frozen, so the switcher stops being a switcher.
|
| 6417 |
// The field pickers beside it stay: C3 freezes the MODE, and a kanban's stack field is
|
| 6418 |
// config, not mode ("filters/sorts/columns stay editable").
|
|
|
|
| 7421 |
}}
|
| 7422 |
onRouteFieldCreated={revealRouteField}
|
| 7423 |
routePanelOpen={routePanelOpen}
|
| 7424 |
+
/* ⭐ OWNER ITEM 9 — the route's "Add a record" search reaches PAST the view's own
|
| 7425 |
+
filter, so it is handed `scopedRows`: the book after the row wall (`allowed_pids`
|
| 7426 |
+
plus the business-unit scope) and before `useVisibleRows` applies filters, search
|
| 7427 |
+
and the cohort lock. "Unfiltered" is the owner's word for the FILTER, never for
|
| 7428 |
+
the permission wall. */
|
| 7429 |
+
allRows={scopedRows}
|
| 7430 |
selectedPids={selectedPids}
|
| 7431 |
onSelectPids={selectPids}
|
| 7432 |
onOpen={setDetailPid}
|
|
|
|
| 7888 |
deleteDefinitionField(menuField.key);
|
| 7889 |
setColumnMenu(null);
|
| 7890 |
}
|
| 7891 |
+
: /**
|
| 7892 |
+
* ⭐⭐ OWNER ITEM 3 (2026-08-23) — the Destination field's own delete.
|
| 7893 |
+
*
|
| 7894 |
+
* ⛔ MATCHED ON THE DECLARED `kind`, NEVER ON THE `route_` PREFIX. The server
|
| 7895 |
+
* declares the kind precisely so nobody has to read the key as a type, and it
|
| 7896 |
+
* refuses `not_a_route_column` for anything else; inferring here would only move
|
| 7897 |
+
* that refusal from a missing menu row to an unexpected 400.
|
| 7898 |
+
* ⚠ Unlike the two branches above this is NOT gated on `isUserTable`: a route
|
| 7899 |
+
* order is a shared column on the customers REGISTRY topic, which is the whole
|
| 7900 |
+
* reason it fell through both of them and shipped undeletable.
|
| 7901 |
+
*/
|
| 7902 |
+
menuField.shared &&
|
| 7903 |
+
menuField.kind === "route_order" &&
|
| 7904 |
+
menuField.key !== lockedKey
|
| 7905 |
+
? () => {
|
| 7906 |
+
deleteRouteField(menuField.key);
|
| 7907 |
+
setColumnMenu(null);
|
| 7908 |
+
}
|
| 7909 |
: undefined
|
| 7910 |
}
|
| 7911 |
onDuplicate={
|
web/src/customer-grid/MapView.tsx
CHANGED
|
@@ -147,6 +147,136 @@ const R_NULL = 2.6;
|
|
| 147 |
/** A synthetic route-only id. Odoo record ids are positive, so zero cannot become a customer. */
|
| 148 |
const DEPOT_PID = 0;
|
| 149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
interface RouteDepot {
|
| 151 |
address: string;
|
| 152 |
lat: number;
|
|
@@ -218,6 +348,7 @@ export function MapView({
|
|
| 218 |
onGeocoded,
|
| 219 |
onRouteFieldCreated,
|
| 220 |
routePanelOpen,
|
|
|
|
| 221 |
}: {
|
| 222 |
/** DISTINCT data rows from the full pipeline, overlay edits layered — the
|
| 223 |
* calendar/kanban contract, verbatim. */
|
|
@@ -255,6 +386,16 @@ export function MapView({
|
|
| 255 |
onGeocoded?: (writes: { pid: number; value: string }[]) => void;
|
| 256 |
onRouteFieldCreated?: (key: string) => void;
|
| 257 |
routePanelOpen: boolean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
}) {
|
| 259 |
const [hoverPid, setHoverPid] = useState<number | null>(null);
|
| 260 |
// I18-R — the route planner. Off until asked for: a route drawn over a
|
|
@@ -271,9 +412,33 @@ export function MapView({
|
|
| 271 |
* hands it back. Kept as pids rather than indices because the selection can change underneath it.
|
| 272 |
*/
|
| 273 |
const [routeOrder, setRouteOrder] = useState<number[] | null>(null);
|
| 274 |
-
/**
|
| 275 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
const [depot, setDepot] = useState<RouteDepot | null>(null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
/**
|
| 278 |
* W37-T36 — the ROAD answer, which is the half arithmetic cannot produce.
|
| 279 |
*
|
|
@@ -284,7 +449,15 @@ export function MapView({
|
|
| 284 |
* screen is the failure mode worth spending a state field to prevent.
|
| 285 |
*/
|
| 286 |
const [road, setRoad] = useState<
|
| 287 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
>(null);
|
| 289 |
const [roadBusy, setRoadBusy] = useState(false);
|
| 290 |
const [roadErr, setRoadErr] = useState<string | null>(null);
|
|
@@ -389,6 +562,20 @@ export function MapView({
|
|
| 389 |
if (Number(gc.maxBatch) > 0) setGeoBatch(Number(gc.maxBatch));
|
| 390 |
if (Number(gc.secondsPerAddress) > 0) setGeoSeconds(Number(gc.secondsPerAddress));
|
| 391 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
})
|
| 393 |
.catch(() => {});
|
| 394 |
return () => {
|
|
@@ -406,9 +593,17 @@ export function MapView({
|
|
| 406 |
* back. Before that, refitting on new data is the helpful behaviour. */
|
| 407 |
const touchedRef = useRef(false);
|
| 408 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 409 |
const points = useMemo(() => {
|
| 410 |
const out: MapPoint[] = [];
|
| 411 |
-
for (const r of
|
| 412 |
// W37-T34 — the chosen field first, the historic `lat`/`lon` pair when no field is chosen.
|
| 413 |
const at = coordField
|
| 414 |
? parseLatLon(r[coordField.key])
|
|
@@ -434,8 +629,8 @@ export function MapView({
|
|
| 434 |
});
|
| 435 |
}
|
| 436 |
return out;
|
| 437 |
-
}, [
|
| 438 |
-
const noCoords =
|
| 439 |
|
| 440 |
// The fit is the INITIAL view, not the projection (see mapProjection.ts).
|
| 441 |
const fit = useMemo(
|
|
@@ -625,10 +820,10 @@ export function MapView({
|
|
| 625 |
// in the first place, so filtering the pin list for unplottable pins finds exactly nothing.
|
| 626 |
// That mistake would have shipped a chip whose count said 4 and whose names said none.
|
| 627 |
const ok = new Set(customerRoutable.map((p) => p.pid));
|
| 628 |
-
return
|
| 629 |
.filter((r) => selectedPids.has(r.pid) && !ok.has(r.pid))
|
| 630 |
.map((r) => String(r[field.key] ?? "").trim() || `#${r.pid}`);
|
| 631 |
-
}, [
|
| 632 |
|
| 633 |
const plan = useMemo(() => {
|
| 634 |
if (!routeOn || customerRoutable.length < 2) return null;
|
|
@@ -720,7 +915,11 @@ export function MapView({
|
|
| 720 |
}, [routeOn, routable, customerRoutable.length, depotPoint, depot, roundTrip, routeStartPid,
|
| 721 |
coarsePointer, routeOrder]);
|
| 722 |
|
| 723 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 724 |
|
| 725 |
/**
|
| 726 |
* W37-T36 — ask the routing service for the ROAD answer.
|
|
@@ -742,7 +941,7 @@ export function MapView({
|
|
| 742 |
method: "POST",
|
| 743 |
credentials: "same-origin",
|
| 744 |
headers: { "Content-Type": "application/json" },
|
| 745 |
-
body: JSON.stringify({ stops, roundTrip }),
|
| 746 |
});
|
| 747 |
const body = await res.json().catch(() => null);
|
| 748 |
if (!res.ok) {
|
|
@@ -761,14 +960,18 @@ export function MapView({
|
|
| 761 |
line: Array.isArray(body.line) ? body.line : [],
|
| 762 |
key,
|
| 763 |
attribution: String(body.attribution || ""),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 764 |
});
|
| 765 |
} catch {
|
| 766 |
-
setRoadErr("
|
| 767 |
setRoad(null);
|
| 768 |
} finally {
|
| 769 |
setRoadBusy(false);
|
| 770 |
}
|
| 771 |
-
}, [plan, roundTrip]);
|
| 772 |
|
| 773 |
/**
|
| 774 |
* ⛔ THE ONE-SHOT THAT MAKES "PLAN ROUTE" A SINGLE CLICK WITHOUT BECOMING AN AUTO-FETCH.
|
|
@@ -844,7 +1047,11 @@ export function MapView({
|
|
| 844 |
inputsHash: plan.fingerprint,
|
| 845 |
roundTrip,
|
| 846 |
startPid: plan.startPid,
|
| 847 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 848 |
}),
|
| 849 |
});
|
| 850 |
const body = await res.json().catch(() => null);
|
|
@@ -908,8 +1115,8 @@ export function MapView({
|
|
| 908 |
const addrKey = coordField?.geocode?.addressField;
|
| 909 |
if (!addrKey || !coordField || selectedPids.size === 0) return [];
|
| 910 |
const placed = new Set(points.map((p) => p.pid));
|
| 911 |
-
return
|
| 912 |
-
}, [
|
| 913 |
|
| 914 |
/** The estimate, in the words a person plans with. ⚠ Built from the SERVER's measured
|
| 915 |
* seconds-per-address, never from the published rate limit: the limit is a floor on politeness
|
|
@@ -973,46 +1180,67 @@ export function MapView({
|
|
| 973 |
}, [coordField, onGeocoded, geocodable, geoBatch]);
|
| 974 |
|
| 975 |
/** The depot has no row, so it uses the address-list form of the same bounded lookup and wait. */
|
| 976 |
-
|
| 977 |
-
|
| 978 |
-
|
| 979 |
-
|
| 980 |
-
|
| 981 |
-
|
| 982 |
-
|
| 983 |
-
|
| 984 |
-
|
| 985 |
-
|
| 986 |
-
|
| 987 |
-
|
| 988 |
-
|
| 989 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 990 |
});
|
| 991 |
-
|
| 992 |
-
|
| 993 |
-
|
| 994 |
-
|
| 995 |
-
|
| 996 |
-
|
| 997 |
-
|
| 998 |
-
|
| 999 |
-
|
| 1000 |
-
|
| 1001 |
-
|
| 1002 |
-
|
| 1003 |
-
|
| 1004 |
-
|
| 1005 |
-
|
| 1006 |
-
|
| 1007 |
-
|
| 1008 |
-
|
| 1009 |
-
|
| 1010 |
-
|
| 1011 |
-
|
| 1012 |
-
|
| 1013 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1014 |
}
|
| 1015 |
-
|
|
|
|
| 1016 |
|
| 1017 |
const moveStop = useCallback(
|
| 1018 |
(pid: number, delta: number) => {
|
|
@@ -1326,7 +1554,7 @@ export function MapView({
|
|
| 1326 |
) : geocodable.length > 0 ? (
|
| 1327 |
<button
|
| 1328 |
type="button"
|
| 1329 |
-
className="cg-map-
|
| 1330 |
onClick={() => void runGeocode()}
|
| 1331 |
title={`Look up ${geocodable.length.toLocaleString()} address${
|
| 1332 |
geocodable.length === 1 ? "" : "es"
|
|
@@ -1403,7 +1631,7 @@ export function MapView({
|
|
| 1403 |
toolbar's 1,550 ([[no-unverifiable-aggregates]]). */}
|
| 1404 |
<span className="cg-cal-note cg-map-count">
|
| 1405 |
<strong>{points.length.toLocaleString()}</strong> of{" "}
|
| 1406 |
-
{
|
| 1407 |
</span>
|
| 1408 |
{noCoords > 0 && (
|
| 1409 |
<span
|
|
@@ -1438,128 +1666,171 @@ export function MapView({
|
|
| 1438 |
</a>
|
| 1439 |
</span>
|
| 1440 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1441 |
{routePanelOpen && (
|
| 1442 |
-
|
| 1443 |
-
|
| 1444 |
-
|
| 1445 |
-
|
| 1446 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1447 |
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1448 |
</div>
|
| 1449 |
-
|
| 1450 |
-
|
| 1451 |
-
|
| 1452 |
-
|
| 1453 |
-
|
| 1454 |
-
|
| 1455 |
-
|
| 1456 |
-
|
| 1457 |
-
|
| 1458 |
-
|
| 1459 |
-
|
| 1460 |
-
|
| 1461 |
-
|
| 1462 |
-
|
| 1463 |
-
|
| 1464 |
-
|
| 1465 |
-
|
| 1466 |
-
|
| 1467 |
-
|
| 1468 |
-
|
| 1469 |
-
|
| 1470 |
-
|
| 1471 |
-
|
| 1472 |
-
|
| 1473 |
-
|
| 1474 |
-
|
| 1475 |
-
|
| 1476 |
-
|
| 1477 |
-
<strong>{plan.customerStops.toLocaleString()}</strong> visits
|
| 1478 |
-
{plan.depot ? " + depot" : ""} ·{" "}
|
| 1479 |
-
{/* ⭐ W37-T36 — THE ROAD ANSWER REPLACES THE STRAIGHT LINE WHEN WE HAVE ONE,
|
| 1480 |
-
and the old caveat goes with it. The note underneath used to read
|
| 1481 |
-
"straight-line, not driving distance", which was the honest thing to say
|
| 1482 |
-
about a sum of great circles and is simply wrong over a road route with a
|
| 1483 |
-
duration. Which claim is on screen depends on which answer we hold, so
|
| 1484 |
-
both the number and its caveat move together. */}
|
| 1485 |
-
{road && !roadStale ? (
|
| 1486 |
-
<>
|
| 1487 |
-
{road.km.toLocaleString()} km · {formatDuration(road.minutes)}
|
| 1488 |
-
<span className="cg-map-route-note"> by road</span>
|
| 1489 |
-
</>
|
| 1490 |
-
) : (
|
| 1491 |
-
<>
|
| 1492 |
-
{Math.round(plan.km).toLocaleString()} km
|
| 1493 |
-
<span className="cg-map-route-note">
|
| 1494 |
-
{roadBusy
|
| 1495 |
-
? " working out the driving route"
|
| 1496 |
-
: roadStale
|
| 1497 |
-
? " straight line. The stops moved, so the driving route below is out of date."
|
| 1498 |
-
: " straight line, not driving distance"}
|
| 1499 |
-
</span>
|
| 1500 |
-
</>
|
| 1501 |
-
)}
|
| 1502 |
-
</span>
|
| 1503 |
-
{/* The re-ask. Present exactly when the drawn route no longer describes the
|
| 1504 |
-
stops on screen, which is the only moment a person needs it. */}
|
| 1505 |
-
{(roadStale || (!road && !roadBusy)) && (
|
| 1506 |
-
<button
|
| 1507 |
-
type="button"
|
| 1508 |
-
className="cg-map-route-go"
|
| 1509 |
-
onClick={() => void fetchRoad()}
|
| 1510 |
-
title="Ask the routing service for the driving route between these stops, in this order"
|
| 1511 |
-
>
|
| 1512 |
-
{roadStale ? "Update driving route" : "Driving route"}
|
| 1513 |
-
</button>
|
| 1514 |
-
)}
|
| 1515 |
-
{roadErr && <span className="cg-cal-nodate">{roadErr}</span>}
|
| 1516 |
-
<label className="cg-map-route-opt">
|
| 1517 |
-
Depot address
|
| 1518 |
-
<input
|
| 1519 |
-
type="text"
|
| 1520 |
-
className="cg-map-route-start"
|
| 1521 |
-
value={depotAddress}
|
| 1522 |
-
placeholder="Optional route start"
|
| 1523 |
-
aria-label="Depot address for this visit order"
|
| 1524 |
-
maxLength={200}
|
| 1525 |
-
onChange={(e) => {
|
| 1526 |
-
setDepotAddress(e.target.value);
|
| 1527 |
-
setDepot(null);
|
| 1528 |
-
setRouteStartPid(null);
|
| 1529 |
-
}}
|
| 1530 |
-
/>
|
| 1531 |
-
</label>
|
| 1532 |
<button
|
| 1533 |
type="button"
|
| 1534 |
-
className="cg-
|
| 1535 |
-
|
| 1536 |
-
|
| 1537 |
-
|
|
|
|
| 1538 |
>
|
| 1539 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1540 |
</button>
|
| 1541 |
-
|
| 1542 |
-
|
| 1543 |
-
|
| 1544 |
-
|
| 1545 |
-
|
| 1546 |
-
|
| 1547 |
-
|
| 1548 |
-
|
| 1549 |
-
|
| 1550 |
-
|
| 1551 |
-
|
| 1552 |
-
|
| 1553 |
-
|
| 1554 |
-
|
| 1555 |
-
|
| 1556 |
-
|
| 1557 |
-
))}
|
| 1558 |
-
|
| 1559 |
-
|
| 1560 |
-
|
| 1561 |
-
|
| 1562 |
-
<label className="cg-map-route-opt">
|
| 1563 |
<input
|
| 1564 |
type="checkbox"
|
| 1565 |
checked={roundTrip}
|
|
@@ -1567,93 +1838,118 @@ export function MapView({
|
|
| 1567 |
/>
|
| 1568 |
Return to start
|
| 1569 |
</label>
|
| 1570 |
-
|
| 1571 |
-
|
| 1572 |
-
|
| 1573 |
-
|
| 1574 |
-
|
| 1575 |
-
|
| 1576 |
-
|
| 1577 |
-
|
| 1578 |
-
|
| 1579 |
-
|
| 1580 |
-
|
| 1581 |
-
|
| 1582 |
-
|
| 1583 |
-
|
| 1584 |
-
|
| 1585 |
-
|
| 1586 |
-
|
| 1587 |
-
is working around an appointment at eleven, and no solver knows that. So the
|
| 1588 |
-
numbered stops become a list with move controls, and "Re-optimise" gives the
|
| 1589 |
-
arithmetic its turn back. */}
|
| 1590 |
-
<span className="cg-map-stoplist">
|
| 1591 |
-
{plan.ordered.map((p, i) => (
|
| 1592 |
-
<span className="cg-map-stopitem" key={p.pid}>
|
| 1593 |
-
<span className="cg-map-stopn">
|
| 1594 |
-
{p.pid === DEPOT_PID ? "" : i + 1 - (plan.depot ? 1 : 0)}
|
| 1595 |
-
</span>
|
| 1596 |
-
<span className="cg-map-stopname">{p.title || `#${p.pid}`}</span>
|
| 1597 |
-
{p.pid !== DEPOT_PID && <>
|
| 1598 |
-
<button
|
| 1599 |
-
type="button"
|
| 1600 |
-
className="cg-map-stopmove"
|
| 1601 |
-
disabled={i === (plan.depot ? 1 : 0)}
|
| 1602 |
-
aria-label={`Move ${p.title || `#${p.pid}`} earlier`}
|
| 1603 |
-
title="Visit this stop earlier"
|
| 1604 |
-
onClick={() => moveStop(p.pid, -1)}
|
| 1605 |
-
>
|
| 1606 |
-
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10.5 3.5 5.5 8l5 4.5" /></svg>
|
| 1607 |
-
</button>
|
| 1608 |
-
<button
|
| 1609 |
-
type="button"
|
| 1610 |
-
className="cg-map-stopmove"
|
| 1611 |
-
disabled={i === plan.ordered.length - 1}
|
| 1612 |
-
aria-label={`Move ${p.title || `#${p.pid}`} later`}
|
| 1613 |
-
title="Visit this stop later"
|
| 1614 |
-
onClick={() => moveStop(p.pid, 1)}
|
| 1615 |
-
>
|
| 1616 |
-
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M5.5 3.5 10.5 8l-5 4.5" /></svg>
|
| 1617 |
-
</button>
|
| 1618 |
-
</>}
|
| 1619 |
</span>
|
| 1620 |
-
|
| 1621 |
-
|
| 1622 |
-
|
| 1623 |
-
|
| 1624 |
-
|
| 1625 |
-
|
| 1626 |
-
|
| 1627 |
-
|
| 1628 |
-
|
| 1629 |
-
|
| 1630 |
-
|
| 1631 |
-
|
| 1632 |
-
|
| 1633 |
-
|
| 1634 |
-
|
| 1635 |
-
|
| 1636 |
-
|
| 1637 |
-
|
| 1638 |
-
|
| 1639 |
-
|
| 1640 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1641 |
<select
|
| 1642 |
-
className="cg-
|
| 1643 |
value={saveTarget}
|
| 1644 |
-
aria-label="Which visit order
|
| 1645 |
onChange={(e) => {
|
| 1646 |
-
|
| 1647 |
-
const configured = (routeCols || []).find((f) => f.key === next)?.depot || null;
|
| 1648 |
-
setSaveTarget(next);
|
| 1649 |
-
setDepot(configured);
|
| 1650 |
-
setDepotAddress(configured?.address || "");
|
| 1651 |
setRouteStartPid(null);
|
| 1652 |
setSaveMsg(null);
|
| 1653 |
setSaveErr(null);
|
| 1654 |
}}
|
| 1655 |
>
|
| 1656 |
-
<option value="">New
|
| 1657 |
{(routeCols || [])
|
| 1658 |
.filter((f) => f.mine)
|
| 1659 |
.map((f) => (
|
|
@@ -1663,23 +1959,47 @@ export function MapView({
|
|
| 1663 |
))}
|
| 1664 |
</select>
|
| 1665 |
</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1666 |
<button
|
| 1667 |
type="button"
|
| 1668 |
-
className="cg-
|
| 1669 |
-
disabled={saveBusy
|
| 1670 |
onClick={() => void saveRouteOrder()}
|
| 1671 |
title={
|
| 1672 |
saveTarget
|
| 1673 |
-
? "Write these visit numbers into the saved
|
| 1674 |
: "Save these visit numbers as the next Destination field"
|
| 1675 |
}
|
| 1676 |
>
|
| 1677 |
{saveBusy ? "Saving" : saveTarget ? "Update visit order" : "Save visit order"}
|
| 1678 |
</button>
|
| 1679 |
-
{/* ⛔ DERIVED, NEVER STORED. The saved
|
| 1680 |
inputs it was solved from; this compares it against the cohort ON SCREEN
|
| 1681 |
-
NOW
|
| 1682 |
-
under somebody mid-day. */}
|
| 1683 |
{orderStale && (
|
| 1684 |
<span className="cg-map-route-note">
|
| 1685 |
Stale. The saved numbers were solved from different stops, so re-solving
|
|
@@ -1693,45 +2013,52 @@ export function MapView({
|
|
| 1693 |
)}
|
| 1694 |
{saveMsg && <span className="cg-map-route-note">{saveMsg}</span>}
|
| 1695 |
{saveErr && <span className="cg-cal-nodate">{saveErr}</span>}
|
| 1696 |
-
<button
|
| 1697 |
-
type="button"
|
| 1698 |
-
className="cg-map-route-go"
|
| 1699 |
-
onClick={() => {
|
| 1700 |
-
setRouteOn(false);
|
| 1701 |
-
setRouteStartPid(null);
|
| 1702 |
-
setRouteOrder(null);
|
| 1703 |
-
setRoad(null);
|
| 1704 |
-
setRoadErr(null);
|
| 1705 |
-
}}
|
| 1706 |
-
>
|
| 1707 |
-
Clear
|
| 1708 |
-
</button>
|
| 1709 |
</>
|
| 1710 |
-
)
|
| 1711 |
-
|
| 1712 |
-
|
| 1713 |
-
|
| 1714 |
-
|
| 1715 |
-
|
| 1716 |
-
|
| 1717 |
-
|
| 1718 |
-
|
| 1719 |
-
|
| 1720 |
-
|
| 1721 |
-
|
| 1722 |
-
|
| 1723 |
-
|
| 1724 |
-
|
| 1725 |
-
|
| 1726 |
-
|
| 1727 |
-
|
| 1728 |
-
|
| 1729 |
-
|
| 1730 |
-
|
| 1731 |
-
|
| 1732 |
-
|
| 1733 |
-
|
| 1734 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1735 |
{/* ⭐⭐ W37-T37 (R4 / R3 / R14) — LOOK UP THE ADDRESSES OF THE RECORDS YOU CHOSE.
|
| 1736 |
It lives HERE, on the map, because this is the surface where the absence is felt: you
|
| 1737 |
are looking at a picture with a chip saying N records have no location, and the answer
|
|
|
|
| 147 |
/** A synthetic route-only id. Odoo record ids are positive, so zero cannot become a customer. */
|
| 148 |
const DEPOT_PID = 0;
|
| 149 |
|
| 150 |
+
/**
|
| 151 |
+
* ⭐⭐ OWNER ITEM 9 — ONE SEARCHABLE RECORD PICKER, used twice.
|
| 152 |
+
*
|
| 153 |
+
* The owner asked for search in two places at once: the Start dropdown, and a way to add a record
|
| 154 |
+
* by looking it up in the database. Those are the same control over two different pools, so this
|
| 155 |
+
* is one component rather than two that drift.
|
| 156 |
+
*
|
| 157 |
+
* ⛔ IT IS A FILTERED LIST, NOT A FLOATING COMBOBOX, and that is deliberate. The route panel is
|
| 158 |
+
* already an absolutely positioned `<aside>` with its own scroll container; a popup listbox inside
|
| 159 |
+
* it needs portal + placement + reposition-on-scroll machinery to sit right, and every one of
|
| 160 |
+
* those is a way for the list to land off-screen. Expanding IN PLACE cannot be mispositioned.
|
| 161 |
+
*
|
| 162 |
+
* ⚠ THE CAP IS STATED, NEVER SILENT (standing rule 1's second sentence). A book of 3,600 customers
|
| 163 |
+
* cannot paint 3,600 rows into a 360px panel, so the list shows the first `LIST_CAP` matches and
|
| 164 |
+
* SAYS how many more the search found; it does not quietly show a tenth of the answer.
|
| 165 |
+
*/
|
| 166 |
+
const PICKER_LIST_CAP = 40;
|
| 167 |
+
|
| 168 |
+
function RecordPicker({
|
| 169 |
+
label,
|
| 170 |
+
placeholder,
|
| 171 |
+
emptyNote,
|
| 172 |
+
options,
|
| 173 |
+
currentPid,
|
| 174 |
+
onPick,
|
| 175 |
+
}: {
|
| 176 |
+
label: string;
|
| 177 |
+
placeholder: string;
|
| 178 |
+
emptyNote: string;
|
| 179 |
+
options: { pid: number; title: string }[];
|
| 180 |
+
/** Named on the trigger when this picker chooses one of the stops (the Start). */
|
| 181 |
+
currentPid?: number | null;
|
| 182 |
+
onPick: (pid: number) => void;
|
| 183 |
+
}) {
|
| 184 |
+
const [open, setOpen] = useState(false);
|
| 185 |
+
const [q, setQ] = useState("");
|
| 186 |
+
const needle = q.trim().toLowerCase();
|
| 187 |
+
const matches = useMemo(() => {
|
| 188 |
+
if (!needle) return options;
|
| 189 |
+
return options.filter((o) => o.title.toLowerCase().includes(needle));
|
| 190 |
+
}, [options, needle]);
|
| 191 |
+
const shown = matches.slice(0, PICKER_LIST_CAP);
|
| 192 |
+
const current = currentPid == null ? null : options.find((o) => o.pid === currentPid) || null;
|
| 193 |
+
|
| 194 |
+
return (
|
| 195 |
+
<div className="cg-route-picker">
|
| 196 |
+
<span className="cg-route-picker-label">{label}</span>
|
| 197 |
+
<button
|
| 198 |
+
type="button"
|
| 199 |
+
className="cg-route-picker-trigger"
|
| 200 |
+
aria-expanded={open}
|
| 201 |
+
onClick={() => {
|
| 202 |
+
setOpen((v) => !v);
|
| 203 |
+
setQ("");
|
| 204 |
+
}}
|
| 205 |
+
title={open ? `Close the ${label.toLowerCase()} search` : `Search records by name`}
|
| 206 |
+
>
|
| 207 |
+
<span className="cg-route-picker-current">
|
| 208 |
+
{current ? current.title : placeholder}
|
| 209 |
+
</span>
|
| 210 |
+
<svg viewBox="0 0 16 16" aria-hidden="true" className="cg-route-picker-caret">
|
| 211 |
+
<path d="M4 6.5 8 10.5l4-4" />
|
| 212 |
+
</svg>
|
| 213 |
+
</button>
|
| 214 |
+
{open && (
|
| 215 |
+
<div className="cg-route-picker-panel">
|
| 216 |
+
<input
|
| 217 |
+
className="cg-input cg-route-picker-search"
|
| 218 |
+
type="search"
|
| 219 |
+
autoFocus
|
| 220 |
+
value={q}
|
| 221 |
+
placeholder="Search records"
|
| 222 |
+
aria-label={`Search records for ${label.toLowerCase()}`}
|
| 223 |
+
onChange={(e) => setQ(e.target.value)}
|
| 224 |
+
onKeyDown={(e) => {
|
| 225 |
+
if (e.key === "Escape") {
|
| 226 |
+
e.stopPropagation();
|
| 227 |
+
setOpen(false);
|
| 228 |
+
}
|
| 229 |
+
}}
|
| 230 |
+
/>
|
| 231 |
+
{shown.length === 0 ? (
|
| 232 |
+
<span className="cg-route-picker-empty">{needle ? "No record matches that." : emptyNote}</span>
|
| 233 |
+
) : (
|
| 234 |
+
<div className="cg-route-picker-list" role="listbox">
|
| 235 |
+
{shown.map((o) => (
|
| 236 |
+
<button
|
| 237 |
+
key={o.pid}
|
| 238 |
+
type="button"
|
| 239 |
+
role="option"
|
| 240 |
+
aria-selected={o.pid === currentPid}
|
| 241 |
+
className={
|
| 242 |
+
"cg-route-picker-opt" + (o.pid === currentPid ? " is-on" : "")
|
| 243 |
+
}
|
| 244 |
+
onClick={() => {
|
| 245 |
+
onPick(o.pid);
|
| 246 |
+
setOpen(false);
|
| 247 |
+
setQ("");
|
| 248 |
+
}}
|
| 249 |
+
>
|
| 250 |
+
{o.title}
|
| 251 |
+
</button>
|
| 252 |
+
))}
|
| 253 |
+
</div>
|
| 254 |
+
)}
|
| 255 |
+
{matches.length > shown.length && (
|
| 256 |
+
<span className="cg-route-picker-empty">
|
| 257 |
+
Showing the first {shown.length.toLocaleString()} of{" "}
|
| 258 |
+
{matches.length.toLocaleString()} matches. Keep typing to narrow them.
|
| 259 |
+
</span>
|
| 260 |
+
)}
|
| 261 |
+
</div>
|
| 262 |
+
)}
|
| 263 |
+
</div>
|
| 264 |
+
);
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
/** ⭐ OWNER ITEM 7 — the travel modes `routes_geo.py` answers. */
|
| 268 |
+
type TravelMode = "driving" | "walking";
|
| 269 |
+
type RouteModeOffer = { key: TravelMode; label: string; available: boolean };
|
| 270 |
+
/** Matches `routes_geo._ROUTE_MODES`, so the toggle is right before the provider call lands. */
|
| 271 |
+
const TRAVEL_MODES_DEFAULT: RouteModeOffer[] = [
|
| 272 |
+
{ key: "driving", label: "Driving", available: true },
|
| 273 |
+
{ key: "walking", label: "Walking", available: true },
|
| 274 |
+
];
|
| 275 |
+
/** ⚠ ONE frozen empty set, not `new Set()` in a `useState` initialiser argument: the bare call
|
| 276 |
+
* builds a NEW set on every render, and React only ignores it because the initialiser is read
|
| 277 |
+
* once. Hoisting it says so, and keeps the identity stable for the memos that depend on it. */
|
| 278 |
+
const EMPTY_PIDS: ReadonlySet<number> = new Set<number>();
|
| 279 |
+
|
| 280 |
interface RouteDepot {
|
| 281 |
address: string;
|
| 282 |
lat: number;
|
|
|
|
| 348 |
onGeocoded,
|
| 349 |
onRouteFieldCreated,
|
| 350 |
routePanelOpen,
|
| 351 |
+
allRows,
|
| 352 |
}: {
|
| 353 |
/** DISTINCT data rows from the full pipeline, overlay edits layered — the
|
| 354 |
* calendar/kanban contract, verbatim. */
|
|
|
|
| 386 |
onGeocoded?: (writes: { pid: number; value: string }[]) => void;
|
| 387 |
onRouteFieldCreated?: (key: string) => void;
|
| 388 |
routePanelOpen: boolean;
|
| 389 |
+
/**
|
| 390 |
+
* ⭐⭐ OWNER ITEM 9 — THE WHOLE BOOK, so a stop can be added that the VIEW filtered out.
|
| 391 |
+
*
|
| 392 |
+
* ⛔ "UNFILTERED" MEANS UNFILTERED BY THE VIEW, NOT UNWALLED, and the distinction is the whole
|
| 393 |
+
* safety of this prop. The host passes `scopedRows`, which is the row set AFTER `allowed_pids`
|
| 394 |
+
* and the business-unit scope and BEFORE the view's own filters and search. So a person
|
| 395 |
+
* planning a day can reach a customer their current filter hides, and cannot reach one their
|
| 396 |
+
* book does not contain. Absent = the picker does not render, rather than rendering empty.
|
| 397 |
+
*/
|
| 398 |
+
allRows?: Row[];
|
| 399 |
}) {
|
| 400 |
const [hoverPid, setHoverPid] = useState<number | null>(null);
|
| 401 |
// I18-R — the route planner. Off until asked for: a route drawn over a
|
|
|
|
| 412 |
* hands it back. Kept as pids rather than indices because the selection can change underneath it.
|
| 413 |
*/
|
| 414 |
const [routeOrder, setRouteOrder] = useState<number[] | null>(null);
|
| 415 |
+
/**
|
| 416 |
+
* ⛔ OWNER ITEM 6 — THE DEPOT UI IS GONE AND THIS STATE DELIBERATELY IS NOT. The owner removed
|
| 417 |
+
* the "Optional route start" section: the start is the record dropdown and nothing else. What
|
| 418 |
+
* stays is the PLUMBING it fed (`depotPoint` -> `routable` -> `plan.depot`, and the pin), so
|
| 419 |
+
* this is a hotfix that removes a control rather than a refactor that removes a concept, and a
|
| 420 |
+
* column somebody already saved with a depot still round-trips through the server untouched
|
| 421 |
+
* (`saveRouteOrder` no longer SENDS the key, so `route_order_write` preserves what it stored).
|
| 422 |
+
* It is therefore always null now, and `Clear` is what keeps that honest.
|
| 423 |
+
*/
|
| 424 |
const [depot, setDepot] = useState<RouteDepot | null>(null);
|
| 425 |
+
/**
|
| 426 |
+
* ⭐ OWNER ITEM 7 — DRIVING OR WALKING, and the modes come from the SERVER rather than being
|
| 427 |
+
* hardcoded here: a mode this deployment has no router for must not be offered
|
| 428 |
+
* ([[permitted-is-not-answerable]]). The default list matches `routes_geo.py`'s own, so the
|
| 429 |
+
* toggle works before the provider call lands and keeps working if it never does.
|
| 430 |
+
*/
|
| 431 |
+
const [travelMode, setTravelMode] = useState<TravelMode>("driving");
|
| 432 |
+
const [travelModes, setTravelModes] = useState<RouteModeOffer[]>(TRAVEL_MODES_DEFAULT);
|
| 433 |
+
/**
|
| 434 |
+
* ⭐⭐ OWNER ITEM 9 — records added to the route BY HAND, from outside the view's filter.
|
| 435 |
+
*
|
| 436 |
+
* ⛔ THEY JOIN THE MAP'S OWN ROW SET RATHER THAN A PARALLEL STOP LIST, which is what keeps the
|
| 437 |
+
* counts one story: an added record gets a pin, gets counted in "N of M mapped", and lands in
|
| 438 |
+
* the "no location, so not routed" chip if it has no coordinate. A second list beside `points`
|
| 439 |
+
* would have had to re-derive every one of those and would have drifted from the first.
|
| 440 |
+
*/
|
| 441 |
+
const [addedPids, setAddedPids] = useState<ReadonlySet<number>>(EMPTY_PIDS);
|
| 442 |
/**
|
| 443 |
* W37-T36 — the ROAD answer, which is the half arithmetic cannot produce.
|
| 444 |
*
|
|
|
|
| 449 |
* screen is the failure mode worth spending a state field to prevent.
|
| 450 |
*/
|
| 451 |
const [road, setRoad] = useState<
|
| 452 |
+
{
|
| 453 |
+
km: number;
|
| 454 |
+
minutes: number;
|
| 455 |
+
line: number[][];
|
| 456 |
+
key: string;
|
| 457 |
+
attribution: string;
|
| 458 |
+
/** WHICH mode produced these numbers, so the label can never outrun the answer. */
|
| 459 |
+
mode: TravelMode;
|
| 460 |
+
} | null
|
| 461 |
>(null);
|
| 462 |
const [roadBusy, setRoadBusy] = useState(false);
|
| 463 |
const [roadErr, setRoadErr] = useState<string | null>(null);
|
|
|
|
| 562 |
if (Number(gc.maxBatch) > 0) setGeoBatch(Number(gc.maxBatch));
|
| 563 |
if (Number(gc.secondsPerAddress) > 0) setGeoSeconds(Number(gc.secondsPerAddress));
|
| 564 |
}
|
| 565 |
+
// ⭐ ITEM 7 — which travel modes this deployment can actually answer. Unlike the tiles
|
| 566 |
+
// above, a wrong answer here is not a style choice, so the offer is taken from the server
|
| 567 |
+
// and the defaults are only the pre-arrival stand-in.
|
| 568 |
+
const offered = Array.isArray(j.route?.modes) ? j.route.modes : null;
|
| 569 |
+
if (offered) {
|
| 570 |
+
const clean = offered
|
| 571 |
+
.filter((m: { key?: unknown }) => m && (m.key === "driving" || m.key === "walking"))
|
| 572 |
+
.map((m: { key: TravelMode; label?: unknown; available?: unknown }) => ({
|
| 573 |
+
key: m.key,
|
| 574 |
+
label: String(m.label || (m.key === "walking" ? "Walking" : "Driving")),
|
| 575 |
+
available: m.available !== false,
|
| 576 |
+
}));
|
| 577 |
+
if (clean.length) setTravelModes(clean);
|
| 578 |
+
}
|
| 579 |
})
|
| 580 |
.catch(() => {});
|
| 581 |
return () => {
|
|
|
|
| 593 |
* back. Before that, refitting on new data is the helpful behaviour. */
|
| 594 |
const touchedRef = useRef(false);
|
| 595 |
|
| 596 |
+
/** The view's rows PLUS the ones the user reached past the filter for (owner item 9). */
|
| 597 |
+
const mapRows = useMemo(() => {
|
| 598 |
+
if (addedPids.size === 0 || !allRows || allRows.length === 0) return rows;
|
| 599 |
+
const have = new Set(rows.map((r) => r.pid));
|
| 600 |
+
const extra = allRows.filter((r) => addedPids.has(r.pid) && !have.has(r.pid));
|
| 601 |
+
return extra.length ? [...rows, ...extra] : rows;
|
| 602 |
+
}, [rows, allRows, addedPids]);
|
| 603 |
+
|
| 604 |
const points = useMemo(() => {
|
| 605 |
const out: MapPoint[] = [];
|
| 606 |
+
for (const r of mapRows) {
|
| 607 |
// W37-T34 — the chosen field first, the historic `lat`/`lon` pair when no field is chosen.
|
| 608 |
const at = coordField
|
| 609 |
? parseLatLon(r[coordField.key])
|
|
|
|
| 629 |
});
|
| 630 |
}
|
| 631 |
return out;
|
| 632 |
+
}, [mapRows, field.key, coordField, colorField, sizeField]);
|
| 633 |
+
const noCoords = mapRows.length - points.length;
|
| 634 |
|
| 635 |
// The fit is the INITIAL view, not the projection (see mapProjection.ts).
|
| 636 |
const fit = useMemo(
|
|
|
|
| 820 |
// in the first place, so filtering the pin list for unplottable pins finds exactly nothing.
|
| 821 |
// That mistake would have shipped a chip whose count said 4 and whose names said none.
|
| 822 |
const ok = new Set(customerRoutable.map((p) => p.pid));
|
| 823 |
+
return mapRows
|
| 824 |
.filter((r) => selectedPids.has(r.pid) && !ok.has(r.pid))
|
| 825 |
.map((r) => String(r[field.key] ?? "").trim() || `#${r.pid}`);
|
| 826 |
+
}, [mapRows, field.key, selectedPids, customerRoutable]);
|
| 827 |
|
| 828 |
const plan = useMemo(() => {
|
| 829 |
if (!routeOn || customerRoutable.length < 2) return null;
|
|
|
|
| 915 |
}, [routeOn, routable, customerRoutable.length, depotPoint, depot, roundTrip, routeStartPid,
|
| 916 |
coarsePointer, routeOrder]);
|
| 917 |
|
| 918 |
+
/** ⭐ ITEM 7 — a MODE change stales the drawn road exactly as a stop change does. Without the
|
| 919 |
+
* second clause, flipping to Walking would leave driving minutes on screen under a Walking
|
| 920 |
+
* toggle, which is the failure this whole seam was built to prevent. */
|
| 921 |
+
const roadStale =
|
| 922 |
+
!!road && !!plan && (road.key !== plan.key || road.mode !== travelMode);
|
| 923 |
|
| 924 |
/**
|
| 925 |
* W37-T36 — ask the routing service for the ROAD answer.
|
|
|
|
| 941 |
method: "POST",
|
| 942 |
credentials: "same-origin",
|
| 943 |
headers: { "Content-Type": "application/json" },
|
| 944 |
+
body: JSON.stringify({ stops, roundTrip, mode: travelMode }),
|
| 945 |
});
|
| 946 |
const body = await res.json().catch(() => null);
|
| 947 |
if (!res.ok) {
|
|
|
|
| 960 |
line: Array.isArray(body.line) ? body.line : [],
|
| 961 |
key,
|
| 962 |
attribution: String(body.attribution || ""),
|
| 963 |
+
// ⚠ THE SERVER'S mode, not the state's. The toggle can move while the request is in
|
| 964 |
+
// flight, and labelling the answer from the state would then caption a driving route
|
| 965 |
+
// "Walking" for exactly as long as nobody re-asked.
|
| 966 |
+
mode: body.mode === "walking" ? "walking" : "driving",
|
| 967 |
});
|
| 968 |
} catch {
|
| 969 |
+
setRoadErr("The routing service could not be reached. The straight-line estimate remains on the map; try again.");
|
| 970 |
setRoad(null);
|
| 971 |
} finally {
|
| 972 |
setRoadBusy(false);
|
| 973 |
}
|
| 974 |
+
}, [plan, roundTrip, travelMode]);
|
| 975 |
|
| 976 |
/**
|
| 977 |
* ⛔ THE ONE-SHOT THAT MAKES "PLAN ROUTE" A SINGLE CLICK WITHOUT BECOMING AN AUTO-FETCH.
|
|
|
|
| 1047 |
inputsHash: plan.fingerprint,
|
| 1048 |
roundTrip,
|
| 1049 |
startPid: plan.startPid,
|
| 1050 |
+
// ⛔ ITEM 6 — THE KEY IS OMITTED, NOT SENT AS NULL. `route_order_write` preserves the
|
| 1051 |
+
// stored depot when `depot` is absent from the body and CLEARS it when it is present
|
| 1052 |
+
// and null. This UI no longer has a depot control, so it has no business deleting one
|
| 1053 |
+
// a column was saved with; omitting is the difference between removing a control and
|
| 1054 |
+
// silently editing everyone's stored data.
|
| 1055 |
}),
|
| 1056 |
});
|
| 1057 |
const body = await res.json().catch(() => null);
|
|
|
|
| 1115 |
const addrKey = coordField?.geocode?.addressField;
|
| 1116 |
if (!addrKey || !coordField || selectedPids.size === 0) return [];
|
| 1117 |
const placed = new Set(points.map((p) => p.pid));
|
| 1118 |
+
return mapRows.filter((r) => selectedPids.has(r.pid) && !placed.has(r.pid));
|
| 1119 |
+
}, [mapRows, coordField, selectedPids, points]);
|
| 1120 |
|
| 1121 |
/** The estimate, in the words a person plans with. ⚠ Built from the SERVER's measured
|
| 1122 |
* seconds-per-address, never from the published rate limit: the limit is a floor on politeness
|
|
|
|
| 1180 |
}, [coordField, onGeocoded, geocodable, geoBatch]);
|
| 1181 |
|
| 1182 |
/** The depot has no row, so it uses the address-list form of the same bounded lookup and wait. */
|
| 1183 |
+
|
| 1184 |
+
/**
|
| 1185 |
+
* ⭐ OWNER ITEM 9 — TAKE THIS CUSTOMER OFF THE ROUTE.
|
| 1186 |
+
*
|
| 1187 |
+
* ⛔ IT DESELECTS RATHER THAN KEEPING A LOCAL EXCLUSION LIST, and that is the whole reason the
|
| 1188 |
+
* panel stays coherent: the head counts `selectedPids`, the stop list counts `plan.ordered`,
|
| 1189 |
+
* and an exclusion set would have made those two disagree the moment anybody used this. The
|
| 1190 |
+
* hand-picked order drops it too, or a removed stop would be re-appended by `plan`'s "anything
|
| 1191 |
+
* newly selected joins in the planner's order" clause the next time the selection moved.
|
| 1192 |
+
*/
|
| 1193 |
+
const removeStop = useCallback(
|
| 1194 |
+
(pid: number) => {
|
| 1195 |
+
if (pid === DEPOT_PID) return;
|
| 1196 |
+
onSelectPids([...selectedPids].filter((x) => x !== pid), "replace");
|
| 1197 |
+
setRouteOrder((prev) => (prev ? prev.filter((x) => x !== pid) : prev));
|
| 1198 |
+
setAddedPids((prev) => {
|
| 1199 |
+
if (!prev.has(pid)) return prev;
|
| 1200 |
+
const next = new Set(prev);
|
| 1201 |
+
next.delete(pid);
|
| 1202 |
+
return next;
|
| 1203 |
});
|
| 1204 |
+
},
|
| 1205 |
+
[onSelectPids, selectedPids]
|
| 1206 |
+
);
|
| 1207 |
+
|
| 1208 |
+
/**
|
| 1209 |
+
* ⭐ OWNER ITEM 9 — ADD A RECORD THE VIEW IS NOT SHOWING.
|
| 1210 |
+
*
|
| 1211 |
+
* It joins `addedPids` (so `mapRows` gains it and it earns a pin) AND the selection (so every
|
| 1212 |
+
* count in this panel keeps meaning the same thing). Appended to a hand-picked order rather
|
| 1213 |
+
* than inserted, because the person adding it is the one who knows where in the day it goes.
|
| 1214 |
+
*/
|
| 1215 |
+
const addRecord = useCallback(
|
| 1216 |
+
(pid: number) => {
|
| 1217 |
+
setAddedPids((prev) => (prev.has(pid) ? prev : new Set(prev).add(pid)));
|
| 1218 |
+
onSelectPids([pid], "add");
|
| 1219 |
+
setRouteOrder((prev) => (prev && !prev.includes(pid) ? [...prev, pid] : prev));
|
| 1220 |
+
},
|
| 1221 |
+
[onSelectPids]
|
| 1222 |
+
);
|
| 1223 |
+
|
| 1224 |
+
/**
|
| 1225 |
+
* ⭐ OWNER ITEM 9 — WHAT THE "Add a record" SEARCH MAY OFFER.
|
| 1226 |
+
*
|
| 1227 |
+
* ⛔ THE WHOLE BOOK MINUS WHAT IS ALREADY ON THE ROUTE, and "the whole book" is `allRows` (see
|
| 1228 |
+
* the prop's own note): after the row wall, before the view's filter. Records already selected
|
| 1229 |
+
* are excluded because offering them would let a person "add" a stop and see nothing change.
|
| 1230 |
+
* ⚠ NOT FILTERED BY WHETHER A RECORD HAS A LOCATION. One that has none is addable and then
|
| 1231 |
+
* lands in the "No location, so not routed" chip, which is the disclosure that already exists;
|
| 1232 |
+
* hiding it here would make a customer the user can name simply absent from the search, with no
|
| 1233 |
+
* sentence anywhere saying why.
|
| 1234 |
+
*/
|
| 1235 |
+
const addableRecords = useMemo(() => {
|
| 1236 |
+
if (!allRows || allRows.length === 0) return [];
|
| 1237 |
+
const out: { pid: number; title: string }[] = [];
|
| 1238 |
+
for (const r of allRows) {
|
| 1239 |
+
if (selectedPids.has(r.pid)) continue;
|
| 1240 |
+
out.push({ pid: r.pid, title: String(r[field.key] ?? "").trim() || `#${r.pid}` });
|
| 1241 |
}
|
| 1242 |
+
return out.sort((a, b) => a.title.localeCompare(b.title));
|
| 1243 |
+
}, [allRows, selectedPids, field.key]);
|
| 1244 |
|
| 1245 |
const moveStop = useCallback(
|
| 1246 |
(pid: number, delta: number) => {
|
|
|
|
| 1554 |
) : geocodable.length > 0 ? (
|
| 1555 |
<button
|
| 1556 |
type="button"
|
| 1557 |
+
className="cg-btn cg-map-geo-cta"
|
| 1558 |
onClick={() => void runGeocode()}
|
| 1559 |
title={`Look up ${geocodable.length.toLocaleString()} address${
|
| 1560 |
geocodable.length === 1 ? "" : "es"
|
|
|
|
| 1631 |
toolbar's 1,550 ([[no-unverifiable-aggregates]]). */}
|
| 1632 |
<span className="cg-cal-note cg-map-count">
|
| 1633 |
<strong>{points.length.toLocaleString()}</strong> of{" "}
|
| 1634 |
+
{mapRows.length.toLocaleString()} mapped · one pin per record that has a location
|
| 1635 |
</span>
|
| 1636 |
{noCoords > 0 && (
|
| 1637 |
<span
|
|
|
|
| 1666 |
</a>
|
| 1667 |
</span>
|
| 1668 |
)}
|
| 1669 |
+
{/* ═══════════════════════════════════════════════════════════════════════════════════
|
| 1670 |
+
THE ROUTE PANEL — rebuilt for owner items 2, 4, 6, 8 and 9.
|
| 1671 |
+
|
| 1672 |
+
⭐⭐ ITEM 2 IS THE STRUCTURAL ONE AND IT IS WHY THIS IS ONE REBUILD RATHER THAN FIVE
|
| 1673 |
+
EDITS. The panel used to render its entire body inside `selectedPids.size >= 2`, so
|
| 1674 |
+
clicking Route with nothing chosen produced a box containing one sentence telling you
|
| 1675 |
+
off. The owner's answer: show the navigation, empty. So the chrome, the travel mode,
|
| 1676 |
+
the stop list and the record search are UNCONDITIONAL, and only the parts that
|
| 1677 |
+
genuinely describe a solved route (the distance, the visit numbers, the save target)
|
| 1678 |
+
wait for `plan`.
|
| 1679 |
+
|
| 1680 |
+
⛔ `plan` IS NULL UNTIL `routeOn` FLIPS **AND** TWO STOPS CAN BE ROUTED, so every read
|
| 1681 |
+
of `plan.*` below sits inside a `plan &&`. The old code was safe only because the whole
|
| 1682 |
+
body was behind the two-selected wall this item removes; `plan.ordered[0]` with nothing
|
| 1683 |
+
selected is a crash, not a blank.
|
| 1684 |
+
═══════════════════════════════════════════════════════════════════════════════════ */}
|
| 1685 |
{routePanelOpen && (
|
| 1686 |
+
<aside id="cg-route-popover" className="cg-route-popover" aria-label="Route navigation">
|
| 1687 |
+
<div className="cg-route-popover-head">
|
| 1688 |
+
<span className="cg-views-title">Route</span>
|
| 1689 |
+
<span className="cg-route-popover-count">
|
| 1690 |
+
{selectedPids.size > 0
|
| 1691 |
+
? `${selectedPids.size.toLocaleString()} selected`
|
| 1692 |
+
: "Nothing selected"}
|
| 1693 |
+
</span>
|
| 1694 |
+
</div>
|
| 1695 |
+
<div className="cg-map-route">
|
| 1696 |
+
{/* ── the answer, or what is still missing ───────────────────────────────────── */}
|
| 1697 |
+
{plan ? (
|
| 1698 |
+
<span className="cg-map-route-sum">
|
| 1699 |
+
<strong>{plan.customerStops.toLocaleString()}</strong> visits
|
| 1700 |
+
{plan.depot ? " + depot" : ""} ·{" "}
|
| 1701 |
+
{/* ⭐ W37-T36 — THE ROAD ANSWER REPLACES THE STRAIGHT LINE WHEN WE HOLD ONE,
|
| 1702 |
+
and the caveat goes with it: which claim is on screen depends on which
|
| 1703 |
+
answer we have, so the number and its qualifier move together.
|
| 1704 |
+
⭐ ITEM 7 — and the qualifier now names the MODE the server actually
|
| 1705 |
+
answered in (`road.mode`), never the toggle's current position. */}
|
| 1706 |
+
{road && !roadStale ? (
|
| 1707 |
+
<>
|
| 1708 |
+
{road.km.toLocaleString()} km · {formatDuration(road.minutes)}
|
| 1709 |
+
<span className="cg-map-route-note">
|
| 1710 |
+
{road.mode === "walking" ? " on foot" : " by road"}
|
| 1711 |
+
</span>
|
| 1712 |
+
</>
|
| 1713 |
+
) : (
|
| 1714 |
+
<>
|
| 1715 |
+
{Math.round(plan.km).toLocaleString()} km
|
| 1716 |
+
<span className="cg-map-route-note">
|
| 1717 |
+
{roadBusy
|
| 1718 |
+
? " working out the travelling route"
|
| 1719 |
+
: roadStale
|
| 1720 |
+
? " straight line. The stops or the travel mode moved, so the route below is out of date."
|
| 1721 |
+
: " straight line, not travelling distance"}
|
| 1722 |
+
</span>
|
| 1723 |
+
</>
|
| 1724 |
+
)}
|
| 1725 |
</span>
|
| 1726 |
+
) : (
|
| 1727 |
+
<span className="cg-route-empty">
|
| 1728 |
+
{/* ⚠ THREE STATES, NOT TWO, AND THE MIDDLE ONE IS THE X BUTTON'S LANDING SPOT.
|
| 1729 |
+
Removing stops until one is left drops `customerRoutable` below two, and the
|
| 1730 |
+
teardown effect then clears `routeOn` and the hand-picked order: correct,
|
| 1731 |
+
because one stop is not a route. But "No stops yet" over a selection of one
|
| 1732 |
+
is simply false, and it is exactly what a person sees right after using the
|
| 1733 |
+
new X control. Each state says what is actually true. */}
|
| 1734 |
+
{selectedPids.size === 0
|
| 1735 |
+
? "No stops yet. Search for a record below, or shift-click pins on the map."
|
| 1736 |
+
: customerRoutable.length < 2
|
| 1737 |
+
? "A route needs at least two stops with a location. Add another record below."
|
| 1738 |
+
: "Ready to plan."}
|
| 1739 |
+
</span>
|
| 1740 |
+
)}
|
| 1741 |
+
|
| 1742 |
+
{/* ── ITEM 7: driving or walking ─────────────────────────────────────────────────
|
| 1743 |
+
⛔ THE MODES COME FROM THE SERVER. A deployment with no walking router must not
|
| 1744 |
+
be offered a Walking button that spends a click to earn an error, so an
|
| 1745 |
+
unavailable mode renders DISABLED with the reason on it rather than vanishing:
|
| 1746 |
+
a control that disappears reads as a feature we do not have, and this one we do.
|
| 1747 |
+
⚠ Flipping the mode does NOT re-ask on its own (R3: a request is spent by a
|
| 1748 |
+
click, never by a state change). It stales the drawn road, and the re-ask button
|
| 1749 |
+
below appears. */}
|
| 1750 |
+
<div className="cg-route-modes" role="group" aria-label="Travel mode">
|
| 1751 |
+
{travelModes.map((m) => (
|
| 1752 |
+
<button
|
| 1753 |
+
key={m.key}
|
| 1754 |
+
type="button"
|
| 1755 |
+
className={"cg-route-mode" + (travelMode === m.key ? " is-on" : "")}
|
| 1756 |
+
aria-pressed={travelMode === m.key}
|
| 1757 |
+
disabled={!m.available}
|
| 1758 |
+
title={
|
| 1759 |
+
m.available
|
| 1760 |
+
? m.key === "walking"
|
| 1761 |
+
? "Work the route out at walking pace, on paths a car cannot take"
|
| 1762 |
+
: "Work the route out by road, at driving pace"
|
| 1763 |
+
: `This deployment has no ${m.label.toLowerCase()} routing service configured.`
|
| 1764 |
+
}
|
| 1765 |
+
onClick={() => setTravelMode(m.key)}
|
| 1766 |
+
>
|
| 1767 |
+
{m.label}
|
| 1768 |
+
</button>
|
| 1769 |
+
))}
|
| 1770 |
</div>
|
| 1771 |
+
|
| 1772 |
+
{/* ── plan it, or re-ask for the travelling route ────────────────────────────── */}
|
| 1773 |
+
{!routeOn ? (
|
| 1774 |
+
<button
|
| 1775 |
+
type="button"
|
| 1776 |
+
className="cg-btn cg-btn--primary cg-route-cta"
|
| 1777 |
+
// ⭐ ONE CLICK IS THE WHOLE ASK (R3). It turns the planner on AND fetches the
|
| 1778 |
+
// road answer, because "plan this and show me the distance" is one action to a
|
| 1779 |
+
// person and should not be two buttons.
|
| 1780 |
+
onClick={() => {
|
| 1781 |
+
setRouteOn(true);
|
| 1782 |
+
setRouteOrder(null);
|
| 1783 |
+
askRoadRef.current = true;
|
| 1784 |
+
}}
|
| 1785 |
+
disabled={customerRoutable.length < 2}
|
| 1786 |
+
title={
|
| 1787 |
+
customerRoutable.length < 2
|
| 1788 |
+
? "At least two records with a location are needed to plan a route"
|
| 1789 |
+
: "Order these stops into a route"
|
| 1790 |
+
}
|
| 1791 |
+
>
|
| 1792 |
+
{customerRoutable.length < 2
|
| 1793 |
+
? "Plan route"
|
| 1794 |
+
: `Plan route (${customerRoutable.length.toLocaleString()} stops)`}
|
| 1795 |
+
</button>
|
| 1796 |
+
) : (
|
| 1797 |
+
plan &&
|
| 1798 |
+
(roadStale || (!road && !roadBusy)) && (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1799 |
<button
|
| 1800 |
type="button"
|
| 1801 |
+
className="cg-btn cg-route-cta"
|
| 1802 |
+
onClick={() => void fetchRoad()}
|
| 1803 |
+
title={`Ask the routing service for the ${
|
| 1804 |
+
travelMode === "walking" ? "walking" : "driving"
|
| 1805 |
+
} route between these stops, in this order`}
|
| 1806 |
>
|
| 1807 |
+
{roadStale
|
| 1808 |
+
? "Update the route"
|
| 1809 |
+
: travelMode === "walking"
|
| 1810 |
+
? "Walking route"
|
| 1811 |
+
: "Driving route"}
|
| 1812 |
</button>
|
| 1813 |
+
)
|
| 1814 |
+
)}
|
| 1815 |
+
{roadErr && <span className="cg-cal-nodate">{roadErr}</span>}
|
| 1816 |
+
|
| 1817 |
+
{/* ── ITEM 9: where the day starts, and it SEARCHES ──────────────────────────────
|
| 1818 |
+
⛔ ITEM 6 removed the "Optional route start" address box above this, so the
|
| 1819 |
+
start is the record dropdown and nothing else. The `!plan.depot` guard the old
|
| 1820 |
+
select carried is gone with the control that could set one. */}
|
| 1821 |
+
{plan && (
|
| 1822 |
+
<>
|
| 1823 |
+
<RecordPicker
|
| 1824 |
+
label="Start"
|
| 1825 |
+
placeholder="Choose the first stop"
|
| 1826 |
+
emptyNote="No stops on this route yet."
|
| 1827 |
+
options={routable
|
| 1828 |
+
.filter((pt) => pt.pid !== DEPOT_PID)
|
| 1829 |
+
.map((pt) => ({ pid: pt.pid, title: pt.title || `#${pt.pid}` }))}
|
| 1830 |
+
currentPid={plan.ordered[0]?.pid ?? null}
|
| 1831 |
+
onPick={(pid) => setRouteStartPid(pid)}
|
| 1832 |
+
/>
|
| 1833 |
+
<label className="cg-map-route-opt cg-route-check">
|
|
|
|
| 1834 |
<input
|
| 1835 |
type="checkbox"
|
| 1836 |
checked={roundTrip}
|
|
|
|
| 1838 |
/>
|
| 1839 |
Return to start
|
| 1840 |
</label>
|
| 1841 |
+
</>
|
| 1842 |
+
)}
|
| 1843 |
+
|
| 1844 |
+
{/* ── the stops ────────────────────────────────────────────────────────────────
|
| 1845 |
+
⭐ W37-T36 — THE ORDER IS CHANGEABLE, and it has to be more than the Start
|
| 1846 |
+
picker: the planner optimises for distance, and a person routing a day is
|
| 1847 |
+
working around an appointment at eleven that no solver knows about.
|
| 1848 |
+
⭐ ITEM 9 — the controls are UP and DOWN, not left and right. The list runs
|
| 1849 |
+
vertically, so a chevron pointing sideways described the wrong axis; and each
|
| 1850 |
+
row now carries an X, because "not this customer today" was previously only
|
| 1851 |
+
expressible by leaving the panel and changing the selection on the map. */}
|
| 1852 |
+
{plan && plan.ordered.length > 0 && (
|
| 1853 |
+
<div className="cg-map-stoplist">
|
| 1854 |
+
{plan.ordered.map((pt, i) => (
|
| 1855 |
+
<span className="cg-map-stopitem" key={pt.pid}>
|
| 1856 |
+
<span className="cg-map-stopn">
|
| 1857 |
+
{pt.pid === DEPOT_PID ? "" : i + 1 - (plan.depot ? 1 : 0)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1858 |
</span>
|
| 1859 |
+
<span className="cg-map-stopname" title={pt.title || `#${pt.pid}`}>
|
| 1860 |
+
{pt.title || `#${pt.pid}`}
|
| 1861 |
+
</span>
|
| 1862 |
+
{pt.pid !== DEPOT_PID && (
|
| 1863 |
+
<>
|
| 1864 |
+
<button
|
| 1865 |
+
type="button"
|
| 1866 |
+
className="cg-map-stopmove"
|
| 1867 |
+
disabled={i === (plan.depot ? 1 : 0)}
|
| 1868 |
+
aria-label={`Move ${pt.title || `#${pt.pid}`} earlier`}
|
| 1869 |
+
title="Visit this stop earlier"
|
| 1870 |
+
onClick={() => moveStop(pt.pid, -1)}
|
| 1871 |
+
>
|
| 1872 |
+
<svg viewBox="0 0 16 16" aria-hidden="true">
|
| 1873 |
+
<path d="M8 12.5v-9M4 7.5 8 3.5l4 4" />
|
| 1874 |
+
</svg>
|
| 1875 |
+
</button>
|
| 1876 |
+
<button
|
| 1877 |
+
type="button"
|
| 1878 |
+
className="cg-map-stopmove"
|
| 1879 |
+
disabled={i === plan.ordered.length - 1}
|
| 1880 |
+
aria-label={`Move ${pt.title || `#${pt.pid}`} later`}
|
| 1881 |
+
title="Visit this stop later"
|
| 1882 |
+
onClick={() => moveStop(pt.pid, 1)}
|
| 1883 |
+
>
|
| 1884 |
+
<svg viewBox="0 0 16 16" aria-hidden="true">
|
| 1885 |
+
<path d="M8 3.5v9M4 8.5l4 4 4-4" />
|
| 1886 |
+
</svg>
|
| 1887 |
+
</button>
|
| 1888 |
+
<button
|
| 1889 |
+
type="button"
|
| 1890 |
+
className="cg-map-stopmove cg-map-stopdrop"
|
| 1891 |
+
aria-label={`Remove ${pt.title || `#${pt.pid}`} from the route`}
|
| 1892 |
+
title="Take this stop off the route"
|
| 1893 |
+
onClick={() => removeStop(pt.pid)}
|
| 1894 |
+
>
|
| 1895 |
+
<svg viewBox="0 0 16 16" aria-hidden="true">
|
| 1896 |
+
<path d="m4.5 4.5 7 7m0-7-7 7" />
|
| 1897 |
+
</svg>
|
| 1898 |
+
</button>
|
| 1899 |
+
</>
|
| 1900 |
+
)}
|
| 1901 |
+
</span>
|
| 1902 |
+
))}
|
| 1903 |
+
</div>
|
| 1904 |
+
)}
|
| 1905 |
+
|
| 1906 |
+
{/* ── ITEM 9: add a record the view is not showing ────────────────────────────── */}
|
| 1907 |
+
{allRows && allRows.length > 0 && (
|
| 1908 |
+
<RecordPicker
|
| 1909 |
+
label="Add a record"
|
| 1910 |
+
placeholder="Search the database"
|
| 1911 |
+
emptyNote="Every record in your book is already on this route."
|
| 1912 |
+
options={addableRecords}
|
| 1913 |
+
onPick={addRecord}
|
| 1914 |
+
/>
|
| 1915 |
+
)}
|
| 1916 |
+
|
| 1917 |
+
{plan && routeOrder && (
|
| 1918 |
+
<button
|
| 1919 |
+
type="button"
|
| 1920 |
+
className="cg-btn cg-route-cta"
|
| 1921 |
+
onClick={() => setRouteOrder(null)}
|
| 1922 |
+
title="Put the stops back into the shortest order the planner found"
|
| 1923 |
+
>
|
| 1924 |
+
Re-optimise
|
| 1925 |
+
</button>
|
| 1926 |
+
)}
|
| 1927 |
+
|
| 1928 |
+
{/* ── ITEM 8: the visit order field, and its committing button ──────────────────
|
| 1929 |
+
⭐⭐ W38-T20 — THE ORDER BECOMES A COLUMN EVERY PERMITTED COLLEAGUE READS.
|
| 1930 |
+
The number written per record is the INVERSE of the planner's permutation (see
|
| 1931 |
+
`saveRouteOrder`), the field is tenant-wide and grant-governed, and the
|
| 1932 |
+
fingerprint it was solved from rides it so a later reader is TOLD it is out of
|
| 1933 |
+
date rather than shown yesterday's numbers as today's.
|
| 1934 |
+
⭐ ITEM 8 — "New column" reads "New field": `ColumnMenu` calls these fields
|
| 1935 |
+
everywhere else, and one surface calling them columns is the kind of split
|
| 1936 |
+
vocabulary a person has to translate. The SERVER key is untouched. */}
|
| 1937 |
+
{plan && (
|
| 1938 |
+
<>
|
| 1939 |
+
<label className="cg-map-route-opt cg-route-field">
|
| 1940 |
+
Visit order field
|
| 1941 |
<select
|
| 1942 |
+
className="cg-route-select"
|
| 1943 |
value={saveTarget}
|
| 1944 |
+
aria-label="Which visit order field to write"
|
| 1945 |
onChange={(e) => {
|
| 1946 |
+
setSaveTarget(e.target.value);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1947 |
setRouteStartPid(null);
|
| 1948 |
setSaveMsg(null);
|
| 1949 |
setSaveErr(null);
|
| 1950 |
}}
|
| 1951 |
>
|
| 1952 |
+
<option value="">New field</option>
|
| 1953 |
{(routeCols || [])
|
| 1954 |
.filter((f) => f.mine)
|
| 1955 |
.map((f) => (
|
|
|
|
| 1959 |
))}
|
| 1960 |
</select>
|
| 1961 |
</label>
|
| 1962 |
+
{/* ── ITEM 4: the hand-off links, ONE PER LINE, DIRECTLY under the visit order
|
| 1963 |
+
field ────────────────────────────────────────────────────────────────────
|
| 1964 |
+
They were a `flex-wrap` cluster of chips, unreadable the moment a route
|
| 1965 |
+
needs more than one Google leg. Stacked, each on its own row, the list reads
|
| 1966 |
+
as what it is: leg 1, then leg 2.
|
| 1967 |
+
⚠ POSITION IS PART OF THE INSTRUCTION, not a detail. They sit between the
|
| 1968 |
+
select and its Save button rather than after the whole block, because the
|
| 1969 |
+
block's tail can carry a stale marker, a shared-orders note and two message
|
| 1970 |
+
rows, and "under the Visit order column" stops being true the moment three
|
| 1971 |
+
of those render between the two. */}
|
| 1972 |
+
{plan.links.length > 0 && (
|
| 1973 |
+
<div className="cg-map-google-links" aria-label="Google Maps route links">
|
| 1974 |
+
{plan.links.map((link) => (
|
| 1975 |
+
<a
|
| 1976 |
+
key={link.index}
|
| 1977 |
+
href={link.url}
|
| 1978 |
+
target="_blank"
|
| 1979 |
+
rel="noopener noreferrer"
|
| 1980 |
+
title={`Open Google Maps route ${link.index} in a new tab`}
|
| 1981 |
+
>
|
| 1982 |
+
Google Maps route {link.index}
|
| 1983 |
+
</a>
|
| 1984 |
+
))}
|
| 1985 |
+
</div>
|
| 1986 |
+
)}
|
| 1987 |
<button
|
| 1988 |
type="button"
|
| 1989 |
+
className="cg-btn cg-btn--primary cg-route-cta"
|
| 1990 |
+
disabled={saveBusy}
|
| 1991 |
onClick={() => void saveRouteOrder()}
|
| 1992 |
title={
|
| 1993 |
saveTarget
|
| 1994 |
+
? "Write these visit numbers into the saved field, for everyone it is shared with"
|
| 1995 |
: "Save these visit numbers as the next Destination field"
|
| 1996 |
}
|
| 1997 |
>
|
| 1998 |
{saveBusy ? "Saving" : saveTarget ? "Update visit order" : "Save visit order"}
|
| 1999 |
</button>
|
| 2000 |
+
{/* ⛔ DERIVED, NEVER STORED. The saved field carries the fingerprint of the
|
| 2001 |
inputs it was solved from; this compares it against the cohort ON SCREEN
|
| 2002 |
+
NOW, so the marker cannot itself go out of date. */}
|
|
|
|
| 2003 |
{orderStale && (
|
| 2004 |
<span className="cg-map-route-note">
|
| 2005 |
Stale. The saved numbers were solved from different stops, so re-solving
|
|
|
|
| 2013 |
)}
|
| 2014 |
{saveMsg && <span className="cg-map-route-note">{saveMsg}</span>}
|
| 2015 |
{saveErr && <span className="cg-cal-nodate">{saveErr}</span>}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2016 |
</>
|
| 2017 |
+
)}
|
| 2018 |
+
|
| 2019 |
+
{/* ⛔ W37-T36 — NAMED, NOT COUNTED. "4 selected records have no location" tells you
|
| 2020 |
+
something is missing and not WHICH visit you are about to fail to make, and the
|
| 2021 |
+
whole point of the chip is that the exclusion is not silent. Three inline so a
|
| 2022 |
+
big selection cannot swamp the panel, the rest on the tooltip. */}
|
| 2023 |
+
{/* ⛔⛔ GATED ON `selectedPids.size >= 2`, AND THAT IS A REAL DEFECT THIS PANEL
|
| 2024 |
+
REBUILD WOULD OTHERWISE HAVE SHIPPED. `customerRoutable` SHORT-CIRCUITS to `[]`
|
| 2025 |
+
below two selected records, so `unroutable` (= selection size minus routable) is
|
| 2026 |
+
1 whenever exactly ONE record is selected -- and the chip would then name a
|
| 2027 |
+
customer that has a perfectly good location and say it has none. It could not
|
| 2028 |
+
happen before because the whole body sat behind the two-selected wall item 2
|
| 2029 |
+
removes; taking that wall down without this gate turns an honest disclosure into
|
| 2030 |
+
a false accusation about a named customer. */}
|
| 2031 |
+
{selectedPids.size >= 2 && unroutable > 0 && (
|
| 2032 |
+
<span
|
| 2033 |
+
className="cg-cal-nodate"
|
| 2034 |
+
title={`No location on file, so these cannot be routed: ${unroutableNames.join(", ")}`}
|
| 2035 |
+
>
|
| 2036 |
+
No location, so not routed: {unroutableNames.slice(0, 3).join(", ")}
|
| 2037 |
+
{unroutableNames.length > 3 &&
|
| 2038 |
+
` and ${(unroutableNames.length - 3).toLocaleString()} more`}
|
| 2039 |
+
</span>
|
| 2040 |
+
)}
|
| 2041 |
+
|
| 2042 |
+
{routeOn && (
|
| 2043 |
+
<button
|
| 2044 |
+
type="button"
|
| 2045 |
+
className="cg-btn cg-btn--danger cg-route-cta"
|
| 2046 |
+
onClick={() => {
|
| 2047 |
+
setRouteOn(false);
|
| 2048 |
+
setRouteStartPid(null);
|
| 2049 |
+
setRouteOrder(null);
|
| 2050 |
+
setRoad(null);
|
| 2051 |
+
setRoadErr(null);
|
| 2052 |
+
setDepot(null);
|
| 2053 |
+
}}
|
| 2054 |
+
title="Drop this route and start again. The records stay selected."
|
| 2055 |
+
>
|
| 2056 |
+
Clear route
|
| 2057 |
+
</button>
|
| 2058 |
+
)}
|
| 2059 |
+
</div>
|
| 2060 |
+
</aside>
|
| 2061 |
+
)}
|
| 2062 |
{/* ⭐⭐ W37-T37 (R4 / R3 / R14) — LOOK UP THE ADDRESSES OF THE RECORDS YOU CHOSE.
|
| 2063 |
It lives HERE, on the map, because this is the surface where the absence is felt: you
|
| 2064 |
are looking at a picture with a chip saying N records have no location, and the answer
|
web/src/customer-grid/apiBridge.ts
CHANGED
|
@@ -979,6 +979,37 @@ export async function patchTableField(
|
|
| 979 |
* refuses a pre-set one (`may_edit_field`), and removing a column from the screen that the store
|
| 980 |
* still holds is the same lie in the other direction.
|
| 981 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 982 |
export async function deleteTableField(
|
| 983 |
tableKey: string,
|
| 984 |
fieldKey: string
|
|
|
|
| 979 |
* refuses a pre-set one (`may_edit_field`), and removing a column from the screen that the store
|
| 980 |
* still holds is the same lie in the other direction.
|
| 981 |
*/
|
| 982 |
+
/**
|
| 983 |
+
* ⭐⭐ OWNER ITEM 3 (2026-08-23) — REMOVE A DESTINATION FIELD.
|
| 984 |
+
*
|
| 985 |
+
* ⛔ ITS OWN DOOR, NOT `deleteTableField`. That one is `/tables/{key}/fields/{key}`, which serves
|
| 986 |
+
* `ut_*` USER TABLES; a Destination column is a SHARED column on the customers REGISTRY topic and
|
| 987 |
+
* lives in a different stratum with a different wall. Pointing the menu at the `ut_` route would
|
| 988 |
+
* 404 on a table key that does not exist, which is exactly the shape of "delete looks wired and
|
| 989 |
+
* silently does nothing".
|
| 990 |
+
*/
|
| 991 |
+
export async function deleteRouteOrderField(fieldKey: string): Promise<boolean> {
|
| 992 |
+
try {
|
| 993 |
+
const res = await fetch(
|
| 994 |
+
`${API_V1}/customers/route-order/${encodeURIComponent(fieldKey)}`,
|
| 995 |
+
{ method: "DELETE", credentials: CREDENTIALS }
|
| 996 |
+
);
|
| 997 |
+
if (handledSession(res)) return false;
|
| 998 |
+
if (!res.ok) {
|
| 999 |
+
// ⭐ THE SERVER'S OWN SENTENCE. It distinguishes "somebody else planned this route" from
|
| 1000 |
+
// "that is not a route column" from "no such column", and those need three different
|
| 1001 |
+
// things from the person reading them.
|
| 1002 |
+
const body = (await readJson(res)) as { error?: { message?: string } } | null;
|
| 1003 |
+
signal(TOAST_EVENT, refusalMessage(body, res.status));
|
| 1004 |
+
return false;
|
| 1005 |
+
}
|
| 1006 |
+
return true;
|
| 1007 |
+
} catch {
|
| 1008 |
+
signal(TOAST_EVENT, "That field could not be removed. Check your connection and try again.");
|
| 1009 |
+
return false;
|
| 1010 |
+
}
|
| 1011 |
+
}
|
| 1012 |
+
|
| 1013 |
export async function deleteTableField(
|
| 1014 |
tableKey: string,
|
| 1015 |
fieldKey: string
|
web/src/customer-grid/map.css
CHANGED
|
@@ -118,28 +118,37 @@
|
|
| 118 |
scrollbar-width: thin;
|
| 119 |
}
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
.cg-map-stopitem {
|
| 122 |
display: flex;
|
| 123 |
align-items: center;
|
| 124 |
gap: 2px;
|
| 125 |
min-width: 0;
|
| 126 |
width: 100%;
|
| 127 |
-
padding:
|
| 128 |
-
border: 1px solid
|
| 129 |
-
border-radius:
|
| 130 |
-
background:
|
| 131 |
font: 500 var(--lp-fs-3xs)/1.6 Inter, system-ui, sans-serif;
|
| 132 |
-
color:
|
| 133 |
}
|
| 134 |
|
|
|
|
|
|
|
| 135 |
.cg-map-stopn {
|
| 136 |
display: inline-grid;
|
| 137 |
place-items: center;
|
| 138 |
-
|
| 139 |
-
|
|
|
|
| 140 |
border-radius: 50%;
|
| 141 |
-
background:
|
| 142 |
-
|
|
|
|
| 143 |
font-size: var(--lp-fs-5xs);
|
| 144 |
font-weight: 600;
|
| 145 |
}
|
|
@@ -156,19 +165,33 @@
|
|
| 156 |
.cg-map-stopmove {
|
| 157 |
display: inline-grid;
|
| 158 |
place-items: center;
|
| 159 |
-
|
| 160 |
-
|
|
|
|
| 161 |
padding: 0;
|
| 162 |
border: 0;
|
| 163 |
-
border-radius:
|
| 164 |
background: none;
|
| 165 |
-
color:
|
| 166 |
cursor: pointer;
|
| 167 |
}
|
| 168 |
|
| 169 |
.cg-map-stopmove:hover:not(:disabled) {
|
| 170 |
-
background:
|
| 171 |
-
color:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
}
|
| 173 |
|
| 174 |
.cg-map-stopmove:disabled {
|
|
|
|
| 118 |
scrollbar-width: thin;
|
| 119 |
}
|
| 120 |
|
| 121 |
+
/* ⭐ OWNER ITEM 8/9 (2026-08-23) — TOKENS, NOT HEXES. Every colour in this block was a literal
|
| 122 |
+
(`#dfe3ea`, `#2c3340`, `#1f4e78`, `#6b7280`, `#eef2f7`), which /design §8 names as a slop tell
|
| 123 |
+
and DESIGN.md §5 makes concrete: a hex that lives in one file drifts with nothing noticing,
|
| 124 |
+
and `verify_icons.read_tokens` cannot see a value written this way at all. The rows also grew
|
| 125 |
+
a third control this pass, so they are sized for three rather than two. */
|
| 126 |
.cg-map-stopitem {
|
| 127 |
display: flex;
|
| 128 |
align-items: center;
|
| 129 |
gap: 2px;
|
| 130 |
min-width: 0;
|
| 131 |
width: 100%;
|
| 132 |
+
padding: 2px 3px 2px 5px;
|
| 133 |
+
border: 1px solid var(--lp-line);
|
| 134 |
+
border-radius: var(--lp-r-md);
|
| 135 |
+
background: var(--cg-white);
|
| 136 |
font: 500 var(--lp-fs-3xs)/1.6 Inter, system-ui, sans-serif;
|
| 137 |
+
color: var(--cg-text);
|
| 138 |
}
|
| 139 |
|
| 140 |
+
.cg-map-stopitem:hover { background: var(--cg-soft); }
|
| 141 |
+
|
| 142 |
.cg-map-stopn {
|
| 143 |
display: inline-grid;
|
| 144 |
place-items: center;
|
| 145 |
+
flex: 0 0 auto;
|
| 146 |
+
width: 16px;
|
| 147 |
+
height: 16px;
|
| 148 |
border-radius: 50%;
|
| 149 |
+
background: var(--lp-primary);
|
| 150 |
+
/* ⚠ The light ink is declared in the SAME rule as the dark fill (/design §8). */
|
| 151 |
+
color: var(--cg-white);
|
| 152 |
font-size: var(--lp-fs-5xs);
|
| 153 |
font-weight: 600;
|
| 154 |
}
|
|
|
|
| 165 |
.cg-map-stopmove {
|
| 166 |
display: inline-grid;
|
| 167 |
place-items: center;
|
| 168 |
+
flex: 0 0 auto;
|
| 169 |
+
width: 17px;
|
| 170 |
+
height: 17px;
|
| 171 |
padding: 0;
|
| 172 |
border: 0;
|
| 173 |
+
border-radius: 4px;
|
| 174 |
background: none;
|
| 175 |
+
color: var(--lp-muted);
|
| 176 |
cursor: pointer;
|
| 177 |
}
|
| 178 |
|
| 179 |
.cg-map-stopmove:hover:not(:disabled) {
|
| 180 |
+
background: var(--lp-blue-tint);
|
| 181 |
+
color: var(--lp-blue-deep);
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
.cg-map-stopmove:focus-visible {
|
| 185 |
+
outline: 2px solid var(--lp-blue-deep);
|
| 186 |
+
outline-offset: -1px;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
/* ⭐ OWNER ITEM 9 — TAKE THIS STOP OFF THE ROUTE. It hovers in the DANGER hue rather than the
|
| 190 |
+
blue the move controls use, because the two arrows rearrange a day and this one shortens it;
|
| 191 |
+
painting all three alike is how a person removes a customer while meaning to reorder one. */
|
| 192 |
+
.cg-map-stopdrop:hover:not(:disabled) {
|
| 193 |
+
background: var(--lp-red-tint);
|
| 194 |
+
color: var(--lp-red-deep);
|
| 195 |
}
|
| 196 |
|
| 197 |
.cg-map-stopmove:disabled {
|
web/src/customer-grid/types.ts
CHANGED
|
@@ -2037,6 +2037,18 @@ export interface Field {
|
|
| 2037 |
custom?: boolean;
|
| 2038 |
/** True when the definition and its cell values live in the tenant-wide field stratum. */
|
| 2039 |
shared?: boolean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2040 |
/** Host-computed effective Share field role for this viewer. */
|
| 2041 |
sharedRole?: FieldShareRole;
|
| 2042 |
/**
|
|
|
|
| 2037 |
custom?: boolean;
|
| 2038 |
/** True when the definition and its cell values live in the tenant-wide field stratum. */
|
| 2039 |
shared?: boolean;
|
| 2040 |
+
/**
|
| 2041 |
+
* ⭐ OWNER ITEM 3 (2026-08-23) — WHAT THIS SHARED DEFINITION COLUMN *IS*, as the server
|
| 2042 |
+
* declared it. Today the only value is `"route_order"` (`routes_customers.ROUTE_KIND`), stamped
|
| 2043 |
+
* by the door that mints a Destination field and carried through `_merge_shared_fields` verbatim.
|
| 2044 |
+
*
|
| 2045 |
+
* ⛔ IT IS READ, NEVER INFERRED FROM THE KEY. `route_` is a naming convention and the server
|
| 2046 |
+
* says so in as many words; a client that decided "this looks like a route column" by prefix
|
| 2047 |
+
* would offer the route delete door for any shared column that happened to take the name. The
|
| 2048 |
+
* server refuses that (`not_a_route_column`), so inferring would only move the failure from a
|
| 2049 |
+
* missing menu row to a 400 nobody expected.
|
| 2050 |
+
*/
|
| 2051 |
+
kind?: string;
|
| 2052 |
/** Host-computed effective Share field role for this viewer. */
|
| 2053 |
sharedRole?: FieldShareRole;
|
| 2054 |
/**
|
web/src/customer-grid/viewModes.tsx
CHANGED
|
@@ -85,49 +85,23 @@ function IconDayCells() {
|
|
| 85 |
|
| 86 |
// ------------------------------------------------------------- the switcher
|
| 87 |
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
className="cg-mode-rename"
|
| 101 |
-
onSubmit={(event) => {
|
| 102 |
-
event.preventDefault();
|
| 103 |
-
const next = draft.trim();
|
| 104 |
-
if (!next) return;
|
| 105 |
-
onRename(next);
|
| 106 |
-
close();
|
| 107 |
-
}}
|
| 108 |
-
>
|
| 109 |
-
<div className="cg-pop-title">Rename view</div>
|
| 110 |
-
<div className="cg-mode-rename-row">
|
| 111 |
-
<input
|
| 112 |
-
className="cg-input"
|
| 113 |
-
aria-label="View name"
|
| 114 |
-
value={draft}
|
| 115 |
-
onChange={(event) => setDraft(event.target.value)}
|
| 116 |
-
autoFocus
|
| 117 |
-
/>
|
| 118 |
-
<button type="submit" className="cg-btn cg-btn--primary">Save</button>
|
| 119 |
-
</div>
|
| 120 |
-
</form>
|
| 121 |
-
);
|
| 122 |
-
}
|
| 123 |
|
| 124 |
export function ModeSwitch({
|
| 125 |
mode,
|
| 126 |
onMode,
|
| 127 |
locked = false,
|
| 128 |
-
viewName,
|
| 129 |
-
canRenameView = false,
|
| 130 |
-
onRenameView,
|
| 131 |
dateField,
|
| 132 |
dateChoices,
|
| 133 |
stackField,
|
|
@@ -150,11 +124,6 @@ export function ModeSwitch({
|
|
| 150 |
* stay editable"), so removing those too would be a broader lock than the contract grants.
|
| 151 |
*/
|
| 152 |
locked?: boolean;
|
| 153 |
-
/** The current saved view name, used by the rename door in this toolbar control. */
|
| 154 |
-
viewName?: string;
|
| 155 |
-
/** Courtesy gate; the host remains the write authority. */
|
| 156 |
-
canRenameView?: boolean;
|
| 157 |
-
onRenameView?: (name: string) => void;
|
| 158 |
/** The calendar's effective date field (resolved by the caller). */
|
| 159 |
dateField?: Field;
|
| 160 |
dateChoices: Field[];
|
|
@@ -265,13 +234,6 @@ export function ModeSwitch({
|
|
| 265 |
</div>
|
| 266 |
))}
|
| 267 |
</div>
|
| 268 |
-
{canRenameView && onRenameView && viewName !== undefined && (
|
| 269 |
-
<ViewRenameForm
|
| 270 |
-
viewName={viewName}
|
| 271 |
-
onRename={onRenameView}
|
| 272 |
-
close={close}
|
| 273 |
-
/>
|
| 274 |
-
)}
|
| 275 |
</div>
|
| 276 |
)}
|
| 277 |
</Popover>
|
|
|
|
| 85 |
|
| 86 |
// ------------------------------------------------------------- the switcher
|
| 87 |
|
| 88 |
+
/* ⛔ OWNER 2026-08-23 (item 1) — `ViewRenameForm` WAS HERE AND IS DELETED, deliberately with a
|
| 89 |
+
tombstone rather than silently: it shipped four days earlier as v44's fix for "I cannot rename
|
| 90 |
+
while the toggle is at Map View", and the next session to read that log entry would otherwise
|
| 91 |
+
reinstate it. The owner's ruling: renaming is not a display MODE, so it does not belong in the
|
| 92 |
+
control that picks between Grid, Chart, Calendar and Map.
|
| 93 |
+
|
| 94 |
+
⚠ THE RENAME DOOR THIS REPLACES IS NOT GONE, WHICH IS THE ONLY REASON DELETING IS SAFE. The
|
| 95 |
+
views rail owns it (`ViewSidebar`: the row's "..." menu sets `renamingId`, the inline
|
| 96 |
+
`.cg-view-rename` input commits on blur or Enter), it is gated by the SAME `mayEditView`
|
| 97 |
+
predicate this form used, and it writes through the SAME `renameView` callback. It is also
|
| 98 |
+
mode-independent: `<ViewSidebar>` renders under `!hideViews` and never consults `displayMode`,
|
| 99 |
+
so it is reachable from Map exactly as it is from Grid. Verified before removal, not assumed. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
export function ModeSwitch({
|
| 102 |
mode,
|
| 103 |
onMode,
|
| 104 |
locked = false,
|
|
|
|
|
|
|
|
|
|
| 105 |
dateField,
|
| 106 |
dateChoices,
|
| 107 |
stackField,
|
|
|
|
| 124 |
* stay editable"), so removing those too would be a broader lock than the contract grants.
|
| 125 |
*/
|
| 126 |
locked?: boolean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
/** The calendar's effective date field (resolved by the caller). */
|
| 128 |
dateField?: Field;
|
| 129 |
dateChoices: Field[];
|
|
|
|
| 234 |
</div>
|
| 235 |
))}
|
| 236 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
</div>
|
| 238 |
)}
|
| 239 |
</Popover>
|
web/src/index.css
CHANGED
|
@@ -4093,23 +4093,7 @@ body > .cg-overlay {
|
|
| 4093 |
wrapper and the per-mode field select remain. */
|
| 4094 |
.cg-modes { display: inline-flex; align-items: center; gap: 6px; }
|
| 4095 |
.cg-mode-field { max-width: 150px; }
|
| 4096 |
-
.cg-mode-rename
|
| 4097 |
-
display: flex;
|
| 4098 |
-
flex-direction: column;
|
| 4099 |
-
gap: 6px;
|
| 4100 |
-
margin-top: 8px;
|
| 4101 |
-
padding-top: 8px;
|
| 4102 |
-
border-top: 1px solid var(--lp-line);
|
| 4103 |
-
}
|
| 4104 |
-
.cg-mode-rename .cg-pop-title { padding: 0 8px; }
|
| 4105 |
-
.cg-mode-rename-row {
|
| 4106 |
-
display: flex;
|
| 4107 |
-
align-items: center;
|
| 4108 |
-
gap: 6px;
|
| 4109 |
-
padding: 0 8px 2px;
|
| 4110 |
-
}
|
| 4111 |
-
.cg-mode-rename-row .cg-input { min-width: 0; flex: 1 1 auto; }
|
| 4112 |
-
.cg-mode-rename-row .cg-btn { flex: 0 0 auto; }
|
| 4113 |
.cg-mode-empty {
|
| 4114 |
padding: 28px 16px;
|
| 4115 |
color: #6a6f78;
|
|
@@ -4844,12 +4828,18 @@ body > .cg-overlay {
|
|
| 4844 |
sibling over the same frame — deliberately has none.
|
| 4845 |
Colours are `--lp-*` variables only, never literals, so HOST's C1 token pass
|
| 4846 |
flows through here for free. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4847 |
.cg-map-ctl {
|
| 4848 |
position: absolute;
|
| 4849 |
top: 10px;
|
| 4850 |
-
|
| 4851 |
display: flex;
|
| 4852 |
-
flex-direction:
|
| 4853 |
background: #fff;
|
| 4854 |
border: 1px solid var(--lp-line);
|
| 4855 |
border-radius: 6px;
|
|
@@ -4865,12 +4855,15 @@ body > .cg-overlay {
|
|
| 4865 |
justify-content: center;
|
| 4866 |
padding: 0;
|
| 4867 |
border: 0;
|
| 4868 |
-
border-bottom
|
|
|
|
|
|
|
|
|
|
| 4869 |
background: #fff;
|
| 4870 |
color: var(--lp-ink);
|
| 4871 |
cursor: pointer;
|
| 4872 |
}
|
| 4873 |
-
.cg-map-ctl-b:last-child { border-
|
| 4874 |
.cg-map-ctl-b:hover:not(:disabled) { background: var(--lp-blue-tint); }
|
| 4875 |
.cg-map-ctl-b:disabled { color: var(--lp-line); cursor: default; }
|
| 4876 |
.cg-map-ctl-b:focus-visible {
|
|
@@ -5026,7 +5019,23 @@ a.cg-map-ctl-b { text-decoration: none; }
|
|
| 5026 |
min-width: 0;
|
| 5027 |
overflow: visible;
|
| 5028 |
}
|
| 5029 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5030 |
.cg-route-popover .cg-map-route-sum { white-space: normal; line-height: 1.45; }
|
| 5031 |
.cg-route-popover .cg-map-route-opt {
|
| 5032 |
align-items: stretch;
|
|
@@ -5034,29 +5043,138 @@ a.cg-map-ctl-b { text-decoration: none; }
|
|
| 5034 |
gap: 4px;
|
| 5035 |
white-space: normal;
|
| 5036 |
}
|
| 5037 |
-
.cg-route-popover .cg-map-route-opt
|
| 5038 |
flex-direction: row;
|
| 5039 |
align-items: center;
|
| 5040 |
}
|
| 5041 |
-
.cg-route-popover .cg-map-route-start { width: 100%; max-width: none; }
|
| 5042 |
.cg-route-popover .cg-map-route a { white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
|
| 5043 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5044 |
flex: 0 0 auto;
|
| 5045 |
-
|
| 5046 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5047 |
border: 1px solid var(--lp-line);
|
| 5048 |
-
border-radius:
|
| 5049 |
-
background:
|
| 5050 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5051 |
font: inherit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5052 |
cursor: pointer;
|
| 5053 |
}
|
| 5054 |
-
.cg-
|
| 5055 |
-
.cg-
|
| 5056 |
-
.cg-
|
| 5057 |
-
|
| 5058 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5059 |
}
|
|
|
|
| 5060 |
.cg-map-route-sum {
|
| 5061 |
flex: 0 0 auto;
|
| 5062 |
color: var(--lp-ink);
|
|
@@ -5101,10 +5219,16 @@ a.cg-map-ctl-b { text-decoration: none; }
|
|
| 5101 |
outline-offset: 2px;
|
| 5102 |
border-radius: 2px;
|
| 5103 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5104 |
.cg-map-google-links {
|
| 5105 |
display: flex;
|
| 5106 |
-
flex-
|
| 5107 |
-
|
|
|
|
|
|
|
| 5108 |
}
|
| 5109 |
.cg-map-google-links a {
|
| 5110 |
white-space: nowrap;
|
|
|
|
| 4093 |
wrapper and the per-mode field select remain. */
|
| 4094 |
.cg-modes { display: inline-flex; align-items: center; gap: 6px; }
|
| 4095 |
.cg-mode-field { max-width: 150px; }
|
| 4096 |
+
/* (`.cg-mode-rename*` removed 2026-08-23 with `ViewRenameForm`, owner item 1.) */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4097 |
.cg-mode-empty {
|
| 4098 |
padding: 28px 16px;
|
| 4099 |
color: #6a6f78;
|
|
|
|
| 4828 |
sibling over the same frame — deliberately has none.
|
| 4829 |
Colours are `--lp-*` variables only, never literals, so HOST's C1 token pass
|
| 4830 |
flows through here for free. */
|
| 4831 |
+
/* ⭐ OWNER ITEM 5 (2026-08-23) — THE CAMERA BAR MOVED FROM THE RIGHT EDGE TO THE TOP.
|
| 4832 |
+
It was a vertical stack pinned `right: 10px`, which is the map convention and is also the
|
| 4833 |
+
corner a reader reaches last on a left-to-right surface. The owner could not find it. Now a
|
| 4834 |
+
horizontal bar at the top left, above the route panel (which starts at `top: 48px`, so the
|
| 4835 |
+
28px bar at `top: 10px` clears it by 10px and the two never overlap). The legends stay bottom
|
| 4836 |
+
left and the credit bottom right, so nothing else moved into a taken corner. */
|
| 4837 |
.cg-map-ctl {
|
| 4838 |
position: absolute;
|
| 4839 |
top: 10px;
|
| 4840 |
+
left: 10px;
|
| 4841 |
display: flex;
|
| 4842 |
+
flex-direction: row;
|
| 4843 |
background: #fff;
|
| 4844 |
border: 1px solid var(--lp-line);
|
| 4845 |
border-radius: 6px;
|
|
|
|
| 4855 |
justify-content: center;
|
| 4856 |
padding: 0;
|
| 4857 |
border: 0;
|
| 4858 |
+
/* ⚠ THE SEPARATOR TURNED WITH THE BAR. A `border-bottom` under a ROW of buttons draws a rule
|
| 4859 |
+
along the whole underside instead of between the keys, which is how a re-orientated toolbar
|
| 4860 |
+
ends up looking underlined rather than segmented. */
|
| 4861 |
+
border-right: 1px solid var(--lp-line);
|
| 4862 |
background: #fff;
|
| 4863 |
color: var(--lp-ink);
|
| 4864 |
cursor: pointer;
|
| 4865 |
}
|
| 4866 |
+
.cg-map-ctl-b:last-child { border-right: 0; }
|
| 4867 |
.cg-map-ctl-b:hover:not(:disabled) { background: var(--lp-blue-tint); }
|
| 4868 |
.cg-map-ctl-b:disabled { color: var(--lp-line); cursor: default; }
|
| 4869 |
.cg-map-ctl-b:focus-visible {
|
|
|
|
| 5019 |
min-width: 0;
|
| 5020 |
overflow: visible;
|
| 5021 |
}
|
| 5022 |
+
/* OWNER ITEM 8 (2026-08-23) — THE ROUTE PANEL BUTTONS.
|
| 5023 |
+
⛔ `.cg-map-route-go` IS DELETED, and the reason it looked amateur is that it was ONE flat
|
| 5024 |
+
22px chip doing four different jobs: it painted "Save visit order" (the committing action),
|
| 5025 |
+
"Driving route" (a secondary re-ask), "Re-optimise" (a revert) and "Clear" (a destructive
|
| 5026 |
+
reset) identically, so the panel offered a column of interchangeable grey slabs and no
|
| 5027 |
+
hierarchy at all. Everything now uses `.cg-btn` / `--primary` / `--danger`, the SAME family
|
| 5028 |
+
every popover and dialog in this tree already commits with. That is the whole fix and it is a
|
| 5029 |
+
deletion, not a new button language (DESIGN.md §0 authorises no new one).
|
| 5030 |
+
⚠ ONE local override, and it is geometry rather than paint: inside a 360px panel these read
|
| 5031 |
+
as full-width rows rather than inline chips. */
|
| 5032 |
+
.cg-route-popover .cg-btn.cg-route-cta {
|
| 5033 |
+
width: 100%;
|
| 5034 |
+
min-height: 28px;
|
| 5035 |
+
text-align: center;
|
| 5036 |
+
white-space: normal;
|
| 5037 |
+
}
|
| 5038 |
+
.cg-map-geo .cg-map-geo-cta { width: 100%; }
|
| 5039 |
.cg-route-popover .cg-map-route-sum { white-space: normal; line-height: 1.45; }
|
| 5040 |
.cg-route-popover .cg-map-route-opt {
|
| 5041 |
align-items: stretch;
|
|
|
|
| 5043 |
gap: 4px;
|
| 5044 |
white-space: normal;
|
| 5045 |
}
|
| 5046 |
+
.cg-route-popover .cg-map-route-opt.cg-route-check {
|
| 5047 |
flex-direction: row;
|
| 5048 |
align-items: center;
|
| 5049 |
}
|
|
|
|
| 5050 |
.cg-route-popover .cg-map-route a { white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
|
| 5051 |
+
|
| 5052 |
+
/* -- ITEM 7: the travel-mode segmented control --------------------------------
|
| 5053 |
+
Two mutually exclusive choices, both visible, the active one marked. Deliberately NOT a
|
| 5054 |
+
toggle whose label is its own state: a control that renames itself is a different button each
|
| 5055 |
+
time you look for it, which is the argument `viewModes` already makes for the calendar's
|
| 5056 |
+
Records/Summaries popover. */
|
| 5057 |
+
.cg-route-modes {
|
| 5058 |
+
display: flex;
|
| 5059 |
+
width: 100%;
|
| 5060 |
+
border: 1px solid var(--lp-line);
|
| 5061 |
+
border-radius: var(--lp-r-md);
|
| 5062 |
+
overflow: hidden;
|
| 5063 |
+
}
|
| 5064 |
+
.cg-route-mode {
|
| 5065 |
+
flex: 1 1 0;
|
| 5066 |
+
min-height: 26px;
|
| 5067 |
+
padding: 0 8px;
|
| 5068 |
+
border: 0;
|
| 5069 |
+
border-right: 1px solid var(--lp-line);
|
| 5070 |
+
background: var(--cg-white);
|
| 5071 |
+
color: var(--lp-muted);
|
| 5072 |
+
font: inherit;
|
| 5073 |
+
font-size: var(--lp-fs-3xs);
|
| 5074 |
+
cursor: pointer;
|
| 5075 |
+
}
|
| 5076 |
+
.cg-route-mode:last-child { border-right: 0; }
|
| 5077 |
+
.cg-route-mode:hover:not(:disabled):not(.is-on) { background: var(--cg-soft); }
|
| 5078 |
+
.cg-route-mode.is-on {
|
| 5079 |
+
background: var(--lp-primary);
|
| 5080 |
+
/* ⚠ THE INK IS SET IN THE SAME RULE AS THE DARK FILL (/design §8, the two that ship broken
|
| 5081 |
+
most). A rule that darkens a background without naming the foreground inherits the muted
|
| 5082 |
+
grey above and lands as ink-on-ink. */
|
| 5083 |
+
color: var(--cg-white);
|
| 5084 |
+
font-weight: 500;
|
| 5085 |
+
}
|
| 5086 |
+
.cg-route-mode:disabled {
|
| 5087 |
+
/* Three channels, never opacity alone: the real `disabled` attribute is on the element. */
|
| 5088 |
+
opacity: 0.45;
|
| 5089 |
+
cursor: not-allowed;
|
| 5090 |
+
}
|
| 5091 |
+
.cg-route-mode:focus-visible { outline: 2px solid var(--lp-blue-deep); outline-offset: -2px; }
|
| 5092 |
+
|
| 5093 |
+
/* -- ITEM 9: the searchable record picker -------------------------------------
|
| 5094 |
+
Expands IN PLACE rather than floating: see `RecordPicker`'s own note for why a popup listbox
|
| 5095 |
+
inside an absolutely positioned, scrolling `<aside>` is a placement bug waiting to happen. */
|
| 5096 |
+
.cg-route-picker { display: flex; flex-direction: column; gap: 4px; width: 100%; }
|
| 5097 |
+
.cg-route-picker-label { color: var(--lp-muted); font-size: var(--lp-fs-3xs); }
|
| 5098 |
+
.cg-route-picker-trigger {
|
| 5099 |
+
display: flex;
|
| 5100 |
+
align-items: center;
|
| 5101 |
+
justify-content: space-between;
|
| 5102 |
+
gap: 6px;
|
| 5103 |
+
width: 100%;
|
| 5104 |
+
min-height: 28px;
|
| 5105 |
+
padding: 0 8px;
|
| 5106 |
+
border: 1px solid var(--lp-line);
|
| 5107 |
+
border-radius: var(--lp-r-md);
|
| 5108 |
+
background: var(--cg-white);
|
| 5109 |
+
color: var(--cg-text);
|
| 5110 |
+
font: inherit;
|
| 5111 |
+
font-size: var(--lp-fs-3xs);
|
| 5112 |
+
text-align: left;
|
| 5113 |
+
cursor: pointer;
|
| 5114 |
+
}
|
| 5115 |
+
.cg-route-picker-trigger:hover { background: var(--cg-soft); }
|
| 5116 |
+
.cg-route-picker-trigger:focus-visible { outline: 2px solid var(--lp-blue-deep); outline-offset: 1px; }
|
| 5117 |
+
.cg-route-picker-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
| 5118 |
+
.cg-route-picker-caret {
|
| 5119 |
flex: 0 0 auto;
|
| 5120 |
+
width: 12px;
|
| 5121 |
+
height: 12px;
|
| 5122 |
+
fill: none;
|
| 5123 |
+
stroke: currentColor;
|
| 5124 |
+
stroke-width: 1.6;
|
| 5125 |
+
stroke-linecap: round;
|
| 5126 |
+
stroke-linejoin: round;
|
| 5127 |
+
}
|
| 5128 |
+
.cg-route-picker-panel {
|
| 5129 |
+
display: flex;
|
| 5130 |
+
flex-direction: column;
|
| 5131 |
+
gap: 4px;
|
| 5132 |
+
padding: 6px;
|
| 5133 |
+
/* ⚠ ONE containment layer, not a card inside a card (/design §8): the tray is a hairline
|
| 5134 |
+
inset inside the popover, with no second surface colour of its own. */
|
| 5135 |
border: 1px solid var(--lp-line);
|
| 5136 |
+
border-radius: var(--lp-r-md);
|
| 5137 |
+
background: var(--cg-soft);
|
| 5138 |
+
}
|
| 5139 |
+
.cg-route-picker-search { width: 100%; min-width: 0; }
|
| 5140 |
+
.cg-route-picker-list {
|
| 5141 |
+
display: flex;
|
| 5142 |
+
flex-direction: column;
|
| 5143 |
+
max-height: 168px;
|
| 5144 |
+
overflow-y: auto;
|
| 5145 |
+
scrollbar-width: thin;
|
| 5146 |
+
}
|
| 5147 |
+
.cg-route-picker-opt {
|
| 5148 |
+
padding: 5px 6px;
|
| 5149 |
+
border: 0;
|
| 5150 |
+
border-radius: 4px;
|
| 5151 |
+
background: none;
|
| 5152 |
+
color: var(--cg-text);
|
| 5153 |
font: inherit;
|
| 5154 |
+
font-size: var(--lp-fs-3xs);
|
| 5155 |
+
text-align: left;
|
| 5156 |
+
overflow: hidden;
|
| 5157 |
+
text-overflow: ellipsis;
|
| 5158 |
+
white-space: nowrap;
|
| 5159 |
cursor: pointer;
|
| 5160 |
}
|
| 5161 |
+
.cg-route-picker-opt:hover { background: var(--lp-blue-tint); }
|
| 5162 |
+
.cg-route-picker-opt.is-on { color: var(--lp-primary); font-weight: 600; }
|
| 5163 |
+
.cg-route-picker-opt:focus-visible { outline: 2px solid var(--lp-blue-deep); outline-offset: -2px; }
|
| 5164 |
+
.cg-route-picker-empty { color: var(--lp-muted); font-size: var(--lp-fs-3xs); line-height: 1.4; }
|
| 5165 |
+
|
| 5166 |
+
.cg-route-select {
|
| 5167 |
+
width: 100%;
|
| 5168 |
+
min-height: 28px;
|
| 5169 |
+
padding: 0 6px;
|
| 5170 |
+
border: 1px solid var(--lp-line);
|
| 5171 |
+
border-radius: var(--lp-r-md);
|
| 5172 |
+
background: var(--cg-white);
|
| 5173 |
+
color: var(--cg-text);
|
| 5174 |
+
font: inherit;
|
| 5175 |
+
font-size: var(--lp-fs-3xs);
|
| 5176 |
}
|
| 5177 |
+
.cg-route-select:focus-visible { outline: 2px solid var(--lp-blue-deep); outline-offset: 1px; }
|
| 5178 |
.cg-map-route-sum {
|
| 5179 |
flex: 0 0 auto;
|
| 5180 |
color: var(--lp-ink);
|
|
|
|
| 5219 |
outline-offset: 2px;
|
| 5220 |
border-radius: 2px;
|
| 5221 |
}
|
| 5222 |
+
/* ⭐ OWNER ITEM 4 (2026-08-23) — ONE LINK PER LINE. These were `flex-wrap: wrap` chips, so a
|
| 5223 |
+
route needing four Google legs painted as a cluster of near-identical stubs a reader has to
|
| 5224 |
+
compare letter by letter to tell apart. A route's legs are a SEQUENCE; stacked, the list reads
|
| 5225 |
+
as leg 1 then leg 2, which is the order they are driven in. */
|
| 5226 |
.cg-map-google-links {
|
| 5227 |
display: flex;
|
| 5228 |
+
flex-direction: column;
|
| 5229 |
+
align-items: flex-start;
|
| 5230 |
+
gap: 4px;
|
| 5231 |
+
width: 100%;
|
| 5232 |
}
|
| 5233 |
.cg-map-google-links a {
|
| 5234 |
white-space: nowrap;
|