customized transactions.
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
|
||||
(defn admin-accounts-content []
|
||||
[:div
|
||||
(let [accounts @(re-frame/subscribe [::subs/accounts])]
|
||||
(let [accounts @(re-frame/subscribe [::subs/all-accounts])]
|
||||
[:div
|
||||
[:h1.title "Accounts"]
|
||||
[:div.is-pulled-right
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
form @(re-frame/subscribe [::forms/form ::excel-import])
|
||||
|
||||
|
||||
chooseable-expense-accounts @(re-frame/subscribe [::subs/chooseable-expense-accounts])
|
||||
chooseable-expense-accounts @(re-frame/subscribe [::subs/all-accounts])
|
||||
change-event [::all-events/change-form [::expense-accounts]]]
|
||||
(println form)
|
||||
[:div
|
||||
|
||||
@@ -135,23 +135,26 @@
|
||||
(re-frame/reg-event-db
|
||||
::editing
|
||||
(fn [db [_ which]]
|
||||
(-> db (forms/start-form ::form (-> which
|
||||
(select-keys [:description
|
||||
:id
|
||||
:client
|
||||
:bank-account
|
||||
:note
|
||||
:amount-lte
|
||||
:amount-gte
|
||||
:dom-lte
|
||||
:dom-gte
|
||||
:vendor
|
||||
:accounts
|
||||
:yodlee-merchant
|
||||
:transaction-approval-status])
|
||||
(update :accounts (fn [xs]
|
||||
(mapv #(assoc % :amount-percentage (* (:percentage %) 100.0))
|
||||
xs))))))))
|
||||
(let [accounts-by-id @(re-frame/subscribe [::subs/accounts-by-id (:client which)])]
|
||||
(-> db (forms/start-form ::form (-> which
|
||||
(select-keys [:description
|
||||
:id
|
||||
:client
|
||||
:bank-account
|
||||
:note
|
||||
:amount-lte
|
||||
:amount-gte
|
||||
:dom-lte
|
||||
:dom-gte
|
||||
:vendor
|
||||
:accounts
|
||||
:yodlee-merchant
|
||||
:transaction-approval-status])
|
||||
(update :accounts (fn [xs]
|
||||
(mapv #(-> %
|
||||
(assoc :amount-percentage (* (:percentage %) 100.0))
|
||||
(update :account (fn [a] (accounts-by-id (:id a)))))
|
||||
xs)))))))))
|
||||
|
||||
|
||||
(re-frame/reg-event-db
|
||||
@@ -219,9 +222,7 @@
|
||||
(let [{:keys [data active? error id]} @(re-frame/subscribe [::forms/form ::form])
|
||||
{:keys [form field raw-field error-notification submit-button ]} rule-form
|
||||
default-note @(re-frame/subscribe [::default-note])
|
||||
exists? (:id data)
|
||||
chooseable-expense-accounts @(re-frame/subscribe [::subs/chooseable-expense-accounts])
|
||||
accounts-by-id @(re-frame/subscribe [::subs/accounts-for-client-by-id])]
|
||||
exists? (:id data)]
|
||||
^{:key id}
|
||||
[form (assoc params :title "New Transaction Rule")
|
||||
|
||||
@@ -307,6 +308,7 @@
|
||||
[expense-accounts-field {:type "expense-accounts"
|
||||
:descriptor "account asssignment"
|
||||
:percentage-only? true
|
||||
:client (:client data)
|
||||
:locations (into ["Shared"] @(re-frame/subscribe [::subs/locations-for-client-or-bank-account (:id (:client data)) (:id (:bank-account data))]))
|
||||
:max 100
|
||||
:field [:accounts]}]]
|
||||
|
||||
Reference in New Issue
Block a user