added ability to remove a transaction rule.
This commit is contained in:
@@ -4,3 +4,8 @@
|
||||
(defn fa-icon [{:keys [event icon class]}]
|
||||
[:a.button {:class class
|
||||
:on-click (dispatch-event event)} [:span.icon [:i.fa {:class icon}]]])
|
||||
|
||||
(defn sl-icon [{:keys [event icon class]}]
|
||||
[:a.button {:class class
|
||||
:on-click (dispatch-event event)}
|
||||
[:span.icon [:span {:class icon :style {:font-weight "400"}}]]])
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
[auto-ap.views.components.vendor-dialog :refer [vendor-dialog]]
|
||||
|
||||
[auto-ap.views.components.vendor-dialog :refer [vendor-dialog]]
|
||||
[auto-ap.views.components.modal :as modal]
|
||||
[auto-ap.entities.vendors :as vendor]
|
||||
[auto-ap.views.components.vendor-dialog :as vendor-dialog]
|
||||
[clojure.string :as str]))
|
||||
@@ -177,6 +178,7 @@
|
||||
client @(re-frame/subscribe [::subs/client])
|
||||
is-initial-loading @(re-frame/subscribe [::subs/is-initial-loading?])]
|
||||
[:div
|
||||
[modal/global-modal]
|
||||
[navbar ap]
|
||||
[:div {:class "columns has-shadow", :style {:margin-bottom "0px" :height "calc(100vh - 46px)" } :id "mail-app" }
|
||||
[:aside {:class "column aside menu is-2 " }
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
[reagent.core :as r]
|
||||
[auto-ap.events :as events]
|
||||
[auto-ap.subs :as subs]
|
||||
[auto-ap.views.utils :refer [with-keys appearing]]))
|
||||
[auto-ap.status :as status]
|
||||
[auto-ap.views.utils :refer [with-keys appearing dispatch-event]]))
|
||||
|
||||
(defn modal [{:keys [title foot hide-event class]} & body]
|
||||
[:div.modal.is-active (cond-> {}
|
||||
@@ -67,3 +68,61 @@
|
||||
(into (r/children (r/current-component)))
|
||||
(into [(when saving? [:div.is-overlay {:style {"backgroundColor" "rgba(150,150,150, 0.5)"}}])])))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::modal-state
|
||||
(fn [db]
|
||||
(::state db)))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::modal-requested
|
||||
(fn [db [_ state]]
|
||||
(assoc db ::state (assoc state :visible? true))))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::modal-closed
|
||||
(fn [{:keys [db]} [_ state]]
|
||||
(let [[_ status-id] (some-> db ::state :confirm :status-from )]
|
||||
(cond-> {:db (dissoc db ::state)}
|
||||
status-id (assoc :dispatch [::status/completed status-id])))))
|
||||
|
||||
|
||||
(defn global-modal []
|
||||
(let [state (re-frame/subscribe [::modal-state])]
|
||||
(fn []
|
||||
(if (:visible? @state)
|
||||
(let [{:keys [title body foot class cancel? confirm]} @state]
|
||||
[:div.modal.is-active (cond-> {}
|
||||
class (assoc :class class))
|
||||
[:div.modal-background {:on-click (dispatch-event [::modal-closed])}]
|
||||
|
||||
[:div.modal-card
|
||||
[:header.modal-card-head
|
||||
[:p.modal-card-title
|
||||
title]
|
||||
[:button.delete {:on-click (dispatch-event [::modal-closed])}]]
|
||||
[:section.modal-card-body
|
||||
body]
|
||||
(let [status (some-> confirm :status-from re-frame/subscribe deref )]
|
||||
(if foot
|
||||
[:footer.modal-card-foot
|
||||
[appearing {:visible? (= :error (:state status))
|
||||
:timeout 200
|
||||
:enter-class "appear"
|
||||
:exit-class "disappear"}
|
||||
[:div.notification.is-warning (:message (first (:error status)))]]
|
||||
foot]
|
||||
[:footer.modal-card-foot
|
||||
[:div
|
||||
[appearing {:visible? (= :error (:state status))
|
||||
:timeout 200
|
||||
:enter-class "appear"
|
||||
:exit-class "disappear"}
|
||||
[:div.notification.is-warning (:message (first (:error status)))]]
|
||||
|
||||
[:div.buttons
|
||||
(when confirm
|
||||
[:button.button.is-danger {:class (status/class-for status)
|
||||
:on-click (:on-click confirm)}
|
||||
(:value confirm)])
|
||||
(when cancel?
|
||||
[:button.button {:on-click (dispatch-event [::modal-closed] )} "Cancel"])]]]))]])))))
|
||||
|
||||
Reference in New Issue
Block a user