allows manually matching rules.

This commit is contained in:
Bryce Covert
2019-05-16 21:39:28 -07:00
parent 93ef07f4b1
commit 486f09fd94
8 changed files with 135 additions and 132 deletions

View File

@@ -10,9 +10,9 @@
[re-frame.core :as re-frame]))
(re-frame/reg-event-fx
::editing-matches-found
(fn [{:keys [db]} [_ which payment-matches]]
(fn [{:keys [db]} [_ which matches]]
{:dispatch
[::edit/editing which (:potential-payment-matches payment-matches)]}))
[::edit/editing which (:potential-payment-matches matches) (:potential-transaction-rule-matches matches)]}))
(re-frame/reg-event-fx
::editing-matches-failed
@@ -25,9 +25,13 @@
(fn [{:keys [db]} [_ which]]
{:graphql
{:token (-> db :user)
:query-obj {:venia/queries [{:query/data [:potential-payment-matches
{:transaction_id (:id which)}
[:id :memo :check-number [:vendor [:name]]]]}]}
:query-obj {:venia/queries (into [{:query/data [:potential-payment-matches
{:transaction_id (:id which)}
[:id :memo :check-number [:vendor [:name]]]]}]
(when @(re-frame/subscribe [::subs/is-admin?])
[{:query/data [:potential-transaction-rule-matches
{:transaction_id (:id which)}
[:id :note]]}]))}
:on-success [::editing-matches-found which]
:on-error [::editing-matches-failed which]}} ))