all kinds of linkability.
This commit is contained in:
@@ -38,14 +38,17 @@
|
||||
::params-change
|
||||
[with-user]
|
||||
(fn [{:keys [user]} [_ params]]
|
||||
{:graphql {:token user
|
||||
:owns-state {:single [::data-page/page :invoices]}
|
||||
:query-obj (table/query params )
|
||||
:on-success (fn [result]
|
||||
(let [result (set/rename-keys (first (:invoice-page result))
|
||||
{:invoices :data})]
|
||||
(try
|
||||
{:graphql {:token user
|
||||
:owns-state {:single [::data-page/page :invoices]}
|
||||
:query-obj (table/query params )
|
||||
:on-success (fn [result]
|
||||
(let [result (set/rename-keys (first (:invoice-page result))
|
||||
{:invoices :data})]
|
||||
|
||||
[::data-page/received :invoices result]))}}))
|
||||
[::data-page/received :invoices result]))}}
|
||||
(catch js/Error e
|
||||
(println "Warning" e)))))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::unmounted
|
||||
@@ -196,14 +199,36 @@
|
||||
:checkable-fn (fn [i] (not (:scheduled-payment i)))
|
||||
:actions #{:edit :void :expense-accounts}}]]))
|
||||
|
||||
(defn layout [params]
|
||||
(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 {}]]}]))
|
||||
|
||||
(defn unpaid-invoices-page [params]
|
||||
(r/create-class
|
||||
{:display-name "invoices-page"
|
||||
{:display-name "unpaid-invoices-page"
|
||||
:component-will-unmount #(re-frame/dispatch-sync [::unmounted])
|
||||
:component-did-mount #(re-frame/dispatch [::mounted])
|
||||
:reagent-render
|
||||
(fn []
|
||||
(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 {}]]}]))}))
|
||||
:reagent-render layout}))
|
||||
|
||||
(defn paid-invoices-page [params]
|
||||
(r/create-class
|
||||
{:display-name "paid-invoices-page"
|
||||
:component-will-unmount #(re-frame/dispatch-sync [::unmounted])
|
||||
:component-did-mount #(re-frame/dispatch [::mounted])
|
||||
:reagent-render layout}))
|
||||
|
||||
(defn voided-invoices-page [params]
|
||||
(r/create-class
|
||||
{:display-name "voided-invoices-page"
|
||||
:component-will-unmount #(re-frame/dispatch-sync [::unmounted])
|
||||
:component-did-mount #(re-frame/dispatch [::mounted])
|
||||
:reagent-render layout}))
|
||||
|
||||
(defn all-invoices-page [params]
|
||||
(r/create-class
|
||||
{:display-name "all-invoices-page"
|
||||
:component-will-unmount #(re-frame/dispatch-sync [::unmounted])
|
||||
:component-did-mount #(re-frame/dispatch [::mounted])
|
||||
:reagent-render layout}))
|
||||
|
||||
Reference in New Issue
Block a user