Another treat. Yodlee page now will show where they're linked.
This commit is contained in:
@@ -179,26 +179,33 @@
|
|||||||
"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
|
||||||
|
[:table.table
|
||||||
|
[:thead
|
||||||
|
[:tr
|
||||||
|
[:th "Account Name"]
|
||||||
|
[:th "Account Number"]
|
||||||
|
[:th "Yodlee Account Number"]
|
||||||
|
[:th "Balance"]
|
||||||
|
[:th "Yodlee Status"]
|
||||||
|
[:th "Usage"]]]
|
||||||
|
[:tbody
|
||||||
|
|
||||||
[:div
|
(for [account accounts]
|
||||||
[:table.table
|
^{:key (:id account)} [:tr
|
||||||
[:thead
|
[:td (:accountName account)]
|
||||||
[:tr
|
[:td (:accountNumber account)]
|
||||||
[:th "Account Name"]
|
[:td (:id account)]
|
||||||
[:th "Account Number"]
|
[:td.has-text-right (:amount (:balance account))]
|
||||||
[:th "Yodlee Account Number"]
|
[:td (str/join ", " (map :additionalStatus (:dataset account)))]
|
||||||
[:th "Balance"]
|
[:td
|
||||||
[:th "Yodlee Status"]]]
|
(when-let [bank-accounts (get bank-accounts (:id account))]
|
||||||
[:tbody
|
[:div.tags
|
||||||
|
(for [bank-account bank-accounts]
|
||||||
(for [account accounts]
|
^{:key (:id bank-account)}
|
||||||
^{:key (:id account)} [:tr
|
[:div.tag (:name bank-account) " (" (:code bank-account) ")"])])]
|
||||||
[:td (:accountName account)]
|
])]]]))
|
||||||
[:td (:accountNumber account)]
|
|
||||||
[:td (:id account)]
|
|
||||||
[:td.has-text-right (:amount (:balance account))]
|
|
||||||
[:td (str/join ", " (map :additionalStatus (:dataset account)))]
|
|
||||||
])]]])
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::reauthenticate-mfa
|
::reauthenticate-mfa
|
||||||
@@ -293,91 +300,103 @@
|
|||||||
{: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..."]
|
||||||
[:div.columns
|
[:div.columns
|
||||||
[: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
|
[:div.card-header-icon
|
||||||
[delete-button (:id account)]]
|
(when (seq total-usages)
|
||||||
[:div.card-header-icon
|
[:div.tags
|
||||||
(cond
|
[:div.tag.is-primary (count total-usages) " usages"]])]
|
||||||
(= :loading status) [:button.button.is-disabled.is-loading [:i.fa.fa-refresh]]
|
[:div.card-header-icon
|
||||||
error [:button.button.is-disabled [:span.icon [:i.fa.fa-exclamation-triangle]]]
|
[delete-button (:id account)]]
|
||||||
:else
|
[:div.card-header-icon
|
||||||
[:button.button
|
(cond
|
||||||
{:on-click (dispatch-event [::refresh-provider-account (:id account)])}
|
(= :loading status) [:button.button.is-disabled.is-loading [:i.fa.fa-refresh]]
|
||||||
[:span.icon [:i.fa.fa-refresh]]])]]
|
error [:button.button.is-disabled [:span.icon [:i.fa.fa-exclamation-triangle]]]
|
||||||
[:div.card-content
|
:else
|
||||||
|
[:button.button
|
||||||
|
{:on-click (dispatch-event [::refresh-provider-account (:id account)])}
|
||||||
|
[:span.icon [:i.fa.fa-refresh]]])]]
|
||||||
|
[:div.card-content
|
||||||
|
|
||||||
(if (> (some-> (-> account :dataset first :lastUpdated)
|
(if (> (some-> (-> account :dataset first :lastUpdated)
|
||||||
(yodlee-date->date )
|
(yodlee-date->date )
|
||||||
(time/interval (time/now))
|
(time/interval (time/now))
|
||||||
(time/in-days ))
|
(time/in-days ))
|
||||||
1)
|
1)
|
||||||
[:div.notification.is-info.is-light
|
[:div.notification.is-info.is-light
|
||||||
[:div.level
|
[:div.level
|
||||||
[:div.level-left
|
[:div.level-left
|
||||||
[:div.level-item
|
[:div.level-item
|
||||||
[:p
|
[:p
|
||||||
"This account was last updated on "
|
"This account was last updated on "
|
||||||
(yodlee-date->str (-> account :dataset first :lastUpdated))
|
(yodlee-date->str (-> account :dataset first :lastUpdated))
|
||||||
", and last attempted "
|
", and last attempted "
|
||||||
(yodlee-date->str (-> account :dataset first :lastUpdateAttempt))
|
(yodlee-date->str (-> account :dataset first :lastUpdateAttempt))
|
||||||
"."]]]
|
"."]]]
|
||||||
[:div.level-right [:button.button.is-success {:on-click (dispatch-event [::kick (:id account)] )} "Sync yodlee with bank" ]]]
|
[:div.level-right [:button.button.is-success {:on-click (dispatch-event [::kick (:id account)] )} "Sync yodlee with bank" ]]]
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
[yodlee-accounts-table (:accounts account)]
|
[yodlee-accounts-table (:accounts account)]
|
||||||
(if (not= (-> account :dataset first :additionalStatus)
|
(if (not= (-> account :dataset first :additionalStatus)
|
||||||
"AVAILABLE_DATA_RETRIEVED")
|
"AVAILABLE_DATA_RETRIEVED")
|
||||||
[:div
|
[:div
|
||||||
[:div.notification.is-info.is-warning
|
[:div.notification.is-info.is-warning
|
||||||
[:div.level
|
[:div.level
|
||||||
[:div.level-left
|
[:div.level-left
|
||||||
[:div.level-item
|
[:div.level-item
|
||||||
"This provider account's status is '"
|
"This provider account's status is '"
|
||||||
(-> account :dataset first :additionalStatus)
|
(-> account :dataset first :additionalStatus)
|
||||||
"'. If this is in error, it might help to try reauthenticating by filling out the form below."]]]]
|
"'. If this is in error, it might help to try reauthenticating by filling out the form below."]]]]
|
||||||
(let [{error :error account-data :data } @(re-frame/subscribe [::forms/form [::mfa-form (:id account)]])
|
(let [{error :error account-data :data } @(re-frame/subscribe [::forms/form [::mfa-form (:id account)]])
|
||||||
change-event [::forms/change [::mfa-form (:id account)]]
|
change-event [::forms/change [::mfa-form (:id account)]]
|
||||||
{:keys [form-inline field field-holder raw-field error-notification submit-button]} (forms/vertical-form {:can-submit [::can-submit]
|
{:keys [form-inline field field-holder raw-field error-notification submit-button]} (forms/vertical-form {:can-submit [::can-submit]
|
||||||
:change-event change-event
|
:change-event change-event
|
||||||
:submit-event [::reauthenticate-mfa (:id account)]
|
:submit-event [::reauthenticate-mfa (:id account)]
|
||||||
:id [::mfa-form (:id account)]} )]
|
:id [::mfa-form (:id account)]} )]
|
||||||
(form-inline {:title "Reauthenticate"}
|
(form-inline {:title "Reauthenticate"}
|
||||||
[:<>
|
[:<>
|
||||||
(error-notification)
|
(error-notification)
|
||||||
(doall
|
(doall
|
||||||
(for [[row i] (map vector (-> account :loginForm last :row) (range))
|
(for [[row i] (map vector (-> account :loginForm last :row) (range))
|
||||||
f (:field row)
|
f (:field row)
|
||||||
:let [options (map :optionValue (:option f))]]
|
:let [options (map :optionValue (:option f))]]
|
||||||
^{:key (:id f)}
|
^{:key (:id f)}
|
||||||
[:div
|
[:div
|
||||||
(field (:label row)
|
(field (:label row)
|
||||||
[:input.input {:type "text" :field [:login i (:id f)]}])
|
[:input.input {:type "text" :field [:login i (:id f)]}])
|
||||||
(if (seq options)
|
(if (seq options)
|
||||||
[:ul
|
[:ul
|
||||||
(for [o options]
|
(for [o options]
|
||||||
^{:key o}
|
^{:key o}
|
||||||
[:li [:pre o]])])]))
|
[:li [:pre o]])])]))
|
||||||
(doall
|
(doall
|
||||||
(for [f (-> account :field)]
|
(for [f (-> account :field)]
|
||||||
^{: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 []
|
||||||
|
|||||||
Reference in New Issue
Block a user