Adding new clients works

This commit is contained in:
BC
2019-02-18 09:38:42 -08:00
parent b8dffa45d6
commit 9734b3a490

View File

@@ -123,7 +123,7 @@
(-> db
(stop-form ::new-client)
(assoc-in [:admin :adding-client?] false)
(assoc-in [:clients (:id (:edit-client client))] (:edit-client client)))))
(assoc-in [:clients (:id (:edit-client client))] (update (:edit-client client) :bank-accounts (fn [bas] (->> bas (sort-by :sort-order) vec)))))))
(re-frame/reg-event-db
::save-error
@@ -390,13 +390,17 @@
[:div.field
[:p.help "Client code"]
[:div.control
[bind-field
[:input.input {:type "code"
:field :code
:spec ::entity/code
:event ::change-new
:subscription new-client}]]]]
(if (:id new-client)
[:div.control
(:code new-client)
]
[:div.control
[bind-field
[:input.input {:type "code"
:field :code
:spec ::entity/code
:event ::change-new
:subscription new-client}]]])]
[:div.field
[:p.help "Email"]
@@ -441,19 +445,12 @@
[:a.button.is-primary.is-outlined.is-fullwidth {:on-click (dispatch-event [::add-new-bank-account :cash])} "Add Cash Account"]]]
#_[:h2.subtitle "Add bank account"]
#_(when (:saving? new-client) [:div.is-overlay {:style {"backgroundColor" "rgba(150,150,150, 0.5)"}}])
#_(println (s/explain-data ::entity/client new-client))
(when error
[:div.notification.is-warning.animated.fadeInUp
error])
(println (s/explain-data ::entity/client @(re-frame/subscribe [::new-client-request])))
[:submit.button.is-large.is-primary {:disabled (if (s/valid? ::entity/client @(re-frame/subscribe [::new-client-request]))
""
"disabled")