accounts and transactions work the same way

This commit is contained in:
2023-10-23 11:08:05 -07:00
parent 825443ef2c
commit dc1fefd30c
2 changed files with 15 additions and 11 deletions

View File

@@ -244,11 +244,12 @@
;; goes with what, building index on the server side
;; not needing to pass index in
;; TODO decide when cursors are used. other cases it's not, some are
(defn client-override* [override]
[:div.flex.gap-2.mb-2.client-override (-> {"x-ref" "p"
[:div.flex.gap-2.mb-2.client-override (-> {:x-ref "p"
:data-key "show"
}
hx/alpine-mount-then-appear)
:x-data (hx/json {:show (boolean (not (:new? override)))})}
hx/alpine-mount-then-appear)
[:div.w-96
(fc/with-field :db/id
(com/hidden {:name (fc/field-name)
@@ -388,7 +389,8 @@
(defn new-client-override [{ {:keys [index]} :query-params}]
(let [index (or index 0)
account {:account/client-overrides (conj (into [] (repeat index {}))
{:db/id (str (java.util.UUID/randomUUID))})}] ;; TODO schema decode is not working
{:db/id (str (java.util.UUID/randomUUID))
:new? true})}] ;; TODO schema decode is not working
(html-response
(fc/start-form account []
(fc/with-cursor (get-in fc/*current* [:account/client-overrides index])

View File

@@ -342,8 +342,12 @@
(defn- transaction-rule-account-row*
[transaction-rule account]
(com/data-grid-row {:x-data (hx/json {:accountId (or (:db/id (fc/field-value (:transaction-rule-account/account account)))
(fc/field-value (:transaction-rule-account/account account)))})}
(com/data-grid-row (-> {:x-data (hx/json {:accountId (or (:db/id (fc/field-value (:transaction-rule-account/account account)))
(fc/field-value (:transaction-rule-account/account account)))
:show (boolean (not (fc/field-value (:new? account))))})
:data-key "show"
:x-ref "p"}
hx/alpine-mount-then-appear)
(let [account-name (fc/field-name (:transaction-rule-account/account account))]
(list
@@ -394,10 +398,7 @@
(* 100 )
(long ))}))))))
(com/data-grid-cell {:class "align-top"}
(com/a-icon-button
{"_" (hiccup/raw "on click halt the event then transition the closest <tr />'s opacity to 0 then remove closest <tr />")
:href "#"}
svg/x))))
(com/a-icon-button {"@click.prevent.stop" "show=false; setTimeout(() => $refs.p.remove(), 500)"} svg/x))))
;; TODO dialog is no longer closeable
(defn dialog* [& {:keys [entity form-params form-errors]}]
@@ -600,7 +601,8 @@
client-id)
:transaction-rule/accounts (conj (into [] (repeat index {} ))
{:db/id (str (java.util.UUID/randomUUID))
:transaction-rule-account/location "Shared"})}]
:transaction-rule-account/location "Shared"
:new? true})}]
(html-response
(fc/start-form transaction-rule []
(fc/with-cursor (get-in fc/*current* [:transaction-rule/accounts index])