Commit Graph

53 Commits

Author SHA1 Message Date
a2d8517668 refactor(ssr): wizard2 engine absorbs the per-consumer boilerplate (review follow-up)
Adversarial review of Phase 6 found the engine's coupling had relocated rather than
dissolved: every wizard consumer had to hand-build a decode allowlist, re-implement the
open-handler modal wrap, mint temp ids for added rows, and hand-roll the nav buttons +
Enter guard. The engine had the information to prevent all four. Now it does:

- handle-step-submit strips its own nav fields (wizard-id/current-step/direction) from
  form-params before calling a step's :decode -- no per-consumer allowlist, and they can
  no longer leak into the saved entity (the Phase-6 "500 on save" class of bug is
  structurally impossible).
- open-wizard takes an :open-response config fn and owns the create!/render/wrap/thread
  flow, so modal wizards route through (partial wizard2/open-wizard config) directly.
- wizard2/blank-row supplies a temp :db/id (+ :new?) so an added row passes schema
  validation and the step actually advances.
- wizard2/nav-footer emits the direction buttons (Back/advance/Save), marks the primary,
  and wizard-form guards Enter to trigger the primary button.

Consumer (transaction_rules.clj) gets correspondingly leaner: deleted rule-form-keys +
the decode allowlist, rule-nav, and the hand-rolled open-rule-wizard; new/edit routes are
now (partial wizard2/open-wizard config). A new wizard is now just a config map + the step
:render fns. LOC 964 -> 932, and the deleted code was exactly the cross-consumer
boilerplate, not modal-specific logic.

Verification: rule spec 4/4; full suite 55/55; cljfmt clean. Skill gotchas updated from
"three traps" to "use the engine's primitives" (the engine now absorbs them).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 14:38:07 -07:00
107a02f4f1 refactor(ssr): Phase 6b — migrate Transaction Rule wizard onto the session engine; de-cursor
Proves the Phase-6a wizard engine against a real 2-step modal: the Transaction
Rule wizard (edit step + read-only test/preview step) now runs on wizard2 /
wizard-state, fully de-cursored.

What changed
- Wizard machinery removed: deleted the EditModal / TestModal /
  TransactionRuleWizard defrecords (mm/ModalWizardStep + LinearModalWizard),
  MultiStepFormState, the EDN snapshot, and the step-params[...] prefix. Replaced
  with a data-driven `transaction-rule-wizard-config` (two steps + init-fn +
  done-fn) driven by the engine.
- De-cursored the whole edit form (82 fc/ refs -> 0): every field reads explicit
  data + path->name2; errors via a bound *errors* / ferr. The account row's Alpine
  cross-field dispatch wiring (clientId -> accountId -> location) is preserved
  verbatim — only the data plumbing moved off the cursor.
- The test step's :render reads :all-data (the engine's get-all), so the
  formtools "combine at the end" mechanism feeds the preview table.
