Flash transaction row after editing through modal
When a transaction is saved via the edit modal, return the updated row
HTML with {:flash? true} instead of an empty div. This makes the row
flash with the live-added animation, matching the behavior of other
pages like invoices and accounts.
Uses hx-retarget to swap the specific row in the table while also
triggering modalclose to close the modal.
This commit is contained in:
@@ -17,9 +17,11 @@
|
||||
:refer [wrap-client-redirect-unauthenticated]]
|
||||
[auto-ap.rule-matching :as rm]
|
||||
[auto-ap.solr :as solr]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.common-handlers :refer [add-new-entity-handler]]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.common-handlers :refer [add-new-entity-handler]]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.grid-page-helper :as helper]
|
||||
[auto-ap.ssr.transaction.common :refer [grid-page]]
|
||||
[auto-ap.ssr.components.multi-modal :as mm]
|
||||
[auto-ap.ssr.form-cursor :as fc]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
@@ -44,6 +46,8 @@
|
||||
:transaction-approval-status/approved "Approved"
|
||||
:transaction-approval-status/suppressed "Suppressed"})
|
||||
|
||||
(def row* (partial helper/row* grid-page))
|
||||
|
||||
(defn get-vendor [vendor-id]
|
||||
(dc/pull
|
||||
(dc/db conn)
|
||||
@@ -1081,8 +1085,10 @@
|
||||
(alog/error ::cant-save-solr :error e)))
|
||||
|
||||
(html-response
|
||||
[:div]
|
||||
:headers {"hx-trigger" "modalclose"}))))
|
||||
(row* (:identity request) (d-transactions/get-by-id tx-id) {:flash? true})
|
||||
:headers {"hx-trigger" "modalclose"
|
||||
"hx-retarget" (format "#entity-table tr[data-id=\"%d\"]" tx-id)
|
||||
"hx-reswap" "outerHTML"}))))
|
||||
|
||||
(defn unlink-payment [{{{transaction-id :db/id} :snapshot} :multi-form-state :as request}]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user