fixed sorting and filtering issue
This commit is contained in:
@@ -56,15 +56,14 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn invoice-table [{:keys [id invoice-page status on-params-change vendors params check-boxes checked on-check-changed on-edit-invoice on-void-invoice expense-event]}]
|
(defn invoice-table [{:keys [id invoice-page status on-params-change vendors params check-boxes checked on-check-changed on-edit-invoice on-void-invoice expense-event]}]
|
||||||
(let [state (reagent/atom (or @params {}))
|
(let [visible-checks @(re-frame/subscribe [::visible-checks])
|
||||||
visible-checks @(re-frame/subscribe [::visible-checks])
|
|
||||||
visible-expense-accounts @(re-frame/subscribe [::visible-expense-accounts])
|
visible-expense-accounts @(re-frame/subscribe [::visible-expense-accounts])
|
||||||
selected-client @(re-frame/subscribe [::subs/client])
|
selected-client @(re-frame/subscribe [::subs/client])
|
||||||
opc (fn [p]
|
opc (fn [p]
|
||||||
(swap! state merge p)
|
(on-params-change (merge @params p)))]
|
||||||
(on-params-change p))]
|
(fn [{:keys [id invoice-page status on-params-change vendors checked params]}]
|
||||||
(fn [{:keys [id invoice-page status on-params-change vendors checked]}]
|
(println "PARAMS" @params)
|
||||||
(let [{:keys [sort-by asc]} @state
|
(let [{:keys [sort-by asc]} @params
|
||||||
{:keys [invoices start end count total]} @invoice-page
|
{:keys [invoices start end count total]} @invoice-page
|
||||||
visible-checks @(re-frame/subscribe [::visible-checks])
|
visible-checks @(re-frame/subscribe [::visible-checks])
|
||||||
visible-expense-accounts @(re-frame/subscribe [::visible-expense-accounts])
|
visible-expense-accounts @(re-frame/subscribe [::visible-expense-accounts])
|
||||||
@@ -74,7 +73,7 @@
|
|||||||
[:div
|
[:div
|
||||||
[paginator {:start start :end end :count count :total total
|
[paginator {:start start :end end :count count :total total
|
||||||
:on-change (fn [p ]
|
:on-change (fn [p ]
|
||||||
(on-params-change (swap! state merge p)))}]
|
(on-params-change (merge @params p) ))}]
|
||||||
"Showing " (inc start) "-" end "/" total
|
"Showing " (inc start) "-" end "/" total
|
||||||
|
|
||||||
[:table.table.is-fullwidth
|
[:table.table.is-fullwidth
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
(assoc-in [:status :loading] true)
|
(assoc-in [:status :loading] true)
|
||||||
(assoc-in [::params] params))
|
(assoc-in [::params] params))
|
||||||
:graphql {:token (-> cofx :db :user)
|
:graphql {:token (-> cofx :db :user)
|
||||||
:query-obj (invoice-table/query (assoc params :imported true :status "unpaid"))
|
:query-obj (invoice-table/query (doto (assoc params :imported true :status "unpaid") println))
|
||||||
:on-success [::received]}}))
|
:on-success [::received]}}))
|
||||||
|
|
||||||
(re-frame/reg-event-db
|
(re-frame/reg-event-db
|
||||||
|
|||||||
Reference in New Issue
Block a user