rules can be edited fully and more.

This commit is contained in:
Bryce Covert
2019-05-12 20:31:28 -07:00
parent 51691fa553
commit 76c903d16d
16 changed files with 132 additions and 38 deletions

View File

@@ -37,27 +37,23 @@
[:span {:class "name"} "Vendors"]]]
[:li.menu-item
[:a {:href (bidi/path-for routes/routes :admin-users), :class (str "item" (active-when ap = :admin-users))}
[:span {:class "icon"}
[:i {:class "fa fa-envelope-o"}]]
[:span {:class "icon icon-single-neutral-book" :style {:font-size "25px"}}]
[:span {:class "name"} "Users"]]]
[:li.menu-item
[:a {:href (bidi/path-for routes/routes :admin-accounts), :class (str "item" (active-when ap = :admin-accounts))}
[:span {:class "icon"}
[:i {:class "fa fa-envelope-o"}]]
[:span {:class "icon icon-list-bullets" :style {:font-size "25px"}}]
[:span {:class "name"} "Accounts"]]]
[:li.menu-item
[:a {:href (bidi/path-for routes/routes :admin-rules), :class (str "item" (active-when ap = :admin-rules))}
[:span {:class "icon"}
[:i {:class "fa fa-envelope-o"}]]
[:span {:class "icon icon-cog-play-1" :style {:font-size "25px"}}]
[:span {:class "name"} "Rules"]]]
[:li.menu-item
[:a {:href (bidi/path-for routes/routes :admin-yodlee), :class (str "item" (active-when ap = :admin-yodlee))}
[:span {:class "icon"}
[:i {:class "fa fa-envelope-o"}]]
[:span {:class "icon icon-saving-bank-1" :style {:font-size "25px"}}]
[:span {:class "name"} "Yodlee Link"]]]
[:ul ]]

View File

@@ -10,4 +10,8 @@
[:vendor [:name :id]]
[:client [:name :id]]
[:bank-account [:name :id]]
[:accounts [[:account [:id :name :numeric-code]]
:id
:percentage
:location]]
])

View File

@@ -39,7 +39,18 @@
:amount-gte
:dom-lte
:dom-gte
:accounts
:note])
(assoc :vendor-id (:id (:vendor data)))
(update :accounts (fn [as]
(map #(-> %
(update :id (fn [i] (if (some-> i (str/starts-with? "new-"))
nil
i)))
(assoc :percentage (/ (get-in % [:amount-percentage]) 100 ))
(assoc :account-id (get-in % [:account :id]))
(select-keys [:percentage :id :location :account-id]))
as)))
(assoc :client-id (:id (:client data)))
(assoc :bank-account-id (:id (:bank-account data))))}
default-read]}]}))
@@ -88,23 +99,27 @@
:dom-lte nil
:dom-gte nil
:vendor nil
:expense-accounts [])))))
:accounts [])))))
(re-frame/reg-event-db
::editing
(fn [db [_ which]]
(-> db (forms/start-form ::form (assoc (select-keys which
[:description
:id
:client
:bank-account
:note
:amount-lte
:amount-gte
:dom-lte
:dom-gte
:vendor])
:expense-accounts [])))))
(-> db (forms/start-form ::form (-> which
(select-keys [:description
:id
:client
:bank-account
:note
:amount-lte
:amount-gte
:dom-lte
:dom-gte
:vendor
:accounts])
(update :accounts (fn [xs]
(println xs)
(mapv #(assoc % :amount-percentage (* (:percentage %) 100.0))
xs))))))))
(re-frame/reg-event-db
@@ -251,7 +266,7 @@
:percentage-only? true
:locations @(re-frame/subscribe [::subs/locations-for-client (:id (:client data))])
:max 100
:field [:expense-accounts]}]]
:field [:accounts]}]]
[error-notification]