transaction rules are testable not whilst editing.
This commit is contained in:
@@ -1,11 +1,37 @@
|
||||
(ns auto-ap.views.pages.admin.rules.table
|
||||
(:require [auto-ap.subs :as subs]
|
||||
[auto-ap.views.utils :refer [dispatch-event ->$]]
|
||||
[auto-ap.views.utils :refer [dispatch-event ->$ with-user]]
|
||||
[auto-ap.views.pages.admin.rules.form :as form]
|
||||
[auto-ap.views.components.paginator :refer [paginator]]
|
||||
[auto-ap.views.pages.admin.rules.results-modal :as results-modal]
|
||||
[auto-ap.views.components.sorter :refer [sorted-column]]
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::run-clicked
|
||||
[with-user]
|
||||
(fn [{:keys [user db]} [_ which]]
|
||||
{:graphql
|
||||
{:token user
|
||||
:query-obj {:venia/operation {:operation/type :query
|
||||
:operation/name "RunTransactionRule"}
|
||||
:venia/queries [{:query/data [:run-transaction-rule
|
||||
{:transaction-rule-id (:id which)}
|
||||
[:id
|
||||
:date
|
||||
:amount
|
||||
[:client [:name]]
|
||||
[:bank-account [:name]]
|
||||
:description-original]]}]}
|
||||
:on-success [::succeeded-run]
|
||||
#_#_:on-error [:forms/save-error ::form]}}))
|
||||
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::succeeded-run
|
||||
(fn [{:keys [db]} [_ result]]
|
||||
{:dispatch [::results-modal/opening (:run-transaction-rule result) true]}))
|
||||
|
||||
(defn table [{:keys [id rule-page on-params-change params status]}]
|
||||
(let [opc (fn [p]
|
||||
(on-params-change (merge @params p )))]
|
||||
@@ -42,7 +68,7 @@
|
||||
"Description"]
|
||||
|
||||
#_[sorted-column {:on-sort opc
|
||||
:style {:width "8em" :cursor "pointer"}
|
||||
:style {:width "8em" :cukjsor "pointer"}
|
||||
:class "has-text-right"
|
||||
:sort-key "amount-gte"
|
||||
:sort-by sort-by
|
||||
@@ -63,7 +89,7 @@
|
||||
:sort-by sort-by
|
||||
:asc asc}
|
||||
"Note"]
|
||||
[:th {:style {:width "6em"}}
|
||||
[:th {:style {:width "9em"}}
|
||||
]]]
|
||||
[:tbody
|
||||
(if (:loading @status)
|
||||
@@ -90,4 +116,6 @@
|
||||
"")]
|
||||
[:td note]
|
||||
[:td
|
||||
[:a.button {:on-click (dispatch-event [::form/editing r])} [:span.icon [:i.fa.fa-pencil]]]]]))]]]))))
|
||||
[:div.buttons
|
||||
[:a.button {:on-click (dispatch-event [::run-clicked r])} [:span.icon [:i.fa.fa-play]]]
|
||||
[:a.button {:on-click (dispatch-event [::form/editing r])} [:span.icon [:i.fa.fa-pencil]]]]]]))]]]))))
|
||||
|
||||
Reference in New Issue
Block a user