added support for merging vendors.
This commit is contained in:
@@ -21,35 +21,26 @@
|
||||
[:footer.modal-card-foot
|
||||
foot])]])
|
||||
|
||||
(defn action-modal [{:keys [title action-text id save-event can-submit?] :or {can-submit? true}} & rest]
|
||||
(let [{:keys [visible? saving? error-message]} @(re-frame/subscribe [::subs/modal-state id])]
|
||||
(defn action-modal [{:keys [title action-text id save-event can-submit? status-from] :or {can-submit? true}} & rest]
|
||||
(let [{:keys [visible? saving? error-message]} @(re-frame/subscribe [::subs/modal-state id status-from])]
|
||||
(when visible?
|
||||
(-> [modal {:title [:span title
|
||||
[:form {:id id
|
||||
:on-submit (fn [e]
|
||||
(.preventDefault e)
|
||||
(re-frame/dispatch [::events/modal-status id {:saving? true :error-message nil}])
|
||||
(re-frame/dispatch save-event))}
|
||||
(-> [modal {:title [:span title]
|
||||
:foot [:input.button.is-primary (cond-> {:type "submit"
|
||||
:form id
|
||||
:class (when saving?
|
||||
"is-loading")
|
||||
:value action-text}
|
||||
saving? (assoc :disabled "disabled")
|
||||
(not can-submit?) (assoc :disabled "disabled"))
|
||||
]
|
||||
:foot [:input.button.is-primary {:type "submit"
|
||||
:tabindex "1"
|
||||
:form id
|
||||
:disabled (cond saving?
|
||||
"disabled"
|
||||
|
||||
(not can-submit?)
|
||||
"disabled"
|
||||
|
||||
:else
|
||||
"")
|
||||
:class (when saving?
|
||||
"is-loading")
|
||||
:value action-text}
|
||||
]
|
||||
:id id
|
||||
:hide-event [::events/modal-status id {:visible? false}]}
|
||||
(into [:form {:id id
|
||||
:on-submit (fn [e]
|
||||
(.preventDefault e)
|
||||
(re-frame/dispatch [::events/modal-status id {:saving? true :error-message nil}])
|
||||
(re-frame/dispatch save-event))}
|
||||
(when error-message
|
||||
[:div.notification.is-warning error-message])]
|
||||
|
||||
(r/children (r/current-component)) )]
|
||||
(into [(when saving? [:div.is-overlay {:style {"backgroundColor" "rgba(150,150,150, 0.5)"}}])])))))
|
||||
:id id
|
||||
:hide-event [::events/modal-status id {:visible? false}]}
|
||||
(when error-message
|
||||
[:div.notification.is-warning error-message])]
|
||||
(into (r/children (r/current-component)))
|
||||
(into [(when saving? [:div.is-overlay {:style {"backgroundColor" "rgba(150,150,150, 0.5)"}}])]))])))
|
||||
|
||||
Reference in New Issue
Block a user