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