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:
@@ -2,18 +2,17 @@
|
||||
(:require [auto-ap.ssr.form-cursor :as fc]
|
||||
[auto-ap.ssr.utils :refer [html-response wrap-schema-enforce]]))
|
||||
|
||||
|
||||
(defn add-new-entity-handler
|
||||
([path render-fn] (add-new-entity-handler path
|
||||
render-fn
|
||||
(fn default-data [base _]
|
||||
(fn default-data [base _]
|
||||
base)))
|
||||
([path render-fn build-data]
|
||||
(-> (fn new-entity [{{:keys [index]} :query-params :as request}]
|
||||
(html-response
|
||||
(fc/start-form-with-prefix (conj path (or index 0))
|
||||
(build-data {:db/id (str (java.util.UUID/randomUUID))
|
||||
:new? true} request)
|
||||
:new? true} request)
|
||||
[]
|
||||
(render-fn fc/*current* request))))
|
||||
(wrap-schema-enforce :query-schema [:map
|
||||
|
||||
Reference in New Issue
Block a user