made ledger table updated.

This commit is contained in:
Bryce Covert
2020-08-05 08:07:41 -07:00
parent 0fd8d4a1c1
commit e0222bac48
4 changed files with 86 additions and 167 deletions

View File

@@ -67,7 +67,6 @@
(re-frame/reg-event-fx
::editing
(fn [{:keys [db]} [_ client-id]]
(println (get (:clients db) client-id))
{:db (-> db
(forms/stop-form ::form)
(forms/start-form ::form (-> (get (:clients db) client-id)
@@ -113,27 +112,6 @@
(assoc-in [:clients (:id (:edit-client client))] (update (:edit-client client) :bank-accounts (fn [bas] (->> bas (sort-by :sort-order) vec)))))))
(re-frame/reg-event-db
::add-forecasted-transaction
[(forms/in-form ::form) (re-frame/path [:data])]
(fn [client _]
(-> client
(update :forecasted-transactions conj (assoc (:new-forecasted-transaction client) :temp-id (random-uuid)))
(dissoc :new-forecasted-transaction))))
(re-frame/reg-event-db
::remove-forecasted-transaction
[(forms/in-form ::form) (re-frame/path [:data])]
(fn [client [_ which]]
(-> client
(update :forecasted-transactions #(transduce
(filter (fn [x] (and (not= (:temp-id x) which)
(not= (:id x) which))))
conj
[]
%)))))
(re-frame/reg-event-db
@@ -350,8 +328,6 @@
next-week-b (if (is-week-a? (t/now))
"Next week"
"This week")]
(println "ID" (:id new-client))
[side-bar {:on-close (dispatch-event [::forms/form-closing ::form ])}
^{:key (:id new-client)}
[:div ;; div is important for actually unmounting for now
@@ -416,11 +392,11 @@
:maxlength 2
:style { :width "4em"}}]]}])]
[:div {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
[:h2.subtitle "Address"]
[address-field {:field [:address]
:event [::forms/change ::form]
:subscription new-client}]]
[:h2.subtitle "Address"]
[address-field {:field [:address]
:event [::forms/change ::form]
:subscription new-client}]
[:h2.subtitle "Bank accounts"]
(for [bank-account (sort-by :sort-order (:bank-accounts new-client))]