form improvements.

This commit is contained in:
Bryce Covert
2019-05-17 16:22:29 -07:00
parent c56e5372e4
commit 598c58a6bd

View File

@@ -104,7 +104,10 @@
:dom-gte nil
:vendor nil
:transaction-approval-status :unapproved
:accounts [])))))
:accounts [{:id (str "new-" (random-uuid))
:amount-mode "%"
:amount-percentage 100
:location nil}])))))
(re-frame/reg-event-db
::editing
@@ -132,7 +135,17 @@
::changed
(forms/change-handler ::form
(fn [data field value]
[])))
(cond (and (= [:vendor] field)
value
(doto (expense-accounts-field/can-replace-with-default? (:accounts data))
println))
[[:accounts] (expense-accounts-field/default-account (:accounts data)
@(re-frame/subscribe [::subs/vendor-default-account value])
(:total data)
[])]
:else
[]))))
(re-frame/reg-event-fx
::saving
@@ -192,6 +205,7 @@
[form (assoc params :title "New Transaction Rule")
[field "Note"
[:input.input {:type "text"
:auto-focus true
:field [:note]
:spec ::entity/note}]]
@@ -199,14 +213,12 @@
[typeahead-entity {:matches @(re-frame/subscribe [::subs/clients])
:match->text :name
:type "typeahead-entity"
:auto-focus (if @(re-frame/subscribe [::subs/client]) false true)
:field [:client]
:spec ::entity/client}]]
[field "Bank account"
[typeahead-entity {:matches @(re-frame/subscribe [::subs/real-bank-accounts-for-client (:client data)])
:match->text :name
:auto-focus (if @(re-frame/subscribe [::subs/client]) true false)
:type "typeahead-entity"
:field [:bank-account]
:spec ::entity/bank-account}]]
@@ -270,7 +282,6 @@
[typeahead-entity {:matches @(re-frame/subscribe [::subs/vendors])
:match->text :name
:type "typeahead-entity"
:auto-focus (if @(re-frame/subscribe [::subs/vendors]) false true)
:field [:vendor]
:spec ::entity/vendor}]]