last refactoring before adding new accounts.

This commit is contained in:
Bryce Covert
2019-04-11 08:41:08 -07:00
parent c3199fb4cb
commit f6d0870f32
3 changed files with 31 additions and 42 deletions

View File

@@ -0,0 +1,13 @@
(ns auto-ap.views.pages.transactions.common)
(def transaction-read
[:id
:amount
[:vendor [:name :id]]
:date
:post_date
:status
:description_original
[:payment [:check_number :s3_url]]
[:client [:name :id]]
[:bank-account [:name :yodlee-account-id]]])

View File

@@ -2,6 +2,7 @@
(:require [auto-ap.forms :as forms]
[auto-ap.subs :as subs]
[auto-ap.views.components.typeahead :refer [typeahead]]
[auto-ap.views.pages.transactions.common :refer [transaction-read]]
[auto-ap.views.utils :refer [bind-field]]
[re-frame.core :as re-frame]))
@@ -32,26 +33,14 @@
(fn [{:keys [db]} [_ edit-completed]]
(when @(re-frame/subscribe [::can-submit])
(let [{{:keys [id vendor-id]} :data :as data} @(re-frame/subscribe [::forms/form ::edit-transaction])]
{:db (forms/loading db ::edit-transaction )
:graphql
{:token (-> db :user)
:query-obj {:venia/operation {:operation/type :mutation
:operation/name "EditTransaction"}
:venia/queries [{:query/data [:edit-transaction
{:transaction {:id id :vendor-id vendor-id}}
[:id
:amount
[:vendor [:name :id]]
:date
:post_date
:status
:description_original
[:payment [:check_number :s3_url]]
[:client [:name :id]]
[:bank-account [:name :yodlee-account-id]]]]}]}
transaction-read]}]}
:on-success [::edited edit-completed]
:on-error [::forms/save-error ::edit-transaction]}}))))
@@ -70,8 +59,9 @@
(re-frame/dispatch-sync [::saving edit-completed]))}
[:h1.title.is-2 "Edit Transaction"]
[:div.notification
[:p "This transaction matches Invoice 'ABC' for 'DBI Beverages'. " [:a "Create payment and match"] "."]]
(comment
[:div.notification
[:p "This transaction matches Invoice 'ABC' for 'DBI Beverages'. " [:a "Create payment and match"] "."]])
[:div.field
@@ -96,14 +86,14 @@
:event change-event
:subscription data}]]]]
[:div.field
[:p.control
[:label.checkbox
[:input.checkbox {:type "checkbox"
:field [:always-map]
:subscription data}]
" Always match Merchant '" (:merchant-name data) "' to '" (:vendor-name data) "'" ]]]
(comment
[:div.field
[:p.control
[:label.checkbox
[:input.checkbox {:type "checkbox"
:field [:always-map]
:subscription data}]
" Always match Merchant '" (:merchant-name data) "' to '" (:vendor-name data) "'" ]]])
[:div.field
[:p.help "Credit Account"]