adding new clients improvement more.

This commit is contained in:
Bryce Covert
2019-02-16 18:35:44 -08:00
parent 193a46e12c
commit b697107a7f
7 changed files with 10700 additions and 176 deletions

View File

@@ -90,7 +90,7 @@
(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?)
[:div.aside
[:aside {:class "column is-4 aside menu hero is-fullheight"}
[:div.sub-main children]]
[:div])])))
@@ -100,10 +100,10 @@
[:div
[navbar ap]
[:div {:class "columns ", :id "mail-app"}
[:aside {:class "column is-narrow aside menu hero is-fullheight"}
[:aside {:class "column aside menu hero is-2"}
[:div.main.left-nav
side-bar]]
[:div {:class "column messages hero is-fullheight", :id "message-feed"}
[:div {:class "column messages hero is-fullheight ", :id "message-feed"}
^{:key (str "active-page-" (:name client))}
[:div.inbox-messages main]]
[appearing-side-bar {:visible? right-side-bar-visible?} right-side-bar]]

View File

@@ -372,181 +372,180 @@
(defn new-client-form []
(let [new-client (:new-client @(re-frame/subscribe [::subs/admin]))
error (:error (:client @(re-frame/subscribe [::subs/admin])))]
[:div
[:form
[:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
[:h1.title "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}]]]]
[:form
[:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
[: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 "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 "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 ])]]]
[: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
[: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-new-bank-account])} "Add"]]]]
[: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"}}
[:h2.subtitle "Bank Accounts"]
[:div.field
nil
[:div.control
[:ul
(for [{:keys [code name number check-number id]} (:bank-accounts new-client)]
^{:key id} [:li code ": " name])
(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))
[: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
[: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-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)]
^{:key id} [:li code ": " name])
(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 ::save-client]) (when error " animated shake"))} "Save"]]]))
(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 ::save-client]) (when error " animated shake"))} "Save"]]))
(defn admin-clients-page []
(let [{:keys [adding-client?]} @(re-frame/subscribe [::subs/admin])]