other changes to make app more predictable.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
[clojure.spec.alpha :as s]
|
||||
[clojure.string :as str :refer [blank?]]
|
||||
[goog.string :as gstring]
|
||||
[vimsical.re-frame.cofx.inject :as inject]
|
||||
[re-frame.core :as re-frame]
|
||||
[reagent.core :as r]))
|
||||
|
||||
@@ -70,6 +71,7 @@
|
||||
:<- [::side-bar/filter-params]
|
||||
:<- [::table/table-params]
|
||||
(fn [[client filter-params table-params]]
|
||||
(re-frame/dispatch [::params-change])
|
||||
(cond-> {:import-status "imported"}
|
||||
client (assoc :client-id (:id client))
|
||||
(seq filter-params) (merge filter-params)
|
||||
@@ -84,17 +86,16 @@
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::params-change
|
||||
[with-user]
|
||||
(fn [cofx _]
|
||||
(let [new-params @(re-frame/subscribe [::params])]
|
||||
(when (not= new-params (::last-params (:db cofx)))
|
||||
{:db (-> (:db cofx)
|
||||
(assoc-in [:status :loading] true)
|
||||
(assoc-in [::last-params] new-params))
|
||||
:graphql {:token (-> cofx :db :user)
|
||||
:query-obj (table/query new-params )
|
||||
:on-success [::received]
|
||||
:on-error [::events/page-failed]}}))))
|
||||
[with-user (re-frame/inject-cofx ::inject/sub [::params])]
|
||||
(fn [{::keys [params] :as cofx} _]
|
||||
(when (not= params (::last-params (:db cofx)))
|
||||
{:db (-> (:db cofx)
|
||||
(assoc-in [:status :loading] true)
|
||||
(assoc-in [::last-params] params))
|
||||
:graphql {:token (-> cofx :db :user)
|
||||
:query-obj (table/query params )
|
||||
:on-success [::received]
|
||||
:on-error [::events/page-failed]}})))
|
||||
|
||||
|
||||
|
||||
@@ -605,7 +606,7 @@
|
||||
(let [{:keys [checked print-checks-shown? print-checks-loading? advanced-print-shown? vendor-filter]} @(re-frame/subscribe [::invoice-page])
|
||||
current-client @(re-frame/subscribe [::subs/client])]
|
||||
[:div
|
||||
[:h1.title (str (str/capitalize (or status "all")) " invoices")]
|
||||
#_[:h1.title (str (str/capitalize (or status "all")) " invoices")]
|
||||
(when (= status "unpaid")
|
||||
[pay-button {:print-checks-shown? print-checks-shown? :checked-invoices checked :print-checks-loading? print-checks-loading?}])
|
||||
[table/invoice-table {:id :unpaid
|
||||
@@ -631,7 +632,8 @@
|
||||
:component-will-unmount #(re-frame/dispatch [::unmounted])
|
||||
:reagent-render
|
||||
(fn []
|
||||
(let [{invoice-bar-active? :active?} @(re-frame/subscribe [::forms/form ::form/form])]
|
||||
(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 {}]
|
||||
:main [unpaid-invoices-content params]
|
||||
:bottom [:div
|
||||
|
||||
Reference in New Issue
Block a user