Minor refactoring to simplify consumer. May be better to use macro.

This commit is contained in:
2022-07-20 06:27:21 -07:00
parent 9b5b7bef53
commit 86aaa4a933
5 changed files with 119 additions and 131 deletions

View File

@@ -101,14 +101,6 @@
[upload-replacement-button {:on-change on-change} "Upload signature"]]]))
])))
(re-frame/reg-sub
::can-submit
:<- [::new-client-request]
(fn [_ _]
true
#_(s/valid? ::entity/client r)))
(re-frame/reg-sub
::new-client-request
:<- [::forms/form ::form]
@@ -749,8 +741,7 @@
^{:key (or (:id new-client)
"new")}
[form-builder/builder {:can-submit [::can-submit]
:submit-event [::save-new-client ]
[form-builder/builder {:submit-event [::save-new-client ]
:id ::form
:fullwidth? false}

View File

@@ -57,7 +57,6 @@
(- (:total (:original data)) (:outstanding-balance (:original data))))
account-total (reduce + 0 (map :amount (:expense-accounts data)))]
(and
(m/validate schema data)
(or (not min-total) (>= (:total data) min-total))
(or (not (:id data))
(dollars= (Math/abs (:total data)) (Math/abs account-total)))))))
@@ -440,6 +439,7 @@
(list
^{:key (str id "-check")} [:a.dropdown-item {:on-click (dispatch-event [::save-requested [::add-and-print id :check]])} "Print checks from " name]
^{:key (str id "-debit")} [:a.dropdown-item {:on-click (dispatch-event [::save-requested [::add-and-print id :debit]])} "Debit from " name]))))]]])
[:div.column
[form-builder/submit-button {:class ["is-fullwidth"]}
"Save"]]]])])