adding new invoices has validation.

This commit is contained in:
Bryce Covert
2018-05-23 12:16:18 -07:00
parent 0611c169c7
commit a0007c2bbc
4 changed files with 15 additions and 6 deletions

View File

@@ -21,13 +21,21 @@
[:footer.modal-card-foot
foot])]])
(defn action-modal [{:keys [title action-text id save-event]} & rest]
(defn action-modal [{:keys [title action-text id save-event can-submit?] :or {can-submit? true}} & rest]
(let [{:keys [visible? saving?]} @(re-frame/subscribe [::subs/modal-state id])]
(when visible?
(-> [modal {:title title
:foot [:a.button.is-primary {:on-click (fn []
:foot [:button.button.is-primary {:on-click (fn []
(re-frame/dispatch [::events/modal-status id {:saving? true}])
(re-frame/dispatch save-event))
:disabled (cond saving?
"disabled"
(not can-submit?)
"disabled"
:else
"")
:class (when saving?
"is-loading")}
[:span action-text]]