- Routes 4 -> 2: open-rule-wizard (new + edit), save-step (every transition via the
  engine's `direction` field). The dedicated `navigate` route is deleted.
- decode-rule-form select-keys to the schema's known keys so the engine's nav
  fields (wizard-id/current-step/direction) don't leak into the upserted entity.

Scorecard (admin/transaction_rules.clj): fc/ 82->0, mm/ 20->0, defrecords 3->0,
LOC 1000->964, routes 4->2.

Scope note: the de-cursored edit step keeps com/* Hiccup leaf components (not yet
sc/* Selmer); the value here was removing fc/ + mm/ and proving the engine, not
re-templating the conditional/Alpine-cross-field layout. Hiccup-in-render is a
documented partial; the com/ -> sc/ swap is a mechanical follow-up.

Verification: rule spec 4/4 (new + edit dialogs, advance-to-test preview, save);
full Playwright suite 55/55; cljfmt clean. Skill fed: scorecard row + narrative
(engine's first real modal; generalizes for a one-data-step wizard); gotchas
(strip engine nav fields in decode, new-row temp-id, direction-button nav).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 11:12:33 -07:00
d0028f403c fix(ssr): allow picking bank account when editing a transaction rule
The bank-account filter rendered "Please select a client" even when a
client was set on the rule. Two causes:

- Inside (fc/with-field :transaction-rule/bank-account ...) the cursor is
  rebound to the bank-account field, so (:transaction-rule/client
  (fc/field-value)) read the nil bank-account value and the server
  rendered the placeholder. The clientId watcher only fires on change, so
  when editing (client preset, unchanged) the htmx swap never corrected
  it. Read the client from the form root before entering the field.
- The clientId-change swap used innerHTML, nesting a fresh typeahead
  inside the stale one and breaking its Alpine refs. Use outerHTML so the
  typeahead is replaced in place.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 13:32:30 -07:00
11024b7b89 fix(ssr): transaction rule wizard drops fields on Next
The EditModal step body wrapped all rule fields in a nested
<form id="my-form"> inside the wizard's own #wizard-form. By HTML
form-ownership rules those fields belonged to the inner form, so when
htmx serialized #wizard-form on Next, none of the step-params fields
were sent. The server saw an empty rule, reported "required" for
description/accounts, and re-rendered a blank wizard (losing input).

Replace the nested <form> with a plain <div>; the wizard form already
owns submission, so the inner form and its htmx attributes were
redundant.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 14:58:36 -07:00
ba87805d4c Add vendor pre-population for bulk code and individual edit forms
- Add vendor-changed HTMX handlers for both bulk code and individual edit
- Pre-populate default account at 100% when vendor is selected and no accounts exist
- Fix render-accounts-section to render from step-params correctly
- Change bulk code vendor-changed from hx-get to hx-post to include form data
- Add routes for vendor-changed endpoints
- Update e2e tests to cover vendor pre-population
- Run lein cljfmt fix across codebase
2026-05-21 14:45:19 -07:00
a8c7c7eb8e cleans up grids 2024-11-18 19:41:54 -08:00
6fd609be3e Adds new ledger import page 2024-08-26 20:53:21 -07:00
d9bd09a9cc Resets selected on page change, adds account number to drop downs and makes missing emails less noisy 2024-08-22 21:14:43 -07:00
Bryce
87952b79d1 simplifies alpine for syncing props. 2024-03-21 21:09:18 -07:00
Bryce
8af5713ba2 Makes navigation a little bit better. 2024-03-20 14:48:44 -07:00
5b9c4b7aef progress on invoices. 2024-03-14 07:16:59 -07:00
f48c819a96 speeds up 2024-02-08 21:05:37 -08:00
c290c34ec7 Allows making rules by client group 2024-02-08 15:56:46 -08:00
8063a8fcbd Builds client SSR approach, sunsets old cljs. 2024-02-07 21:22:56 -08:00
57f1805b55 Fixes an issue with adding accounts. 2024-01-18 20:04:48 -08:00
384bb23aa2 minor fixes from kyle 2023-11-09 21:26:35 -08:00
320d7c73df Allows for deleting of transaction rules 2023-11-03 16:53:36 -07:00
eef1cfb919 Vendors form progress 2023-11-02 23:40:24 -07:00
3d5c307760 Made error page look pretty good 2023-10-30 20:47:55 -07:00
f0a7c378f7 can run transaction rules 2023-10-28 21:03:59 -07:00
e8a419fb3c more cleanup. 2023-10-28 20:27:00 -07:00
855c23f4ae changes for running. 2023-10-28 12:17:01 -07:00
a4678c8fde fixes 2023-10-27 15:08:06 -07:00
7f7458d54a Makes testing of transaction rules work 2023-10-26 21:23:52 -07:00
5ed23f26be fixes 2023-10-26 15:54:41 -07:00
506d2ac782 Makes background jobs work again 2023-10-25 15:35:33 -07:00
deaad7513c Fixes modal, but users still have to say h-full on every element leading to the card 2023-10-25 12:43:00 -07:00
b4ea51df84 preserves values. 2023-10-25 06:46:31 -07:00
f5fd532a31 ccount modal 2023-10-24 16:59:43 -07:00
a8cce0377d lots of progress 2023-10-24 11:52:55 -07:00
91f7e79aed a lot of streamlining for validation 2023-10-24 11:12:31 -07:00
48347bb8c5 Uses cursors for simplicity, uses common grid bottom 2023-10-23 23:46:01 -07:00
84d6f455ff Makes cursor-seq for lists 2023-10-23 15:02:36 -07:00
be9d777a17 consistent user experience with new client 2023-10-23 11:59:14 -07:00
dc1fefd30c accounts and transactions work the same way 2023-10-23 11:08:05 -07:00
825443ef2c Made accounts page look great 2023-10-23 10:57:35 -07:00
Bryce
76760b7bcf progress for accounts 2023-10-22 21:32:36 -07:00
fc0392a235 improvements 2023-10-22 21:00:04 -07:00
Bryce
a6032e2be2 progress on updating users 2023-10-22 06:27:55 -07:00
998d29690e animates with shake 2023-10-21 20:08:08 -07:00
34f4a12b2e Makes appear logic work right 2023-10-21 13:25:00 -07:00
9ddbd31cc8 almost perfect user experience 2023-10-21 13:04:42 -07:00
fc3634c6bd does not change now. 2023-10-21 12:43:01 -07:00
Bryce
aa14a310ab big ui improvemet 2023-10-21 07:37:05 -07:00
2fc9a71577 vertical alignment 2023-10-20 22:23:47 -07:00
ffcc43ba5e alpine for dropdown. 2023-10-20 17:52:15 -07:00
8684a68471 stacked radios 2023-10-20 13:56:59 -07:00
c0db7eb763 Lots of less customization when creating and editing forms 2023-10-20 11:38:29 -07:00
e3443a3dd8 uses cursors instead, much clearer experience. 2023-10-20 08:54:00 -07:00
ce8fa027b2 Simplifies a lot by using cursors 2023-10-20 00:12:42 -07:00