more help.
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
(re-frame/reg-event-fx
|
||||
::params-change
|
||||
[with-user]
|
||||
(fn [{:keys [user]} [_ params]]
|
||||
(fn [{:keys [user db]} [_ params]]
|
||||
(try
|
||||
{:graphql {:token user
|
||||
:owns-state {:single [::data-page/page ::page]}
|
||||
@@ -37,34 +37,13 @@
|
||||
:end]]
|
||||
:query/alias :result}]}
|
||||
:on-success (fn [result]
|
||||
[::data-page/received ::page (:result result)])}}
|
||||
[::data-page/received ::page (:result result)])}
|
||||
:db (-> db
|
||||
(forms/stop-form ::edit/form))}
|
||||
(catch js/Error e
|
||||
;; this catches an error where you choose a parameter, change to invoices page, then change to voided invoices
|
||||
(println "Error!" e)))))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::bulk-change-transaction-status
|
||||
(fn [cofx [_ status params]]
|
||||
(let [checked @(re-frame/subscribe [::data-page/checked ::page])
|
||||
checked-params (get checked "header")
|
||||
specific-transactions (map :id (vals (dissoc checked "header")))]
|
||||
(println checked-params)
|
||||
{:db (-> (:db cofx)
|
||||
(assoc-in [:status :loading] true))
|
||||
:graphql {:token (-> cofx :db :user)
|
||||
:owns-state {:single ::bulk-change-transaction-status}
|
||||
:query-obj
|
||||
{:venia/operation {:operation/type :mutation
|
||||
:operation/name "BulkChangeTransactionStatus"}
|
||||
:venia/queries [{:query/data
|
||||
[:bulk-change-transaction-status
|
||||
{:filters (some-> checked-params data-params->query-params)
|
||||
:status status
|
||||
:ids specific-transactions}
|
||||
[:message]]}]}
|
||||
:on-success (fn [_]
|
||||
[::params-change params])}})))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::delete-selected
|
||||
(fn [cofx [_ params suppress]]
|
||||
@@ -153,13 +132,11 @@
|
||||
checked @(re-frame/subscribe [::data-page/checked ::page])]
|
||||
[:div
|
||||
[:h1.title "Transactions"]
|
||||
[status/status-notification {:statuses [[::status/single ::bulk-change-transaction-status]
|
||||
[::status/single ::delete-selected]
|
||||
[status/status-notification {:statuses [[::status/single ::delete-selected]
|
||||
[::status/single ::manual-import]]}]
|
||||
(when is-admin?
|
||||
[:div.is-pulled-right
|
||||
[:div.buttons
|
||||
|
||||
(into [:div.tags ] (map (fn [[z {:keys [id]}]]
|
||||
(if (= "header" z)
|
||||
[:span.tag.is-medium {:on-click
|
||||
@@ -171,22 +148,6 @@
|
||||
checked))
|
||||
[:button.button.is-outlined.is-primary {:on-click (dispatch-event [::manual/opening])}
|
||||
"Manual Yodlee Import"]
|
||||
[:button.button.is-warning {:on-click (dispatch-event [::bulk-change-transaction-status :unapproved params])
|
||||
:class (status/class-for @(re-frame/subscribe [::status/single ::bulk-change-transaction-status]))
|
||||
:disabled (or (status/disabled-for @(re-frame/subscribe [::status/single ::bulk-change-transaction-status]))
|
||||
(not (seq checked)))}
|
||||
"Unapprove"]
|
||||
|
||||
[:button.button.is-warning {:on-click (dispatch-event [::bulk-change-transaction-status :excluded params])
|
||||
:class (status/class-for @(re-frame/subscribe [::status/single ::bulk-change-transaction-status]))
|
||||
:disabled (or (status/disabled-for @(re-frame/subscribe [::status/single ::bulk-change-transaction-status]))
|
||||
(not (seq checked)))}
|
||||
"Exclude"]
|
||||
[:button.button.is-warning {:on-click (dispatch-event [::bulk-change-transaction-status :requires-feedback params])
|
||||
:class (status/class-for @(re-frame/subscribe [::status/single ::bulk-change-transaction-status]))
|
||||
:disabled (or (status/disabled-for @(re-frame/subscribe [::status/single ::bulk-change-transaction-status]))
|
||||
(not (seq checked)))}
|
||||
"Client Review"]
|
||||
(when (:client-id params)
|
||||
[:button.button.is-warning {:on-click (dispatch-event [::bulk/code-requested checked params])
|
||||
:disabled (not (seq checked))}
|
||||
|
||||
Reference in New Issue
Block a user