allowing users to self service delete links to payments.
This commit is contained in:
@@ -122,6 +122,21 @@
|
||||
[::edited (first (:match-transaction-rules result))])
|
||||
:on-error [::forms/save-error ::form]}}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::unlink
|
||||
[with-user (forms/triggers-loading ::form) (forms/in-form ::form)]
|
||||
(fn [{{{:keys [id]} :data} :db user :user} [_]]
|
||||
{:graphql
|
||||
{:token user
|
||||
:query-obj {:venia/operation {:operation/type :mutation
|
||||
:operation/name "UnlinkTransaction"}
|
||||
:venia/queries [{:query/data [:unlink-transaction
|
||||
{:transaction-id id}
|
||||
transaction-read]}]}
|
||||
:on-success (fn [result]
|
||||
[::edited (:unlink-transaction result)])
|
||||
:on-error [::forms/save-error ::form]}}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::edited
|
||||
[(forms/triggers-stop ::form)]
|
||||
@@ -274,6 +289,12 @@
|
||||
:type "typeahead-entity"
|
||||
:field [:forecast-match]}])
|
||||
|
||||
(when (and (:payment data)
|
||||
is-admin?)
|
||||
[:p.notification.is-info.is-light>div.level>div.level-left
|
||||
[:div.level-item "This transaction is linked to a payment "]
|
||||
[:div.level-item [:button.button.is-warning {:on-click (dispatch-event [::unlink])} "Unlink"]]])
|
||||
|
||||
|
||||
(error-notification)
|
||||
(when-not should-disable-for-client?
|
||||
|
||||
Reference in New Issue
Block a user