less janky experience

This commit is contained in:
2023-10-19 22:28:08 -07:00
parent da6167622f
commit 174c428405
2 changed files with 22 additions and 23 deletions

View File

@@ -364,26 +364,26 @@
(com/field-errors {:source account
:key :transaction-rule-account/account})])
(com/data-grid-cell {}
[:div {:hx-trigger (hx/triggers
(hx/trigger-field-change :name "transaction-rule/client"
:from "#edit-form")
(hx/trigger-field-change :name account-name
:from "#edit-form"))
:hx-include "#edit-form"
:hx-vals (hx/vals {:name location-name})
:hx-ext "rename-params"
:hx-rename-params-ex (hx/json {"transaction-rule/client" "client-id"
account-name "account-id"
"name" "name"
location-name "value"})
:hx-get (bidi/path-for ssr-routes/only-routes :admin-transaction-rule-location-select)
:hx-swap "innerHTML"}
(location-select* {:name location-name
:account-location (:account/location (cond->> (:transaction-rule-account/account account)
(nat-int? (:transaction-rule-account/account account)) (dc/pull (dc/db conn)
'[:account/location])))
:client-locations (:client/locations (:transaction-rule/client transaction-rule))
:value (:transaction-rule-account/location account)})
[:div [:div {:hx-trigger (hx/triggers
(hx/trigger-field-change :name "transaction-rule/client"
:from "#edit-form")
(hx/trigger-field-change :name account-name
:from "#edit-form"))
:hx-include "#edit-form"
:hx-vals (hx/vals {:name location-name})
:hx-ext "rename-params"
:hx-rename-params-ex (hx/json {"transaction-rule/client" "client-id"
account-name "account-id"
"name" "name"
location-name "value"})
:hx-get (bidi/path-for ssr-routes/only-routes :admin-transaction-rule-location-select)
:hx-swap "innerHTML"}
(location-select* {:name location-name
:account-location (:account/location (cond->> (:transaction-rule-account/account account)
(nat-int? (:transaction-rule-account/account account)) (dc/pull (dc/db conn)
'[:account/location])))
:client-locations (:client/locations (:transaction-rule/client transaction-rule))
:value (:transaction-rule-account/location account)})]
(com/field-errors {:source account
:key :transaction-rule-account/location})])
(com/data-grid-cell (com/money-input {:name (format "transaction-rule/accounts[%s][transaction-rule-account/percentage]" (:db/id account))

View File

@@ -110,10 +110,9 @@ c.clearChoices();
(defn field-errors- [{:keys [source key]} & rest]
(if-let [errors (:errors (cond-> (meta source)
(let [errors (:errors (cond-> (meta source)
key (get key)))]
[:div.text-red-500 (str/join ", " errors)]
[:p.mt-2.text-xs.text-red-600.dark:text-red-500]))
[:p.mt-2.text-xs.text-red-600.dark:text-red-500.h-4 (str/join ", " errors)]))
(defn field- [params & rest]
[:div {:id (:id params)}