Tons of small fixes

This commit is contained in:
Bryce Covert
2020-07-27 21:28:02 -07:00
parent 3737cfa628
commit fdc1d3e9e4
26 changed files with 428 additions and 178 deletions

View File

@@ -167,9 +167,26 @@
:debits (upcoming-debits (date->str start-date) 0.0)
:outstanding-payments (- outstanding-payments)
:query-params (cemerick.url/map->query {:due-range {:end (date->str start-date standard)}})})
(if (= :seven-days (:cash-flow-range chart-options))
(condp = (:cash-flow-range chart-options)
:seven-days
(range 1 7)
(range 1 31)))))))
:thirty-days
(range 1 31)
:sixty-days
(range 1 61)
:ninety-days
(range 1 91)
:one-hundred-twenty-days
(range 1 121)
:one-hundred-fifty-days
(range 1 151)
:one-hundred-eighty-days
(range 1 181)))))))
(re-frame/reg-event-fx
::mounted
@@ -191,6 +208,12 @@
[:upcoming-debits [:date :amount]]]]]}
:on-success [::received]}}))
(defn cash-flow-range-button [{:keys [name value chart-options]}]
[:a.button {:class (when (= value (:cash-flow-range chart-options))
["is-info" "is-selected"])
:on-click (dispatch-event [::select-cash-flow-range value])}
name])
(defn home-content []
(let [client-id (-> @(re-frame/subscribe [::subs/client]) :id)
chart-options @(re-frame/subscribe [::chart-options])]
@@ -207,14 +230,29 @@
[:h1.title.is-4 "Cash Flow"]
[:div.buttons.has-addons
[:a.button {:class (when (= :seven-days (:cash-flow-range chart-options))
["is-info" "is-selected"])
:on-click (dispatch-event [::select-cash-flow-range :seven-days])}
"7 days"]
[:a.button {:class (when (= :thirty-days (:cash-flow-range chart-options))
["is-info" "is-selected"])
:on-click (dispatch-event [::select-cash-flow-range :thirty-days])}
"30 days"]]
[cash-flow-range-button {:name "7 days"
:value :seven-days
:chart-options chart-options}]
[cash-flow-range-button {:name "30 days"
:value :thirty-days
:chart-options chart-options}]
[cash-flow-range-button {:name "60 days"
:value :sixty-days
:chart-options chart-options}]
[cash-flow-range-button {:name "90 days"
:value :ninety-days
:chart-options chart-options}]
[cash-flow-range-button {:name "120 days"
:value :one-hundred-twenty-days
:chart-options chart-options}]
[cash-flow-range-button {:name "150 days"
:value :one-hundred-fifty-days
:chart-options chart-options}]
[cash-flow-range-button {:name "180 days"
:value :one-hundred-eighty-days
:chart-options chart-options}]]
(make-cash-flow-chart {:width 800 :height 500