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,29 +36,28 @@
(defn filters [request]
[:form {"hx-trigger" "change delay:500ms, keyup changed from:.hot-filter delay:1000ms"
"hx-get" (bidi/path-for ssr-routes/only-routes
:pos-sales-table)
:pos-sales-table)
"hx-target" "#sales-table"
"hx-indicator" "#sales-table"
#_#_:hx-disabled-elt "find fieldset"}
[:fieldset.space-y-6
[:fieldset.space-y-6
(date-range-field* request)
(total-field* request)
[:div
(com/field {:label "Payment Method"}
(com/radio-card {:size :small
:name "payment-method"
:options [{:value ""
:content "All"}
{:value "CASH"
:content "Cash"}
{:value "CARD"
:content "Card"}
{:value "SQUARE_GIFT_CARD"
:content "Gift Card"}
{:value "OTHER"
:content "Other"}
]}))]
:name "payment-method"
:options [{:value ""
:content "All"}
{:value "CASH"
:content "Cash"}
{:value "CARD"
:content "Card"}
{:value "SQUARE_GIFT_CARD"
:content "Gift Card"}
{:value "OTHER"
:content "Other"}]}))]
[:div
(processor-field* request)]
@@ -87,8 +86,7 @@
:sales-order/source,
:sales-order/reference-link,
{:sales-order/client [:client/name :db/id :client/code]
:sales-order/charges [
:charge/type-name,
:sales-order/charges [:charge/type-name,
:charge/total,
:charge/tax,
:charge/tip,
@@ -125,13 +123,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-order/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-order/total ?a]
'[(<= ?a ?total-lte)]]}
@@ -155,7 +153,6 @@
'[?chg :charge/processor ?processor]]}
:args [(:processor query-params)]})
true
(merge-query {:query {:find ['?sort-default '?e]}}))]
(clojure.pprint/pprint (update-in query [:args] #(drop 1 %)))
@@ -178,7 +175,6 @@
[(->> (hydrate-results ids-to-retrieve db request))
matching-count]))
(def grid-page
(helper/build
{:id "sales-table"
@@ -255,7 +251,6 @@
"OTHER" "other"
nil)))])}]}))
(def row* (partial helper/row* grid-page))
(def table* (partial helper/table* grid-page))