Adding transaction approval status to transaction page

This commit is contained in:
Bryce Covert
2019-05-17 07:14:16 -07:00
parent d0b5772d94
commit a87d22c320
9 changed files with 71 additions and 26 deletions

View File

@@ -5,6 +5,7 @@
:amount
:location
:exclude-from-ledger
:approval-status
[:matched-rule [:note :id]]
[:vendor [:name :id]]
[:accounts [:id :amount :location [:account [:name :id :location :numeric-code]]]]

View File

@@ -3,6 +3,7 @@
[auto-ap.subs :as subs]
[auto-ap.views.components.layouts :as layouts]
[auto-ap.views.components.typeahead :refer [typeahead typeahead-entity]]
[auto-ap.views.components.button-radio :refer [button-radio]]
[auto-ap.views.components.expense-accounts-field :refer [expense-accounts-field] :as expense-accounts-field]
[auto-ap.views.pages.transactions.common :refer [transaction-read]]
[auto-ap.views.utils :refer [bind-field dispatch-event with-user]]
@@ -14,7 +15,7 @@
(re-frame/reg-sub
::submit-query
:<- [::forms/form ::form]
(fn [{{:keys [id vendor accounts exclude-from-ledger]} :data}]
(fn [{{:keys [id vendor accounts exclude-from-ledger approval-status]} :data}]
{:venia/operation {:operation/type :mutation
:operation/name "EditTransaction"}
:venia/queries [{:query/data
@@ -22,6 +23,7 @@
{:transaction {:id id
:vendor-id (:id vendor)
:exclude-from-ledger exclude-from-ledger
:approval-status approval-status
:accounts (map
(fn [{:keys [id account amount location]}]
{:id (when-not (str/starts-with? id "new-")
@@ -49,7 +51,7 @@
(-> which
(select-keys [:vendor :amount :payment :client :description-original
:yodlee-merchant :id :potential-payment-matches
:exclude-from-ledger :location :accounts :transaction-approval-status
:exclude-from-ledger :location :accounts :approval-status
:matched-rule])
(assoc :potential-payment-matches (if (:matched-rule which)
nil
@@ -249,6 +251,22 @@
:field [:exclude-from-ledger]}]]
" Exclude from ledger"]]
[field "Include in ledger"
[button-radio
{:type "button-radio"
:field [:exclude-from-ledger]
:options [[true "Exclude from Ledger"]
[false "Include in Ledger"]
]}]]
[field "Approval Status"
[button-radio
{:type "button-radio"
:field [:approval-status]
:options [[:unapproved "Unapproved"]
[:requires-feedback "Client Review"]
[:approved "Approved"]]}]]
[:hr]
[error-notification]