makes plaid really usable, allowing choosing on bank screen, and searchable on vendors page.

This commit is contained in:
Bryce
2023-07-22 21:33:06 -07:00
parent ff2d64fee5
commit dfd1af77c4
15 changed files with 101 additions and 21 deletions

View File

@@ -78,7 +78,7 @@
(re-frame/reg-event-fx
::save
[with-user with-is-admin? (forms/triggers-loading ::vendor-form) (forms/in-form ::vendor-form)]
(fn [{:keys [user is-admin?] {{:keys [name hidden print-as terms invoice-reminder-schedule primary-contact automatically-paid-when-due schedule-payment-dom secondary-contact address default-account terms-overrides account-overrides id legal-entity-name legal-entity-tin legal-entity-tin-type legal-entity-first-name legal-entity-last-name legal-entity-middle-name legal-entity-1099-type] :as data} :data} :db} _]
(fn [{:keys [user is-admin?] {{:keys [name hidden print-as terms invoice-reminder-schedule plaid-merchant primary-contact automatically-paid-when-due schedule-payment-dom secondary-contact address default-account terms-overrides account-overrides id legal-entity-name legal-entity-tin legal-entity-tin-type legal-entity-first-name legal-entity-last-name legal-entity-middle-name legal-entity-1099-type] :as data} :data} :db} _]
(if (m/validate schema data)
(let [query [:upsert-vendor
{:vendor (cond-> {:id id
@@ -114,6 +114,7 @@
:automatically-paid-when-due (mapv
(comp :id :client)
automatically-paid-when-due)
:plaid-merchant (:id plaid-merchant)
:legal-entity-name legal-entity-name
:legal-entity-first-name legal-entity-first-name
:legal-entity-middle-name legal-entity-middle-name
@@ -179,8 +180,18 @@
"Print Checks As"
[:input.input]]
(when is-admin?
[form-builder/raw-field-v2 {:field :hidden}
[com/checkbox {:label "Hidden"}]])
[:<>
[form-builder/raw-field-v2 {:field :hidden}
[com/checkbox {:label "Hidden"}]]
[form-builder/field-v2 {:field :plaid-merchant
:required? false}
"Plaid merchant"
[search-backed-typeahead {:search-query (fn [i]
[:search_plaid_merchants
{:query i}
[:name :id]])
:style {:width "19em"}}]]])
[form-builder/section {:title "Terms"}
[form-builder/field-v2 {:field :terms}

View File

@@ -460,9 +460,9 @@
"Intuit Bank Account"
[typeahead-v3 {:entities @(re-frame/subscribe [::subs/intuit-bank-accounts])
:entity->text (fn [m] (str (:name m)))}]]
[form-builder/field-v2 {:field :plaid-accounti}
[form-builder/field-v2 {:field :plaid-account}
"Plaid Account"
[typeahead-v3 {:entities @(re-frame/subscribe [::plaid-accounts (:id new-client)])
[typeahead-v3 {:entities (mapcat :accounts (:plaid-items new-client ))
:entity->text (fn [m] (str (:name m)))}]]])
(when (#{:credit ":credit"} type )
@@ -498,7 +498,7 @@
[form-builder/field-v2 {:field :plaid-account}
"Plaid Account"
[typeahead-v3 {:entities @(re-frame/subscribe [::plaid-accounts (:id new-client)])
[typeahead-v3 {:entities (mapcat :accounts (:plaid-items new-client ))
:entity->text (fn [m] (str (:name m)))}]]])
[:div.field
[:label.label "Locations"]

View File

@@ -22,6 +22,7 @@
[:usage [:client-id :count]]
[:primary-contact [:name :phone :email :id]]
[:secondary-contact [:id :name :phone :email]]
[:plaid-merchant [:id :name]]
:print-as :invoice-reminder-schedule :code
:legal-entity-name
:legal-entity-first-name :legal-entity-middle-name :legal-entity-last-name

View File

@@ -7,6 +7,7 @@
[:schedule-payment-dom [[:client [:id :name]] :id :dom]]
[:usage [:client-id :count]]
[:primary-contact [:name :phone :email :id]]
[:plaid-merchant [:name :id]]
[:secondary-contact [:id :name :phone :email]]
:print-as :invoice-reminder-schedule :code
:legal-entity-name

View File

@@ -13,6 +13,7 @@
[:accounts [:id :amount :location [:account [:name :id :location :numeric-code]]]]
:date
[:yodlee_merchant [:name :yodlee-id :id]]
[:plaid_merchant [:name :id]]
:post_date
[:expected-deposit [:id :date]]
[:forecast-match [:id :identifier]]

View File

@@ -60,6 +60,7 @@
(-> which
(select-keys [:vendor :amount :payment :client :description-original
:yodlee-merchant :id :potential-payment-matches
:plaid-merchant
:forecast-match :date
:location :accounts :approval-status
:matched-rule])
@@ -359,6 +360,10 @@
"Description"
[:input.input {:type "text"
:disabled "disabled"}]]
[form-builder/field-v2 {:field [:plaid-merchant :name]}
"Merchant"
[:input.input {:type "text"
:disabled "disabled"}]]
[form-builder/field-v2 {:field [:date]}
"Date"