refactor(ssr): Phase 5 — full Selmer migration of Invoice Bulk Edit; remove the wizard; implement live totals

Migrates the Invoice Bulk Edit modal off the wizard to a plain Selmer form,
building on the parity gate. Structurally Phase 3's bulk-code applied to invoices
(selected entities -> expense-account rows), so near-pure reuse of bulk-code's
flat-state plumbing + edit's account-totals-tbody.

What changed
- Wizard removed: deleted BulkEditWizard/AccountsStep records, MultiStepFormState,
  the step-params[...] prefix, the EDN snapshot, and all mm/* for this modal.
  Replaced with a plain handler + flat wrap-bulk-state (decode straight into
  bulk-edit-schema, no snapshot).
- Selection-as-ids round-trip: the non-editable invoice selection is resolved to a
  concrete not-locked id vector at open and ridden back in hidden ids[] fields (the
  bulk analog of edit's single db/id) -- no filter re-query.
- De-cursored bulk-edit-account-row* to Selmer (sc/*), explicit-id location swap
  (#account-location-<index>, replacing the old find * swap), reusing
  tx-edit/location-select*.
- 100% Selmer modal render path; the surgical edit was done with the text-based
  Edit tool (the clojure-mcp structural tools reformat the whole 1812-line file),
  so the diff is contained to the requires + the bulk-edit region.
- Routes 5 -> 3: GET bulk-edit, PUT bulk-edit-submit, POST bulk-edit-form-changed
  (one whole-form op dispatcher folding the old new-account route).

Implemented the dead totals
- The wizard's TOTAL/BALANCE percentage rows were commented out (#_(...)) with a
  duplicate id="total". Implemented as a #expense-totals sibling-<tbody> refreshed by
  a Rule-4 percentage-keyup swap (the new-account + total + balance routes all fold
  into form-changed / the sibling-tbody).

Scorecard delta (bulk-edit modal): wizard records 2->0, bulk-edit routes 5->3,
step-params/fc-cursor (modal) ->0, location swap find *-> explicit-id, totals
dead->implemented.

Verification: invoice-bulk-edit spec 5/5 (incl. add-row, save, validation, the
implemented totals); full Playwright suite 50/50; cljfmt clean; diff confined to
the modal region. Skill fed: scorecard row + settled repeated-row target-selector
convention; gotcha (structural tools reformat large files -> use text Edit).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-24 23:09:37 -07:00
parent 4139919036
commit 2bf87056d7
7 changed files with 390 additions and 250 deletions

View File

@@ -0,0 +1,4 @@
{# Top-level plain bulk-edit form (no wizard). The resolved (not-locked) invoice id set
rides in hidden ids[] fields so the selection survives form-changed / submit posts
without an EDN snapshot or a filter round-trip. #}
<form id="bulk-edit-form"{{ form_attrs|safe }}>{{ ids_hidden|safe }}{{ modal|safe }}</form>

View File

@@ -0,0 +1,5 @@
{# Running TOTAL / BALANCE percentage rows in their own swappable <tbody>, a sibling of
the input rows, so a percentage edit refreshes them with a targeted swap (Rule 4) and
never replaces the input-bearing rows above. Replaces the old per-cell bulk-edit-total
/ bulk-edit-balance routes. #}
<tbody id="expense-totals">{{ rows|safe }}</tbody>