Made all interactions much better
This commit is contained in:
@@ -35,22 +35,6 @@
|
||||
[reagent.core :as r]
|
||||
[vimsical.re-frame.fx.track :as track]))
|
||||
|
||||
;; TODO: Sort out approaches for which buttons to show
|
||||
;; TODO: make it so filters are basically free
|
||||
|
||||
(re-frame/reg-sub
|
||||
::params
|
||||
:<- [::subs/client]
|
||||
:<- [::side-bar/filter-params]
|
||||
:<- [::table/table-params]
|
||||
(fn [[client filter-params table-params]]
|
||||
(cond-> {:import-status "imported"}
|
||||
client (assoc :client-id (:id client))
|
||||
(seq filter-params) (merge filter-params)
|
||||
(seq table-params) (merge table-params))))
|
||||
|
||||
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::params-change
|
||||
[with-user]
|
||||
@@ -63,11 +47,7 @@
|
||||
{:invoices :data})]
|
||||
|
||||
[::data-page/received :invoices result]))
|
||||
:on-error [::events/page-failed]}
|
||||
:set-uri-params (dissoc params
|
||||
:status
|
||||
:client-id
|
||||
:import-status)}))
|
||||
:on-error [::events/page-failed]}}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::unmounted
|
||||
@@ -82,7 +62,7 @@
|
||||
::mounted
|
||||
(fn [{:keys [db]} _]
|
||||
{::track/register [{:id ::params
|
||||
:subscription [::params]
|
||||
:subscription [::data-page/params :invoices]
|
||||
:event-fn (fn [params]
|
||||
[::params-change params])}]
|
||||
::forward/register [{:id ::updated
|
||||
@@ -207,7 +187,7 @@
|
||||
(dispatch-event [::data-page/remove-check :invoices id])}]]) checked-invoices))]]))
|
||||
|
||||
|
||||
(defn unpaid-invoices-content [{:keys [status] :as params}]
|
||||
(defn unpaid-invoices-content [{:keys [status]}]
|
||||
(let [page @(re-frame/subscribe [::data-page/page :invoices])
|
||||
current-client @(re-frame/subscribe [::subs/client])]
|
||||
[:div
|
||||
@@ -216,12 +196,8 @@
|
||||
(when (= status :unpaid)
|
||||
[pay-button])
|
||||
[table/invoice-table {:id (:id page)
|
||||
:checked (:checked page)
|
||||
:data (:data page)
|
||||
:status (:status page)
|
||||
:data-page :invoices
|
||||
:check-boxes (= status :unpaid)
|
||||
:on-check-changed (fn [new]
|
||||
(re-frame/dispatch [::data-page/toggle-check :invoices new ]))
|
||||
:actions #{:edit :void :expense-accounts}}]]))
|
||||
|
||||
(defn unpaid-invoices-page [params]
|
||||
@@ -231,8 +207,7 @@
|
||||
:component-did-mount #(re-frame/dispatch [::mounted])
|
||||
:reagent-render
|
||||
(fn []
|
||||
(let [{invoice-bar-active? :active?} @(re-frame/subscribe [::forms/form ::form/form])
|
||||
params @(re-frame/subscribe [::params])]
|
||||
[side-bar-layout {:side-bar [invoices-side-bar {}]
|
||||
(let [{invoice-bar-active? :active?} @(re-frame/subscribe [::forms/form ::form/form])]
|
||||
[side-bar-layout {:side-bar [invoices-side-bar {:data-page :invoices}]
|
||||
:main [unpaid-invoices-content params]
|
||||
:right-side-bar [appearing-side-bar {:visible? invoice-bar-active?} [form/form {}]]}]))}))
|
||||
|
||||
Reference in New Issue
Block a user