transactions page progress.

This commit is contained in:
2025-03-02 20:09:40 -08:00
parent 3d65816d9c
commit 7c7fc10a8d
11 changed files with 1340 additions and 29 deletions

View File

@@ -12,6 +12,7 @@
[auto-ap.ssr-routes :as ssr-routes]
[auto-ap.ssr.components :as com]
[auto-ap.ssr.components.link-dropdown :refer [link-dropdown]]
[auto-ap.ssr.transaction.edit :as edit]
[auto-ap.ssr.grid-page-helper :as helper :refer [wrap-apply-sort]]
[auto-ap.ssr.hx :as hx]
[auto-ap.ssr.ledger :refer [wrap-ensure-bank-account-belongs]]
@@ -271,17 +272,10 @@
::route/new)}
"Add Transaction")])
:row-buttons (fn [request entity]
[#_(when (and (can? (:identity request) {:subject :transaction :activity :edit}))
(com/icon-button {:hx-put (bidi/path-for ssr-routes/only-routes
::route/edit-wizard
:db/id (:db/id entity))}
svg/pencil))
#_(when (and (can? (:identity request) {:subject :transaction :activity :delete}))
(com/icon-button {:hx-delete (bidi/path-for ssr-routes/only-routes
::route/delete
:db/id (:db/id entity))
:hx-confirm "Are you sure you want to delete this transaction?"}
svg/trash))])
[(com/icon-button {:hx-get (bidi/path-for ssr-routes/only-routes
::route/edit-wizard
:db/id (:db/id entity))}
svg/pencil)])
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes ::route/page)}
"Transactions"]]
@@ -290,6 +284,10 @@
:entity-name "register"
:route ::route/table
:csv-route ::route/csv
:table-attributes (fn [_]
{:hx-trigger "refreshTable from:body"
:hx-get (bidi/path-for ssr-routes/only-routes ::route/table)
:hx-target "#entity-table"})
:break-table (fn [request entity]
(cond
(= (-> request :query-params :sort first :name) "Vendor")
@@ -375,18 +373,19 @@
(def csv (helper/csv-route grid-page))
(def key->handler
(apply-middleware-to-all-handlers
{::route/page page
::route/table table
::route/csv csv
::route/bank-account-filter bank-account-filter}
(fn [h]
(-> h
(wrap-copy-qp-pqp)
(wrap-apply-sort grid-page)
(merge edit/key->handler
(apply-middleware-to-all-handlers
{::route/page page
::route/table table
::route/csv csv
::route/bank-account-filter bank-account-filter}
(fn [h]
(-> h
(wrap-copy-qp-pqp)
(wrap-apply-sort grid-page)
(wrap-ensure-bank-account-belongs)
(wrap-merge-prior-hx)
(wrap-schema-enforce :query-schema query-schema)
(wrap-schema-enforce :hx-schema query-schema)
(wrap-must {:activity :view :subject :transaction})
(wrap-client-redirect-unauthenticated)))))
(wrap-schema-enforce :query-schema query-schema)
(wrap-schema-enforce :hx-schema query-schema)
(wrap-must {:activity :view :subject :transaction})
(wrap-client-redirect-unauthenticated))))))