Another treat. Yodlee page now will show where they're linked.

This commit is contained in:
Bryce Covert
2020-12-17 08:25:04 -08:00
parent a9da35d7b9
commit a84d71c496

View File

@@ -179,7 +179,7 @@
"N/A"))) "N/A")))
(defn yodlee-accounts-table [accounts] (defn yodlee-accounts-table [accounts]
(let [bank-accounts @(re-frame/subscribe [::bank-accounts-by-yodlee-account-id])]
[:div [:div
[:table.table [:table.table
[:thead [:thead
@@ -188,7 +188,8 @@
[:th "Account Number"] [:th "Account Number"]
[:th "Yodlee Account Number"] [:th "Yodlee Account Number"]
[:th "Balance"] [:th "Balance"]
[:th "Yodlee Status"]]] [:th "Yodlee Status"]
[:th "Usage"]]]
[:tbody [:tbody
(for [account accounts] (for [account accounts]
@@ -198,7 +199,13 @@
[:td (:id account)] [:td (:id account)]
[:td.has-text-right (:amount (:balance account))] [:td.has-text-right (:amount (:balance account))]
[:td (str/join ", " (map :additionalStatus (:dataset account)))] [:td (str/join ", " (map :additionalStatus (:dataset account)))]
])]]]) [:td
(when-let [bank-accounts (get bank-accounts (:id account))]
[:div.tags
(for [bank-account bank-accounts]
^{:key (:id bank-account)}
[:div.tag (:name bank-account) " (" (:code bank-account) ")"])])]
])]]]))
(re-frame/reg-event-fx (re-frame/reg-event-fx
::reauthenticate-mfa ::reauthenticate-mfa
@@ -293,7 +300,14 @@
{:on-click (dispatch-event [::delete-requested account-id])} {:on-click (dispatch-event [::delete-requested account-id])}
[:span.icon [:i.fa.fa-times]]]) [:span.icon [:i.fa.fa-times]]])
(re-frame/reg-sub
::bank-accounts-by-yodlee-account-id
:<- [::subs/bank-accounts]
(fn [bank-accounts]
(group-by :yodlee-account-id bank-accounts)))
(defn yodlee-provider-accounts-table [] (defn yodlee-provider-accounts-table []
(let [bank-accounts @(re-frame/subscribe [::bank-accounts-by-yodlee-account-id])]
(if @(re-frame/subscribe [::provider-accounts-loading?]) (if @(re-frame/subscribe [::provider-accounts-loading?])
[:div "Loading..."] [:div "Loading..."]
@@ -301,12 +315,17 @@
[:div.column.is-half [:div.column.is-half
(doall (doall
(for [account @(re-frame/subscribe [::provider-accounts]) (for [account @(re-frame/subscribe [::provider-accounts])
:let [{:keys [error status] :as g} @(re-frame/subscribe [::forms/form [::refresh-provider-account (:id account)]])]] :let [{:keys [error status] :as g} @(re-frame/subscribe [::forms/form [::refresh-provider-account (:id account)]])
total-usages (mapcat (comp bank-accounts :id) (:accounts account))]]
^{:key (:id account)} ^{:key (:id account)}
[:div.card {:style {:margin-bottom "1em"}} [:div.card {:style {:margin-bottom "1em"}}
[:div.card-header [:div.card-header
[:div.card-header-title "Provider account " (:id account)] [:div.card-header-title "Provider account " (:id account)]
[:div.card-header-icon
(when (seq total-usages)
[:div.tags
[:div.tag.is-primary (count total-usages) " usages"]])]
[:div.card-header-icon [:div.card-header-icon
[delete-button (:id account)]] [delete-button (:id account)]]
[:div.card-header-icon [:div.card-header-icon
@@ -377,7 +396,7 @@
^{:key (:id f)} ^{:key (:id f)}
(field (:label f) (field (:label f)
[:input.input {:type "text" :mfa [:form (:id f)] :value (-> f :field first :value)}]))) [:input.input {:type "text" :mfa [:form (:id f)] :value (-> f :field first :value)}])))
(submit-button "Reauthenticate")]))])]]))]])) (submit-button "Reauthenticate")]))])]]))]])))
(defn admin-yodlee-content [] (defn admin-yodlee-content []