tweak.
This commit is contained in:
@@ -111,59 +111,60 @@
|
||||
(defn transaction-row [r & {:keys [hide-actions? class last?]}]
|
||||
(let [simality-list (try (pinecone-similarity-list (:db/id r)) (catch Exception e
|
||||
[]))]
|
||||
(com/data-grid-row
|
||||
(cond-> {:class class}
|
||||
last? (assoc :hx-get (bidi/path-for ssr-routes/only-routes
|
||||
:transaction-insight-rows
|
||||
:after (:db/id r))
|
||||
:hx-trigger "intersect once"
|
||||
:hx-indicator "#insight-table"
|
||||
:hx-swap "afterend"))
|
||||
(com/data-grid-cell {} (:client/code (:transaction/client r)))
|
||||
(com/data-grid-cell {} (:bank-account/code (:transaction/bank-account r)))
|
||||
(com/data-grid-cell {} (some-> (:transaction/date r) coerce/to-date-time (atime/unparse-local atime/normal-date)))
|
||||
(when (seq simality-list)
|
||||
(com/data-grid-row
|
||||
(cond-> {:class class}
|
||||
last? (assoc :hx-get (bidi/path-for ssr-routes/only-routes
|
||||
:transaction-insight-rows
|
||||
:after (:db/id r))
|
||||
:hx-trigger "intersect once"
|
||||
:hx-indicator "#insight-table"
|
||||
:hx-swap "afterend"))
|
||||
(com/data-grid-cell {} (:client/code (:transaction/client r)))
|
||||
(com/data-grid-cell {} (:bank-account/code (:transaction/bank-account r)))
|
||||
(com/data-grid-cell {} (some-> (:transaction/date r) coerce/to-date-time (atime/unparse-local atime/normal-date)))
|
||||
|
||||
(com/data-grid-cell {} (str (:transaction/description-original r)))
|
||||
(com/data-grid-cell {}
|
||||
(if (> (:transaction/amount r) 0.0)
|
||||
[:div.tag.is-success.is-light (str "$" (Math/round (:transaction/amount r)))]
|
||||
[:div.tag.is-danger.is-light (str "$" (Math/round (:transaction/amount r)))]))
|
||||
(com/data-grid-cell {:style {:width "12em"}}
|
||||
[:div.flex.gap-2.flex-wrap {:style {:width "12em"}}
|
||||
(when-let [vendor-name (:vendor-name (first simality-list))]
|
||||
(com/pill {:color :primary} vendor-name))
|
||||
(when-let [numeric-code (:numeric-code (first simality-list))]
|
||||
(com/pill {:color :secondary} numeric-code))
|
||||
#_(com/pill {:class (cond
|
||||
(> (:transaction/account-confidence r) 0.90)
|
||||
"is-success is-light"
|
||||
(> (:transaction/account-confidence r) 0.80)
|
||||
"is-info is-light"
|
||||
(com/data-grid-cell {} (str (:transaction/description-original r)))
|
||||
(com/data-grid-cell {}
|
||||
(if (> (:transaction/amount r) 0.0)
|
||||
[:div.tag.is-success.is-light (str "$" (Math/round (:transaction/amount r)))]
|
||||
[:div.tag.is-danger.is-light (str "$" (Math/round (:transaction/amount r)))]))
|
||||
(com/data-grid-cell {:style {:width "12em"}}
|
||||
[:div.flex.gap-2.flex-wrap {:style {:width "12em"}}
|
||||
(when-let [vendor-name (:vendor-name (first simality-list))]
|
||||
(com/pill {:color :primary} vendor-name))
|
||||
(when-let [numeric-code (:numeric-code (first simality-list))]
|
||||
(com/pill {:color :secondary} numeric-code))
|
||||
#_(com/pill {:class (cond
|
||||
(> (:transaction/account-confidence r) 0.90)
|
||||
"is-success is-light"
|
||||
(> (:transaction/account-confidence r) 0.80)
|
||||
"is-info is-light"
|
||||
|
||||
:else
|
||||
"is-warning is-light")} (str "%" (Math/round (* 100.0 (:transaction/account-confidence r)))))])
|
||||
(com/data-grid-right-stack-cell {}
|
||||
(when-not hide-actions?
|
||||
[:form.flex.gap-2
|
||||
[:input {:type :hidden :name "id" :value (:db/id r)}]
|
||||
(com/icon-button {:hx-post (bidi/path-for ssr-routes/only-routes
|
||||
:transaction-insight-approve
|
||||
:transaction-id (:db/id r))
|
||||
:hx-target "closest tr"
|
||||
:color :primary-light}
|
||||
svg/thumbs-up)
|
||||
(com/icon-button {:hx-delete (bidi/path-for ssr-routes/only-routes
|
||||
:transaction-insight-disapprove
|
||||
:transaction-id (:db/id r))
|
||||
:hx-target "closest tr"
|
||||
:color :danger-light}
|
||||
svg/thumbs-down)
|
||||
(com/icon-button {:hx-get (bidi/path-for ssr-routes/only-routes
|
||||
:transaction-insight-explain
|
||||
:transaction-id (:db/id r))
|
||||
:hx-target "#modal-holder"
|
||||
:hx-swap "outerHTML"}
|
||||
svg/question)])))))
|
||||
:else
|
||||
"is-warning is-light")} (str "%" (Math/round (* 100.0 (:transaction/account-confidence r)))))])
|
||||
(com/data-grid-right-stack-cell {}
|
||||
(when-not hide-actions?
|
||||
[:form.flex.gap-2
|
||||
[:input {:type :hidden :name "id" :value (:db/id r)}]
|
||||
(com/icon-button {:hx-post (bidi/path-for ssr-routes/only-routes
|
||||
:transaction-insight-approve
|
||||
:transaction-id (:db/id r))
|
||||
:hx-target "closest tr"
|
||||
:color :primary-light}
|
||||
svg/thumbs-up)
|
||||
(com/icon-button {:hx-delete (bidi/path-for ssr-routes/only-routes
|
||||
:transaction-insight-disapprove
|
||||
:transaction-id (:db/id r))
|
||||
:hx-target "closest tr"
|
||||
:color :danger-light}
|
||||
svg/thumbs-down)
|
||||
(com/icon-button {:hx-get (bidi/path-for ssr-routes/only-routes
|
||||
:transaction-insight-explain
|
||||
:transaction-id (:db/id r))
|
||||
:hx-target "#modal-holder"
|
||||
:hx-swap "outerHTML"}
|
||||
svg/question)]))))))
|
||||
|
||||
(defn approve [{:keys [identity session] {:keys [transaction-id]} :route-params}]
|
||||
(let [approval-details (dc/pull (dc/db conn) [{:transaction/recommended-account [:account/location :db/id]}
|
||||
@@ -240,7 +241,7 @@
|
||||
[:tr
|
||||
[:td (subs date 0 10)]
|
||||
[:td description]
|
||||
[:td amount]
|
||||
[:td (format "$%.2f" amount)]
|
||||
[:td vendor-name]
|
||||
[:td numeric-code]
|
||||
[:td (format "%.1f%%" (* 100 (double score)))]]))]]
|
||||
|
||||
Reference in New Issue
Block a user