Supports editing the approval status.

This commit is contained in:
Bryce Covert
2019-05-14 09:06:58 -07:00
parent 76c903d16d
commit 66fd9a87bc
7 changed files with 68 additions and 14 deletions

View File

@@ -7,6 +7,7 @@
:amount-lte
:dom-gte
:dom-lte
:transaction-approval-status
[:vendor [:name :id]]
[:client [:name :id]]
[:bank-account [:name :id]]

View File

@@ -35,6 +35,7 @@
{:transaction-rule (-> data
(select-keys [:id
:description
:transaction-approval-status
:amount-lte
:amount-gte
:dom-lte
@@ -115,7 +116,8 @@
:dom-lte
:dom-gte
:vendor
:accounts])
:accounts
:transaction-approval-status])
(update :accounts (fn [xs]
(println xs)
(mapv #(assoc % :amount-percentage (* (:percentage %) 100.0))
@@ -173,6 +175,17 @@
:submit-event [::saving ]
:id ::form}))
(defn button-radio [{:keys [options on-change value]}]
[:div.control
[:div.field.has-addons
(for [[k v] options]
^{:key k}
[:p.control
[:a.button {:class (if (= value k)
"is-primary"
"")
:on-click (fn [] (on-change k))} v]])]])
(defn form [{:keys [can-change-amount?] :as params}]
[layouts/side-bar {:on-close (dispatch-event [::forms/form-closing ::form ])}
(let [{:keys [data active? error id]} @(re-frame/subscribe [::forms/form ::form])
@@ -268,7 +281,17 @@
:max 100
:field [:accounts]}]]
[field "Approval Status"
[button-radio
{:type "button-radio"
:field [:transaction-approval-status]
:options [[:unapproved "Unapproved"]
[:requires-feedback "Client Review"]
[:approved "Approved"]
]}]]
[:div.is-divider]
[error-notification]
[:div.columns