lots of improvements.
This commit is contained in:
@@ -132,6 +132,7 @@
|
|||||||
(swap! timeouts dissoc key))
|
(swap! timeouts dissoc key))
|
||||||
time))))
|
time))))
|
||||||
|
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:graphql
|
:graphql
|
||||||
(fn [{:keys [query on-success on-error token variables query-obj]}]
|
(fn [{:keys [query on-success on-error token variables query-obj]}]
|
||||||
|
|||||||
@@ -18,168 +18,140 @@
|
|||||||
[auto-ap.routes :as routes]
|
[auto-ap.routes :as routes]
|
||||||
[bidi.bidi :as bidi]))
|
[bidi.bidi :as bidi]))
|
||||||
|
|
||||||
|
(re-frame/reg-sub
|
||||||
|
::form
|
||||||
|
(fn [db [_ x]]
|
||||||
|
(-> db ::forms x)))
|
||||||
|
|
||||||
|
;; TODO PREVENT DUPLICATES!
|
||||||
|
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
::loading-class
|
::loading-class
|
||||||
(fn [db [_ x]]
|
(fn [db [_ x]]
|
||||||
(if (get-in db [::loading x])
|
(if (= (get-in db [::forms x :status]) "loading")
|
||||||
"is-loading"
|
"is-loading"
|
||||||
"")))
|
"")))
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(defn start-form [db form data]
|
||||||
|
(assoc-in db [::forms form] {:error nil
|
||||||
|
:status nil
|
||||||
|
:data data}))
|
||||||
|
(defn stop-form [db form]
|
||||||
|
(update db ::forms dissoc form))
|
||||||
|
|
||||||
|
(re-frame/reg-event-db
|
||||||
::new
|
::new
|
||||||
(fn [{:keys [db]} [_ client-id]]
|
(fn [db [_ client-id]]
|
||||||
{:db (-> db (assoc-in [:admin :adding-client?] true)
|
(-> db
|
||||||
(assoc-in [:admin :new-client] {:new-account {:type :check}}))}))
|
(assoc-in [:admin :adding-client?] true)
|
||||||
|
(start-form ::new-client (assoc {} :new-account {:type :check})))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::edit-client-clicked
|
::edit-client-clicked
|
||||||
(fn [{:keys [db]} [_ client-id]]
|
(fn [{:keys [db]} [_ client-id]]
|
||||||
{:db (-> db
|
{:db (-> db
|
||||||
(assoc-in [:admin :new-client] (assoc (get (:clients db) client-id) :new-account {:type :check}))
|
(start-form ::new-client (assoc (get (:clients db) client-id) :new-account {:type :check}))
|
||||||
(assoc-in [:admin :adding-client? ] true))}))
|
(assoc-in [:admin :adding-client? ] true))}))
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
|
||||||
::save
|
|
||||||
(fn [{:keys [db]} _]
|
|
||||||
(let [edited-client (-> (:client @(re-frame/subscribe [::subs/admin]))
|
|
||||||
(dissoc :location))]
|
|
||||||
{:db (-> db
|
|
||||||
(assoc-in [::loading ::save-client] true)
|
|
||||||
(assoc-in [:admin :client :error] nil))
|
|
||||||
:graphql
|
|
||||||
{:token (-> db :user)
|
|
||||||
:query-obj {:venia/operation {:operation/type :mutation
|
|
||||||
:operation/name "EditClient"}
|
|
||||||
:venia/queries [{:query/data [:edit-client
|
|
||||||
{:edit-client
|
|
||||||
(-> edited-client
|
|
||||||
(update :bank-accounts #(seq (into % (map (fn [ba] (dissoc ba :is-new?)) (:new-bank-accounts edited-client)))))
|
|
||||||
(dissoc :new-account)
|
|
||||||
(dissoc :new-bank-accounts)
|
|
||||||
)}
|
|
||||||
[:id :name :code :email [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :number :check-number :name :code :bank-code :bank-name :routing]]]]}]}
|
|
||||||
:on-success [::save-complete]
|
|
||||||
:on-error [::save-error]}})))
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::save-new-client
|
::save-new-client
|
||||||
(fn [{:keys [db]} _]
|
[(re-frame/path [::forms ::new-client])]
|
||||||
(let [new-client (-> (:new-client @(re-frame/subscribe [::subs/admin]))
|
(fn [{{new-client-data :data :as new-client-form} :db} _]
|
||||||
(dissoc :location))]
|
|
||||||
(if (s/valid? ::entity/client new-client)
|
|
||||||
|
|
||||||
{:db (-> db (assoc-in [::loading ::save-client] true)
|
(let [new-client-req {:id (:id new-client-data),
|
||||||
(assoc-in [:admin :client :error] nil))
|
:name (:name new-client-data)
|
||||||
|
:code (:code new-client-data) ;; TODO add validation can't change
|
||||||
|
:email (:email new-client-data)
|
||||||
|
:locations (:locations new-client-data)
|
||||||
|
:address {:street1 (:street1 (:address new-client-data))
|
||||||
|
:street2 (:street2 (:address new-client-data)),
|
||||||
|
:city (:city (:address new-client-data))
|
||||||
|
:state (:state (:address new-client-data))
|
||||||
|
:zip (:zip (:address new-client-data))}
|
||||||
|
:bank-accounts (map (fn [{:keys [number name check-number type id code bank-name routing bank-code]}]
|
||||||
|
{:number number
|
||||||
|
:name name
|
||||||
|
:check-number check-number
|
||||||
|
:type type
|
||||||
|
:id id
|
||||||
|
:code (str (:code new-client-data) "-" code)
|
||||||
|
:bank-name bank-name
|
||||||
|
:routing routing
|
||||||
|
:bank-code bank-code})
|
||||||
|
(:bank-accounts new-client-data))}
|
||||||
|
user @(re-frame/subscribe [::subs/token])]
|
||||||
|
(if (s/valid? ::entity/client new-client-req)
|
||||||
|
|
||||||
|
{:db (-> new-client-form
|
||||||
|
(assoc :status :loading)
|
||||||
|
(assoc :error nil))
|
||||||
:graphql
|
:graphql
|
||||||
{:token (-> db :user)
|
{:token user
|
||||||
:query-obj {:venia/operation {:operation/type :mutation
|
:query-obj {:venia/operation {:operation/type :mutation
|
||||||
:operation/name "EditClient"}
|
:operation/name "EditClient"}
|
||||||
:venia/queries [{:query/data [:edit-client
|
:venia/queries [{:query/data [:edit-client
|
||||||
{:edit-client
|
{:edit-client new-client-req}
|
||||||
;; TODO - hard code fields we want
|
[:id :name :code :email :locations [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :number :check-number :name :code :bank-code :bank-name :routing]]]]}]}
|
||||||
(-> new-client
|
|
||||||
(update :bank-accounts #(seq (into % (map (fn [ba] (dissoc ba :is-new?)) (:new-bank-accounts new-client)))))
|
|
||||||
(dissoc :new-account)
|
|
||||||
(dissoc :new-bank-accounts))
|
|
||||||
}
|
|
||||||
[:id :name :code :email [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :number :check-number :name :code :bank-code :bank-name :routing]]]
|
|
||||||
]}]}
|
|
||||||
:on-success [::save-complete]
|
:on-success [::save-complete]
|
||||||
:on-error [::save-error]}}
|
:on-error [::save-error]}}
|
||||||
{:db db}))))
|
{:db new-client-form}))))
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-db
|
||||||
::save-complete
|
::save-complete
|
||||||
(fn [{:keys [db]} [_ client]]
|
(fn [db [_ client]]
|
||||||
|
(-> db
|
||||||
|
(stop-form ::new-client)
|
||||||
{:dispatch [::events/modal-completed :auto-ap.views.pages.admin.clients/edit]
|
(assoc-in [:admin :adding-client?] false)
|
||||||
:db (-> db
|
(assoc-in [:clients (:id (:edit-client client))] (:edit-client client)))))
|
||||||
(assoc-in [:admin :adding-client?] false)
|
|
||||||
(assoc-in [::loading ::save-client] nil)
|
|
||||||
(update :admin dissoc :new-client)
|
|
||||||
|
|
||||||
|
|
||||||
(assoc-in [:admin :client] nil)
|
|
||||||
(assoc-in [:clients (:id (:edit-client client))] (:edit-client client)))}))
|
|
||||||
|
|
||||||
(re-frame/reg-event-db
|
(re-frame/reg-event-db
|
||||||
::save-error
|
::save-error
|
||||||
|
[(re-frame/path [::forms ::new-client])]
|
||||||
(fn [db [_ result]]
|
(fn [db [_ result]]
|
||||||
(-> db
|
(-> db
|
||||||
(assoc-in [::loading ::save-client] false)
|
(assoc :status :error)
|
||||||
(assoc-in [:admin :client :error] (:message (first result))))))
|
(assoc :error (:message (first result))))))
|
||||||
|
|
||||||
(re-frame/reg-event-db
|
|
||||||
::change
|
|
||||||
(fn [db [_ path value]]
|
|
||||||
|
|
||||||
(assoc-in db (concat [:admin :client] path)
|
|
||||||
value)))
|
|
||||||
|
|
||||||
(re-frame/reg-event-db
|
(re-frame/reg-event-db
|
||||||
::change-new
|
::change-new
|
||||||
|
[(re-frame/path [::forms ::new-client :data])]
|
||||||
(fn [db [_ path value]]
|
(fn [db [_ path value]]
|
||||||
|
(println db)
|
||||||
|
(assoc-in db path value)))
|
||||||
|
|
||||||
(assoc-in db (concat [:admin :new-client] path)
|
(re-frame/reg-event-db
|
||||||
value)))
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
|
||||||
::add-location
|
|
||||||
(fn [{:keys [db]} _]
|
|
||||||
(let [client (:client @(re-frame/subscribe [::subs/admin]))]
|
|
||||||
{:db (-> db
|
|
||||||
(update-in [:admin :client :locations] conj (:location client))
|
|
||||||
(update-in [:admin :client] dissoc :location))})))
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
|
||||||
::add-new-location
|
::add-new-location
|
||||||
(fn [{:keys [db]} _]
|
[(re-frame/path [::forms ::new-client :data])]
|
||||||
(let [client (:new-client @(re-frame/subscribe [::subs/admin]))]
|
(fn [client _]
|
||||||
{:db (-> db
|
(-> client
|
||||||
(update-in [:admin :new-client :locations] conj (:location client))
|
(update :locations conj (:location client))
|
||||||
(update-in [:admin :new-client] dissoc :location))})))
|
(dissoc :location))))
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
|
||||||
|
(re-frame/reg-event-db
|
||||||
::add-new-bank-account
|
::add-new-bank-account
|
||||||
(fn [{:keys [db]} _]
|
[(re-frame/path [::forms ::new-client :data])]
|
||||||
(let [client (:client @(re-frame/subscribe [::subs/admin]))
|
(fn [{:keys [new-account] :as client} _]
|
||||||
_ (prn (s/explain-data ::entity/bank-account (:new-account client)))
|
(let [new-account (-> new-account
|
||||||
new-bank-account (:new-account client)
|
(update :check-number #(if (seq %) (js/parseInt %) nil))
|
||||||
new-bank-account (-> new-bank-account
|
(update :yodlee-account-id #(if (seq %) (js/parseInt %) nil)))]
|
||||||
(update :code #(str (:code client) "-" %))
|
(println new-account)
|
||||||
(update :check-number #(if (seq %) (js/parseInt %) nil))
|
(-> client
|
||||||
(update :yodlee-account-id #(if (seq %) (js/parseInt %) nil))
|
(update :bank-accounts conj new-account )
|
||||||
(assoc :is-new? true))]
|
(assoc :new-account {:type :check})))))
|
||||||
{:db (-> db
|
|
||||||
(update-in [:admin :client :new-bank-accounts] (fn [bank-accounts]
|
|
||||||
(conj bank-accounts new-bank-account)))
|
|
||||||
(update-in [:admin :client :new-account] {:type :check}))})))
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
|
||||||
::add-new-new-bank-account
|
|
||||||
(fn [{:keys [db]} _]
|
|
||||||
(let [client (:new-client @(re-frame/subscribe [::subs/admin]))
|
|
||||||
new-bank-account (:new-account client)
|
|
||||||
new-bank-account (-> new-bank-account
|
|
||||||
(update :code #(str (:code client) "-" %))
|
|
||||||
(update :check-number #(if (seq %) (js/parseInt %) nil))
|
|
||||||
(update :yodlee-account-id #(if (seq %) (js/parseInt %) nil))
|
|
||||||
(assoc :is-new? true))]
|
|
||||||
{:db (-> db
|
|
||||||
(update-in [:admin :new-client :new-bank-accounts] (fn [bank-accounts]
|
|
||||||
(conj bank-accounts new-bank-account)))
|
|
||||||
(update-in [:admin :new-client] dissoc :new-account))})))
|
|
||||||
|
|
||||||
(re-frame/reg-event-db
|
(re-frame/reg-event-db
|
||||||
::remove-new-bank-account
|
::remove-new-bank-account
|
||||||
(fn [db [_ index]]
|
[(re-frame/path [::forms ::new-client :data])]
|
||||||
(update-in db [:admin :new-client :new-bank-accounts]
|
(fn [db [_ code]]
|
||||||
|
(update db :bank-accounts
|
||||||
(fn [bas]
|
(fn [bas]
|
||||||
(vec (concat (take index bas)
|
(filter #(not= (:code %) code) bas)))))
|
||||||
(drop (inc index) bas)))))))
|
|
||||||
|
|
||||||
(defn clients-table []
|
(defn clients-table []
|
||||||
(let [clients (re-frame/subscribe [::subs/clients])
|
(let [clients (re-frame/subscribe [::subs/clients])
|
||||||
@@ -200,161 +172,7 @@
|
|||||||
[:td (str/join ", " locations)]
|
[:td (str/join ", " locations)]
|
||||||
[:td email]])]]))
|
[:td email]])]]))
|
||||||
|
|
||||||
(defn clients-modal []
|
|
||||||
(let [original-client-code (:code (:client @(re-frame/subscribe [::subs/admin])))]
|
|
||||||
(fn []
|
|
||||||
(let [editing-client (:client @(re-frame/subscribe [::subs/admin]))]
|
|
||||||
[action-modal {:id ::edit
|
|
||||||
:title (str "Edit " (:name editing-client))
|
|
||||||
:action-text "Save"
|
|
||||||
:save-event [::save]}
|
|
||||||
[horizontal-field
|
|
||||||
[:label.label "Name"]
|
|
||||||
[:div.control
|
|
||||||
[bind-field
|
|
||||||
[:input.input {:type "text"
|
|
||||||
:field :name
|
|
||||||
:spec ::entity/name
|
|
||||||
:event ::change
|
|
||||||
:subscription editing-client}]]]]
|
|
||||||
|
|
||||||
[horizontal-field
|
|
||||||
[:label.label "Client code"]
|
|
||||||
[:div.control
|
|
||||||
[bind-field
|
|
||||||
[:input.input {:type "code"
|
|
||||||
:field :code
|
|
||||||
:disabled (if (str/blank? original-client-code)
|
|
||||||
""
|
|
||||||
"disabled")
|
|
||||||
:spec ::entity/code
|
|
||||||
:event ::change
|
|
||||||
:subscription editing-client}]]]]
|
|
||||||
|
|
||||||
[horizontal-field
|
|
||||||
[:label.label "Email"]
|
|
||||||
[:div.control
|
|
||||||
[bind-field
|
|
||||||
[:input.input {:type "email"
|
|
||||||
:field :email
|
|
||||||
:spec ::entity/email
|
|
||||||
:event ::change
|
|
||||||
:subscription editing-client}]]]]
|
|
||||||
|
|
||||||
[horizontal-field
|
|
||||||
[:label.label "Locations"]
|
|
||||||
[:div.control
|
|
||||||
[:div.field.has-addons
|
|
||||||
[:p.control
|
|
||||||
[bind-field
|
|
||||||
[:input.input {:type "text"
|
|
||||||
:field :location
|
|
||||||
:event ::change
|
|
||||||
:subscription editing-client}]]]
|
|
||||||
[:p.control [:button.button.is-primary {:on-click (dispatch-event [::add-location])} "Add"]]]
|
|
||||||
[:ul
|
|
||||||
(for [location (:locations editing-client)]
|
|
||||||
^{:key location} [:li location ])]]]
|
|
||||||
[:h2.subtitle "Address"]
|
|
||||||
|
|
||||||
|
|
||||||
[address-field {:field [:address]
|
|
||||||
:event ::change
|
|
||||||
:subscription editing-client}]
|
|
||||||
[:h2.subtitle "Add account"]
|
|
||||||
[horizontal-field
|
|
||||||
[:label.label "Acct code"]
|
|
||||||
[:div.control
|
|
||||||
[:div.field.has-addons.is-extended
|
|
||||||
[:p.control [:a.button.is-static (:code editing-client) "-" ]]
|
|
||||||
[:p.control
|
|
||||||
[bind-field
|
|
||||||
[:input.input {:type "code"
|
|
||||||
:field [:new-account :code]
|
|
||||||
:spec ::entity/code
|
|
||||||
:event ::change
|
|
||||||
:subscription editing-client}]]]]]]
|
|
||||||
|
|
||||||
[horizontal-field
|
|
||||||
[:label.label "Bank"]
|
|
||||||
[:div.control
|
|
||||||
|
|
||||||
[bind-field
|
|
||||||
[:input.input {:placeholder "Bank Name"
|
|
||||||
:type "text"
|
|
||||||
:field [:new-account :bank-name]
|
|
||||||
:event ::change
|
|
||||||
:subscription editing-client}]]]
|
|
||||||
[:div.control
|
|
||||||
|
|
||||||
[bind-field
|
|
||||||
[:input.input {:placeholder "Routing"
|
|
||||||
:type "text"
|
|
||||||
:field [:new-account :routing]
|
|
||||||
:event ::change
|
|
||||||
:subscription editing-client}]]]
|
|
||||||
[:div.control
|
|
||||||
|
|
||||||
[bind-field
|
|
||||||
[:input.input {:placeholder "Code"
|
|
||||||
:type "text"
|
|
||||||
:field [:new-account :bank-code]
|
|
||||||
:event ::change
|
|
||||||
:subscription editing-client}]]]]
|
|
||||||
[horizontal-field
|
|
||||||
[:label.label "Account"]
|
|
||||||
[:div.control
|
|
||||||
[bind-field
|
|
||||||
[:input.input {:placeholder "Nickname"
|
|
||||||
:type "text"
|
|
||||||
:field [:new-account :name]
|
|
||||||
:event ::change
|
|
||||||
:subscription editing-client}]]]
|
|
||||||
[:div.control
|
|
||||||
[bind-field
|
|
||||||
[:input.input {:placeholder "Acct #"
|
|
||||||
:type "text"
|
|
||||||
:field [:new-account :number]
|
|
||||||
:event ::change
|
|
||||||
:subscription editing-client}]]]
|
|
||||||
[:div.control
|
|
||||||
[bind-field
|
|
||||||
[:input.input {:placeholder "Check #"
|
|
||||||
:type "text"
|
|
||||||
:field [:new-account :check-number]
|
|
||||||
:event ::change
|
|
||||||
:subscription editing-client}]]]]
|
|
||||||
[horizontal-field
|
|
||||||
[:label.label "Yodlee Account"]
|
|
||||||
[:div.control
|
|
||||||
[bind-field
|
|
||||||
[:input.input {:placeholder "Yodlee Account #"
|
|
||||||
:type "text"
|
|
||||||
:field [:new-account :yodlee-account-id]
|
|
||||||
:event ::change
|
|
||||||
:subscription editing-client}]]]
|
|
||||||
[:div.control
|
|
||||||
[:button.button.is-primary.is-pulled-right {:on-click (dispatch-event [::add-new-bank-account])
|
|
||||||
:disabled (if (and (s/valid? ::entity/bank-account (:new-account editing-client))
|
|
||||||
(not ((set (map :code (:bank-accounts editing-client)))
|
|
||||||
(str (:code editing-client) "-" (-> editing-client :new-account :code)))))
|
|
||||||
""
|
|
||||||
"disabled")} "Add"]]]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[:h2.subtitle "Bank Accounts"]
|
|
||||||
[horizontal-field
|
|
||||||
nil
|
|
||||||
[:div.control
|
|
||||||
[:ul
|
|
||||||
|
|
||||||
(for [{:keys [code name number check-number id]} (:bank-accounts editing-client)]
|
|
||||||
^{:key id} [:li code ": " name])
|
|
||||||
(for [[index {:keys [name code number check-number]}] (map vector (range) (:new-bank-accounts editing-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? editing-client) [:div.is-overlay {:style {"backgroundColor" "rgba(150,150,150, 0.5)"}}])]))))
|
|
||||||
|
|
||||||
(defn admin-clients-content []
|
(defn admin-clients-content []
|
||||||
[:div
|
[:div
|
||||||
@@ -364,14 +182,11 @@
|
|||||||
[:h1.title "Clients"]
|
[:h1.title "Clients"]
|
||||||
[:div.is-pulled-right
|
[:div.is-pulled-right
|
||||||
[:a.button.is-primary.is-large {:on-click (dispatch-event [::new])} "New client"]]
|
[:a.button.is-primary.is-large {:on-click (dispatch-event [::new])} "New client"]]
|
||||||
[clients-table]
|
[clients-table]])])
|
||||||
(when editing-client
|
|
||||||
[clients-modal])])])
|
|
||||||
|
|
||||||
|
|
||||||
(defn new-client-form []
|
(defn new-client-form []
|
||||||
(let [new-client (:new-client @(re-frame/subscribe [::subs/admin]))
|
(let [{error :error new-client :data } @(re-frame/subscribe [::form ::new-client])]
|
||||||
error (:error (:client @(re-frame/subscribe [::subs/admin])))]
|
|
||||||
[:form
|
[:form
|
||||||
[:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
|
[:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
|
||||||
[:h1.title.is-2 "Add client"]
|
[:h1.title.is-2 "Add client"]
|
||||||
@@ -519,7 +334,7 @@
|
|||||||
(str (:code new-client) "-" (-> new-client :new-account :code)))))
|
(str (:code new-client) "-" (-> new-client :new-account :code)))))
|
||||||
""
|
""
|
||||||
"disabled")
|
"disabled")
|
||||||
:on-click (dispatch-event [::add-new-new-bank-account])} "Add"]]]]
|
:on-click (dispatch-event [::add-new-bank-account])} "Add"]]]]
|
||||||
|
|
||||||
[:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
|
[:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
|
||||||
[:h2.subtitle "Bank Accounts"]
|
[:h2.subtitle "Bank Accounts"]
|
||||||
@@ -529,7 +344,11 @@
|
|||||||
[:ul
|
[:ul
|
||||||
|
|
||||||
(for [{:keys [code name number check-number id]} (:bank-accounts new-client)]
|
(for [{:keys [code name number check-number id]} (:bank-accounts new-client)]
|
||||||
^{:key id} [:li code ": " name])
|
(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))]
|
(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]]]])]]]]
|
^{:key index} [:li [:strong "* " code ": " name] [:button.button {:on-click (dispatch-event [::remove-new-bank-account index])} [:span.icon [:i.fa.fa-times]]]])]]]]
|
||||||
|
|
||||||
@@ -545,7 +364,7 @@
|
|||||||
""
|
""
|
||||||
"disabled")
|
"disabled")
|
||||||
:on-click (dispatch-event [::save-new-client])
|
:on-click (dispatch-event [::save-new-client])
|
||||||
:class (str @(re-frame/subscribe [::loading-class ::save-client]) (when error " animated shake"))} "Save"]]))
|
:class (str @(re-frame/subscribe [::loading-class ::new-client]) (when error " animated shake"))} "Save"]]))
|
||||||
|
|
||||||
(defn admin-clients-page []
|
(defn admin-clients-page []
|
||||||
(let [{:keys [adding-client?]} @(re-frame/subscribe [::subs/admin])]
|
(let [{:keys [adding-client?]} @(re-frame/subscribe [::subs/admin])]
|
||||||
|
|||||||
Reference in New Issue
Block a user