showing matched rule.

This commit is contained in:
Bryce Covert
2019-05-16 08:34:12 -07:00
parent ac5ffd26fe
commit 8845ec9688
7 changed files with 37 additions and 17 deletions

View File

@@ -90,6 +90,7 @@
(let [results (->> (d/pull-many db '[* {:transaction/client [:client/name :db/id :client/code]
:transaction/bank-account [:bank-account/name :bank-account/code :bank-account/yodlee-account-id :db/id]
:transaction/vendor [:db/id :vendor/name]
:transaction/matched-rule [:db/id :transaction-rule/note]
:transaction/accounts [:transaction-account/amount
:db/id
:transaction-account/location
@@ -117,6 +118,7 @@
'[* {:transaction/client [:client/name :db/id :client/code :client/locations]
:transaction/bank-account [:bank-account/name :bank-account/code :bank-account/yodlee-account-id :db/id]
:transaction/vendor [:db/id :vendor/name]
:transaction/matched-rule [:db/id :transaction-rule/note]
:transaction/accounts [:transaction-account/amount
:db/id
:transaction-account/location

View File

@@ -188,7 +188,8 @@
:vendor {:type :vendor}
:bank_account {:type :bank_account}
:date {:type 'String}
:post_date {:type 'String}}}
:post_date {:type 'String}
:matched_rule {:type :transaction_rule}}}
:transaction_rule {:fields {:id {:type :id}
:note {:type 'String}

View File

@@ -151,6 +151,12 @@
false
%))))
(re-frame/reg-sub
::is-admin?
:<- [::user]
(fn [user]
(= "admin" (:user/role user))))
(re-frame/reg-sub
::user
(fn [db]

View File

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

View File

@@ -49,7 +49,8 @@
(-> 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 :transaction-approval-status
:matched-rule])
(assoc :potential-payment-matches potential-payment-matches)
(update :accounts expense-accounts-field/from-graphql (:amount which) locations))))))
@@ -114,7 +115,6 @@
(defn potential-payment-matches-box [{:keys [potential-payment-matches] :as params}]
(println potential-payment-matches)
[:div.box
[:div.columns
[:div.column
@@ -140,10 +140,18 @@
locations @(re-frame/subscribe [::subs/locations-for-client (:id (:client data))])
{:keys [form field raw-field error-notification submit-button ]} transaction-form]
[form {:title "Hello" :edit-completed edit-completed}
[field "Merchant"
[:input.input {:type "text"
:field [:yodlee-merchant :name]
:disabled "disabled"}]]
(when @(re-frame/subscribe [::subs/is-admin?])
[field "Merchant"
[:input.input {:type "text"
:field [:yodlee-merchant :name]
:disabled "disabled"}]])
(when @(re-frame/subscribe [::subs/is-admin?])
[field "Matched Rule"
[:input.input {:type "text"
:field [:matched-rule :note]
:disabled "disabled"}]])
[field "Amount"
[:input.input {:type "text"
:field [:amount]

View File

@@ -7,11 +7,12 @@
[auto-ap.datomic :refer [uri]]))
(defn wrap-setup
[f]
(d/create-database uri)
(m/-main false)
(f)
(d/release (d/connect uri))
(d/delete-database uri))
(with-redefs [auto-ap.datomic/uri "datomic:mem://datomic-transactor:4334/invoice"]
(d/create-database uri)
(m/-main false)
(f)
(d/release (d/connect uri))
(d/delete-database uri)))
(use-fixtures :each wrap-setup)
(deftest ledger-page

View File

@@ -8,11 +8,12 @@
(defn wrap-setup
[f]
(d/create-database uri)
(m/-main false)
(f)
(d/release (d/connect uri))
(d/delete-database uri))
(with-redefs [auto-ap.datomic/uri "datomic:mem://datomic-transactor:4334/invoice"]
(d/create-database uri)
(m/-main false)
(f)
(d/release (d/connect uri))
(d/delete-database uri)))
(t/use-fixtures :each wrap-setup)