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
This commit is contained in:
2026-05-21 14:45:19 -07:00
parent 8bd0cee1b1
commit ba87805d4c
210 changed files with 8694 additions and 9627 deletions

View File

@@ -36,7 +36,7 @@
"hx-indicator" "#refund-table"
#_#_:hx-disabled-elt "find fieldset"}
[:fieldset.space-y-6
[:fieldset.space-y-6
(date-range-field* request)
(total-field* request)]])
@@ -54,7 +54,7 @@
:where '[[(iol-ion.query/scan-sales-refunds $ ?clients ?start-date ?end-date) [[?e _ ?sort-default] ...]]]}
:args [db [(:trimmed-clients request)
(some-> query-params :start-date c/to-date)
(some-> query-params :end-date c/to-date )]]}
(some-> query-params :end-date c/to-date)]]}
(:sort query-params) (add-sorter-fields {"client" ['[?e :sales-refund/client ?c]
'[?c :client/name ?sort-client]]
"date" ['[?e :sales-refund/date ?sort-date]]
@@ -68,13 +68,13 @@
:where []}
:args [(:exact-match-id query-params)]})
(:total-gte query-params)
(:total-gte query-params)
(merge-query {:query {:in ['?total-gte]
:where ['[?e :sales-refund/total ?a]
'[(>= ?a ?total-gte)]]}
:args [(:total-gte query-params)]})
(:total-lte query-params)
(:total-lte query-params)
(merge-query {:query {:in ['?total-lte]
:where ['[?e :sales-refund/total ?a]
'[(<= ?a ?total-lte)]]}
@@ -83,7 +83,7 @@
true
(merge-query {:query {:find ['?sort-default '?e]
:where ['[?e :sales-refund/date ?sort-default]]}}))]
(cond->> (query2 query)
true (apply-sort-3 query-params)
true (apply-pagination query-params))))
@@ -149,13 +149,13 @@
(def table* (partial helper/table* grid-page))
(def key->handler
(apply-middleware-to-all-handlers
(apply-middleware-to-all-handlers
{:pos-refunds (helper/page-route grid-page)
:pos-refund-table (helper/table-route grid-page)}
(fn [h]
(-> h
(wrap-copy-qp-pqp)
(wrap-apply-sort grid-page)
(wrap-merge-prior-hx)
(wrap-schema-enforce :query-schema query-schema)
(wrap-schema-enforce :hx-schema query-schema)))))
(-> h
(wrap-copy-qp-pqp)
(wrap-apply-sort grid-page)
(wrap-merge-prior-hx)
(wrap-schema-enforce :query-schema query-schema)
(wrap-schema-enforce :hx-schema query-schema)))))