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

@@ -4,7 +4,6 @@
[cheshire.generate :refer [add-encoder]]
[clojure.string :as str]))
(defn vals [m]
(cheshire/generate-string m))
@@ -15,18 +14,17 @@
(add-encoder jsfn jsf)
(defn json [m]
(let [starting-point (cheshire/generate-string m)]
(if (map? m)
(reduce
(fn [starting-point [k v]]
(if (instance? jsfn v)
(-> (str/replace starting-point (re-pattern (str "(?s)\"__" (.-name v) "__(.*?)__end__\"")) "$1" )
(str/replace "\\n" "\n"))
starting-point))
starting-point
m)
(reduce
(fn [starting-point [k v]]
(if (instance? jsfn v)
(-> (str/replace starting-point (re-pattern (str "(?s)\"__" (.-name v) "__(.*?)__end__\"")) "$1")
(str/replace "\\n" "\n"))
starting-point))
starting-point
m)
starting-point)))
(defn random-alpha-string []
@@ -67,7 +65,7 @@
alpine-disappear)
(dissoc params :data-key)))
(defn alpine-mount-then-disappear [{:keys [data-key] :as params :or {data-key "show"}} ]
(defn alpine-mount-then-disappear [{:keys [data-key] :as params :or {data-key "show"}}]
(merge (-> {:x-data (json {data-key true})
:x-init (format "$nextTick(() => %s=false)" (name data-key))
:x-show (name data-key)}
@@ -85,13 +83,12 @@
(format "\"%s\": $data.%s || ''" field alpine-field))
field->alpine-field)))))
(defn trigger-click-or-enter [m]
(assoc m :hx-trigger "click, keyup[keyCode==13]"))
(defn htmx-transition-appear [params]
(-> params
(-> params
(update :class (fn [c]
(-> (or c "")
(hh/add-class "opacity-100 transition htmx-added:opacity-0 duration-300")))))
)
(hh/add-class "opacity-100 transition htmx-added:opacity-0 duration-300"))))))