working on making splitting accounts work properly.
This commit is contained in:
@@ -279,6 +279,14 @@
|
||||
(update-in db [::change-expense-accounts :invoice :expense-accounts]
|
||||
conj {:amount 0 :expense-account-id nil})))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::remove-expense-account-split
|
||||
(fn [db [_ index]]
|
||||
(update-in db [::change-expense-accounts :invoice :expense-accounts]
|
||||
(fn [expense-accounts]
|
||||
(concat (take index expense-accounts)
|
||||
(drop (inc index) expense-accounts))))))
|
||||
|
||||
(defn change-expense-accounts-modal []
|
||||
(let [{{:keys [expense-accounts]} :invoice :as data} @(re-frame/subscribe [::change-expense-accounts])
|
||||
change-event [::events/change-form [::change-expense-accounts]]]
|
||||
@@ -323,7 +331,7 @@
|
||||
|
||||
:max (:total data)
|
||||
:step "0.01"}]]]]]]
|
||||
[:td [:a.button [:i.fa.fa-times]]]]
|
||||
[:td [:a.button {:on-click (dispatch-event [::remove-expense-account-split index])} [:i.fa.fa-times]]]]
|
||||
)]]]))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user