shows as locked

This commit is contained in:
2025-03-29 19:36:52 -07:00
parent 5c0ba7cfa4
commit 7f12b31fdf
3 changed files with 26 additions and 8 deletions

View File

@@ -28,6 +28,7 @@
[auto-ap.time :as atime]
[bidi.bidi :as bidi]
[clj-time.coerce :as coerce]
[clj-time.core :as time]
[clojure.string :as str]
[datomic.api :as dc]
[hiccup.util :as hu]
@@ -212,7 +213,7 @@
:transaction/client-overrides
:db/id
{:transaction/vendor [:vendor/name :db/id]
:transaction/client [:client/name :client/code :db/id]
:transaction/client [:client/name :client/code :db/id [ :client/locked-until :xform clj-time.coerce/from-date]]
:transaction/bank-account [:bank-account/numeric-code :bank-account/name]
:transaction/accounts [{:transaction-account/account [:account/name :db/id]}
:transaction-account/location
@@ -282,15 +283,22 @@
[(assoc-in (date-range-field* request) [1 :hx-swap-oob] true)
(assoc-in (exact-match-id* request) [1 :hx-swap-oob] true)])
:action-buttons (fn [request]
[(com/button {:color :primary
[#_(com/button {:color :primary
:hx-get (bidi/path-for ssr-routes/only-routes
::route/new)}
"Add Transaction")])
:row-buttons (fn [request entity]
[(com/icon-button {:hx-get (bidi/path-for ssr-routes/only-routes
::route/edit-wizard
:db/id (:db/id entity))}
svg/pencil)])
(let [client (:transaction/client entity)
locked-until (:client/locked-until client)
tx-date (:transaction/date entity)
is-locked (and locked-until tx-date (time/before? tx-date locked-until))]
(if is-locked
[ [:div.p-3.rounded-full.bg-gray-50.text-gray-400.w-6.h-6.box-content
svg/lock]]
[(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"]]