Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +7 -1
- VERSION +1 -1
- api/routes_grid.py +132 -0
- platform/core/record_recurrence.py +130 -0
- web/src/customer-grid/CustomerGrid.tsx +4 -1
- web/src/customer-grid/DatePicker.tsx +119 -9
- web/src/customer-grid/MapView.tsx +42 -2
- web/src/customer-grid/RouteNav.tsx +417 -144
- web/src/customer-grid/routeZoneTypes.ts +6 -0
- web/src/customer-grid/viewModes.tsx +2 -2
- web/src/styles/wave42/route-nav.css +78 -0
- web/src/styles/wave46/map-panels.css +19 -3
- web/wiring_rows/wave42_f.py +6 -2
- web/wiring_rows/wave43_shell_repair.py +8 -5
RELEASES.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
{
|
| 5 |
"version": "v61",
|
| 6 |
"sha": "bbc4c07",
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "2940f6d",
|
| 3 |
"releases": [
|
| 4 |
+
{
|
| 5 |
+
"version": "v62",
|
| 6 |
+
"sha": "2c8f702",
|
| 7 |
+
"date": "2026-08-31",
|
| 8 |
+
"subject": "release v62"
|
| 9 |
+
},
|
| 10 |
{
|
| 11 |
"version": "v61",
|
| 12 |
"sha": "bbc4c07",
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
2940f6d
|
api/routes_grid.py
CHANGED
|
@@ -1145,6 +1145,138 @@ def recurrence_preview(body: dict = Body(default=None),
|
|
| 1145 |
}
|
| 1146 |
|
| 1147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1148 |
# ββ ββ W47-T26 (owner instruction 13 / ruling R2, contract C5): THE NEXT DATE IS A REAL CELL β
|
| 1149 |
#
|
| 1150 |
# R2, verbatim: the computed next date is STORED in the cell, "so it filters, sorts and groups
|
|
|
|
| 1145 |
}
|
| 1146 |
|
| 1147 |
|
| 1148 |
+
# ββ ββ OWNER 2026-08-31 β A REPEAT RULE BELONGS TO THE RECORD, AND IT REVERSES WAVE 47's R1/R2 β
|
| 1149 |
+
#
|
| 1150 |
+
# Owner, verbatim: *"THE EDIT REPEAT IS STILL NOT PER FIELD."* Asked which of three readings that
|
| 1151 |
+
# was, and shown wave 47's own ruling that a column anchor is what makes a rule per-record, they
|
| 1152 |
+
# chose *"Each ROW stores its own repeat rule. Reverse R1/R2."* A current owner instruction beats
|
| 1153 |
+
# a recorded older one, and the comment the older one left behind is rewritten in the same change
|
| 1154 |
+
# rather than left for the next reader to undo (`core/record_recurrence.py`'s header).
|
| 1155 |
+
#
|
| 1156 |
+
# β THE FIELD'S RULE SURVIVES AS THE DEFAULT A ROW INHERITS. `_recurrence_columns` and
|
| 1157 |
+
# `_materialise_recurrence_cells` are untouched: a column with a rule and no per-record overrides
|
| 1158 |
+
# behaves exactly as it did this morning. What changes is that the picker now writes the RECORD.
|
| 1159 |
+
#
|
| 1160 |
+
# ββ AND THIS IS WHAT CLOSES THE SECOND HALF OF THE OWNER'S COMPLAINT β *"IT STILL DOESN'T
|
| 1161 |
+
# POPULATE THE CELL AS THE NEXTDATE WHEN I CLICK IT ... IT IS ONLY POPULATING WHEN I CLICK THE DATE
|
| 1162 |
+
# IN THE CALENDAR ITSELF."* `_materialise_recurrence_cells` writes the cell on `field_upsert`, and
|
| 1163 |
+
# its own scope note says it materialises for `ut_*` USER TABLES ONLY, because the registry topics
|
| 1164 |
+
# patch ONE pid per call and writing ~3,600 customer rows that way is a performance defect. A
|
| 1165 |
+
# PER-RECORD rule is one row by construction, so that wall is simply not on this path: this door
|
| 1166 |
+
# returns the ONE next date and the browser writes it through `patchAndRecord`, the same door a
|
| 1167 |
+
# typed edit takes, keeping the undo stack and the permission check that already exist.
|
| 1168 |
+
#
|
| 1169 |
+
# β ROW-LEVEL PERMISSION, STATED RATHER THAN ASSUMED. `workspace()` refuses a scope this session
|
| 1170 |
+
# cannot open and `govern_date_recurrence` refuses a field it cannot see, so the COLUMN is walled.
|
| 1171 |
+
# The bucket is tenant-bound through `session.runtime`, so no rule can cross a tenant. There is no
|
| 1172 |
+
# per-ROW wall here beyond that, which matches every other per-record sidecar in the tree
|
| 1173 |
+
# (`record_comments` reaches its rows the same way); a cohort-scoped reader can therefore store a
|
| 1174 |
+
# rule against a pid outside their cohort if they can name it. Booked rather than hidden.
|
| 1175 |
+
|
| 1176 |
+
|
| 1177 |
+
def _record_recurrence_request(body):
|
| 1178 |
+
"""The three things every door below needs, validated once."""
|
| 1179 |
+
body = body if isinstance(body, dict) else {}
|
| 1180 |
+
scope = _scope_or_400(body.get("scopeKey"))
|
| 1181 |
+
try:
|
| 1182 |
+
pid = int(body.get("pid"))
|
| 1183 |
+
except (TypeError, ValueError):
|
| 1184 |
+
raise err(400, "bad_record", "a per-record repeat rule names one record")
|
| 1185 |
+
field_key = str(body.get("field") or "").strip()
|
| 1186 |
+
if not field_key:
|
| 1187 |
+
raise err(400, "bad_field", "a per-record repeat rule names one Date field")
|
| 1188 |
+
return scope, pid, field_key
|
| 1189 |
+
|
| 1190 |
+
|
| 1191 |
+
@router.post("/grid/record-recurrence/read")
|
| 1192 |
+
def record_recurrence_read(body: dict = Body(default=None),
|
| 1193 |
+
session: Session = Depends(require_session)):
|
| 1194 |
+
"""ONE record's stored rule for ONE column, plus the next date it currently names.
|
| 1195 |
+
|
| 1196 |
+
A POST rather than a GET because the scope key, the pid and the field key are three
|
| 1197 |
+
parameters this app already sends as a body everywhere else on this router, and because a
|
| 1198 |
+
read that names a record does not belong in a URL that lands in a browser history.
|
| 1199 |
+
|
| 1200 |
+
``inherited`` is the honest fourth state beside "has a rule": the row has none of its own and
|
| 1201 |
+
is answering with the COLUMN's, which is a different sentence from "no repeat" and the picker
|
| 1202 |
+
renders it as one.
|
| 1203 |
+
"""
|
| 1204 |
+
import aios_grid
|
| 1205 |
+
from core import record_recurrence
|
| 1206 |
+
|
| 1207 |
+
scope, pid, field_key = _record_recurrence_request(body)
|
| 1208 |
+
current = workspace(scope=scope, session=session)["workspace"]
|
| 1209 |
+
fields = current.get("fields") or []
|
| 1210 |
+
field = next((item for item in fields
|
| 1211 |
+
if isinstance(item, dict) and str(item.get("key")) == field_key), None)
|
| 1212 |
+
if not field or field.get("type") != "date":
|
| 1213 |
+
raise err(404, "unknown_field", "that Date field is not visible on this database")
|
| 1214 |
+
try:
|
| 1215 |
+
stored = record_recurrence.rule_for(session.runtime, pid, field_key, scope=scope)
|
| 1216 |
+
except record_recurrence.RecurrenceUnavailable as exc:
|
| 1217 |
+
raise err(503, "recurrence_unavailable", str(exc))
|
| 1218 |
+
inherited = stored is None
|
| 1219 |
+
effective = stored if stored is not None else field.get("recurrence")
|
| 1220 |
+
condition_fields = {str(item.get("key")) for item in fields
|
| 1221 |
+
if isinstance(item, dict) and item.get("key")}
|
| 1222 |
+
next_date = aios_grid.recurrence_row_next_date(
|
| 1223 |
+
effective, body.get("anchorValue"), today=time.strftime("%Y-%m-%d"),
|
| 1224 |
+
condition_fields=condition_fields) if isinstance(effective, dict) else None
|
| 1225 |
+
return {"recurrence": effective if isinstance(effective, dict) else None,
|
| 1226 |
+
"inherited": inherited, "nextDate": next_date}
|
| 1227 |
+
|
| 1228 |
+
|
| 1229 |
+
@router.post("/grid/record-recurrence")
|
| 1230 |
+
def record_recurrence_write(body: dict = Body(default=None),
|
| 1231 |
+
session: Session = Depends(require_session)):
|
| 1232 |
+
"""Store, replace or clear ONE record's repeat rule, and answer with its next date.
|
| 1233 |
+
|
| 1234 |
+
β THE SAME AUTHORITY THE FIELD-LEVEL WRITE PASSES THROUGH, CALLED RATHER THAN RESTATED.
|
| 1235 |
+
`govern_date_recurrence` is what validates the anchor, the conditions and every rule kind for
|
| 1236 |
+
the preview and for `field_upsert`; a second validator here is how the two doors come to
|
| 1237 |
+
disagree about what a legal rule is.
|
| 1238 |
+
|
| 1239 |
+
β THE CELL IS NOT WRITTEN HERE. The browser writes it through the ordinary patch door, so
|
| 1240 |
+
the edit joins the undo stack and meets the field-permission check that already guards a typed
|
| 1241 |
+
date. A second writer sitting outside those guards is the shape D-12 exists to refuse.
|
| 1242 |
+
"""
|
| 1243 |
+
import aios_grid
|
| 1244 |
+
from core import record_recurrence
|
| 1245 |
+
|
| 1246 |
+
scope, pid, field_key = _record_recurrence_request(body)
|
| 1247 |
+
current = workspace(scope=scope, session=session)["workspace"]
|
| 1248 |
+
fields = current.get("fields") or []
|
| 1249 |
+
field = next((item for item in fields
|
| 1250 |
+
if isinstance(item, dict) and str(item.get("key")) == field_key), None)
|
| 1251 |
+
if not field or field.get("type") != "date":
|
| 1252 |
+
raise err(404, "unknown_field", "that Date field is not visible on this database")
|
| 1253 |
+
|
| 1254 |
+
raw = body.get("recurrence")
|
| 1255 |
+
clean = None
|
| 1256 |
+
if raw is not None:
|
| 1257 |
+
try:
|
| 1258 |
+
clean = govern_date_recurrence(session, scope, fields, raw)
|
| 1259 |
+
except ValueError as exc:
|
| 1260 |
+
raise err(400, "bad_recurrence", str(exc))
|
| 1261 |
+
try:
|
| 1262 |
+
stored = record_recurrence.put_rule(session.runtime, pid, field_key, clean, scope=scope)
|
| 1263 |
+
except ValueError as exc:
|
| 1264 |
+
raise err(400, "bad_recurrence", str(exc))
|
| 1265 |
+
except record_recurrence.RecurrenceUnavailable as exc:
|
| 1266 |
+
raise err(503, "recurrence_unavailable", str(exc))
|
| 1267 |
+
|
| 1268 |
+
condition_fields = {str(item.get("key")) for item in fields
|
| 1269 |
+
if isinstance(item, dict) and item.get("key")}
|
| 1270 |
+
# β CLEARING A RECORD'S RULE FALLS BACK TO THE COLUMN'S, it does not fall back to nothing:
|
| 1271 |
+
# the row is inheriting again, and answering `null` here would tell the picker the opposite.
|
| 1272 |
+
effective = stored if stored is not None else field.get("recurrence")
|
| 1273 |
+
next_date = aios_grid.recurrence_row_next_date(
|
| 1274 |
+
effective, body.get("anchorValue"), today=time.strftime("%Y-%m-%d"),
|
| 1275 |
+
condition_fields=condition_fields) if isinstance(effective, dict) else None
|
| 1276 |
+
return {"recurrence": effective if isinstance(effective, dict) else None,
|
| 1277 |
+
"inherited": stored is None, "nextDate": next_date}
|
| 1278 |
+
|
| 1279 |
+
|
| 1280 |
# ββ ββ W47-T26 (owner instruction 13 / ruling R2, contract C5): THE NEXT DATE IS A REAL CELL β
|
| 1281 |
#
|
| 1282 |
# R2, verbatim: the computed next date is STORED in the cell, "so it filters, sorts and groups
|
platform/core/record_recurrence.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A repeat rule that belongs to ONE RECORD, one bucket per database.
|
| 2 |
+
|
| 3 |
+
ββ OWNER RULING 2026-08-31, AND IT REVERSES R1/R2 OF WAVE 47 ON PURPOSE.
|
| 4 |
+
|
| 5 |
+
Wave 47's R1/R2 read: *"A date rule anchors on a COLUMN, and that is why it is per-record"* β the
|
| 6 |
+
rule stayed on `Field.recurrence` and every row computed its own answer from its own anchor cell.
|
| 7 |
+
Asked directly whether that still stood, the owner chose *"Each ROW stores its own repeat rule.
|
| 8 |
+
Reverse R1/R2."* So a row's rule is now a record of its own, and the field's rule becomes the
|
| 9 |
+
DEFAULT a row inherits until it is given one.
|
| 10 |
+
|
| 11 |
+
β THE FIELD'S RULE IS NOT DELETED, and that is not timidity. `Field.recurrence` is what
|
| 12 |
+
``aios_grid.project_date_recurrences`` publishes, what ``routes_grid._recurrence_columns`` sweeps
|
| 13 |
+
and what every already-saved column holds; dropping it would silently retire live rules on tables
|
| 14 |
+
nobody was asked about. Inheritance keeps both true: a row with no rule of its own still repeats
|
| 15 |
+
the way its column says, and the first time somebody edits that row's repeat it stops listening.
|
| 16 |
+
|
| 17 |
+
β AND IT IS A SIBLING STRATUM, NEVER A COLUMN IN THE ROW. ``user_tables.add_row`` builds a row as
|
| 18 |
+
field-keys-only by construction, so a reserved key inside one is stripped on the way in β the
|
| 19 |
+
measured reason ``AI_ENRICH_MARK_KEY`` lives beside ``rows`` rather than in them. This follows
|
| 20 |
+
``core/record_comments.py``'s shape instead: ONE BUCKET PER DATABASE, keyed by bare pid, held in
|
| 21 |
+
AIOS's own writable tenant store. That is what makes it work over a read-only Odoo topic, where a
|
| 22 |
+
per-record rule has nowhere else it could possibly live.
|
| 23 |
+
|
| 24 |
+
β WHAT IT DELIBERATELY DOES NOT DO: it never computes a date. ``aios_grid.recurrence_row_next_date``
|
| 25 |
+
is the one evaluator and stays the one evaluator; this module stores a config and hands it back.
|
| 26 |
+
"""
|
| 27 |
+
from __future__ import annotations
|
| 28 |
+
|
| 29 |
+
STORE_KEY = "customer_record_recurrence"
|
| 30 |
+
|
| 31 |
+
#: A record may carry a repeat rule on at most this many of its Date columns. The bound exists
|
| 32 |
+
#: for the same reason ``MAX_PER_RECORD`` does in ``record_comments``: this document is copied
|
| 33 |
+
#: whole on every read, so a per-record bag with no ceiling is a store problem wearing a
|
| 34 |
+
#: feature's name. Twelve matches ``govern_date_recurrence``'s own rule and condition ceilings.
|
| 35 |
+
MAX_PER_RECORD = 12
|
| 36 |
+
|
| 37 |
+
#: Mirrors ``record_comments.LEGACY_SCOPES``. Restated rather than imported for the same reason
|
| 38 |
+
#: that file gives: ``core/`` does not import ``modules/``, and the customer topic keeps the bare
|
| 39 |
+
#: key so a bucket written under one name is never orphaned by a later rename.
|
| 40 |
+
LEGACY_SCOPES = frozenset({"", "customer", "cohort"})
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class RecurrenceUnavailable(RuntimeError):
|
| 44 |
+
"""The tenant store cannot currently provide durable per-record repeat rules."""
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def key_for(scope=None):
|
| 48 |
+
"""The bucket ONE database's per-record rules live in."""
|
| 49 |
+
s = str(scope or "customer").strip().lower()
|
| 50 |
+
return STORE_KEY if s in LEGACY_SCOPES else f"{s}_record_recurrence"
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def _record_key(pid):
|
| 54 |
+
return str(int(pid))
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def _read(runtime, scope=None):
|
| 58 |
+
if not runtime.available():
|
| 59 |
+
raise RecurrenceUnavailable("the tenant store is unavailable")
|
| 60 |
+
try:
|
| 61 |
+
data = runtime.get(key_for(scope))
|
| 62 |
+
except Exception as exc:
|
| 63 |
+
raise RecurrenceUnavailable("per-record repeat rules could not be read") from exc
|
| 64 |
+
return data if isinstance(data, dict) else {}
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def for_record(runtime, pid, scope=None):
|
| 68 |
+
"""``{field_key: recurrence}`` for ONE record. Absent = the record inherits its columns."""
|
| 69 |
+
bag = _read(runtime, scope).get(_record_key(pid))
|
| 70 |
+
if not isinstance(bag, dict):
|
| 71 |
+
return {}
|
| 72 |
+
return {str(key): dict(value) for key, value in bag.items() if isinstance(value, dict)}
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def rule_for(runtime, pid, field_key, scope=None):
|
| 76 |
+
"""ONE record's rule for ONE column, or ``None`` when it inherits the column's."""
|
| 77 |
+
got = for_record(runtime, pid, scope=scope).get(str(field_key))
|
| 78 |
+
return dict(got) if isinstance(got, dict) else None
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def put_rule(runtime, pid, field_key, recurrence, scope=None):
|
| 82 |
+
"""Store, replace or clear ONE record's rule for ONE column, atomically.
|
| 83 |
+
|
| 84 |
+
``recurrence=None`` REMOVES the record's own rule, which is not the same act as storing an
|
| 85 |
+
empty one: the row goes back to inheriting its column. An empty record bag is dropped rather
|
| 86 |
+
than left behind, so a bucket cannot accumulate a key per record anybody ever opened.
|
| 87 |
+
"""
|
| 88 |
+
key = str(field_key or "").strip()
|
| 89 |
+
if not key:
|
| 90 |
+
raise ValueError("a per-record repeat rule names a field")
|
| 91 |
+
if recurrence is not None and not isinstance(recurrence, dict):
|
| 92 |
+
raise ValueError("a per-record repeat rule must be an object")
|
| 93 |
+
# β AN EMPTY RULE IS REFUSED, NOT STORED, AND THIS GATE FOUND IT. A `{}` here would sit in the
|
| 94 |
+
# bag as the record's own rule: `rule_for` would answer it, `inherited` would read False, and
|
| 95 |
+
# the row would stop following its column while repeating by nothing. That is the "feature
|
| 96 |
+
# that looks like it worked" shape, and CLEARING already has an unambiguous spelling - `None`.
|
| 97 |
+
# `govern_date_recurrence` refuses it upstream too; a door is not a reason to leave the
|
| 98 |
+
# primitive willing.
|
| 99 |
+
if isinstance(recurrence, dict) and not recurrence.get("rules"):
|
| 100 |
+
raise ValueError("a repeat rule needs at least one repeat clause; pass null to clear it")
|
| 101 |
+
if not runtime.available():
|
| 102 |
+
raise RecurrenceUnavailable("the tenant store is unavailable")
|
| 103 |
+
record = _record_key(pid)
|
| 104 |
+
|
| 105 |
+
def _apply(data):
|
| 106 |
+
if not isinstance(data, dict):
|
| 107 |
+
data = {}
|
| 108 |
+
bag = data.get(record)
|
| 109 |
+
if not isinstance(bag, dict):
|
| 110 |
+
bag = {}
|
| 111 |
+
if recurrence is None:
|
| 112 |
+
bag.pop(key, None)
|
| 113 |
+
else:
|
| 114 |
+
if key not in bag and len(bag) >= MAX_PER_RECORD:
|
| 115 |
+
raise ValueError(
|
| 116 |
+
f"a record may carry a repeat rule on at most {MAX_PER_RECORD} columns")
|
| 117 |
+
bag[key] = dict(recurrence)
|
| 118 |
+
if bag:
|
| 119 |
+
data[record] = bag
|
| 120 |
+
else:
|
| 121 |
+
data.pop(record, None)
|
| 122 |
+
return data
|
| 123 |
+
|
| 124 |
+
try:
|
| 125 |
+
runtime.update(key_for(scope), _apply, flush="sync")
|
| 126 |
+
except ValueError:
|
| 127 |
+
raise
|
| 128 |
+
except Exception as exc:
|
| 129 |
+
raise RecurrenceUnavailable("the repeat rule was not saved") from exc
|
| 130 |
+
return None if recurrence is None else dict(recurrence)
|
web/src/customer-grid/CustomerGrid.tsx
CHANGED
|
@@ -10843,11 +10843,14 @@ function CustomerGridSurface({
|
|
| 10843 |
anchor={datePicker.anchor}
|
| 10844 |
field={dateField}
|
| 10845 |
fields={fields}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10846 |
scopeKey={scope}
|
| 10847 |
value={dateValue}
|
| 10848 |
today={today}
|
| 10849 |
onChange={(value) => patchAndRecord(datePicker.pid, { [dateField.key]: value }, "a date")}
|
| 10850 |
-
onRecurrence={(recurrence) => saveField({ ...dateField, recurrence: recurrence ?? null })}
|
| 10851 |
onClose={() => {
|
| 10852 |
setDatePicker(null);
|
| 10853 |
requestAnimationFrame(() => gridRef.current?.focus());
|
|
|
|
| 10843 |
anchor={datePicker.anchor}
|
| 10844 |
field={dateField}
|
| 10845 |
fields={fields}
|
| 10846 |
+
/* ββ OWNER 2026-08-31 - the repeat rule is the RECORD's now, so the picker needs to
|
| 10847 |
+
know WHICH record. `onRecurrence` is gone with the field-level write it fed; see the
|
| 10848 |
+
header on `DatePicker` for the ruling that retired it. */
|
| 10849 |
+
pid={datePicker.pid}
|
| 10850 |
scopeKey={scope}
|
| 10851 |
value={dateValue}
|
| 10852 |
today={today}
|
| 10853 |
onChange={(value) => patchAndRecord(datePicker.pid, { [dateField.key]: value }, "a date")}
|
|
|
|
| 10854 |
onClose={() => {
|
| 10855 |
setDatePicker(null);
|
| 10856 |
requestAnimationFrame(() => gridRef.current?.focus());
|
web/src/customer-grid/DatePicker.tsx
CHANGED
|
@@ -142,9 +142,30 @@ function recurrenceSentence(rules: DateRule[], ends: RecurrenceEnds, calendars:
|
|
| 142 |
return `Repeats ${body}.`;
|
| 143 |
}
|
| 144 |
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
}) {
|
| 149 |
const selected = parseIso(value) ?? parseIso(today) ?? new Date();
|
| 150 |
const selectedIso = iso(selected);
|
|
@@ -158,7 +179,14 @@ export function DatePicker({ anchor, field, fields, scopeKey, value, today, onCh
|
|
| 158 |
// `?? undefined` is load-bearing: `LinkedRecurrence` now widens `rules`, so the assertion is
|
| 159 |
// only legal in the direction DateRecurrence -> LinkedRecurrence, and a `null` on the source
|
| 160 |
// side has no counterpart in the target union.
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
const [anchorTable, setAnchorTable] = useState(() => storedRecurrence?.anchorField?.table ?? "same");
|
| 163 |
// W47-T24: the anchor DEFAULTS to this field's own column. `govern_date_recurrence` requires an
|
| 164 |
// `anchorField` on every recurrence it admits, and the picker used to emit none until somebody
|
|
@@ -195,6 +223,43 @@ export function DatePicker({ anchor, field, fields, scopeKey, value, today, onCh
|
|
| 195 |
...(ends.kind !== "never" ? { ends } : {}),
|
| 196 |
}) : null, [anchorField, anchorTable, conditions, ends, linkedVia, previewCount, rules, selectedIso]);
|
| 197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
// Server-evaluated preview: the exact payload saved below is sent here, so edited previews
|
| 199 |
// cannot differ from the default next date after refresh because of timezone/holiday drift.
|
| 200 |
useEffect(() => {
|
|
@@ -240,8 +305,46 @@ export function DatePicker({ anchor, field, fields, scopeKey, value, today, onCh
|
|
| 240 |
setChooserOpen(false);
|
| 241 |
setStep("date");
|
| 242 |
};
|
| 243 |
-
|
| 244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
const monthStart = new Date(Date.UTC(cursor.getUTCFullYear(), cursor.getUTCMonth(), 1));
|
| 246 |
const leading = (monthStart.getUTCDay() + 6) % 7;
|
| 247 |
const days = new Date(Date.UTC(cursor.getUTCFullYear(), cursor.getUTCMonth() + 1, 0)).getUTCDate();
|
|
@@ -396,9 +499,16 @@ export function DatePicker({ anchor, field, fields, scopeKey, value, today, onCh
|
|
| 396 |
reads beside the preview it sizes rather than behind the door that adds rules. */}
|
| 397 |
<div className="cg-date-preview" aria-live="polite"><div className="cg-pop-title">Next dates{nextDate ? ` Β· next ${nextDate}` : ""}<label className="w46-recur-preview-count">Show next <select className="cg-select" value={previewCount} aria-label="Number of preview dates" onChange={(event) => setPreviewCount(bounded(event.target.value, 1, 50, 10))}>{[3, 5, 10, 20, 50].map((count) => <option key={count} value={count}>{count}</option>)}</select> dates</label></div>{preview.map((date) => <span key={date}>{date}</span>)}{rules.length > 0 && !preview.length && !previewError && <span>Calculating the server previewβ¦</span>}{previewError && <span role="status">{previewError}</span>}</div>
|
| 398 |
<div className="w46-recur-foot">
|
| 399 |
-
{
|
| 400 |
-
|
| 401 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 402 |
</div>
|
| 403 |
</div>}
|
| 404 |
</AnchoredOverlay>;
|
|
|
|
| 142 |
return `Repeats ${body}.`;
|
| 143 |
}
|
| 144 |
|
| 145 |
+
/**
|
| 146 |
+
* ββ OWNER 2026-08-31 - THE REPEAT RULE BELONGS TO THE RECORD, AND WAVE 47's R1/R2 IS REVERSED.
|
| 147 |
+
*
|
| 148 |
+
* Owner: *"THE EDIT REPEAT IS STILL NOT PER FIELD."* Shown R1/R2 - *"a date rule anchors on a
|
| 149 |
+
* COLUMN, and that is why it is per-record"* - and asked which reading they meant, they chose
|
| 150 |
+
* *"Each ROW stores its own repeat rule. Reverse R1/R2."* So this picker no longer writes the
|
| 151 |
+
* FIELD at all: it reads and writes `/grid/record-recurrence` for the row it was opened on.
|
| 152 |
+
*
|
| 153 |
+
* β `field.recurrence` IS STILL READ, as the default a row INHERITS until it is given a rule of
|
| 154 |
+
* its own. Every column saved before today has one, and treating those as "no repeat" would
|
| 155 |
+
* silently retire live rules on tables nobody was asked about.
|
| 156 |
+
*
|
| 157 |
+
* ββ AND SAVING NOW WRITES THE CELL, which is the other half of what the owner reported: *"IT
|
| 158 |
+
* STILL DOESN'T POPULATE THE CELL AS THE NEXTDATE WHEN I CLICK IT. WHY IS IT ONLY POPULATING ONLY
|
| 159 |
+
* WHEN I CLICK THE DATE IN THE CALENDAR ITSELF NOT UNDER REPEAT BUTTON."* It was literal:
|
| 160 |
+
* `onChange` - the ONLY path to `patchAndRecord` - was called by a calendar day and by nothing
|
| 161 |
+
* else, and the server-side materialiser that did write cells (`routes_grid.py`) declares in its
|
| 162 |
+
* own scope note that it runs for `ut_*` user tables only. A per-record rule is one row, so that
|
| 163 |
+
* limit is not on this path; `saveEditor` writes the returned next date through the same
|
| 164 |
+
* `onChange` a typed date takes, undo stack and permission check included.
|
| 165 |
+
*/
|
| 166 |
+
export function DatePicker({ anchor, field, fields, pid, scopeKey, value, today, onChange, onClose }: {
|
| 167 |
+
anchor: AnchorRect; field: Field; fields: Field[]; pid: number; scopeKey: string; value: unknown; today?: string; onChange: (value: string) => void;
|
| 168 |
+
onClose: () => void;
|
| 169 |
}) {
|
| 170 |
const selected = parseIso(value) ?? parseIso(today) ?? new Date();
|
| 171 |
const selectedIso = iso(selected);
|
|
|
|
| 179 |
// `?? undefined` is load-bearing: `LinkedRecurrence` now widens `rules`, so the assertion is
|
| 180 |
// only legal in the direction DateRecurrence -> LinkedRecurrence, and a `null` on the source
|
| 181 |
// side has no counterpart in the target union.
|
| 182 |
+
/** The rule this row is currently answering with, and whether it is the row's own. Seeded
|
| 183 |
+
* from the FIELD so the picker paints something correct before the record read lands, then
|
| 184 |
+
* replaced by that read. */
|
| 185 |
+
const [storedRecurrence, setStoredRecurrence] = useState<LinkedRecurrence | undefined>(
|
| 186 |
+
() => (field.recurrence ?? undefined) as LinkedRecurrence | undefined
|
| 187 |
+
);
|
| 188 |
+
const [inherited, setInherited] = useState(true);
|
| 189 |
+
const [saving, setSaving] = useState(false);
|
| 190 |
const [anchorTable, setAnchorTable] = useState(() => storedRecurrence?.anchorField?.table ?? "same");
|
| 191 |
// W47-T24: the anchor DEFAULTS to this field's own column. `govern_date_recurrence` requires an
|
| 192 |
// `anchorField` on every recurrence it admits, and the picker used to emit none until somebody
|
|
|
|
| 223 |
...(ends.kind !== "never" ? { ends } : {}),
|
| 224 |
}) : null, [anchorField, anchorTable, conditions, ends, linkedVia, previewCount, rules, selectedIso]);
|
| 225 |
|
| 226 |
+
/**
|
| 227 |
+
* THE RECORD'S OWN RULE, read once per opened cell.
|
| 228 |
+
*
|
| 229 |
+
* β IT RESEEDS EVERY DRAFT, not just `rules`. The anchor, the conditions and the Ends clause
|
| 230 |
+
* are all parts of ONE stored config, and reseeding a subset would leave the editor showing
|
| 231 |
+
* this row's repeat rules under the COLUMN's end date - a mixture that belongs to neither and
|
| 232 |
+
* would be saved as if somebody had authored it.
|
| 233 |
+
*/
|
| 234 |
+
useEffect(() => {
|
| 235 |
+
const controller = new AbortController();
|
| 236 |
+
void fetch(`${API_V1}/grid/record-recurrence/read`, {
|
| 237 |
+
method: "POST", credentials: CREDENTIALS, signal: controller.signal,
|
| 238 |
+
headers: { "Content-Type": "application/json" },
|
| 239 |
+
body: JSON.stringify({ scopeKey, pid, field: field.key, anchorValue: parseIso(value) ? selectedIso : null }),
|
| 240 |
+
}).then(async (response) => {
|
| 241 |
+
if (!response.ok) return null;
|
| 242 |
+
return await response.json().catch(() => null) as
|
| 243 |
+
{ recurrence?: LinkedRecurrence | null; inherited?: boolean } | null;
|
| 244 |
+
}).then((data) => {
|
| 245 |
+
if (!data || controller.signal.aborted) return;
|
| 246 |
+
const got = (data.recurrence ?? undefined) as LinkedRecurrence | undefined;
|
| 247 |
+
setStoredRecurrence(got);
|
| 248 |
+
setInherited(data.inherited !== false);
|
| 249 |
+
setRules(got?.rules ?? []);
|
| 250 |
+
setPreviewCount(got?.previewCount ?? 10);
|
| 251 |
+
setAnchorTable(got?.anchorField?.table ?? "same");
|
| 252 |
+
setAnchorField(got?.anchorField?.field ?? field.key);
|
| 253 |
+
setLinkedVia(got?.anchorField?.linkedVia ?? "");
|
| 254 |
+
setConditions(got?.conditions ?? []);
|
| 255 |
+
setEnds(got?.ends ?? { kind: "never" });
|
| 256 |
+
}).catch(() => { /* The picker still edits a date when the sidecar cannot be read. */ });
|
| 257 |
+
return () => controller.abort();
|
| 258 |
+
// One read per opened cell. The drafts below are what changes afterwards, and re-running on
|
| 259 |
+
// them would overwrite the edit in progress with the stored rule on every keystroke.
|
| 260 |
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
| 261 |
+
}, [field.key, pid, scopeKey]);
|
| 262 |
+
|
| 263 |
// Server-evaluated preview: the exact payload saved below is sent here, so edited previews
|
| 264 |
// cannot differ from the default next date after refresh because of timezone/holiday drift.
|
| 265 |
useEffect(() => {
|
|
|
|
| 305 |
setChooserOpen(false);
|
| 306 |
setStep("date");
|
| 307 |
};
|
| 308 |
+
/**
|
| 309 |
+
* Persist the ROW's rule, then write the date it names into the ROW's cell.
|
| 310 |
+
*
|
| 311 |
+
* β THE CELL IS WRITTEN FROM THE SERVER'S ANSWER, never from `nextDate` in local state. The
|
| 312 |
+
* preview effect and this write would then be two computations of one number, and the one the
|
| 313 |
+
* cell keeps has to be the one the store agrees with - which is the same reason the preview
|
| 314 |
+
* itself is a server call rather than arithmetic in this file.
|
| 315 |
+
* β A refusal leaves the editor OPEN with its message. Closing on a failed save is how a
|
| 316 |
+
* person walks away believing a rule is stored that is not.
|
| 317 |
+
*/
|
| 318 |
+
const persistRecurrence = (next: LinkedRecurrence | null) => {
|
| 319 |
+
setSaving(true);
|
| 320 |
+
setPreviewError("");
|
| 321 |
+
void fetch(`${API_V1}/grid/record-recurrence`, {
|
| 322 |
+
method: "POST", credentials: CREDENTIALS,
|
| 323 |
+
headers: { "Content-Type": "application/json" },
|
| 324 |
+
body: JSON.stringify({ scopeKey, pid, field: field.key, recurrence: next,
|
| 325 |
+
anchorValue: parseIso(value) ? selectedIso : null }),
|
| 326 |
+
}).then(async (response) => {
|
| 327 |
+
const data = await response.json().catch(() => ({}));
|
| 328 |
+
if (!response.ok) throw new Error(String(data?.detail?.message ?? data?.error?.message
|
| 329 |
+
?? "Could not save this repeat"));
|
| 330 |
+
return data as { recurrence?: LinkedRecurrence | null; inherited?: boolean; nextDate?: string | null };
|
| 331 |
+
}).then((data) => {
|
| 332 |
+
setStoredRecurrence((data.recurrence ?? undefined) as LinkedRecurrence | undefined);
|
| 333 |
+
setInherited(data.inherited !== false);
|
| 334 |
+
if (data.nextDate) onChange(data.nextDate);
|
| 335 |
+
setRestorePoint(null);
|
| 336 |
+
setChooserOpen(false);
|
| 337 |
+
setStep("date");
|
| 338 |
+
}).catch((error: unknown) => {
|
| 339 |
+
setPreviewError(error instanceof Error ? error.message : "Could not save this repeat");
|
| 340 |
+
}).finally(() => setSaving(false));
|
| 341 |
+
};
|
| 342 |
+
const saveEditor = () => persistRecurrence(recurrence);
|
| 343 |
+
const removeRepeat = () => {
|
| 344 |
+
setRules([]); setEnds({ kind: "never" }); setConditions([]);
|
| 345 |
+
setShowAnchor(false); setShowConditions(false);
|
| 346 |
+
persistRecurrence(null);
|
| 347 |
+
};
|
| 348 |
const monthStart = new Date(Date.UTC(cursor.getUTCFullYear(), cursor.getUTCMonth(), 1));
|
| 349 |
const leading = (monthStart.getUTCDay() + 6) % 7;
|
| 350 |
const days = new Date(Date.UTC(cursor.getUTCFullYear(), cursor.getUTCMonth() + 1, 0)).getUTCDate();
|
|
|
|
| 499 |
reads beside the preview it sizes rather than behind the door that adds rules. */}
|
| 500 |
<div className="cg-date-preview" aria-live="polite"><div className="cg-pop-title">Next dates{nextDate ? ` Β· next ${nextDate}` : ""}<label className="w46-recur-preview-count">Show next <select className="cg-select" value={previewCount} aria-label="Number of preview dates" onChange={(event) => setPreviewCount(bounded(event.target.value, 1, 50, 10))}>{[3, 5, 10, 20, 50].map((count) => <option key={count} value={count}>{count}</option>)}</select> dates</label></div>{preview.map((date) => <span key={date}>{date}</span>)}{rules.length > 0 && !preview.length && !previewError && <span>Calculating the server previewβ¦</span>}{previewError && <span role="status">{previewError}</span>}</div>
|
| 501 |
<div className="w46-recur-foot">
|
| 502 |
+
{/* β THE SENTENCE THAT STOPS A SURPRISE. A row with no rule of its own is answering with
|
| 503 |
+
its COLUMN's, and pressing Save here gives the row a rule of its OWN - after which
|
| 504 |
+
the column can change and this row will not follow. Saying so beats letting somebody
|
| 505 |
+
discover it a month later. */}
|
| 506 |
+
{inherited && storedRecurrence?.rules?.length ? (
|
| 507 |
+
<span className="w46-recur-word">Repeating from this column's rule. Saving makes it this record's own.</span>
|
| 508 |
+
) : null}
|
| 509 |
+
{storedRecurrence?.rules?.length && !inherited ? <button type="button" className="w46-recur-quiet is-danger" disabled={saving} onClick={removeRepeat}>Remove repeat</button> : null}
|
| 510 |
+
<button type="button" className="w46-recur-quiet" disabled={saving} onClick={cancelEditor}>Cancel</button>
|
| 511 |
+
<button type="button" className="w46-recur-save" disabled={saving} onClick={saveEditor}>{saving ? "Saving" : "Save"}</button>
|
| 512 |
</div>
|
| 513 |
</div>}
|
| 514 |
</AnchoredOverlay>;
|
web/src/customer-grid/MapView.tsx
CHANGED
|
@@ -1226,9 +1226,49 @@ export function MapView({
|
|
| 1226 |
onManagedRouteViewState?.(body.viewState);
|
| 1227 |
setRouteSelectionWarning(route.outsideFilter && next.has(route.id) ? `${route.name} is included through its managed route group.` : null);
|
| 1228 |
const pids = namedRoutes.filter((item) => next.has(item.id)).flatMap((item) => item.visibleStopIds);
|
| 1229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1230 |
} catch { setRouteSelectionWarning("Route inclusion could not be changed."); }
|
| 1231 |
-
}, [activeView, managedRouteViewState, namedRoutes, onManagedRouteViewState, onSelectPids, selectedRouteIds]);
|
| 1232 |
const moveNamedRouteStop = useCallback(async (route: MapRouteDto, customerPid: number, order: number): Promise<string | null> => {
|
| 1233 |
try {
|
| 1234 |
const res = await fetch(`/api/v1/customers/routes/${encodeURIComponent(route.id)}/stops/move`, {
|
|
|
|
| 1226 |
onManagedRouteViewState?.(body.viewState);
|
| 1227 |
setRouteSelectionWarning(route.outsideFilter && next.has(route.id) ? `${route.name} is included through its managed route group.` : null);
|
| 1228 |
const pids = namedRoutes.filter((item) => next.has(item.id)).flatMap((item) => item.visibleStopIds);
|
| 1229 |
+
/**
|
| 1230 |
+
* ββ OWNER 2026-08-31 item 1 - UNTICKING A ROUTE UNDOES EVERYTHING TICKING IT DID.
|
| 1231 |
+
*
|
| 1232 |
+
* Owner: *"When I press clear after I selected the Route that has records not actually a
|
| 1233 |
+
* part of the filter. The record stays, only when I change the filter it actually move
|
| 1234 |
+
* back."* Confirmed with them: the control is the route's own checkbox, and the records
|
| 1235 |
+
* stay in the grid AND on the map.
|
| 1236 |
+
*
|
| 1237 |
+
* β THE ADD PATH WROTE THREE STORES AND THE REMOVE PATH CLEARED ONE. Ticking a Route
|
| 1238 |
+
* writes (a) the server's managed OR clause, (b) the host row selection, and (c) - once
|
| 1239 |
+
* the Route has also been opened - `addedPids`, which is what earns an out-of-filter stop
|
| 1240 |
+
* a pin through `mapRows`. Unticking sent `"add"` with the REMAINING routes' pids, and
|
| 1241 |
+
* `"add"` is monotone: it can never take a pid back out. So (b) and (c) survived, the
|
| 1242 |
+
* record kept its row and its pin, and the next filter edit rebuilt the pipeline from
|
| 1243 |
+
* scratch - which is exactly the "only when I change the filter" the owner described.
|
| 1244 |
+
*
|
| 1245 |
+
* β ONLY THE PIDS NO SURVIVING ROUTE STILL CLAIMS ARE DROPPED. Two ticked routes sharing
|
| 1246 |
+
* a stop must not lose it when one of them is unticked, and a record the person picked by
|
| 1247 |
+
* hand is not this callback's to remove either - hence the subtraction is computed
|
| 1248 |
+
* against `keep`, and the host selection is rebuilt from what it currently holds rather
|
| 1249 |
+
* than replaced by the route union.
|
| 1250 |
+
*/
|
| 1251 |
+
if (isAdding) {
|
| 1252 |
+
onSelectPids([...new Set(pids)], "add");
|
| 1253 |
+
} else {
|
| 1254 |
+
const keep = new Set(pids);
|
| 1255 |
+
const dropped = (route.visibleStopIds || []).filter((pid) => !keep.has(pid));
|
| 1256 |
+
if (dropped.length) {
|
| 1257 |
+
const gone = new Set(dropped);
|
| 1258 |
+
onSelectPids([...selectedPids].filter((pid) => !gone.has(pid)), "replace");
|
| 1259 |
+
setAddedPids((prev) => {
|
| 1260 |
+
if (![...gone].some((pid) => prev.has(pid))) return prev;
|
| 1261 |
+
const remaining = new Set(prev);
|
| 1262 |
+
for (const pid of gone) remaining.delete(pid);
|
| 1263 |
+
return remaining;
|
| 1264 |
+
});
|
| 1265 |
+
}
|
| 1266 |
+
// The opened Route detail is armed from `activeNamedRoute`; leaving the arming key set
|
| 1267 |
+
// would refuse to re-arm this Route on a later tick, because the signature would match.
|
| 1268 |
+
if (armedRouteRef.current.startsWith(`${route.id}:`)) armedRouteRef.current = "";
|
| 1269 |
+
}
|
| 1270 |
} catch { setRouteSelectionWarning("Route inclusion could not be changed."); }
|
| 1271 |
+
}, [activeView, managedRouteViewState, namedRoutes, onManagedRouteViewState, onSelectPids, selectedPids, selectedRouteIds]);
|
| 1272 |
const moveNamedRouteStop = useCallback(async (route: MapRouteDto, customerPid: number, order: number): Promise<string | null> => {
|
| 1273 |
try {
|
| 1274 |
const res = await fetch(`/api/v1/customers/routes/${encodeURIComponent(route.id)}/stops/move`, {
|
web/src/customer-grid/RouteNav.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import { useEffect, useMemo, useRef, useState } from "react";
|
|
|
|
| 2 |
import { createPortal } from "react-dom";
|
| 3 |
-
import {
|
| 4 |
import {
|
| 5 |
formatSeconds, haversineKm, isPlottable, parseRouteAnswer, previewSeconds,
|
| 6 |
routeCaveats, routeSaving, routeTimeLabel, routeTimeTone,
|
|
@@ -53,6 +54,42 @@ const ROUTE_PRINTING_CLASS = "cg-w46-route-printing";
|
|
| 53 |
const PRINT_RELEASE_MS = 120_000;
|
| 54 |
|
| 55 |
const ROUTE_DOOR = "/api/v1/geo/route";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
const SETTLE_DEBOUNCE_MS = 400;
|
| 57 |
/** Both halves of the figure must ask the same question, or the number jumps on drop by the size
|
| 58 |
* of a closing edge and the reorder gets blamed for it. These two travel together, into
|
|
@@ -156,11 +193,41 @@ export function RouteNav({ routes, folders, selectedIds, activeRouteId, sources,
|
|
| 156 |
* disabled with a sentence, never a silently empty dropdown. */
|
| 157 |
zones?: MapZoneDto[];
|
| 158 |
}) {
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
const [creating, setCreating] = useState(false);
|
| 165 |
const [creatingFolder, setCreatingFolder] = useState(false);
|
| 166 |
const [name, setName] = useState("");
|
|
@@ -173,6 +240,9 @@ export function RouteNav({ routes, folders, selectedIds, activeRouteId, sources,
|
|
| 173 |
const [editMapsUrl, setEditMapsUrl] = useState("");
|
| 174 |
/** D-599 - the Route's Zone, as a draft, saved by the same Save Route button as the Maps URL. */
|
| 175 |
const [editZoneId, setEditZoneId] = useState("");
|
|
|
|
|
|
|
|
|
|
| 176 |
const [assignmentAssignee, setAssignmentAssignee] = useState("");
|
| 177 |
const [assignmentDate, setAssignmentDate] = useState("");
|
| 178 |
const [assignmentNotice, setAssignmentNotice] = useState<string | null>(null);
|
|
@@ -181,7 +251,6 @@ export function RouteNav({ routes, folders, selectedIds, activeRouteId, sources,
|
|
| 181 |
const [deleteConfirm, setDeleteConfirm] = useState(false);
|
| 182 |
const [menuId, setMenuId] = useState<string | null>(null);
|
| 183 |
const [renameId, setRenameId] = useState<string | null>(null);
|
| 184 |
-
const [renameDraft, setRenameDraft] = useState("");
|
| 185 |
const [busy, setBusy] = useState(false);
|
| 186 |
const [deliveryMapsPerLink, setDeliveryMapsPerLink] = useState(10);
|
| 187 |
const [deliveryNotice, setDeliveryNotice] = useState<string | null>(null);
|
|
@@ -232,36 +301,72 @@ export function RouteNav({ routes, folders, selectedIds, activeRouteId, sources,
|
|
| 232 |
route?.assignee && !assigneeNames.has(route.assignee)
|
| 233 |
);
|
| 234 |
const knownFolders = useMemo(() => new Set(folders.map((folder) => folder.id)), [folders]);
|
| 235 |
-
const validAt = resolveStoredPath(at, knownFolders);
|
| 236 |
-
const level = useMemo(
|
| 237 |
-
() => levelAt(validAt, folders, routes, (item) => item.folderId),
|
| 238 |
-
[folders, routes, validAt]
|
| 239 |
-
);
|
| 240 |
-
const crumbs = useMemo(() => folderPath(validAt, folders), [folders, validAt]);
|
| 241 |
const deliveryTimezone = useMemo(() => {
|
| 242 |
try { return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC"; }
|
| 243 |
catch { return "UTC"; }
|
| 244 |
}, []);
|
| 245 |
|
| 246 |
-
|
| 247 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
setMenuId(null);
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
if (folderId)
|
| 252 |
-
|
| 253 |
-
|
|
|
|
|
|
|
| 254 |
};
|
| 255 |
-
|
| 256 |
-
useEffect(() => {
|
| 257 |
-
if (at && !validAt) navigate(null);
|
| 258 |
-
// `navigate` deliberately remains a local action; validity is the only reactive input.
|
| 259 |
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
| 260 |
-
}, [at, validAt]);
|
| 261 |
useEffect(() => {
|
| 262 |
setTitleDraft(null);
|
| 263 |
setEditMapsUrl(route?.mapsUrl || "");
|
| 264 |
setEditZoneId(route?.zoneId || "");
|
|
|
|
| 265 |
setOrderDrafts({});
|
| 266 |
setOrderErrors({});
|
| 267 |
setDeleteConfirm(false);
|
|
@@ -424,14 +529,6 @@ export function RouteNav({ routes, folders, selectedIds, activeRouteId, sources,
|
|
| 424 |
}
|
| 425 |
})();
|
| 426 |
};
|
| 427 |
-
const swap = (ids: string[], id: string, delta: number) => {
|
| 428 |
-
const index = ids.indexOf(id);
|
| 429 |
-
const other = index + delta;
|
| 430 |
-
if (index < 0 || other < 0 || other >= ids.length) return null;
|
| 431 |
-
const next = [...ids];
|
| 432 |
-
[next[index], next[other]] = [next[other], next[index]];
|
| 433 |
-
return next;
|
| 434 |
-
};
|
| 435 |
|
| 436 |
/* ββ W46-T19: the drive time, the saving, and the number that moves during a drag βββββββββ
|
| 437 |
The whole feature is state and arithmetic here, and exactly one request, so that the two
|
|
@@ -1047,6 +1144,35 @@ export function RouteNav({ routes, folders, selectedIds, activeRouteId, sources,
|
|
| 1047 |
<input className="cg-input" type="url" value={editMapsUrl} maxLength={2048}
|
| 1048 |
placeholder="https://www.google.com/maps/..." onChange={(event) => setEditMapsUrl(event.target.value)} />
|
| 1049 |
</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1050 |
{/* ββ D-599 / W46-T22 - THE ROUTE'S ZONE. Until wave 46's hotfix no route record
|
| 1051 |
carried a zone at all, so this control had nothing to write and did not exist:
|
| 1052 |
Routes and Zones were two separate tables and `__zone__` was a field on a CUSTOMER
|
|
@@ -1075,7 +1201,7 @@ export function RouteNav({ routes, folders, selectedIds, activeRouteId, sources,
|
|
| 1075 |
<div className="cg-form-actions">
|
| 1076 |
<button type="button" className="cg-btn cg-btn--primary" disabled={busy}
|
| 1077 |
onClick={() => finish(onUpdate(route, { mapsUrl: editMapsUrl.trim(),
|
| 1078 |
-
zoneId: editZoneId || null }))}>
|
| 1079 |
Save Route
|
| 1080 |
</button>
|
| 1081 |
<button type="button" className="cg-btn" disabled={busy} onClick={() => finish(onShare(route))}>Share</button>
|
|
@@ -1152,22 +1278,50 @@ export function RouteNav({ routes, folders, selectedIds, activeRouteId, sources,
|
|
| 1152 |
</section>
|
| 1153 |
)}
|
| 1154 |
{canEdit && (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1155 |
<section className="cg-w44-route-delivery" aria-labelledby="cg-route-delivery-title">
|
| 1156 |
-
<div>
|
| 1157 |
-
<h3 id="cg-route-delivery-title">Daily delivery</h3>
|
| 1158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1159 |
</div>
|
| 1160 |
-
<label className="cg-w44-route-label">Stops per Maps link
|
| 1161 |
-
<input className="cg-input" type="number" min={2} max={10} value={deliveryMapsPerLink}
|
| 1162 |
-
onChange={(event) => setDeliveryMapsPerLink(
|
| 1163 |
-
Math.max(2, Math.min(10, Number(event.target.value) || 2))
|
| 1164 |
-
)} />
|
| 1165 |
-
</label>
|
| 1166 |
-
<button type="button" className="cg-btn cg-btn--primary"
|
| 1167 |
-
disabled={deliveryBusy || stopIds.length < 2 || !route.assignee || savedAssigneeUnavailable}
|
| 1168 |
-
onClick={() => scheduleDelivery(route)}>
|
| 1169 |
-
{deliveryBusy ? "Scheduling" : "Schedule delivery"}
|
| 1170 |
-
</button>
|
| 1171 |
{stopIds.length < 2 && (
|
| 1172 |
<span className="cg-w44-route-empty">Add at least two stops before scheduling.</span>
|
| 1173 |
)}
|
|
@@ -1241,60 +1395,94 @@ export function RouteNav({ routes, folders, selectedIds, activeRouteId, sources,
|
|
| 1241 |
);
|
| 1242 |
}
|
| 1243 |
|
| 1244 |
-
|
| 1245 |
-
|
| 1246 |
-
|
| 1247 |
-
|
| 1248 |
-
|
| 1249 |
-
|
| 1250 |
-
|
| 1251 |
-
|
| 1252 |
-
|
| 1253 |
-
|
| 1254 |
-
|
| 1255 |
-
|
| 1256 |
-
|
| 1257 |
-
|
| 1258 |
-
|
| 1259 |
-
|
| 1260 |
-
|
| 1261 |
-
|
| 1262 |
-
|
| 1263 |
-
|
| 1264 |
-
|
| 1265 |
-
|
| 1266 |
-
|
| 1267 |
-
|
| 1268 |
-
|
| 1269 |
-
|
| 1270 |
-
|
| 1271 |
-
|
| 1272 |
-
|
| 1273 |
-
|
| 1274 |
-
|
| 1275 |
-
|
| 1276 |
-
|
| 1277 |
-
|
| 1278 |
-
|
| 1279 |
-
|
| 1280 |
-
|
| 1281 |
-
|
| 1282 |
-
|
| 1283 |
-
|
| 1284 |
-
|
| 1285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1286 |
aria-expanded={menuId === `folder:${folder.id}`}
|
| 1287 |
onClick={() => setMenuId(menuId === `folder:${folder.id}` ? null : `folder:${folder.id}`)}>...</button>
|
| 1288 |
-
{menuId === `folder:${folder.id}` && <div className="cg-
|
| 1289 |
<button type="button" role="menuitem"
|
| 1290 |
-
onClick={() => { setRenameId(`folder:${folder.id}`);
|
| 1291 |
-
<button type="button" role="menuitem" disabled={index === 0 || busy}
|
| 1292 |
-
onClick={() => { const next = swap(folderIds, folder.id, -1); if (next) finish(onFolderReorder(next)); }}>Move up</button>
|
| 1293 |
-
<button type="button" role="menuitem" disabled={index === folderIds.length - 1 || busy}
|
| 1294 |
-
onClick={() => { const next = swap(folderIds, folder.id, 1); if (next) finish(onFolderReorder(next)); }}>Move down</button>
|
| 1295 |
{folder.parent && <button type="button" role="menuitem"
|
| 1296 |
-
onClick={() => { setMenuId(null); finish(onFolderUpdate(folder, { parent:
|
| 1297 |
-
{folders.filter((target) => target.id !== folder.id).map((target) =>
|
| 1298 |
<button type="button" role="menuitem" key={target.id}
|
| 1299 |
onClick={() => { setMenuId(null); finish(onFolderUpdate(folder, { parent: target.id })); }}>
|
| 1300 |
Move into {target.name}
|
|
@@ -1303,53 +1491,138 @@ export function RouteNav({ routes, folders, selectedIds, activeRouteId, sources,
|
|
| 1303 |
onClick={() => { setMenuId(null); if (window.confirm(`Delete ${folder.name}? Its contents move to Routes.`)) finish(onFolderDelete(folder)); }}>Delete</button>
|
| 1304 |
</div>}
|
| 1305 |
</div>
|
| 1306 |
-
|
| 1307 |
-
|
| 1308 |
-
|
| 1309 |
-
|
| 1310 |
-
|
| 1311 |
-
|
| 1312 |
-
|
| 1313 |
-
|
| 1314 |
-
|
| 1315 |
-
|
| 1316 |
-
|
| 1317 |
-
|
| 1318 |
-
|
| 1319 |
-
|
| 1320 |
-
|
| 1321 |
-
|
| 1322 |
-
|
| 1323 |
-
|
| 1324 |
-
|
| 1325 |
-
|
| 1326 |
-
|
| 1327 |
-
|
| 1328 |
-
|
| 1329 |
-
|
| 1330 |
-
|
| 1331 |
-
|
| 1332 |
-
|
| 1333 |
-
|
| 1334 |
-
|
| 1335 |
-
|
| 1336 |
-
|
| 1337 |
-
|
| 1338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1339 |
onClick={() => { setMenuId(null); finish(onRouteMove(item, folder.id)); }}>Move to {folder.name}</button>)}
|
| 1340 |
-
|
| 1341 |
-
|
| 1342 |
-
|
| 1343 |
-
|
| 1344 |
-
|
| 1345 |
-
|
| 1346 |
-
|
| 1347 |
-
|
| 1348 |
-
|
| 1349 |
-
|
| 1350 |
-
|
| 1351 |
-
|
| 1352 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1353 |
</p>}
|
| 1354 |
</div>
|
| 1355 |
{createdRoute && <div className="cg-w44-route-created" role="dialog" aria-label="Route privacy choice">
|
|
|
|
| 1 |
import { useEffect, useMemo, useRef, useState } from "react";
|
| 2 |
+
import type { ReactElement } from "react";
|
| 3 |
import { createPortal } from "react-dom";
|
| 4 |
+
import { FolderMark } from "./icons";
|
| 5 |
import {
|
| 6 |
formatSeconds, haversineKm, isPlottable, parseRouteAnswer, previewSeconds,
|
| 7 |
routeCaveats, routeSaving, routeTimeLabel, routeTimeTone,
|
|
|
|
| 54 |
const PRINT_RELEASE_MS = 120_000;
|
| 55 |
|
| 56 |
const ROUTE_DOOR = "/api/v1/geo/route";
|
| 57 |
+
/**
|
| 58 |
+
* OWNER 2026-08-31 item 2 - the six defaults a new Route is stamped with, offered back as an
|
| 59 |
+
* edit. β THIS LIST IS A MIRROR OF `route_system.py::_ROUTE_COLORS` AND MUST STAY ONE. The
|
| 60 |
+
* server is the authority: `_color` falls back to `_ROUTE_COLORS[ordinal % len]` for anything
|
| 61 |
+
* `_COLOR_RE` refuses, so a swatch offered here that the server does not recognise would save
|
| 62 |
+
* as a different colour than the one the person pressed. The free picker beside them is why the
|
| 63 |
+
* list does not need to grow: it is a shortcut, not the vocabulary.
|
| 64 |
+
*/
|
| 65 |
+
const ROUTE_SWATCHES = ["#6E4AC7", "#1F4E78", "#C85A54", "#2F8F83", "#B57716", "#A14B8B"];
|
| 66 |
+
|
| 67 |
+
/** The rail's own top level, as a map key. A bare string keeps `foldersByParent` and
|
| 68 |
+
* `routesByFolder` one type instead of `Map<string | null, ...>`, and no folder id can collide
|
| 69 |
+
* with it: `route_system.py` mints folder ids, and none of them is empty. */
|
| 70 |
+
const ROOT_LEVEL = "";
|
| 71 |
+
/* β TWO DRAG TYPES, ONE PER ROW KIND, and that is the same discrimination `ViewSidebar` makes
|
| 72 |
+
with `FOLD_DRAG_TYPE` against a view's own channel. Sharing one channel would let a folder
|
| 73 |
+
dropped on a Route reorder the Routes, and the handler that fired first would decide which. */
|
| 74 |
+
const ROUTE_DRAG = "application/x-aios-route";
|
| 75 |
+
const ROUTE_FOLDER_DRAG = "application/x-aios-route-folder";
|
| 76 |
+
|
| 77 |
+
/** Owner item 3 - the ONE mark every Route row wears. Deliberately the SAME waypoint path
|
| 78 |
+
* `viewModes.tsx::IconRouteZone` draws, at the same 1.5 stroke: the toolbar button that opens
|
| 79 |
+
* this rail and the rows inside it are one family, and a second route glyph would read as two. */
|
| 80 |
+
function IconRoute() {
|
| 81 |
+
return (
|
| 82 |
+
<svg width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true"
|
| 83 |
+
className="cg-view-route-mark">
|
| 84 |
+
<path d="M4 2.4a2 2 0 0 1 2 2c0 1.5-2 3.7-2 3.7S2 5.9 2 4.4a2 2 0 0 1 2-2Z" stroke="currentColor"
|
| 85 |
+
strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
| 86 |
+
<path d="M12 2.4a2 2 0 0 1 2 2c0 1.5-2 3.7-2 3.7s-2-2.2-2-3.7a2 2 0 0 1 2-2Z" stroke="currentColor"
|
| 87 |
+
strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
| 88 |
+
<path d="M4.2 9.4c2.1 2.7 5.5 2.7 7.6 0" stroke="currentColor" strokeWidth="1.5"
|
| 89 |
+
strokeLinecap="round" strokeLinejoin="round" />
|
| 90 |
+
</svg>
|
| 91 |
+
);
|
| 92 |
+
}
|
| 93 |
const SETTLE_DEBOUNCE_MS = 400;
|
| 94 |
/** Both halves of the figure must ask the same question, or the number jumps on drop by the size
|
| 95 |
* of a closing edge and the reorder gets blamed for it. These two travel together, into
|
|
|
|
| 193 |
* disabled with a sentence, never a silently empty dropdown. */
|
| 194 |
zones?: MapZoneDto[];
|
| 195 |
}) {
|
| 196 |
+
/* ββ OWNER 2026-08-31 item 3 - THE ROUTES RAIL IS THE VIEWS RAIL, NOT A COUSIN OF IT.
|
| 197 |
+
Owner: *"I need the routes LIST navigation and the routes itself to have the exact same
|
| 198 |
+
interface just like how we have it with view, where you can just click it and drag it AND
|
| 199 |
+
its fucking compact. Make it the exact same layout. The only difference is the icon."* and,
|
| 200 |
+
in the grill: *"exactly like how Views rail is, with the +create for folder and find at the
|
| 201 |
+
top. Exactly the same. instead of number it should all just be the same Route icon."*
|
| 202 |
+
|
| 203 |
+
β SO THE BREADCRUMB PATH IS GONE, AND THAT IS THE STRUCTURAL HALF OF THE ASK. A folder used
|
| 204 |
+
to be a place you NAVIGATED INTO (`levelAt` + `folderPath` + an `Up` button), which is a
|
| 205 |
+
different interaction from the Views rail's disclosure groups however similar the rows look.
|
| 206 |
+
Folders now open and shut in place, and the stored key holds the SHUT set rather than the
|
| 207 |
+
current level - so a person who never touches a folder sees every Route, which is the
|
| 208 |
+
behaviour a rail whose whole job is "pick one" should have.
|
| 209 |
+
|
| 210 |
+
β THE ROW CLASSES ARE THE VIEWS RAIL'S OWN (`.cg-view-row`, `.cg-view-main`, `.cg-view-text`,
|
| 211 |
+
`.cg-view-name`, `.cg-view-more`, `.cg-fold*`, `.cg-create-new`, `.cg-find-view`), reused
|
| 212 |
+
rather than copied. Copying them into a `cg-w44-route-*` twin is how the two lists drift
|
| 213 |
+
apart again the first time either is polished, and "exact same layout" is a promise that
|
| 214 |
+
only a shared contract can keep. */
|
| 215 |
+
const routePathKey = `aios-routes-shut-${storageKey}`;
|
| 216 |
+
const [shutFolders, setShutFolders] = useState<ReadonlySet<string>>(() => {
|
| 217 |
+
if (typeof window === "undefined") return new Set<string>();
|
| 218 |
+
try {
|
| 219 |
+
const raw = window.localStorage.getItem(routePathKey);
|
| 220 |
+
const parsed = raw ? JSON.parse(raw) : null;
|
| 221 |
+
return new Set<string>(Array.isArray(parsed) ? parsed.filter((id) => typeof id === "string") : []);
|
| 222 |
+
} catch { return new Set<string>(); }
|
| 223 |
});
|
| 224 |
+
/** Owner item 3 - "find at the top". Local, never persisted: a search is a way of LOOKING at
|
| 225 |
+
* the rail, not a property of it, which is the rule `ViewSidebar`'s own box already follows. */
|
| 226 |
+
const [routeQuery, setRouteQuery] = useState("");
|
| 227 |
+
const [createMenu, setCreateMenu] = useState(false);
|
| 228 |
+
/** The row being carried, and the row it would land ABOVE. Same two marks the Views rail uses. */
|
| 229 |
+
const [rowDrag, setRowDrag] = useState<string | null>(null);
|
| 230 |
+
const [rowOver, setRowOver] = useState<string | null>(null);
|
| 231 |
const [creating, setCreating] = useState(false);
|
| 232 |
const [creatingFolder, setCreatingFolder] = useState(false);
|
| 233 |
const [name, setName] = useState("");
|
|
|
|
| 240 |
const [editMapsUrl, setEditMapsUrl] = useState("");
|
| 241 |
/** D-599 - the Route's Zone, as a draft, saved by the same Save Route button as the Maps URL. */
|
| 242 |
const [editZoneId, setEditZoneId] = useState("");
|
| 243 |
+
/** OWNER 2026-08-31 item 2 - the Route's colour, as a draft, on the same Save Route button.
|
| 244 |
+
* Seeded from the record so the swatch a person sees selected is the colour the map draws. */
|
| 245 |
+
const [editColor, setEditColor] = useState(ROUTE_SWATCHES[0]);
|
| 246 |
const [assignmentAssignee, setAssignmentAssignee] = useState("");
|
| 247 |
const [assignmentDate, setAssignmentDate] = useState("");
|
| 248 |
const [assignmentNotice, setAssignmentNotice] = useState<string | null>(null);
|
|
|
|
| 251 |
const [deleteConfirm, setDeleteConfirm] = useState(false);
|
| 252 |
const [menuId, setMenuId] = useState<string | null>(null);
|
| 253 |
const [renameId, setRenameId] = useState<string | null>(null);
|
|
|
|
| 254 |
const [busy, setBusy] = useState(false);
|
| 255 |
const [deliveryMapsPerLink, setDeliveryMapsPerLink] = useState(10);
|
| 256 |
const [deliveryNotice, setDeliveryNotice] = useState<string | null>(null);
|
|
|
|
| 301 |
route?.assignee && !assigneeNames.has(route.assignee)
|
| 302 |
);
|
| 303 |
const knownFolders = useMemo(() => new Set(folders.map((folder) => folder.id)), [folders]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
const deliveryTimezone = useMemo(() => {
|
| 305 |
try { return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC"; }
|
| 306 |
catch { return "UTC"; }
|
| 307 |
}, []);
|
| 308 |
|
| 309 |
+
/** Child folders of one parent, in their stored order. `ROOT_LEVEL` is the rail's own top. */
|
| 310 |
+
const foldersByParent = useMemo(() => {
|
| 311 |
+
const map = new Map<string, MapRouteFolderDto[]>();
|
| 312 |
+
for (const folder of folders) {
|
| 313 |
+
const parent = folder.parent && knownFolders.has(folder.parent) ? folder.parent : ROOT_LEVEL;
|
| 314 |
+
const bucket = map.get(parent);
|
| 315 |
+
if (bucket) bucket.push(folder); else map.set(parent, [folder]);
|
| 316 |
+
}
|
| 317 |
+
for (const bucket of map.values()) bucket.sort((a, b) => (a.order || 0) - (b.order || 0));
|
| 318 |
+
return map;
|
| 319 |
+
}, [folders, knownFolders]);
|
| 320 |
+
|
| 321 |
+
/** Routes filed in one folder, in their stored rail order. A Route whose folder this reader
|
| 322 |
+
* cannot see falls to the top level rather than disappearing. */
|
| 323 |
+
const routesByFolder = useMemo(() => {
|
| 324 |
+
const map = new Map<string, MapRouteDto[]>();
|
| 325 |
+
for (const item of routes) {
|
| 326 |
+
const parent = item.folderId && knownFolders.has(item.folderId) ? item.folderId : ROOT_LEVEL;
|
| 327 |
+
const bucket = map.get(parent);
|
| 328 |
+
if (bucket) bucket.push(item); else map.set(parent, [item]);
|
| 329 |
+
}
|
| 330 |
+
for (const bucket of map.values()) bucket.sort((a, b) => (a.navOrder || 0) - (b.navOrder || 0));
|
| 331 |
+
return map;
|
| 332 |
+
}, [routes, knownFolders]);
|
| 333 |
+
|
| 334 |
+
/** β A FOLDER SURVIVES THE FIND BOX WHEN A DESCENDANT MATCHES, never only when its own name
|
| 335 |
+
* does. Hiding a folder whose contents match is how a search convinces somebody a Route has
|
| 336 |
+
* been deleted. `ViewSidebar` holds the same rule for its groups. */
|
| 337 |
+
const query = routeQuery.trim().toLowerCase();
|
| 338 |
+
const folderMatches = useMemo(() => {
|
| 339 |
+
const hit = new Set<string>();
|
| 340 |
+
if (!query) return hit;
|
| 341 |
+
const walk = (parent: string): boolean => {
|
| 342 |
+
let found = (routesByFolder.get(parent) || []).some(
|
| 343 |
+
(item) => item.name.toLowerCase().includes(query)
|
| 344 |
+
);
|
| 345 |
+
for (const child of foldersByParent.get(parent) || []) {
|
| 346 |
+
const inside = walk(child.id);
|
| 347 |
+
if (inside || child.name.toLowerCase().includes(query)) { hit.add(child.id); found = true; }
|
| 348 |
+
}
|
| 349 |
+
return found;
|
| 350 |
+
};
|
| 351 |
+
walk(ROOT_LEVEL);
|
| 352 |
+
return hit;
|
| 353 |
+
}, [foldersByParent, query, routesByFolder]);
|
| 354 |
+
|
| 355 |
+
const toggleFolder = (folderId: string) => {
|
| 356 |
setMenuId(null);
|
| 357 |
+
setShutFolders((current) => {
|
| 358 |
+
const next = new Set(current);
|
| 359 |
+
if (next.has(folderId)) next.delete(folderId); else next.add(folderId);
|
| 360 |
+
try { window.localStorage.setItem(routePathKey, JSON.stringify([...next])); }
|
| 361 |
+
catch { /* The rail still opens and shuts when storage is unavailable. */ }
|
| 362 |
+
return next;
|
| 363 |
+
});
|
| 364 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 365 |
useEffect(() => {
|
| 366 |
setTitleDraft(null);
|
| 367 |
setEditMapsUrl(route?.mapsUrl || "");
|
| 368 |
setEditZoneId(route?.zoneId || "");
|
| 369 |
+
setEditColor((route?.color || ROUTE_SWATCHES[0]).toUpperCase());
|
| 370 |
setOrderDrafts({});
|
| 371 |
setOrderErrors({});
|
| 372 |
setDeleteConfirm(false);
|
|
|
|
| 529 |
}
|
| 530 |
})();
|
| 531 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 532 |
|
| 533 |
/* ββ W46-T19: the drive time, the saving, and the number that moves during a drag βββββββββ
|
| 534 |
The whole feature is state and arithmetic here, and exactly one request, so that the two
|
|
|
|
| 1144 |
<input className="cg-input" type="url" value={editMapsUrl} maxLength={2048}
|
| 1145 |
placeholder="https://www.google.com/maps/..." onChange={(event) => setEditMapsUrl(event.target.value)} />
|
| 1146 |
</label>
|
| 1147 |
+
{/* OWNER 2026-08-31 item 4, second half: the Maps link cap belongs to the Google Maps
|
| 1148 |
+
block, not to Daily delivery. It is a property of the LINK, and it was sitting
|
| 1149 |
+
under a scheduling heading where nobody looking for it would think to read. The
|
| 1150 |
+
value still travels in the delivery request; only its place on screen moved. */}
|
| 1151 |
+
<label className="cg-w44-route-label">Stops per Maps link
|
| 1152 |
+
<input className="cg-input" type="number" min={2} max={10} value={deliveryMapsPerLink}
|
| 1153 |
+
onChange={(event) => setDeliveryMapsPerLink(
|
| 1154 |
+
Math.max(2, Math.min(10, Number(event.target.value) || 2))
|
| 1155 |
+
)} />
|
| 1156 |
+
</label>
|
| 1157 |
+
{/* OWNER 2026-08-31 item 2 - EVERY ROUTE GETS ITS OWN COLOUR, EDITABLE HERE.
|
| 1158 |
+
The colour was already the record's own and already painted the line and the
|
| 1159 |
+
sidebar swatch (`MapView.tsx::overlaidRoutes`); what did not exist was any way to
|
| 1160 |
+
CHANGE it. `route_system.py::put_route` already reads `raw.get("color", ...)`
|
| 1161 |
+
through `_color`, so the server door needed nothing: an unrecognised value falls
|
| 1162 |
+
back to the ordinal default rather than painting the SVG initial black. */}
|
| 1163 |
+
<div className="cg-w44-route-label">Route colour
|
| 1164 |
+
<div className="cg-w44-route-colors">
|
| 1165 |
+
{ROUTE_SWATCHES.map((swatch) => (
|
| 1166 |
+
<button key={swatch} type="button" disabled={busy}
|
| 1167 |
+
className={"cg-w44-route-swatch" + (editColor.toUpperCase() === swatch ? " is-on" : "")}
|
| 1168 |
+
style={{ backgroundColor: swatch }} aria-pressed={editColor.toUpperCase() === swatch}
|
| 1169 |
+
aria-label={`Use ${swatch} for this Route`} onClick={() => setEditColor(swatch)} />
|
| 1170 |
+
))}
|
| 1171 |
+
<input className="cg-w44-route-colorpick" type="color" value={editColor} disabled={busy}
|
| 1172 |
+
aria-label="Pick any colour for this Route"
|
| 1173 |
+
onChange={(event) => setEditColor(event.target.value.toUpperCase())} />
|
| 1174 |
+
</div>
|
| 1175 |
+
</div>
|
| 1176 |
{/* ββ D-599 / W46-T22 - THE ROUTE'S ZONE. Until wave 46's hotfix no route record
|
| 1177 |
carried a zone at all, so this control had nothing to write and did not exist:
|
| 1178 |
Routes and Zones were two separate tables and `__zone__` was a field on a CUSTOMER
|
|
|
|
| 1201 |
<div className="cg-form-actions">
|
| 1202 |
<button type="button" className="cg-btn cg-btn--primary" disabled={busy}
|
| 1203 |
onClick={() => finish(onUpdate(route, { mapsUrl: editMapsUrl.trim(),
|
| 1204 |
+
zoneId: editZoneId || null, color: editColor }))}>
|
| 1205 |
Save Route
|
| 1206 |
</button>
|
| 1207 |
<button type="button" className="cg-btn" disabled={busy} onClick={() => finish(onShare(route))}>Share</button>
|
|
|
|
| 1278 |
</section>
|
| 1279 |
)}
|
| 1280 |
{canEdit && (
|
| 1281 |
+
/* β OWNER 2026-08-31 item 4 - THIS IS THE "REPEAT EVERY" CONTROL, SAID ABOUT A ROUTE.
|
| 1282 |
+
Owner: *"this whole function needs to be almost the exact same formatting as our
|
| 1283 |
+
'Repeat every' layout under date field. its practically the same thing."* It IS the
|
| 1284 |
+
same thing: a rule that fires on a cadence. So it borrows the date editor's own
|
| 1285 |
+
`w46-recur-*` contract (`field-panels.css`) rather than growing a second look for
|
| 1286 |
+
one idea, and the sentence reads left to right the way that one does.
|
| 1287 |
+
β THE CADENCE IS NOT A CHOICE YET, AND THE CONTROL SAYS SO RATHER THAN OFFERING
|
| 1288 |
+
ONE. `route_delivery` mints a fixed daily 08:00 cron; rendering an interval box
|
| 1289 |
+
this server would ignore is the shape of a control that lies. */
|
| 1290 |
<section className="cg-w44-route-delivery" aria-labelledby="cg-route-delivery-title">
|
| 1291 |
+
<div className="w46-recur-head">
|
| 1292 |
+
<h3 className="cg-pop-title" id="cg-route-delivery-title">Daily delivery</h3>
|
| 1293 |
+
</div>
|
| 1294 |
+
<div className="w46-recur-card">
|
| 1295 |
+
<div className="w46-recur-row">
|
| 1296 |
+
<span className="w46-recur-label">Repeat every</span>
|
| 1297 |
+
<div className="w46-recur-controls">
|
| 1298 |
+
<span className="w46-recur-word">day, at 08:00 ({deliveryTimezone})</span>
|
| 1299 |
+
</div>
|
| 1300 |
+
</div>
|
| 1301 |
+
<div className="w46-recur-row">
|
| 1302 |
+
<span className="w46-recur-label">Send to</span>
|
| 1303 |
+
<div className="w46-recur-controls">
|
| 1304 |
+
<span className="w46-recur-word">
|
| 1305 |
+
{route.assignee ? `${route.assignee}'s Inbox` : "the assignee's Inbox"}
|
| 1306 |
+
</span>
|
| 1307 |
+
</div>
|
| 1308 |
+
</div>
|
| 1309 |
+
<div className="w46-recur-row">
|
| 1310 |
+
<span className="w46-recur-label">Stop order</span>
|
| 1311 |
+
<div className="w46-recur-controls">
|
| 1312 |
+
<span className="w46-recur-word">
|
| 1313 |
+
Frozen as it stands now, {stopIds.length.toLocaleString()} stops.
|
| 1314 |
+
</span>
|
| 1315 |
+
</div>
|
| 1316 |
+
</div>
|
| 1317 |
+
<div className="cg-form-actions">
|
| 1318 |
+
<button type="button" className="cg-btn cg-btn--primary"
|
| 1319 |
+
disabled={deliveryBusy || stopIds.length < 2 || !route.assignee || savedAssigneeUnavailable}
|
| 1320 |
+
onClick={() => scheduleDelivery(route)}>
|
| 1321 |
+
{deliveryBusy ? "Scheduling" : "Schedule delivery"}
|
| 1322 |
+
</button>
|
| 1323 |
+
</div>
|
| 1324 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1325 |
{stopIds.length < 2 && (
|
| 1326 |
<span className="cg-w44-route-empty">Add at least two stops before scheduling.</span>
|
| 1327 |
)}
|
|
|
|
| 1395 |
);
|
| 1396 |
}
|
| 1397 |
|
| 1398 |
+
/* ββ The rail itself βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 1399 |
+
One recursive level: folders first as `.cg-fold` disclosure groups, then the Routes filed
|
| 1400 |
+
at that level as `.cg-view-row`s. Both kinds of row drag, and both drop ABOVE the row they
|
| 1401 |
+
are released on, which is the gesture `ViewSidebar` teaches.
|
| 1402 |
+
|
| 1403 |
+
β MOVE UP / MOVE DOWN ARE GONE FROM THE "..." MENU, on the owner's ruling that drag
|
| 1404 |
+
REPLACES them. Two ways to reorder in one rail is what made the menu long enough to need
|
| 1405 |
+
scrolling, and the length of that menu is half of why the row could not be compact. */
|
| 1406 |
+
const dropReorder = (siblings: string[], moved: string, over: string, kind: "route" | "folder") => {
|
| 1407 |
+
const from = siblings.indexOf(moved);
|
| 1408 |
+
const to = siblings.indexOf(over);
|
| 1409 |
+
if (from < 0 || to < 0 || from === to) return;
|
| 1410 |
+
const next = [...siblings];
|
| 1411 |
+
next.splice(to, 0, next.splice(from, 1)[0]);
|
| 1412 |
+
finish(kind === "route" ? onRouteReorder(next) : onFolderReorder(next));
|
| 1413 |
+
};
|
| 1414 |
+
|
| 1415 |
+
const renderLevel = (parent: string, depth: number): ReactElement[] => {
|
| 1416 |
+
const out: ReactElement[] = [];
|
| 1417 |
+
const childFolders = (foldersByParent.get(parent) || [])
|
| 1418 |
+
.filter((folder) => !query || folderMatches.has(folder.id));
|
| 1419 |
+
const childRoutes = (routesByFolder.get(parent) || [])
|
| 1420 |
+
.filter((item) => !query || item.name.toLowerCase().includes(query));
|
| 1421 |
+
const folderIds = childFolders.map((folder) => folder.id);
|
| 1422 |
+
const routeIds = childRoutes.map((item) => item.id);
|
| 1423 |
+
|
| 1424 |
+
for (const folder of childFolders) {
|
| 1425 |
+
// A live find shows every surviving folder open, whatever the stored set holds, and the
|
| 1426 |
+
// chevron is drawn from THAT state so a click means what it looks like (W41-T34's rule).
|
| 1427 |
+
const shut = !query && shutFolders.has(folder.id);
|
| 1428 |
+
const empty = !(foldersByParent.get(folder.id) || []).length
|
| 1429 |
+
&& !(routesByFolder.get(folder.id) || []).length;
|
| 1430 |
+
out.push(
|
| 1431 |
+
<div className={"cg-fold" + (rowOver === `folder:${folder.id}` && rowDrag ? " is-drop" : "")}
|
| 1432 |
+
key={`folder:${folder.id}`} style={depth ? { marginLeft: 12 } : undefined}>
|
| 1433 |
+
<div className="cg-fold-head"
|
| 1434 |
+
draggable={renameId !== `folder:${folder.id}`}
|
| 1435 |
+
onDragStart={(event) => {
|
| 1436 |
+
event.dataTransfer.setData(ROUTE_FOLDER_DRAG, folder.id);
|
| 1437 |
+
event.dataTransfer.effectAllowed = "move";
|
| 1438 |
+
setRowDrag(`folder:${folder.id}`);
|
| 1439 |
+
}}
|
| 1440 |
+
onDragEnd={() => { setRowDrag(null); setRowOver(null); }}
|
| 1441 |
+
onDragOver={(event) => {
|
| 1442 |
+
if (!event.dataTransfer.types.includes(ROUTE_FOLDER_DRAG)) return;
|
| 1443 |
+
event.preventDefault();
|
| 1444 |
+
setRowOver(`folder:${folder.id}`);
|
| 1445 |
+
}}
|
| 1446 |
+
onDragLeave={() => setRowOver((current) => current === `folder:${folder.id}` ? null : current)}
|
| 1447 |
+
onDrop={(event) => {
|
| 1448 |
+
const moved = event.dataTransfer.getData(ROUTE_FOLDER_DRAG);
|
| 1449 |
+
setRowDrag(null); setRowOver(null);
|
| 1450 |
+
if (!moved || moved === folder.id) return;
|
| 1451 |
+
event.preventDefault();
|
| 1452 |
+
dropReorder(folderIds, moved, folder.id, "folder");
|
| 1453 |
+
}}>
|
| 1454 |
+
<button type="button" className="cg-fold-toggle" aria-expanded={!shut}
|
| 1455 |
+
aria-label={`${shut ? "Open" : "Close"} folder ${folder.name}`}
|
| 1456 |
+
onClick={() => toggleFolder(folder.id)}>
|
| 1457 |
+
<FolderMark size={16} />
|
| 1458 |
+
{renameId === `folder:${folder.id}` ? (
|
| 1459 |
+
<input className="cg-input cg-fold-rename" autoFocus defaultValue={folder.name}
|
| 1460 |
+
aria-label={`Rename ${folder.name}`} onClick={(event) => event.stopPropagation()}
|
| 1461 |
+
onBlur={(event) => {
|
| 1462 |
+
const value = event.target.value.trim();
|
| 1463 |
+
if (value && value !== folder.name) finish(onFolderUpdate(folder, { name: value }));
|
| 1464 |
+
setRenameId(null);
|
| 1465 |
+
}}
|
| 1466 |
+
onKeyDown={(event) => {
|
| 1467 |
+
if (event.key === "Enter") event.currentTarget.blur();
|
| 1468 |
+
if (event.key === "Escape") setRenameId(null);
|
| 1469 |
+
}} />
|
| 1470 |
+
) : <span className="cg-fold-name">{folder.name}</span>}
|
| 1471 |
+
<svg className={"cg-fold-chev" + (shut ? " is-shut" : "")} width="12" height="12"
|
| 1472 |
+
viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
| 1473 |
+
<path d="m4 6 4 4 4-4" stroke="currentColor" strokeWidth="1.5"
|
| 1474 |
+
strokeLinecap="round" strokeLinejoin="round" />
|
| 1475 |
+
</svg>
|
| 1476 |
+
</button>
|
| 1477 |
+
<button type="button" className="cg-view-more" aria-label={`Actions for ${folder.name}`}
|
| 1478 |
aria-expanded={menuId === `folder:${folder.id}`}
|
| 1479 |
onClick={() => setMenuId(menuId === `folder:${folder.id}` ? null : `folder:${folder.id}`)}>...</button>
|
| 1480 |
+
{menuId === `folder:${folder.id}` && <div className="cg-view-menu" role="menu">
|
| 1481 |
<button type="button" role="menuitem"
|
| 1482 |
+
onClick={() => { setRenameId(`folder:${folder.id}`); setMenuId(null); }}>Rename</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1483 |
{folder.parent && <button type="button" role="menuitem"
|
| 1484 |
+
onClick={() => { setMenuId(null); finish(onFolderUpdate(folder, { parent: null })); }}>Move to Routes</button>}
|
| 1485 |
+
{folders.filter((target) => target.id !== folder.id && target.id !== folder.parent).map((target) =>
|
| 1486 |
<button type="button" role="menuitem" key={target.id}
|
| 1487 |
onClick={() => { setMenuId(null); finish(onFolderUpdate(folder, { parent: target.id })); }}>
|
| 1488 |
Move into {target.name}
|
|
|
|
| 1491 |
onClick={() => { setMenuId(null); if (window.confirm(`Delete ${folder.name}? Its contents move to Routes.`)) finish(onFolderDelete(folder)); }}>Delete</button>
|
| 1492 |
</div>}
|
| 1493 |
</div>
|
| 1494 |
+
{!shut && renderLevel(folder.id, depth + 1)}
|
| 1495 |
+
{!shut && empty && <p className="cg-fold-empty">This folder is empty.</p>}
|
| 1496 |
+
</div>
|
| 1497 |
+
);
|
| 1498 |
+
}
|
| 1499 |
+
|
| 1500 |
+
for (const item of childRoutes) {
|
| 1501 |
+
out.push(
|
| 1502 |
+
<div key={item.id} style={depth ? { marginLeft: 12 } : undefined}
|
| 1503 |
+
className={"cg-view-row"
|
| 1504 |
+
+ (activeRouteId === item.id ? " is-active" : "")
|
| 1505 |
+
+ (item.outsideFilter ? " is-outside" : "")
|
| 1506 |
+
+ (rowDrag === `route:${item.id}` ? " is-viewdrag" : "")
|
| 1507 |
+
+ (rowOver === `route:${item.id}` && rowDrag && rowDrag !== `route:${item.id}`
|
| 1508 |
+
? " is-drop-above" : "")}
|
| 1509 |
+
draggable={renameId !== item.id}
|
| 1510 |
+
onDragStart={(event) => {
|
| 1511 |
+
event.dataTransfer.setData(ROUTE_DRAG, item.id);
|
| 1512 |
+
event.dataTransfer.effectAllowed = "move";
|
| 1513 |
+
setRowDrag(`route:${item.id}`);
|
| 1514 |
+
}}
|
| 1515 |
+
onDragEnd={() => { setRowDrag(null); setRowOver(null); }}
|
| 1516 |
+
onDragOver={(event) => {
|
| 1517 |
+
if (!event.dataTransfer.types.includes(ROUTE_DRAG)) return;
|
| 1518 |
+
event.preventDefault();
|
| 1519 |
+
setRowOver(`route:${item.id}`);
|
| 1520 |
+
}}
|
| 1521 |
+
onDragLeave={() => setRowOver((current) => current === `route:${item.id}` ? null : current)}
|
| 1522 |
+
onDrop={(event) => {
|
| 1523 |
+
const moved = event.dataTransfer.getData(ROUTE_DRAG);
|
| 1524 |
+
setRowDrag(null); setRowOver(null);
|
| 1525 |
+
if (!moved || moved === item.id) return;
|
| 1526 |
+
event.preventDefault();
|
| 1527 |
+
dropReorder(routeIds, moved, item.id, "route");
|
| 1528 |
+
}}>
|
| 1529 |
+
{/* β W47-T07 / instruction 9: a REAL checkbox, not a pressed button, and the swatch on
|
| 1530 |
+
it is the SAME `item.color` the drawn line uses (`MapView.tsx::overlaidRoutes`). */}
|
| 1531 |
+
<label className="cg-w44-route-toggle" title={`Show ${item.name} on the map`}>
|
| 1532 |
+
<input type="checkbox" checked={selectedIds.has(item.id)}
|
| 1533 |
+
aria-label={`Show ${item.name} on the map`}
|
| 1534 |
+
onChange={() => onToggle(item)} />
|
| 1535 |
+
<i style={{ backgroundColor: item.color }} aria-hidden="true" />
|
| 1536 |
+
</label>
|
| 1537 |
+
<button type="button" className="cg-view-main" onClick={() => {
|
| 1538 |
+
setError(null); setCreating(false); onActiveRouteChange(item.id);
|
| 1539 |
+
}}>
|
| 1540 |
+
{/* Owner item 3: the ONE difference from a view row. Every Route wears the same
|
| 1541 |
+
waypoint mark; the ordinal that used to prefix the name is gone from the rail. */}
|
| 1542 |
+
<IconRoute />
|
| 1543 |
+
<span className="cg-view-text">
|
| 1544 |
+
<span className="cg-view-name">{item.name}</span>
|
| 1545 |
+
{(item.shared || item.sharedOut || item.outsideFilter) && (
|
| 1546 |
+
<span className="cg-view-desc">
|
| 1547 |
+
{item.shared ? `Shared by ${item.owner || "another user"}`
|
| 1548 |
+
: item.sharedOut ? "Shared" : "Outside filter"}
|
| 1549 |
+
</span>
|
| 1550 |
+
)}
|
| 1551 |
+
</span>
|
| 1552 |
+
</button>
|
| 1553 |
+
<button type="button" className="cg-view-more" aria-label={`Actions for ${item.name}`}
|
| 1554 |
+
aria-expanded={menuId === item.id} onClick={() => setMenuId(menuId === item.id ? null : item.id)}>...</button>
|
| 1555 |
+
{menuId === item.id && <div className="cg-view-menu" role="menu">
|
| 1556 |
+
<button type="button" role="menuitem" disabled={!mayRouteAction(item, "duplicate")}
|
| 1557 |
+
onClick={() => { setMenuId(null); finish(onDuplicate(item)); }}>Duplicate</button>
|
| 1558 |
+
<button type="button" role="menuitem" disabled={!mayRouteAction(item, "star")}
|
| 1559 |
+
onClick={() => { setMenuId(null); finish(onUpdate(item, { starred: !item.starred })); }}>
|
| 1560 |
+
{item.starred ? "Unstar" : "Star"}
|
| 1561 |
+
</button>
|
| 1562 |
+
<button type="button" role="menuitem" disabled={!mayRouteAction(item, "share")}
|
| 1563 |
+
onClick={() => { setMenuId(null); finish(onShare(item)); }}>Share</button>
|
| 1564 |
+
{folders.filter((folder) => folder.id !== item.folderId).map((folder) =>
|
| 1565 |
+
<button type="button" role="menuitem" key={folder.id}
|
| 1566 |
onClick={() => { setMenuId(null); finish(onRouteMove(item, folder.id)); }}>Move to {folder.name}</button>)}
|
| 1567 |
+
{item.folderId && <button type="button" role="menuitem"
|
| 1568 |
+
onClick={() => { setMenuId(null); finish(onRouteMove(item, null)); }}>Move to Routes</button>}
|
| 1569 |
+
<button type="button" role="menuitem" disabled={!mayRouteAction(item, "delete")}
|
| 1570 |
+
onClick={() => { setMenuId(null); if (window.confirm(`Delete ${item.name}?`)) finish(onDelete(item)); }}>Delete</button>
|
| 1571 |
+
</div>}
|
| 1572 |
+
</div>
|
| 1573 |
+
);
|
| 1574 |
+
}
|
| 1575 |
+
return out;
|
| 1576 |
+
};
|
| 1577 |
+
|
| 1578 |
+
const rows = renderLevel(ROOT_LEVEL, 0);
|
| 1579 |
+
return (
|
| 1580 |
+
<section className="cg-w44-route-nav" aria-label="Named routes">
|
| 1581 |
+
{/* Owner item 3 - the SAME create door the Views rail mounts (`.cg-create-new` /
|
| 1582 |
+
`.cg-create-btn` are a shared contract, see `ViewSidebar.tsx`'s note on them), with the
|
| 1583 |
+
two things a Routes rail can make behind it. */}
|
| 1584 |
+
<div className="cg-create-new">
|
| 1585 |
+
<button type="button" className="cg-link-btn cg-create-btn" aria-haspopup="menu"
|
| 1586 |
+
aria-expanded={createMenu} onClick={() => { setMenuId(null); setCreateMenu(!createMenu); }}>
|
| 1587 |
+
<span className="cg-create-icon" aria-hidden="true">+</span>
|
| 1588 |
+
<span className="cg-create-label">Create newβ¦</span>
|
| 1589 |
+
</button>
|
| 1590 |
+
{createMenu && <div className="cg-view-menu" role="menu">
|
| 1591 |
+
<button type="button" role="menuitem" onClick={() => {
|
| 1592 |
+
setCreateMenu(false); setError(null); onCreateStart(); setCreating(true);
|
| 1593 |
+
}}>Route</button>
|
| 1594 |
+
<button type="button" role="menuitem" onClick={() => {
|
| 1595 |
+
setCreateMenu(false); setCreatingFolder(true);
|
| 1596 |
+
}}>Folder</button>
|
| 1597 |
+
</div>}
|
| 1598 |
+
</div>
|
| 1599 |
+
<div className="cg-find-view">
|
| 1600 |
+
<svg className="cg-find-view-icon" width="14" height="14" viewBox="0 0 16 16" fill="none"
|
| 1601 |
+
aria-hidden="true">
|
| 1602 |
+
<circle cx="7" cy="7" r="4.4" stroke="currentColor" strokeWidth="1.35" />
|
| 1603 |
+
<path d="m10.4 10.4 3.1 3.1" stroke="currentColor" strokeWidth="1.35" strokeLinecap="round" />
|
| 1604 |
+
</svg>
|
| 1605 |
+
<input type="text" value={routeQuery} placeholder="Findβ¦" aria-label="Find a route"
|
| 1606 |
+
onChange={(event) => setRouteQuery(event.target.value)}
|
| 1607 |
+
onKeyDown={(event) => { if (event.key === "Escape") setRouteQuery(""); }} />
|
| 1608 |
+
</div>
|
| 1609 |
+
{creatingFolder && <div className="cg-view-create cg-create-form cg-fold-form">
|
| 1610 |
+
<input className="cg-input" value={folderName} maxLength={80} autoFocus
|
| 1611 |
+
aria-label="New Route folder name" onChange={(event) => setFolderName(event.target.value)} />
|
| 1612 |
+
<div className="cg-form-actions">
|
| 1613 |
+
<button type="button" className="cg-btn cg-btn--primary" disabled={busy || !folderName.trim()}
|
| 1614 |
+
onClick={() => { setBusy(true); void onFolderCreate(folderName.trim(), null).then((message) => {
|
| 1615 |
+
setError(message); if (!message) { setFolderName(""); setCreatingFolder(false); }
|
| 1616 |
+
}).finally(() => setBusy(false)); }}>Create</button>
|
| 1617 |
+
<button type="button" className="cg-btn" disabled={busy}
|
| 1618 |
+
onClick={() => { setFolderName(""); setCreatingFolder(false); }}>Cancel</button>
|
| 1619 |
+
</div>
|
| 1620 |
+
</div>}
|
| 1621 |
+
<div className="cg-view-list" aria-label="Route folder contents">
|
| 1622 |
+
{rows}
|
| 1623 |
+
{!rows.length && <p className="cg-w44-route-empty">
|
| 1624 |
+
{query ? "No Route matches that search."
|
| 1625 |
+
: "No routes yet. Create one from selected Zones or records."}
|
| 1626 |
</p>}
|
| 1627 |
</div>
|
| 1628 |
{createdRoute && <div className="cg-w44-route-created" role="dialog" aria-label="Route privacy choice">
|
web/src/customer-grid/routeZoneTypes.ts
CHANGED
|
@@ -87,6 +87,12 @@ export interface MapRouteFolderDto {
|
|
| 87 |
export type MapRouteUpdate = {
|
| 88 |
name?: string;
|
| 89 |
mapsUrl?: string;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
starred?: boolean;
|
| 91 |
assignee?: string | null;
|
| 92 |
date?: string | null;
|
|
|
|
| 87 |
export type MapRouteUpdate = {
|
| 88 |
name?: string;
|
| 89 |
mapsUrl?: string;
|
| 90 |
+
/** OWNER 2026-08-31 item 2 - the Route's own colour, the one `MapView::overlaidRoutes` strokes
|
| 91 |
+
* the line with and the one the rail's checkbox swatch shows. `route_system.py::_color`
|
| 92 |
+
* already validated and persisted it on every write; nothing could SEND it until now.
|
| 93 |
+
* β An unrecognised value is not an error: the server falls back to the ordinal default
|
| 94 |
+
* rather than letting an empty string paint the SVG initial black (W47-T02's defect). */
|
| 95 |
+
color?: string;
|
| 96 |
starred?: boolean;
|
| 97 |
assignee?: string | null;
|
| 98 |
date?: string | null;
|
web/src/customer-grid/viewModes.tsx
CHANGED
|
@@ -557,10 +557,10 @@ export function MapSettings({
|
|
| 557 |
aria-expanded={routeOpen}
|
| 558 |
aria-controls="cg-route-popover"
|
| 559 |
onClick={onToggleRoute}
|
| 560 |
-
title="Show or hide Routes
|
| 561 |
>
|
| 562 |
<IconRouteZone />
|
| 563 |
-
<span>Routes
|
| 564 |
</button>
|
| 565 |
{coordChoices.length > 0 && (
|
| 566 |
<span className="cg-mode-field-mark" aria-hidden><IconLocation /></span>
|
|
|
|
| 557 |
aria-expanded={routeOpen}
|
| 558 |
aria-controls="cg-route-popover"
|
| 559 |
onClick={onToggleRoute}
|
| 560 |
+
title="Show or hide Routes"
|
| 561 |
>
|
| 562 |
<IconRouteZone />
|
| 563 |
+
<span>Routes{selectedCount >= 2 ? ` / ${selectedCount} selected` : ""}</span>
|
| 564 |
</button>
|
| 565 |
{coordChoices.length > 0 && (
|
| 566 |
<span className="cg-mode-field-mark" aria-hidden><IconLocation /></span>
|
web/src/styles/wave42/route-nav.css
CHANGED
|
@@ -445,3 +445,81 @@
|
|
| 445 |
font-size: inherit;
|
| 446 |
white-space: normal;
|
| 447 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 445 |
font-size: inherit;
|
| 446 |
white-space: normal;
|
| 447 |
}
|
| 448 |
+
|
| 449 |
+
/* βββββββ OWNER 2026-08-31 β THE ROUTES RAIL IS THE VIEWS RAIL ββββββββββββββββββββββββββββββββ
|
| 450 |
+
Owner: *"I need the routes LIST navigation and the routes itself to have the exact same
|
| 451 |
+
interface just like how we have it with view ... Make it the exact same layout. The only
|
| 452 |
+
difference is the icon."*
|
| 453 |
+
|
| 454 |
+
β SO THERE IS ALMOST NO CSS HERE, AND THAT IS THE POINT. `RouteNav` now renders the Views
|
| 455 |
+
rail's own classes (`.cg-view-row`, `.cg-view-main`, `.cg-fold*`, `.cg-create-new`,
|
| 456 |
+
`.cg-find-view`), which index.css already sizes, spaces and hovers. Anything restated below
|
| 457 |
+
would be a second copy free to drift, so the only rules here are the ones that describe what
|
| 458 |
+
this rail has and the Views rail does not: a colour checkbox on the row, and the Route mark.
|
| 459 |
+
|
| 460 |
+
β `#cg-route-popover` PREFIXES EVERY SELECTOR because this sheet is @imported at the top of
|
| 461 |
+
index.css and therefore loses every equal-specificity tie with it β the rule stated at the
|
| 462 |
+
head of this file. An id beats a class, so these land. */
|
| 463 |
+
|
| 464 |
+
#cg-route-popover .cg-view-row > .cg-w44-route-toggle {
|
| 465 |
+
flex: 0 0 auto;
|
| 466 |
+
padding-left: 6px;
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
#cg-route-popover .cg-view-row .cg-w44-route-toggle i {
|
| 470 |
+
display: inline-block;
|
| 471 |
+
width: 9px;
|
| 472 |
+
height: 9px;
|
| 473 |
+
border-radius: 2px;
|
| 474 |
+
}
|
| 475 |
+
|
| 476 |
+
/* The Route mark takes the gutter a view's mode dot occupies, so the two rails' NAMES start at
|
| 477 |
+
the same x. That alignment is what makes "the exact same layout" true rather than approximate. */
|
| 478 |
+
#cg-route-popover .cg-view-main > .cg-view-route-mark {
|
| 479 |
+
flex: 0 0 16px;
|
| 480 |
+
color: var(--lp-primary);
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
/* A Route whose stops sit outside the current filter. The row still reads normally; the mark is
|
| 484 |
+
the `.cg-view-desc` line the row already carries, so nothing here paints. */
|
| 485 |
+
#cg-route-popover .cg-view-row.is-outside .cg-view-desc { color: var(--lp-yellow-deep); }
|
| 486 |
+
|
| 487 |
+
/* ββ OWNER 2026-08-31 item 2: the per-Route colour editor ββββββββββββββββββββββββββββββββββββ */
|
| 488 |
+
#cg-route-popover .cg-w44-route-colors {
|
| 489 |
+
display: flex;
|
| 490 |
+
align-items: center;
|
| 491 |
+
gap: 6px;
|
| 492 |
+
flex-wrap: wrap;
|
| 493 |
+
padding-top: 4px;
|
| 494 |
+
}
|
| 495 |
+
|
| 496 |
+
#cg-route-popover .cg-w44-route-swatch {
|
| 497 |
+
width: 22px;
|
| 498 |
+
height: 22px;
|
| 499 |
+
padding: 0;
|
| 500 |
+
border: 2px solid transparent;
|
| 501 |
+
border-radius: var(--lp-r-sm);
|
| 502 |
+
cursor: pointer;
|
| 503 |
+
}
|
| 504 |
+
|
| 505 |
+
/* The selected swatch is marked by a RING outside its own fill, never by a tick drawn on top:
|
| 506 |
+
half these colours are dark and half are not, so an inked mark would vanish on three of six. */
|
| 507 |
+
#cg-route-popover .cg-w44-route-swatch.is-on {
|
| 508 |
+
border-color: var(--lp-ink);
|
| 509 |
+
box-shadow: 0 0 0 2px var(--lp-surface);
|
| 510 |
+
}
|
| 511 |
+
|
| 512 |
+
#cg-route-popover .cg-w44-route-swatch:focus-visible {
|
| 513 |
+
outline: 2px solid var(--lp-blue-deep);
|
| 514 |
+
outline-offset: 2px;
|
| 515 |
+
}
|
| 516 |
+
|
| 517 |
+
#cg-route-popover .cg-w44-route-colorpick {
|
| 518 |
+
width: 28px;
|
| 519 |
+
height: 22px;
|
| 520 |
+
padding: 0;
|
| 521 |
+
border: 1px solid var(--lp-line);
|
| 522 |
+
border-radius: var(--lp-r-sm);
|
| 523 |
+
background: transparent;
|
| 524 |
+
cursor: pointer;
|
| 525 |
+
}
|
web/src/styles/wave46/map-panels.css
CHANGED
|
@@ -102,13 +102,29 @@
|
|
| 102 |
|
| 103 |
/* `tabular-nums` plus the floor width keeps every name starting on the same x once the route
|
| 104 |
passes nine stops, so the column of names reads as a column. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
.cg-w46-stop-index {
|
| 106 |
flex: 0 0 auto;
|
| 107 |
-
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
font-size: var(--lp-fs-3xs);
|
|
|
|
| 110 |
font-variant-numeric: tabular-nums;
|
| 111 |
-
|
|
|
|
| 112 |
}
|
| 113 |
|
| 114 |
.cg-w46-stop-name {
|
|
|
|
| 102 |
|
| 103 |
/* `tabular-nums` plus the floor width keeps every name starting on the same x once the route
|
| 104 |
passes nine stops, so the column of names reads as a column. */
|
| 105 |
+
/* β OWNER 2026-08-31 item 3 - THE STOP ORDINAL IS A FILLED PURPLE DISC WITH WHITE INK.
|
| 106 |
+
Owner: *"the details for each stops under each route should only have the number 1, 2, 3 etc.
|
| 107 |
+
put it inside a purple circle and the font be colored white."* Confirmed in the grill that this
|
| 108 |
+
is the OPENED Route panel's stop list; the rail itself carries no numbering at all.
|
| 109 |
+
|
| 110 |
+
β IT IS A FIXED SQUARE, NOT A PADDED ONE. A disc sized by its own text is an oval at "10" and
|
| 111 |
+
a circle at "1", and a route of a dozen stops shows both on one screen. 18px holds two digits
|
| 112 |
+
at this size; three digits ellipsise rather than reflowing the row, which is the same trade the
|
| 113 |
+
name beside it already makes. */
|
| 114 |
.cg-w46-stop-index {
|
| 115 |
flex: 0 0 auto;
|
| 116 |
+
display: inline-grid;
|
| 117 |
+
place-items: center;
|
| 118 |
+
width: 18px;
|
| 119 |
+
height: 18px;
|
| 120 |
+
border-radius: 50%;
|
| 121 |
+
background: var(--lp-primary);
|
| 122 |
+
color: var(--cg-white);
|
| 123 |
font-size: var(--lp-fs-3xs);
|
| 124 |
+
font-weight: 600;
|
| 125 |
font-variant-numeric: tabular-nums;
|
| 126 |
+
line-height: 1;
|
| 127 |
+
overflow: hidden;
|
| 128 |
}
|
| 129 |
|
| 130 |
.cg-w46-stop-name {
|
web/wiring_rows/wave42_f.py
CHANGED
|
@@ -20,8 +20,12 @@ ROWS: list[tuple[str, str, str, str, str]] = [
|
|
| 20 |
("W42 C6 post-create privacy prompt receives the new Route",
|
| 21 |
"customer-grid/RouteNav.tsx", r"createdRoute: MapRouteDto \| null;",
|
| 22 |
"customer-grid/MapView.tsx", r"createdRoute=\{createdRoute\}"),
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
"customer-grid/MapView.tsx", r"folders=\{routeFolders\}"),
|
| 26 |
("W42 C6 personal Route filing reaches the normalized folder door",
|
| 27 |
"customer-grid/RouteNav.tsx", r"onRouteMove: \(route: MapRouteDto, folderId: string \| null\)",
|
|
|
|
| 20 |
("W42 C6 post-create privacy prompt receives the new Route",
|
| 21 |
"customer-grid/RouteNav.tsx", r"createdRoute: MapRouteDto \| null;",
|
| 22 |
"customer-grid/MapView.tsx", r"createdRoute=\{createdRoute\}"),
|
| 23 |
+
# RE-AIMED 2026-08-31: the owner's *"exact same layout as views"* rail replaced `levelAt`'s
|
| 24 |
+
# one-level path with the Views rail's disclosure tree, so the old declaring literal names
|
| 25 |
+
# nothing. The WIRING this row exists to prove is unchanged and is what stays pinned: the
|
| 26 |
+
# host's folder list reaches the rail and the rail files Routes against it.
|
| 27 |
+
("W42 C6 Route folders ride the listing into a folder tree",
|
| 28 |
+
"customer-grid/RouteNav.tsx", r"const foldersByParent = useMemo\(",
|
| 29 |
"customer-grid/MapView.tsx", r"folders=\{routeFolders\}"),
|
| 30 |
("W42 C6 personal Route filing reaches the normalized folder door",
|
| 31 |
"customer-grid/RouteNav.tsx", r"onRouteMove: \(route: MapRouteDto, folderId: string \| null\)",
|
web/wiring_rows/wave43_shell_repair.py
CHANGED
|
@@ -15,11 +15,14 @@ ROWS: list[tuple[str, str, str, str, str]] = [
|
|
| 15 |
"customer-grid/DatePicker.tsx", r"onChange: \(value: string\) => void;",
|
| 16 |
"customer-grid/CustomerGrid.tsx",
|
| 17 |
r'onChange=\{\(value\) => patchAndRecord\(datePicker\.pid, \{ \[dateField\.key\]: value \}, "a date"\)\}'),
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
| 23 |
]
|
| 24 |
|
| 25 |
DELETIONS: list[tuple[str, str, str, str]] = []
|
|
|
|
| 15 |
"customer-grid/DatePicker.tsx", r"onChange: \(value: string\) => void;",
|
| 16 |
"customer-grid/CustomerGrid.tsx",
|
| 17 |
r'onChange=\{\(value\) => patchAndRecord\(datePicker\.pid, \{ \[dateField\.key\]: value \}, "a date"\)\}'),
|
| 18 |
+
# RE-AIMED 2026-08-31. The owner reversed wave 47's R1/R2 - *"Each ROW stores its own repeat
|
| 19 |
+
# rule"* - so the picker no longer persists the FIELD definition and `onRecurrence` is gone
|
| 20 |
+
# with the write it fed. The cross-fence fact this row exists to prove survives the reversal
|
| 21 |
+
# intact and is simply restated for the new contract: the picker cannot edit a repeat without
|
| 22 |
+
# being told WHICH RECORD, and the host is what tells it.
|
| 23 |
+
("W43C-T02 the repeat editor is per RECORD, so the host must name the record",
|
| 24 |
+
"customer-grid/DatePicker.tsx", r'pid: number;',
|
| 25 |
+
"customer-grid/CustomerGrid.tsx", r'pid=\{datePicker\.pid\}'),
|
| 26 |
]
|
| 27 |
|
| 28 |
DELETIONS: list[tuple[str, str, str, str]] = []
|