tells you about potential matches.

This commit is contained in:
Bryce Covert
2019-04-24 07:35:19 -07:00
parent deef4eb4a4
commit f547911c5b
6 changed files with 104 additions and 34 deletions

View File

@@ -6,6 +6,32 @@
[auto-ap.views.utils :refer [date->str dispatch-event nf]]
[goog.string :as gstring]
[re-frame.core :as re-frame]))
(re-frame/reg-event-fx
::editing-matches-found
(fn [{:keys [db]} [_ which payment-matches]]
(println "FOUND" payment-matches)
{:dispatch
[::edit/editing which (:potential-payment-matches payment-matches)]}))
(re-frame/reg-event-fx
::editing-matches-failed
(fn [{:keys [db]} [_ which payment-matches]]
(println "FAILED" payment-matches)
{:dispatch
[::edit/editing which payment-matches]}))
(re-frame/reg-event-fx
::intend-to-edit
(fn [{:keys [db]} [_ which]]
{:graphql
{:token (-> db :user)
:query-obj {:venia/queries [{:query/data [:potential-payment-matches
{:transaction_id (:id which)}
[:id :memo [:vendor [:name]]]]}]}
:on-success [::editing-matches-found which]
:on-error [::editing-matches-failed which]}} ))
(defn table [{:keys [id transaction-page status on-params-change vendors params check-boxes checked on-check-changed expense-event]}]
(let [opc (fn [p]
@@ -96,7 +122,7 @@
[:td status]
[:td (:name bank-account )]
[:td
[:a.button {:on-click (dispatch-event [::edit/editing i])} [:span [:span.icon [:i.fa.fa-pencil]]]]
[:a.button {:on-click (dispatch-event [::intend-to-edit i])} [:span [:span.icon [:i.fa.fa-pencil]]]]
(when payment
[:a.tag {:href (:s3-url payment) :target "_new"}
#_[:i.fa.fa-money-check]