started adjusting the transaction form to support splits.

This commit is contained in:
Bryce Covert
2019-04-17 12:08:10 -07:00
parent d30b0948d4
commit 0081d0aaed
4 changed files with 23 additions and 38 deletions

View File

@@ -139,13 +139,10 @@
::change-vendor
[(forms/in-form ::form)]
(fn [{{:keys [data]} :db} [_ location field value]]
(println "data" data)
(let [has-only-one-expense-account? (and value
(or (not (seq (:expense-accounts data)))
(<= 1 (count (:expense-accounts data))))
(not (get-in data [:expense-accounts 0 :account :id])))]
(println "has only one?" has-only-one-expense-account?)
(if has-only-one-expense-account?
{:dispatch [::forms/change ::form
field value
@@ -296,6 +293,7 @@
[bind-field
[expense-accounts-field {:subscription data
:type "expense-accounts"
:descriptor "expense account"
:event change-event
:locations locations
:max-value (:total data)