alpine for dropdown.
This commit is contained in:
@@ -306,7 +306,7 @@
|
||||
(or (get tempids (:db/id entity)) (:db/id entity)))]
|
||||
(html-response
|
||||
(row* identity updated-account {:flash? true})
|
||||
:headers {"hx-trigger" "modalClosing"
|
||||
:headers {"hx-trigger" "modalclose"
|
||||
"hx-retarget" (format "#transaction-rule-table tr[data-id=\"%d\"]" (:db/id updated-account))})))
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@
|
||||
(defn- account-typeahead*
|
||||
[{:keys [name value client-id]}]
|
||||
[:div.flex.flex-col
|
||||
(com/typeahead {:name name
|
||||
(com/typeahead-2 {:name name
|
||||
:placeholder "Search..."
|
||||
:url (str (bidi/path-for ssr-routes/only-routes :account-search) "?client-id=" client-id)
|
||||
:id name
|
||||
@@ -408,6 +408,7 @@
|
||||
:href "#"}
|
||||
svg/x))))
|
||||
|
||||
;; TODO dialog is no longer closeable
|
||||
(defn dialog* [& {:keys [ entity form-params form-errors]}]
|
||||
(com/modal
|
||||
{:modal-class "max-w-4xl"}
|
||||
@@ -417,7 +418,8 @@
|
||||
[:form#edit-form (merge {:hx-ext "response-targets"
|
||||
:hx-swap "outerHTML swap:300ms"
|
||||
:hx-target "#modal-holder"
|
||||
:hx-target-400 "#form-errors .error-content"}
|
||||
:hx-target-400 "#form-errors .error-content"
|
||||
#_#_:x-trap "true"}
|
||||
form-params)
|
||||
[:fieldset {:class "hx-disable" :hx-disinherit "hx-target"}
|
||||
|
||||
@@ -433,17 +435,18 @@
|
||||
{:label "Client"
|
||||
:errors (fc/field-errors)}
|
||||
[:div.w-96
|
||||
(com/typeahead {:name (fc/field-name)
|
||||
:error? (fc/error?)
|
||||
:class "w-96"
|
||||
:placeholder "Search..."
|
||||
:url (bidi/path-for ssr-routes/only-routes :company-search)
|
||||
:id (str "form-client-search")
|
||||
:value (fc/field-value)
|
||||
:value-fn (some-fn :db/id identity)
|
||||
:content-fn (fn [c] (cond->> c
|
||||
(nat-int? c) (dc/pull (dc/db conn) '[:client/name])
|
||||
true :client/name))})]))
|
||||
(com/typeahead-2 {:name (fc/field-name)
|
||||
:x-init "$el.focus()"
|
||||
:error? (fc/error?)
|
||||
:class "w-96"
|
||||
:placeholder "Search..."
|
||||
:url (bidi/path-for ssr-routes/only-routes :company-search)
|
||||
:id (str "form-client-search")
|
||||
:value (fc/field-value)
|
||||
:value-fn (some-fn :db/id identity)
|
||||
:content-fn (fn [c] (cond->> c
|
||||
(nat-int? c) (dc/pull (dc/db conn) '[:client/name])
|
||||
true :client/name))})]))
|
||||
|
||||
|
||||
(fc/with-field :transaction-rule/bank-account
|
||||
@@ -510,13 +513,13 @@
|
||||
(com/validated-field {:label "Assign Vendor"
|
||||
:errors (fc/field-errors)}
|
||||
[:div.w-96
|
||||
(com/typeahead {:name (fc/field-name)
|
||||
:placeholder "Search..."
|
||||
:url (bidi/path-for ssr-routes/only-routes :vendor-search)
|
||||
:id (str "form-vendor-search")
|
||||
:value (fc/field-value)
|
||||
:value-fn (some-fn :db/id identity)
|
||||
:content-fn (some-fn :vendor/name #(pull-attr (dc/db conn) :vendor/name %))})]))
|
||||
(com/typeahead-2 {:name (fc/field-name)
|
||||
:placeholder "Search..."
|
||||
:url (bidi/path-for ssr-routes/only-routes :vendor-search)
|
||||
:id (str "form-vendor-search")
|
||||
:value (fc/field-value)
|
||||
:value-fn (some-fn :db/id identity)
|
||||
:content-fn (some-fn :vendor/name #(pull-attr (dc/db conn) :vendor/name %))})]))
|
||||
|
||||
(fc/with-field :transaction-rule/accounts
|
||||
(list
|
||||
@@ -609,7 +612,7 @@
|
||||
(html-response (dialog* :entity entity
|
||||
:form-params {:hx-put (str (bidi/path-for ssr-routes/only-routes
|
||||
:admin-transaction-rule-edit-save))})
|
||||
:headers {"hx-trigger" "modalOpening"})))
|
||||
:headers {"hx-trigger" "modalopen"})))
|
||||
|
||||
(defn transaction-rule-error [request]
|
||||
(let [entity (some-> request :last-form)]
|
||||
@@ -629,7 +632,7 @@
|
||||
:form-errors {}
|
||||
:form-params {:hx-post (str (bidi/path-for ssr-routes/only-routes
|
||||
:admin-transaction-rule-edit-save))})
|
||||
:headers {"hx-trigger" "modalOpening"}))
|
||||
:headers {"hx-trigger" "modalopen"}))
|
||||
|
||||
(def transaction-rule-schema (mc/schema
|
||||
[:map
|
||||
|
||||
Reference in New Issue
Block a user