can hide.
This commit is contained in:
@@ -86,8 +86,8 @@
|
||||
(fn [{:keys [visible?]} & children]
|
||||
[css-transition-group {:in visible? :class-names {:exitDone "bounce animated" :exit "fadeOutRight animated" :enter "fadeInRight animated"} :timeout 300 :onEnter (fn [] (reset! final-state true )) :onExited (fn [] (reset! final-state false))}
|
||||
(if (or @final-state visible?)
|
||||
[:aside {:class "column is-3 aside menu hero is-fullheight" :style {:height "100vh" :overflow "auto"}}
|
||||
[:div.sub-main {:style {:padding-bottom "80px"}}children ]]
|
||||
[:aside {:class "column is-3 aside menu" :style {:height "calc(100vh - 46px)" :overflow "auto"}}
|
||||
[:div.sub-main {} children ]]
|
||||
[:div])])))
|
||||
|
||||
(defn side-bar-layout [{:keys [side-bar main ap bottom right-side-bar right-side-bar-visible?]}]
|
||||
@@ -95,12 +95,12 @@
|
||||
client @(re-frame/subscribe [::subs/client])]
|
||||
[:div
|
||||
[navbar ap]
|
||||
[:div {:class "columns has-shadow", :style {:margin-bottom "0px" :height "100vh"} :id "mail-app" }
|
||||
[:div {:class "columns has-shadow", :style {:margin-bottom "0px" :height "calc(100vh - 46px)" } :id "mail-app" }
|
||||
[:aside {:class "column aside menu is-2 " }
|
||||
[:div.main.left-nav
|
||||
[:div side-bar
|
||||
]]]
|
||||
[:div {:class "column messages hero is-fullheight " :style { :overflow "auto" }, :id "message-feed"}
|
||||
[:div {:class "column messages hero " :style { :overflow "auto" }, :id "message-feed"}
|
||||
^{:key (str "active-page-" (:name client))}
|
||||
[:div.inbox-messages main]]
|
||||
[appearing-side-bar {:visible? right-side-bar-visible?} right-side-bar]]
|
||||
|
||||
@@ -37,6 +37,14 @@
|
||||
(defn stop-form [db form]
|
||||
(update db ::forms dissoc form))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::form-closing
|
||||
(fn [db [_ f]]
|
||||
|
||||
(-> db
|
||||
(assoc-in [:admin :adding-client?] false)
|
||||
(stop-form f))))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::new
|
||||
(fn [db [_ client-id]]
|
||||
@@ -99,6 +107,7 @@
|
||||
:on-error [::save-error]}}
|
||||
{:db new-client-form}))))
|
||||
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::save-complete
|
||||
(fn [db [_ client]]
|
||||
@@ -185,183 +194,188 @@
|
||||
[clients-table]])])
|
||||
|
||||
|
||||
(defn side-bar-form [_ children]
|
||||
[:div [:a.delete.is-pulled-right {:on-click (dispatch-event [::form-closing ::new-client])}] [:div children]])
|
||||
|
||||
(defn new-client-form []
|
||||
(let [{error :error new-client :data } @(re-frame/subscribe [::form ::new-client])]
|
||||
[:form
|
||||
[:h1.title.is-2 "Add client"]
|
||||
[:div.field
|
||||
[:label.label "Name"]
|
||||
[:div.control
|
||||
[bind-field
|
||||
[:input.input {:type "text"
|
||||
:field :name
|
||||
:spec ::entity/name
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]
|
||||
|
||||
[:div.field
|
||||
[:label.label "Client code"]
|
||||
[:div.control
|
||||
[bind-field
|
||||
[:input.input {:type "code"
|
||||
:field :code
|
||||
:spec ::entity/code
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]
|
||||
|
||||
[:div.field
|
||||
[:label.label "Email"]
|
||||
[:div.control
|
||||
[bind-field
|
||||
[:input.input {:type "email"
|
||||
:field :email
|
||||
:spec ::entity/email
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]
|
||||
|
||||
[:div.field
|
||||
[:label.label "Locations"]
|
||||
[:div.control
|
||||
[:div.field.has-addons
|
||||
[:p.control
|
||||
[bind-field
|
||||
[:input.input {:type "text"
|
||||
:field :location
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]
|
||||
[:p.control [:button.button.is-primary {:on-click (dispatch-event [::add-new-location])} "Add"]]]
|
||||
[:ul
|
||||
(for [location (:locations new-client)]
|
||||
^{:key location} [:li location ])]]]
|
||||
|
||||
[:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
|
||||
[:h2.subtitle "Address"]
|
||||
[address-field {:field [:address]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]
|
||||
|
||||
[:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em" :background "hsl(0, 0%, 96%)"}}
|
||||
[:h2.subtitle "Add bank account"]
|
||||
[:label.label "General"]
|
||||
[horizontal-field
|
||||
nil
|
||||
|
||||
[side-bar-form {}
|
||||
[:form
|
||||
[:h1.title.is-2 "Add client"]
|
||||
[:div.field
|
||||
[:label.label "Name"]
|
||||
[:div.control
|
||||
[:p.help "Account Code"]
|
||||
[:div.field.has-addons.is-extended
|
||||
[:p.control [:a.button.is-static (:code new-client) "-" ]]
|
||||
[bind-field
|
||||
[:input.input {:type "text"
|
||||
:field :name
|
||||
:spec ::entity/name
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]
|
||||
|
||||
[:div.field
|
||||
[:label.label "Client code"]
|
||||
[:div.control
|
||||
[bind-field
|
||||
[:input.input {:type "code"
|
||||
:field :code
|
||||
:spec ::entity/code
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]
|
||||
|
||||
[:div.field
|
||||
[:label.label "Email"]
|
||||
[:div.control
|
||||
[bind-field
|
||||
[:input.input {:type "email"
|
||||
:field :email
|
||||
:spec ::entity/email
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]
|
||||
|
||||
[:div.field
|
||||
[:label.label "Locations"]
|
||||
[:div.control
|
||||
[:div.field.has-addons
|
||||
[:p.control
|
||||
[bind-field
|
||||
[:input.input {:type "code"
|
||||
:field [:new-account :code]
|
||||
:spec ::entity/code
|
||||
[:input.input {:type "text"
|
||||
:field :location
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]]
|
||||
|
||||
[:div.control
|
||||
[:p.help "Nickname"]
|
||||
[bind-field
|
||||
[:input.input {:placeholder "BOA Checking #1"
|
||||
:type "text"
|
||||
:field [:new-account :name]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]
|
||||
|
||||
[:label.label "Bank"]
|
||||
[horizontal-field
|
||||
nil
|
||||
[:div.control
|
||||
[:p.help "Bank Name"]
|
||||
[bind-field
|
||||
[:input.input {:placeholder "Bank of America"
|
||||
:type "text"
|
||||
:field [:new-account :bank-name]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]
|
||||
[:div.control
|
||||
[:p.help "Routing #"]
|
||||
[bind-field
|
||||
[:input.input {:placeholder "104819123"
|
||||
:type "text"
|
||||
:field [:new-account :routing]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]
|
||||
[:div.control
|
||||
[:p.help "Bank code"]
|
||||
[bind-field
|
||||
[:input.input {:placeholder "12/10123"
|
||||
:type "text"
|
||||
:field [:new-account :bank-code]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]
|
||||
|
||||
[:label.label "Checking account"]
|
||||
[horizontal-field
|
||||
nil
|
||||
[:div.control
|
||||
[:p.help "Account #"]
|
||||
[bind-field
|
||||
[:input.input {:placeholder "123456789"
|
||||
:type "text"
|
||||
:field [:new-account :number]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]
|
||||
[:div.control
|
||||
[:p.help "Check Number"]
|
||||
[bind-field
|
||||
[:input.input {:placeholder "10000"
|
||||
:type "text"
|
||||
:field [:new-account :check-number]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]
|
||||
|
||||
[:div.field
|
||||
[:label.label "Yodlee Account"]
|
||||
[:div.control
|
||||
[bind-field
|
||||
[:input.input {:placeholder "Yodlee Account #"
|
||||
:type "text"
|
||||
:field [:new-account :yodlee-account-id]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]
|
||||
]
|
||||
[:div.field
|
||||
[:div.control
|
||||
#_(println (s/explain-data ::entity/bank-account (:new-account new-client)))
|
||||
[:button.button.is-primary {:disabled (if (and (doto (s/valid? ::entity/bank-account (:new-account new-client)) println)
|
||||
(not ((set (map :code (:new-bank-accounts new-client)))
|
||||
(str (:code new-client) "-" (-> new-client :new-account :code)))))
|
||||
""
|
||||
"disabled")
|
||||
:on-click (dispatch-event [::add-new-bank-account])} "Add"]]]]
|
||||
|
||||
[:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
|
||||
[:h2.subtitle "Bank Accounts"]
|
||||
[:div.field
|
||||
nil
|
||||
[:div.control
|
||||
:subscription new-client}]]]
|
||||
[:p.control [:button.button.is-primary {:on-click (dispatch-event [::add-new-location])} "Add"]]]
|
||||
[:ul
|
||||
|
||||
(for [{:keys [code name number check-number id]} (:bank-accounts new-client)]
|
||||
(if id
|
||||
^{:key code}
|
||||
[:li code ": " name]
|
||||
^{:key code}
|
||||
[:li [:strong "* " code ": " name] [:button.button {:on-click (dispatch-event [::remove-new-bank-account code])} [:span.icon [:i.fa.fa-times]]]]))
|
||||
(for [[index {:keys [name code number check-number]}] (map vector (range) (:new-bank-accounts new-client))]
|
||||
^{:key index} [:li [:strong "* " code ": " name] [:button.button {:on-click (dispatch-event [::remove-new-bank-account index])} [:span.icon [:i.fa.fa-times]]]])]]]]
|
||||
|
||||
#_(when (:saving? new-client) [:div.is-overlay {:style {"backgroundColor" "rgba(150,150,150, 0.5)"}}])
|
||||
#_(println (s/explain-data ::entity/client new-client))
|
||||
(for [location (:locations new-client)]
|
||||
^{:key location} [:li location ])]]]
|
||||
|
||||
(when error
|
||||
[:div.notification.is-warning.animated.fadeInUp
|
||||
error])
|
||||
|
||||
[:submit.button.is-large.is-primary {:disabled (if (s/valid? ::entity/client new-client)
|
||||
""
|
||||
"disabled")
|
||||
:on-click (dispatch-event [::save-new-client])
|
||||
:class (str @(re-frame/subscribe [::loading-class ::new-client]) (when error " animated shake"))} "Save"]]))
|
||||
[:div {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
|
||||
[:h2.subtitle "Address"]
|
||||
[address-field {:field [:address]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]
|
||||
|
||||
[:h2.subtitle "Add bank account"]
|
||||
[:div {:style {:padding-bottom "0.75em" :padding-top "0.75em" :background "hsl(0, 0%, 96%)"}}
|
||||
[:label.label "General"]
|
||||
[horizontal-field
|
||||
nil
|
||||
[:div.control
|
||||
[:p.help "Account Code"]
|
||||
[:div.field.has-addons.is-extended
|
||||
[:p.control [:a.button.is-static (:code new-client) "-" ]]
|
||||
[:p.control
|
||||
[bind-field
|
||||
[:input.input {:type "code"
|
||||
:field [:new-account :code]
|
||||
:spec ::entity/code
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]]
|
||||
|
||||
[:div.control
|
||||
[:p.help "Nickname"]
|
||||
[bind-field
|
||||
[:input.input {:placeholder "BOA Checking #1"
|
||||
:type "text"
|
||||
:field [:new-account :name]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]
|
||||
|
||||
[:label.label "Bank"]
|
||||
[horizontal-field
|
||||
nil
|
||||
[:div.control
|
||||
[:p.help "Bank Name"]
|
||||
[bind-field
|
||||
[:input.input {:placeholder "Bank of America"
|
||||
:type "text"
|
||||
:field [:new-account :bank-name]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]
|
||||
[:div.control
|
||||
[:p.help "Routing #"]
|
||||
[bind-field
|
||||
[:input.input {:placeholder "104819123"
|
||||
:type "text"
|
||||
:field [:new-account :routing]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]
|
||||
[:div.control
|
||||
[:p.help "Bank code"]
|
||||
[bind-field
|
||||
[:input.input {:placeholder "12/10123"
|
||||
:type "text"
|
||||
:field [:new-account :bank-code]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]
|
||||
|
||||
[:label.label "Checking account"]
|
||||
[horizontal-field
|
||||
nil
|
||||
[:div.control
|
||||
[:p.help "Account #"]
|
||||
[bind-field
|
||||
[:input.input {:placeholder "123456789"
|
||||
:type "text"
|
||||
:field [:new-account :number]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]
|
||||
[:div.control
|
||||
[:p.help "Check Number"]
|
||||
[bind-field
|
||||
[:input.input {:placeholder "10000"
|
||||
:type "text"
|
||||
:field [:new-account :check-number]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]]
|
||||
|
||||
[:div.field
|
||||
[:label.label "Yodlee Account"]
|
||||
[:div.control
|
||||
[bind-field
|
||||
[:input.input {:placeholder "Yodlee Account #"
|
||||
:type "text"
|
||||
:field [:new-account :yodlee-account-id]
|
||||
:event ::change-new
|
||||
:subscription new-client}]]]
|
||||
]
|
||||
[:div.field
|
||||
[:div.control
|
||||
#_(println (s/explain-data ::entity/bank-account (:new-account new-client)))
|
||||
[:button.button.is-primary {:disabled (if (and (doto (s/valid? ::entity/bank-account (:new-account new-client)) println)
|
||||
(not ((set (map :code (:new-bank-accounts new-client)))
|
||||
(str (:code new-client) "-" (-> new-client :new-account :code)))))
|
||||
""
|
||||
"disabled")
|
||||
:on-click (dispatch-event [::add-new-bank-account])} "Add"]]]]
|
||||
|
||||
[:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
|
||||
[:h2.subtitle "Bank Accounts"]
|
||||
[:div.field
|
||||
nil
|
||||
[:div.control
|
||||
[:ul
|
||||
|
||||
(for [{:keys [code name number check-number id]} (:bank-accounts new-client)]
|
||||
(if id
|
||||
^{:key code}
|
||||
[:li code ": " name]
|
||||
^{:key code}
|
||||
[:li [:strong "* " code ": " name] [:button.button {:on-click (dispatch-event [::remove-new-bank-account code])} [:span.icon [:i.fa.fa-times]]]]))
|
||||
(for [[index {:keys [name code number check-number]}] (map vector (range) (:new-bank-accounts new-client))]
|
||||
^{:key index} [:li [:strong "* " code ": " name] [:button.button {:on-click (dispatch-event [::remove-new-bank-account index])} [:span.icon [:i.fa.fa-times]]]])]]]]
|
||||
|
||||
#_(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])
|
||||
|
||||
[:submit.button.is-large.is-primary {:disabled (if (s/valid? ::entity/client new-client)
|
||||
""
|
||||
"disabled")
|
||||
:on-click (dispatch-event [::save-new-client])
|
||||
:class (str @(re-frame/subscribe [::loading-class ::new-client]) (when error " animated shake"))} "Save"]]]))
|
||||
|
||||
(defn admin-clients-page []
|
||||
(let [{:keys [adding-client?]} @(re-frame/subscribe [::subs/admin])]
|
||||
|
||||
Reference in New Issue
Block a user