beginnings of better import.

This commit is contained in:
2021-12-03 09:21:39 -08:00
parent a992fcb5d5
commit 0e49b9f493
13 changed files with 406 additions and 92 deletions

View File

@@ -35,6 +35,7 @@
[:location-matches [:id :location :match]]
[:bank-accounts [:id :start-date :numeric-code :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id
[:yodlee-account [:name :id :number]]
[:intuit-bank-account [:name :id :external-id]]
:locations :include-in-reports :current-balance :yodlee-balance-old] ]
[:address [:street1 :street2 :city :state :zip]]
[:forecasted-transactions [:id :amount :identifier :day-of-month]]]

View File

@@ -174,6 +174,11 @@
(fn [db]
(:is-initial-loading? db)))
(re-frame/reg-sub
::intuit-bank-accounts
(fn [db]
(::intuit-bank-accounts db)))
(re-frame/reg-sub
::modal-state
(fn [db [_ id status-from]]

View File

@@ -12,7 +12,7 @@
[auto-ap.views.components.address :refer [address-field]]
[auto-ap.views.components.layouts :refer [side-bar-layout appearing-side-bar side-bar] ]
[auto-ap.views.components.admin.side-bar :refer [admin-side-bar]]
[auto-ap.views.utils :refer [login-url dispatch-event dispatch-value-change bind-field horizontal-field nf]]
[auto-ap.views.utils :refer [login-url dispatch-event dispatch-value-change bind-field horizontal-field nf with-user]]
[auto-ap.views.pages.admin.clients.table :as table]
[auto-ap.views.pages.admin.clients.form :as form]
[cljs.reader :as edn]
@@ -23,12 +23,22 @@
[auto-ap.views.pages.admin.clients.side-bar :as side-bar]
[vimsical.re-frame.fx.track :as track]))
(re-frame/reg-event-db
::received-intuit-bank-accounts
(fn [db [_ result]]
(assoc db ::subs/intuit-bank-accounts (:intuit-bank-accounts result))))
(re-frame/reg-event-fx
::mounted
(fn [{:keys [db]} _]
[with-user]
(fn [{:keys [db user]} _]
{::track/register {:id ::params
:subscription [::params]
:event-fn (fn [params] [::params-change params])}}))
:event-fn (fn [params] [::params-change params])}
:graphql {:token user
:query-obj {:venia/queries [[:intuit_bank_accounts [:external_id :id :name]]]}
:owns-state {:single [::load-intuit-bank-accounts]}
:on-success [::received-intuit-bank-accounts]} }))
(re-frame/reg-event-fx
::unmounted
@@ -45,6 +55,8 @@
(seq filter-params) (merge filter-params)
(seq table-params) (merge table-params))))
(re-frame/reg-event-db
::new
(fn [db [_ client-id]]

View File

@@ -127,7 +127,8 @@
:identifier identifier
:amount amount})
(:forecasted-transactions new-client-data))
:bank-accounts (map (fn [{:keys [number name check-number include-in-reports type id code numeric-code start-date bank-name routing bank-code new? sort-order visible yodlee-account-id locations yodlee-account]}]
:bank-accounts (map (fn [{:keys [number name check-number intuit-bank-account include-in-reports type id code numeric-code start-date bank-name routing bank-code new? sort-order visible yodlee-account-id locations yodlee-account]}]
(println intuit-bank-account)
{:number number
:name name
:check-number (when-not (str/blank? check-number)
@@ -152,6 +153,7 @@
:yodlee-account-id (when-not (str/blank? yodlee-account-id)
(js/parseInt yodlee-account-id))
:yodlee-account (:id yodlee-account)
:intuit-bank-account (:id intuit-bank-account)
:code (if new?
(str (:code new-client-data) "-" code)
code)
@@ -390,7 +392,12 @@
[typeahead-v3 {:entities @(re-frame/subscribe [::yodlee-accounts (:id new-client)])
:entity->text (fn [m] (str (:name m) " - " (:number m)))
:type "typeahead-v3"
:field [:bank-accounts sort-order :yodlee-account]}]]])
:field [:bank-accounts sort-order :yodlee-account]}]]
[field "Intuit Bank Account"
[typeahead-v3 {:entities @(re-frame/subscribe [::subs/intuit-bank-accounts])
:entity->text (fn [m] (str (:name m)))
:type "typeahead-v3"
:field [:bank-accounts sort-order :intuit-bank-account]}]]])
(when (#{:credit ":credit"} type )
[:div
@@ -420,7 +427,12 @@
[typeahead-v3 {:entities @(re-frame/subscribe [::yodlee-accounts (:id new-client)])
:entity->text (fn [m] (str (:name m) " - " (:number m)))
:type "typeahead-v3"
:field [:bank-accounts sort-order :yodlee-account]}]]])
:field [:bank-accounts sort-order :yodlee-account]}]]
[field "Intuit Bank Account"
[typeahead-v3 {:entities @(re-frame/subscribe [::subs/intuit-bank-accounts])
:entity->text (fn [m] (str (:name m)))
:type "typeahead-v3"
:field [:bank-accounts sort-order :intuit-bank-account]}]]])
[:div.field
[:label.label "Locations"]
[:div.control