supports yodlee manual import.
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
[:div {:class "navbar-end"}
|
||||
(if @user
|
||||
[:div {:class (str "navbar-item has-dropdown " (when (get-in @menu [:account :active?]) "is-active"))}
|
||||
|
||||
[:a {:class "navbar-link login" :on-click (fn [e] (re-frame/dispatch [::events/toggle-menu :account]))} (:name @user)]
|
||||
[:div {:class "navbar-dropdown"}
|
||||
[:a {:class "navbar-item"} "My profile"]
|
||||
@@ -206,6 +207,8 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
]
|
||||
[:div {:class "compose has-text-centered"}
|
||||
[:a {:class "button is-danger is-block is-bold" :href (bidi/path-for routes/routes :index)
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
[reagent.core :as reagent]
|
||||
[goog.string :as gstring]
|
||||
[auto-ap.views.components.sorter :refer [sorted-column]]
|
||||
[auto-ap.views.components.modal :refer [action-modal]]
|
||||
[auto-ap.views.components.paginator :refer [paginator]]
|
||||
[auto-ap.events :as events]
|
||||
[auto-ap.views.utils :refer [dispatch-event date->str ]]
|
||||
[auto-ap.views.utils :refer [dispatch-event date->str bind-field]]
|
||||
[auto-ap.utils :refer [by]]
|
||||
[auto-ap.views.components.invoice-table :refer [invoice-table] :as invoice-table]
|
||||
[auto-ap.subs :as subs]))
|
||||
@@ -135,19 +136,73 @@
|
||||
[:a.tag {:href (:s3-url check) :target "_new"} [:i.fa.fa-money-check] [:span.icon [:i.fa.fa-money]] (str " " (:check-number check) " (" (gstring/format "$%.2f" amount ) ")")])]
|
||||
]))]]]))))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::manual-yodlee-import
|
||||
(fn [{:keys [db]} _]
|
||||
{:dispatch [::events/modal-status ::manual-yodlee-import {:visible? true}]
|
||||
:db (assoc-in db [::manual-yodlee-import] {:company-id (:id @(re-frame/subscribe [::subs/company]))
|
||||
:data ""})}))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::manual-yodlee-import
|
||||
(fn [db]
|
||||
(-> db ::manual-yodlee-import)))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::manual-yodlee-import-completed
|
||||
(fn [{:keys [db]} _]
|
||||
{:dispatch [::events/modal-completed ::manual-yodlee-import]}))
|
||||
|
||||
(re-frame/reg-event-fx
|
||||
::manual-yodlee-import-started
|
||||
(fn [{:keys [db]} _]
|
||||
(let [manual-yodlee-import (::manual-yodlee-import db)]
|
||||
{:http {:token (:user db)
|
||||
:method :post
|
||||
:body (pr-str manual-yodlee-import)
|
||||
:headers {"Content-Type" "application/edn"}
|
||||
:uri (str "/api/transactions/batch-upload")
|
||||
:on-success [::manual-yodlee-import-completed]
|
||||
:on-error [::manual-yodlee-import-error]}})))
|
||||
|
||||
|
||||
(defn manual-yodlee-import-modal []
|
||||
(let [data @(re-frame/subscribe [::manual-yodlee-import])
|
||||
change-event [::events/change-form [::manual-yodlee-import]]]
|
||||
[action-modal {:id ::manual-yodlee-import
|
||||
:title "Manual Yodlee Import"
|
||||
:action-text "Import"
|
||||
:save-event [::manual-yodlee-import-started]}
|
||||
[:div.field
|
||||
[:label.label
|
||||
"Yodlee manual import table"]
|
||||
[:div.control
|
||||
[bind-field
|
||||
[:textarea.textarea {:field [:data]
|
||||
:event change-event
|
||||
:subscription data}]]]]]))
|
||||
|
||||
(def transactions-page
|
||||
|
||||
(with-meta
|
||||
(fn []
|
||||
(let [current-company @(re-frame/subscribe [::subs/company])]
|
||||
(let [current-company @(re-frame/subscribe [::subs/company])
|
||||
user @(re-frame/subscribe [::subs/user])]
|
||||
[:div
|
||||
[:h1.title "Transactions"]
|
||||
(when (= "admin" (:role user))
|
||||
[:div.is-pulled-right
|
||||
[:button.button.is-danger {:disabled (if current-company
|
||||
""
|
||||
"disabled")
|
||||
:on-click (dispatch-event [::manual-yodlee-import])}
|
||||
"Manual Yodlee Import"]])
|
||||
[transaction-table {:id :transactions
|
||||
:params (re-frame/subscribe [::params])
|
||||
:transaction-page (re-frame/subscribe [::transaction-page])
|
||||
:status (re-frame/subscribe [::subs/status])
|
||||
:on-params-change (fn [params]
|
||||
(re-frame/dispatch [::params-change params]))}]]))
|
||||
(re-frame/dispatch [::params-change params]))}]
|
||||
[manual-yodlee-import-modal]]))
|
||||
{:component-will-mount #(re-frame/dispatch-sync [::params-change {}]) }))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user