making it loadable.
This commit is contained in:
@@ -111,7 +111,6 @@
|
||||
:db/doc "A client's computer-friendly name"}
|
||||
{:db/ident :client/signature-file
|
||||
:db/valueType :db.type/string
|
||||
:db/unique :db.unique/identity
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "A check signature image"}
|
||||
|
||||
@@ -536,7 +535,7 @@
|
||||
:code (if (seq code) code nil)
|
||||
:email email
|
||||
:default-expense-account default-expense-account
|
||||
:invoice-reminder-schedule invoice-reminder-schedule
|
||||
:invoice-reminder-schedule nil
|
||||
:address (remove-nils #:address {:street1 (:street1 address)
|
||||
:street2 (:street2 address)
|
||||
:city (:city address)
|
||||
@@ -547,7 +546,9 @@
|
||||
:email primary-email})
|
||||
:secondary-contact (remove-nils #:contact {:name secondary-contact
|
||||
:phone secondary-phone
|
||||
:email secondary-email})}))))))
|
||||
:email secondary-email})}))))
|
||||
)
|
||||
)
|
||||
|
||||
(defn load-clients [clients]
|
||||
(->> clients
|
||||
@@ -606,10 +607,10 @@
|
||||
(map
|
||||
(fn [{:keys [id expense-account-id location amount invoice-id]}]
|
||||
[(remove-nils #:invoice {:original-id invoice-id
|
||||
:expense-accounts [#:invoice-expense-account {:original-id id
|
||||
:expense-accounts [(remove-nils #:invoice-expense-account {:original-id id
|
||||
:expense-account-id expense-account-id
|
||||
:location location
|
||||
:amount (double amount)}]})]))))
|
||||
:amount (double amount)})]})]))))
|
||||
|
||||
|
||||
(defn load-payments [checks]
|
||||
@@ -622,7 +623,9 @@
|
||||
:s3-url s3-url
|
||||
:vendor (when vendor-id [:vendor/original-id vendor-id])
|
||||
:client [:client/original-id company-id]
|
||||
:bank-account (when bank-account-id [:bank-account/original-id (str company-id "-" bank-account-id)])
|
||||
:bank-account (when (and bank-account-id
|
||||
(not= "38-3" (str company-id "-" bank-account-id))) ;; TODO - 38-3 got removed at some ponitn
|
||||
[:bank-account/original-id (str company-id "-" bank-account-id)])
|
||||
:check-number check-number
|
||||
:memo memo
|
||||
:date (coerce/to-date date)
|
||||
@@ -644,28 +647,33 @@
|
||||
:amount (double amount)})]))))
|
||||
|
||||
(defn load-transactions [transactions]
|
||||
(->> transactions
|
||||
(map
|
||||
(fn [{:keys [id amount description-original description-simple merchant-id merchant-name
|
||||
date post-date type account-id status vendor-id company-id check-id check-number
|
||||
bank-account-id]}]
|
||||
[(remove-nils #:transaction {:original-id id
|
||||
:description-original description-original
|
||||
:description-simple description-simple
|
||||
:merchant-id merchant-id
|
||||
:merchant-name merchant-name
|
||||
:date (coerce/to-date date)
|
||||
:post-date (coerce/to-date post-date)
|
||||
:type type
|
||||
:status status
|
||||
:amount (double amount)
|
||||
:account-id account-id
|
||||
:check-number check-number
|
||||
:vendor (when vendor-id [:vendor/original-id vendor-id])
|
||||
:client (when company-id [:client/original-id company-id])
|
||||
:payment (when check-id [:payment/original-id check-id])
|
||||
:bank-account (when bank-account-id
|
||||
[:bank-account/original-id (str company-id "-" bank-account-id)])})]))))
|
||||
(let [transactions (->> transactions
|
||||
(map
|
||||
(fn [{:keys [id amount description-original description-simple merchant-id merchant-name
|
||||
date post-date type account-id status vendor-id company-id check-id check-number
|
||||
bank-account-id]}]
|
||||
(remove-nils #:transaction {:original-id id
|
||||
:id id
|
||||
:description-original description-original
|
||||
:description-simple description-simple
|
||||
:merchant-id merchant-id
|
||||
:merchant-name merchant-name
|
||||
:date (coerce/to-date date)
|
||||
:post-date (coerce/to-date post-date)
|
||||
:type type
|
||||
:status status
|
||||
:amount (double amount)
|
||||
:account-id account-id
|
||||
:check-number check-number
|
||||
:vendor (when vendor-id [:vendor/original-id vendor-id])
|
||||
:client (when company-id [:client/original-id company-id])
|
||||
:payment (when check-id [:payment/original-id check-id])
|
||||
:bank-account (when (and bank-account-id
|
||||
(not= "38-3" (str company-id "-" bank-account-id)))
|
||||
[:bank-account/original-id (str company-id "-" bank-account-id)])})))
|
||||
(partition-all 10))]
|
||||
(println "transactions: " (count transactions) "batches of 50")
|
||||
transactions))
|
||||
|
||||
(defn load-users [users]
|
||||
(->> users
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
:args [(d/db (d/connect uri))]}
|
||||
|
||||
(limited-clients (:id args)) (add-arg '[?xx ...] (set (map :db/id (limited-clients (:id args))))
|
||||
'[?e :transaction/client ?xx])
|
||||
'[?e :transaction/client ?xx])
|
||||
(:client-id args) (add-arg '?client-id (:client-id args)
|
||||
'[?e :transaction/client ?client-id])
|
||||
'[?e :transaction/client ?client-id])
|
||||
(:original-id args) (add-arg '?original-id (cond-> (:original-id args) (string? (:original-id args)) Long/parseLong )
|
||||
'[?e :transaction/client ?c]
|
||||
'[?c :client/original-id ?original-id])))
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
:scalars {:id {
|
||||
:parse (schema/as-conformer #(Long/parseLong %))
|
||||
:serialize (schema/as-conformer #(.toString %))}
|
||||
:ident {:parse (schema/as-conformer (fn [x] {:ident x}))
|
||||
:serialize (schema/as-conformer #(do (println %) (:ident %)))}}
|
||||
:ident {:parse (schema/as-conformer (fn [x] {:db/ident x}))
|
||||
:serialize (schema/as-conformer #(or (:ident %) (:db/ident %) %))}}
|
||||
:objects
|
||||
{
|
||||
:client
|
||||
@@ -499,5 +499,4 @@
|
||||
(time (simplify (execute schema q v {:id id})))
|
||||
(catch Exception e
|
||||
(println e)
|
||||
(throw e))
|
||||
)))
|
||||
(throw e)))))
|
||||
|
||||
@@ -10,11 +10,14 @@
|
||||
[auto-ap.views.pages.unpaid-invoices :refer [unpaid-invoices-page]]
|
||||
[auto-ap.views.pages.paid-invoices :refer [paid-invoices-page]]
|
||||
[auto-ap.views.pages.transactions :refer [transactions-page]]
|
||||
[auto-ap.views.pages.login :refer [login-page]]
|
||||
[auto-ap.views.pages.checks :refer [checks-page]]
|
||||
[auto-ap.views.pages.admin :refer [admin-page]]
|
||||
[auto-ap.views.pages.admin.clients :refer [admin-clients-page]]
|
||||
[auto-ap.views.pages.admin.vendors :refer [admin-vendors-page]]
|
||||
[auto-ap.views.pages.admin.excel-import :refer [admin-excel-import-page]]
|
||||
[auto-ap.views.pages.admin.users :refer [admin-users-page]]
|
||||
[auto-ap.views.pages.admin.yodlee :refer [admin-yodlee-page]]
|
||||
[auto-ap.entities.clients :as clients]
|
||||
[auto-ap.views.pages :as pages]
|
||||
[auto-ap.views.components.vendor-dialog :refer [vendor-dialog]]))
|
||||
@@ -44,10 +47,19 @@
|
||||
(defmethod page :admin-vendors [_]
|
||||
(admin-vendors-page))
|
||||
|
||||
(defmethod page :admin-yodlee [_]
|
||||
(admin-yodlee-page))
|
||||
|
||||
(defmethod page :index [_]
|
||||
[side-bar-layout {:side-bar [:div]
|
||||
:main [:h1 "Home"]}])
|
||||
|
||||
(defmethod page :login [_]
|
||||
[login-page])
|
||||
|
||||
(defmethod page :admin-excel-import [_]
|
||||
[admin-excel-import-page])
|
||||
|
||||
(defn active-page []
|
||||
(let [ap (re-frame/subscribe [::subs/active-page])]
|
||||
[:div
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
[auto-ap.events.admin.clients :as events]
|
||||
[auto-ap.entities.clients :as entity]
|
||||
|
||||
[auto-ap.views.components.layouts :refer [side-bar-layout]]
|
||||
[auto-ap.views.components.admin.side-bar :refer [admin-side-bar]]
|
||||
[auto-ap.views.components.typeahead :refer [typeahead]]
|
||||
[auto-ap.views.utils :refer [login-url dispatch-value-change bind-field horizontal-field dispatch-event]]
|
||||
[cljs.reader :as edn]
|
||||
@@ -103,7 +105,7 @@
|
||||
(reduce disj v (get-in db [::excel-import :create-vendors]))))
|
||||
(update-in [::excel-import] dissoc :create-vendors))))
|
||||
|
||||
(defn admin-excel-import-page []
|
||||
(defn admin-excel-import-content []
|
||||
[:div
|
||||
(let [{{:keys [vendors-not-found already-imported imported]} :rows
|
||||
:keys [create-vendors]
|
||||
@@ -196,3 +198,8 @@
|
||||
[:td vendor-name]
|
||||
[:td amount]
|
||||
[:td (map (fn [{:keys [info]}] ^{:key info} [:p info]) row-errors)]])]])])])
|
||||
|
||||
|
||||
(defn admin-excel-import-page []
|
||||
[side-bar-layout {:side-bar [admin-side-bar {}]
|
||||
:main [admin-excel-import-content]}])
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
[auto-ap.subs :as subs]
|
||||
[auto-ap.events.admin.clients :as events]
|
||||
[auto-ap.entities.clients :as entity]
|
||||
[auto-ap.views.components.layouts :refer [side-bar-layout]]
|
||||
[auto-ap.views.components.admin.side-bar :refer [admin-side-bar]]
|
||||
[auto-ap.views.components.address :refer [address-field]]
|
||||
[auto-ap.views.utils :refer [login-url dispatch-event dispatch-value-change bind-field horizontal-field]]
|
||||
[auto-ap.views.components.modal :refer [action-modal]]
|
||||
@@ -165,7 +167,7 @@
|
||||
[:button.button.is-success {:on-click (dispatch-event [::kick (:id account)] )} "Kick." ])]]))]])
|
||||
|
||||
|
||||
(defn admin-yodlee-page []
|
||||
(defn admin-yodlee-content []
|
||||
[(with-meta
|
||||
(fn []
|
||||
[:div
|
||||
@@ -175,3 +177,7 @@
|
||||
[yodlee-link-button]])
|
||||
{:component-did-mount (fn []
|
||||
(re-frame/dispatch [::mounted]))})])
|
||||
|
||||
(defn admin-yodlee-page []
|
||||
[side-bar-layout {:side-bar [admin-side-bar {}]
|
||||
:main [admin-yodlee-content]}])
|
||||
|
||||
Reference in New Issue
Block a user