Supports editing expense accounts
This commit is contained in:
@@ -16,35 +16,36 @@
|
||||
(-> db
|
||||
(update :accounts replace-by :id edit-account))))
|
||||
|
||||
(defn accounts-table [{:keys [accounts]} ]
|
||||
|
||||
(defn accounts-table [{:keys [accounts]}]
|
||||
[:div
|
||||
(for [[account-set accounts] (group-by :account-set accounts)]
|
||||
(do (println accounts)
|
||||
^{:key account-set}
|
||||
[:div
|
||||
[:h2.title.is-4 account-set]
|
||||
[:table.table.compact
|
||||
[:thead
|
||||
[:th "Code"]
|
||||
[:th "Name"]
|
||||
[:th "Type"]
|
||||
[:th {:style {:width "5em"}}]
|
||||
]
|
||||
[:tbody
|
||||
(for [{:keys [id numeric-code name type] :as account} (sort-by :numeric-code accounts)]
|
||||
^{:key id}
|
||||
[:tr
|
||||
[:td numeric-code]
|
||||
[:td name]
|
||||
[:td type]
|
||||
[:td [:a.button {:on-click (dispatch-event [::account-form/editing account])} [:span [:span.icon [:i.fa.fa-pencil]]]]]])]]]))])
|
||||
^{:key (or account-set "blank")}
|
||||
[:div
|
||||
[:h2.title.is-4 account-set]
|
||||
[:table.table.compact.is-fullwidth
|
||||
[:thead
|
||||
[:tr
|
||||
[:th "Code"]
|
||||
[:th "Name"]
|
||||
[:th "Type"]
|
||||
[:th {:style {:width "5em"}}]]]
|
||||
[:tbody
|
||||
(for [{:keys [id numeric-code name type] :as account} (sort-by :numeric-code accounts)]
|
||||
^{:key id}
|
||||
[:tr
|
||||
[:td numeric-code]
|
||||
[:td name]
|
||||
[:td type]
|
||||
[:td [:a.button {:on-click (dispatch-event [::account-form/editing account])} [:span [:span.icon [:i.fa.fa-pencil]]]]]])]]])])
|
||||
|
||||
(defn admin-accounts-content []
|
||||
[:div
|
||||
(let [accounts @(re-frame/subscribe [::subs/accounts])]
|
||||
[:div
|
||||
[:h1.title "Accounts"]
|
||||
[:div.is-pulled-right
|
||||
[:a.button.is-success {:on-click (dispatch-event [::account-form/editing {:type :asset
|
||||
:account-set "default"}])} "New Account"]]
|
||||
[accounts-table {:accounts accounts}]])])
|
||||
|
||||
(defn admin-accounts-page []
|
||||
|
||||
Reference in New Issue
Block a user