msot
This commit is contained in:
22
project.clj
22
project.clj
@@ -112,9 +112,9 @@
|
||||
:source-paths ["src/clj" "src/cljc" "src/cljs" "iol_ion/src" ]
|
||||
:resource-paths ["resources"]
|
||||
:aliases {"build" ["do" ["uberjar"]]
|
||||
"fig:dev" ["run" "-m" "figwheel.main" "-b" "dev" "-r"]
|
||||
#_#_"fig:dev" ["run" "-m" "figwheel.main" "-b" "dev" "-r"]
|
||||
"build-dev" ["trampoline" "run" "-m" "figwheel.main" "-b" "dev" "-r"]
|
||||
"fig:min" ["run" "-m" "figwheel.main" "-O" "whitespace" "-bo" "min"]}
|
||||
#_#_"fig:min" ["run" "-m" "figwheel.main" "-O" "whitespace" "-bo" "min"]}
|
||||
|
||||
|
||||
:profiles {
|
||||
@@ -127,7 +127,7 @@
|
||||
[org.clojure/java.jdbc "0.7.11"]
|
||||
#_[com.datomic/dev-local "1.0.243"]
|
||||
[etaoin "0.4.1"]
|
||||
[com.bhauman/figwheel-main "0.2.18" :exclusions [org.clojure/clojurescript
|
||||
#_[com.bhauman/figwheel-main "0.2.18" :exclusions [org.clojure/clojurescript
|
||||
ring
|
||||
ring/ring-core
|
||||
ring/ring-codec
|
||||
@@ -150,7 +150,7 @@
|
||||
{:java-cmd "/usr/lib/jvm/java-11-openjdk/bin/java"
|
||||
:aot []
|
||||
:prep-tasks ["fig:min"]
|
||||
:dependencies [[com.bhauman/figwheel-main "0.2.18" :exclusions [org.clojure/clojurescript
|
||||
:dependencies [#_[com.bhauman/figwheel-main "0.2.18" :exclusions [org.clojure/clojurescript
|
||||
ring
|
||||
ring/ring-core
|
||||
ring/ring-codec
|
||||
@@ -165,18 +165,18 @@
|
||||
org.eclipse.jetty.websocket/websocket-server
|
||||
org.eclipse.jetty.websocket/websocket-servlet
|
||||
args4j]]]}
|
||||
:provided {:dependencies [[org.clojure/clojurescript "1.11.4"
|
||||
:provided {:dependencies [#_[org.clojure/clojurescript "1.11.4"
|
||||
:exclusions [com.google.code.findbugs/jsr305
|
||||
com.fasterxml.jackson.core/jackson-core]]
|
||||
[reagent "1.0.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server] ]
|
||||
[re-frame "1.1.2"
|
||||
#_[reagent "1.0.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server] ]
|
||||
#_[re-frame "1.1.2"
|
||||
:exclusions
|
||||
[reagent
|
||||
org.clojure/clojurescript]]
|
||||
[re-frame-utils "0.1.0"]
|
||||
[com.andrewmcveigh/cljs-time "0.5.2"]
|
||||
[cljs-http "0.1.46"]
|
||||
[kibu/pushy "0.3.8"]]}
|
||||
#_[re-frame-utils "0.1.0"]
|
||||
#_[com.andrewmcveigh/cljs-time "0.5.2"]
|
||||
#_[cljs-http "0.1.46"]
|
||||
#_[kibu/pushy "0.3.8"]]}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -143,11 +143,14 @@
|
||||
(doseq [d dates]
|
||||
(assert-not-locked client-id d)))
|
||||
|
||||
(defn strip-special [q]
|
||||
(str/replace q #"[\[\]\+\*\-\?]" ""))
|
||||
|
||||
(defn cleanse-query [q]
|
||||
(if (str/includes? q "&")
|
||||
(str "\"" q "\"~0.8")
|
||||
(let [parts (-> q
|
||||
(str/replace #"[\[\]\+\*\-\?]" "")
|
||||
(strip-special)
|
||||
(str/split #"\s+"))
|
||||
exacts (butlast parts)
|
||||
partial (some-> (last parts)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(ns auto-ap.handler
|
||||
(:require [amazonica.core :refer [defcredential]]
|
||||
[auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.datomic :refer [conn pull-many]]
|
||||
[auto-ap.graphql.utils :refer [extract-client-ids limited-clients]]
|
||||
[auto-ap.logging :as alog]
|
||||
@@ -54,7 +53,6 @@
|
||||
|
||||
(def all-routes ["/" (-> (into []
|
||||
(deep-merge ssr-routes/routes
|
||||
(second client-routes/routes)
|
||||
graphql/routes
|
||||
ezcater/routes
|
||||
health/routes
|
||||
@@ -86,13 +84,7 @@
|
||||
(merge auth/match->handler)
|
||||
(merge invoices/match->handler)
|
||||
(merge exports/match->handler)
|
||||
(merge
|
||||
(into {}
|
||||
(map
|
||||
|
||||
(fn [k]
|
||||
[k render-index])
|
||||
client-routes/all-matches)))))
|
||||
))
|
||||
|
||||
(def match->handler
|
||||
(fn [route]
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
[auto-ap.parse :as parse]
|
||||
[amazonica.aws.lambda :as lambda]
|
||||
[config.core :refer [env]]
|
||||
[auto-ap.shared-views.admin.side-bar :refer [admin-side-bar]]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.ui :refer [base-page]]
|
||||
[auto-ap.ssr.utils :refer [html-response]]
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
(ns auto-ap.ssr.admin.import-batch
|
||||
(:require
|
||||
[auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.datomic
|
||||
:refer [add-sorter-fields apply-pagination apply-sort-3 conn merge-query
|
||||
pull-many query2]]
|
||||
[auto-ap.query-params :refer [wrap-copy-qp-pqp]]
|
||||
[auto-ap.routes.admin.import-batch :as route]
|
||||
[auto-ap.routes.transactions :as transaction-routes]
|
||||
[auto-ap.routes.utils
|
||||
:refer [wrap-admin wrap-client-redirect-unauthenticated]]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
@@ -135,7 +135,7 @@
|
||||
:fetch-page fetch-page
|
||||
:page-specific-nav filters
|
||||
:row-buttons (fn [_ entity]
|
||||
[(com/a-icon-button {:href (hu/url (bidi/path-for client-routes/routes :transactions)
|
||||
[(com/a-icon-button {:href (hu/url (bidi/path-for ssr-routes/only-routes ::transaction-routes/all-page)
|
||||
{:import-batch-id (:db/id entity)})
|
||||
:hx-boost true}
|
||||
svg/external-link)])
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
(ns auto-ap.ssr.company-dropdown
|
||||
(:require [auto-ap.datomic :refer [conn pull-many]]
|
||||
[auto-ap.graphql.utils :refer [cleanse-query]]
|
||||
[auto-ap.solr :as solr]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.utils :refer [html-response]]
|
||||
[bidi.bidi :as bidi]
|
||||
[clojure.string :as str]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]
|
||||
[iol-ion.query :refer [can-see-client?]]
|
||||
[clojure.data.json :as json]))
|
||||
(:require
|
||||
[auto-ap.datomic :refer [conn pull-many]]
|
||||
[auto-ap.graphql.utils :refer [cleanse-query strip-special]]
|
||||
[auto-ap.logging :as alog]
|
||||
[auto-ap.solr :as solr]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.utils :refer [html-response]]
|
||||
[bidi.bidi :as bidi]
|
||||
[clojure.data.json :as json]
|
||||
[clojure.string :as str]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]
|
||||
[iol-ion.query :refer [can-see-client?]]))
|
||||
|
||||
|
||||
(defn dropdown-search-results* [{:keys [options]}]
|
||||
@@ -46,22 +48,35 @@
|
||||
|
||||
|
||||
(defn get-clients [identity query]
|
||||
(if (str/starts-with? query "g:")
|
||||
(let [search-query (str "groups:(" (subs query 2) ")")]
|
||||
[{:group (subs query 2)
|
||||
:name (str "All clients matching " (subs query 2))}])
|
||||
(if-let [query (not-empty (cleanse-query query))]
|
||||
(let [search-query (str "name:(" query ")")]
|
||||
(let [raw-query (not-empty (strip-special query))
|
||||
cleansed-query (not-empty (cleanse-query query))
|
||||
cleansed-search-query (str "name:(" query ")")
|
||||
exec-search (fn []
|
||||
(for [n (pull-many (dc/db conn) [:client/name :db/id]
|
||||
(for [{:keys [id name]} (solr/query solr/impl "clients" {"query" cleansed-search-query
|
||||
"fields" "id, name"})
|
||||
:let [client-id (Long/parseLong id)]
|
||||
:when (can-see-client? identity client-id)]
|
||||
client-id))]
|
||||
{:id (:db/id n)
|
||||
:name (:client/name n)}))]
|
||||
(cond (str/starts-with? query "g:")
|
||||
[{:group (subs query 2)
|
||||
:name (str "All clients matching " (subs query 2))}]
|
||||
|
||||
(for [n (pull-many (dc/db conn) [:client/name :db/id]
|
||||
(for [{:keys [id name]} (solr/query solr/impl "clients" {"query" search-query
|
||||
"fields" "id, name"})
|
||||
:let [client-id (Long/parseLong id)]
|
||||
:when (can-see-client? identity client-id)]
|
||||
client-id))]
|
||||
{:id (:db/id n)
|
||||
:name (:client/name n)}))
|
||||
[])))
|
||||
raw-query
|
||||
(let [code-matches (for [n (pull-many (dc/db conn) [:client/name :db/id]
|
||||
(for [{:keys [id name]} (solr/query solr/impl "clients" {"query" (format "code:\"%s\"" raw-query)
|
||||
"fields" "id, name"})
|
||||
:let [client-id (Long/parseLong id)]
|
||||
:when (can-see-client? identity client-id)]
|
||||
client-id))]
|
||||
{:id (:db/id n)
|
||||
:name (:client/name n)})]
|
||||
(or (seq code-matches) (exec-search)))
|
||||
|
||||
cleansed-query
|
||||
(exec-search))))
|
||||
|
||||
(defn dropdown-search-results [{:keys [identity] :as request}]
|
||||
(html-response
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(ns auto-ap.ssr.components.aside
|
||||
(:require
|
||||
[auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.graphql.utils :refer [is-admin?]]
|
||||
[auto-ap.permissions :refer [can?]]
|
||||
[auto-ap.routes.admin.clients :as ac-routes]
|
||||
@@ -13,6 +12,7 @@
|
||||
[auto-ap.routes.ledger :as ledger-routes]
|
||||
[auto-ap.routes.outgoing-invoice :as oi-routes]
|
||||
[auto-ap.routes.payments :as payment-routes]
|
||||
[auto-ap.routes.transactions :as transaction-routes]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components.tags :as tags]
|
||||
[auto-ap.ssr.hiccup-helper :as hh]
|
||||
@@ -255,14 +255,14 @@
|
||||
|
||||
(sub-menu- {:selector "transactions"
|
||||
:active? (= "transactions" selected)}
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:transactions)} "All")
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:unapproved-transactions)} "Unapproved")
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:requires-feedback-transactions)} "Client Review")
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:approved-transactions)} "Approved")
|
||||
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
|
||||
::transaction-routes/all-page)} "All")
|
||||
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
|
||||
::transaction-routes/unapproved-page)} "Unapproved")
|
||||
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
|
||||
::transaction-routes/requires-feedback-page)} "Client Review")
|
||||
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
|
||||
::transaction-routes/approved-page)} "Approved")
|
||||
(when (can? (:identity request)
|
||||
{:subject :transaction :activity :insights})
|
||||
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
|
||||
@@ -277,17 +277,14 @@
|
||||
"Ledger")
|
||||
(sub-menu- {:selector "ledger"
|
||||
:active? (= "ledger" selected)}
|
||||
(if (is-admin? (:identity request))
|
||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||
::ledger-routes/all-page)
|
||||
{:date-range "month"})
|
||||
:active? (= ::ledger-routes/all-page (:matched-route request))
|
||||
:hx-boost "true"}
|
||||
[:div.flex.gap-2
|
||||
"Register"
|
||||
(tags/pill- {:color :secondary} "WIP")])
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:ledger)} "Register"))
|
||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||
::ledger-routes/all-page)
|
||||
{:date-range "month"})
|
||||
:active? (= ::ledger-routes/all-page (:matched-route request))
|
||||
:hx-boost "true"}
|
||||
[:div.flex.gap-2
|
||||
"Register"
|
||||
(tags/pill- {:color :secondary} "WIP")])
|
||||
(when (is-admin? (:identity request))
|
||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||
::ledger-routes/external-page)
|
||||
@@ -297,67 +294,40 @@
|
||||
[:div.flex.gap-2
|
||||
"External Register"
|
||||
(tags/pill- {:color :secondary} "WIP")]))
|
||||
(when (is-admin? (:identity request))
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:ledger)} "Old Register"))
|
||||
(if (is-admin? (:identity request))
|
||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||
::ledger-routes/profit-and-loss))
|
||||
:active? (= ::ledger-routes/profit-and-loss (:matched-route request))
|
||||
:hx-boost "true"}
|
||||
[:div.flex.gap-2
|
||||
"Profit and loss"
|
||||
(tags/pill- {:color :secondary} "WIP")])
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:profit-and-loss)}
|
||||
"Profit and Loss"))
|
||||
(when (is-admin? (:identity request))
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:profit-and-loss)} "Old profit and loss"))
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:profit-and-loss-detail)} "Profit & Loss Detail")
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:cash-flows)} "Cash Flows")
|
||||
(if (is-admin? (:identity request))
|
||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||
::ledger-routes/cash-flows))
|
||||
:active? (= ::ledger-routes/cash-flows (:matched-route request))
|
||||
:hx-boost "true"}
|
||||
[:div.flex.gap-2
|
||||
"Cash flows"
|
||||
(tags/pill- {:color :secondary} "WIP")])
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:cash-flows)} "Cash flows"))
|
||||
(when (is-admin? (:identity request))
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:cash-flows)} "Old Cash flows"))
|
||||
(if (is-admin? (:identity request))
|
||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||
::ledger-routes/balance-sheet))
|
||||
:active? (= ::ledger-routes/balance-sheet (:matched-route request))
|
||||
:hx-boost "true"}
|
||||
[:div.flex.gap-2
|
||||
"Balance Sheet"
|
||||
(tags/pill- {:color :secondary} "WIP")])
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:balance-sheet)} "Balance Sheet"))
|
||||
(when (is-admin? (:identity request))
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:balance-sheet)} "Old Balance Sheet"))
|
||||
(when (can? (:identity request)
|
||||
{:subject :ledger
|
||||
:activity :import})
|
||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
||||
:external-import-ledger)} "External Ledger Import"))
|
||||
(when (is-admin? (:identity request))
|
||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||
::ledger-routes/external-import-page)
|
||||
{:date-range "month"})
|
||||
:active? (= ::ledger-routes/external-import-page (:matched-route request))
|
||||
:hx-boost "true"}
|
||||
[:div.flex.gap-2
|
||||
"External Import"
|
||||
(tags/pill- {:color :secondary} "WIP")])))))]))
|
||||
|
||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||
::ledger-routes/profit-and-loss))
|
||||
:active? (= ::ledger-routes/profit-and-loss (:matched-route request))
|
||||
:hx-boost "true"}
|
||||
[:div.flex.gap-2
|
||||
"Profit and loss"
|
||||
(tags/pill- {:color :secondary} "WIP")])
|
||||
|
||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||
::ledger-routes/cash-flows))
|
||||
:active? (= ::ledger-routes/cash-flows (:matched-route request))
|
||||
:hx-boost "true"}
|
||||
[:div.flex.gap-2
|
||||
"Cash flows"
|
||||
(tags/pill- {:color :secondary} "WIP")])
|
||||
|
||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||
::ledger-routes/balance-sheet))
|
||||
:active? (= ::ledger-routes/balance-sheet (:matched-route request))
|
||||
:hx-boost "true"}
|
||||
[:div.flex.gap-2
|
||||
"Balance Sheet"
|
||||
(tags/pill- {:color :secondary} "WIP")])
|
||||
|
||||
|
||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||
::ledger-routes/external-import-page)
|
||||
{:date-range "month"})
|
||||
:active? (= ::ledger-routes/external-import-page (:matched-route request))
|
||||
:hx-boost "true"}
|
||||
[:div.flex.gap-2
|
||||
"External Import"
|
||||
(tags/pill- {:color :secondary} "WIP")]))))]))
|
||||
|
||||
|
||||
(defn company-aside-nav- [request]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(ns auto-ap.ssr.components.user-dropdown
|
||||
(:require
|
||||
[auto-ap.client-routes :as client-routes2]
|
||||
[auto-ap.datomic :refer [conn pull-attr]]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[bidi.bidi :as bidi]
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
(ns auto-ap.ssr.dashboard
|
||||
(:require [auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.datomic :refer [conn]]
|
||||
[auto-ap.graphql.ledger :refer [get-profit-and-loss-raw]]
|
||||
[auto-ap.graphql.utils :refer [<-graphql]]
|
||||
[auto-ap.ledger.reports :as r]
|
||||
[auto-ap.routes.dashboard :as d-routes]
|
||||
[auto-ap.routes.invoice :as i-routes]
|
||||
[auto-ap.routes.utils :refer [wrap-admin
|
||||
wrap-client-redirect-unauthenticated]]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.company.reports.expense :refer [expense-breakdown-card]]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.hiccup-helper :as hh]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.ui :refer [base-page]]
|
||||
[auto-ap.ssr.utils :refer [apply-middleware-to-all-handlers
|
||||
html-response]]
|
||||
[auto-ap.time :as atime]
|
||||
[bidi.bidi :as bidi]
|
||||
[cemerick.url :as url]
|
||||
[clj-time.coerce :as coerce]
|
||||
[clj-time.core :as time]
|
||||
[datomic.api :as dc]
|
||||
[hiccup.util :as hu]))
|
||||
(:require
|
||||
[auto-ap.datomic :refer [conn]]
|
||||
[auto-ap.graphql.ledger :refer [get-profit-and-loss-raw]]
|
||||
[auto-ap.graphql.utils :refer [<-graphql]]
|
||||
[auto-ap.ledger.reports :as r]
|
||||
[auto-ap.routes.dashboard :as d-routes]
|
||||
[auto-ap.routes.invoice :as i-routes]
|
||||
[auto-ap.routes.transactions :as transaction-routes]
|
||||
[auto-ap.routes.utils :refer [wrap-admin
|
||||
wrap-client-redirect-unauthenticated]]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.hiccup-helper :as hh]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.ui :refer [base-page]]
|
||||
[auto-ap.ssr.utils :refer [apply-middleware-to-all-handlers html-response]]
|
||||
[auto-ap.time :as atime]
|
||||
[bidi.bidi :as bidi]
|
||||
[cemerick.url :as url]
|
||||
[clj-time.coerce :as coerce]
|
||||
[clj-time.core :as time]
|
||||
[datomic.api :as dc]
|
||||
[hiccup.util :as hu]))
|
||||
|
||||
(defn bank-accounts-card [request]
|
||||
(html-response
|
||||
@@ -264,7 +263,7 @@
|
||||
[:div.bg-gray-50.rounded.p-4
|
||||
[:span "You have " (str uncategorized-transaction-count) " transactions needing your feedback. " ]
|
||||
|
||||
(com/link {:href (str (bidi.bidi/path-for client-routes/routes :requires-feedback-transactions)
|
||||
(com/link {:href (str (bidi.bidi/path-for ssr-routes/only-routes ::transaction-routes/requires-feedback-page)
|
||||
"?date-range="
|
||||
(url/url-encode (pr-str {:start (atime/unparse-local (time/plus (time/now) (time/years -1)) atime/iso-date) :end (atime/unparse-local (time/now) atime/iso-date)}))) }
|
||||
|
||||
|
||||
@@ -38,8 +38,7 @@
|
||||
[config.core :refer [env]]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]
|
||||
[malli.core :as mc]
|
||||
[auto-ap.client-routes :as client-routes])
|
||||
[malli.core :as mc])
|
||||
(:import [java.util UUID]))
|
||||
|
||||
|
||||
@@ -338,11 +337,7 @@
|
||||
[:div.px-4.py-3.space-y-4
|
||||
|
||||
[:div.flex.justify-between.items-center [:h1.text-2xl.mb-3.font-bold "Import new invoices"]
|
||||
|
||||
#_[:div.flex.gap-2.items-baseline "Trouble with the new upload experience?"
|
||||
[:a {:href (bidi/path-for client-routes/routes :import-invoices)}
|
||||
(com/pill {:color :secondary}
|
||||
"Go back to previous version")]]]
|
||||
]
|
||||
[:div#page-notification.notification.block {:style {:display "none"}}]
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(ns auto-ap.ssr.invoice.new-invoice-wizard
|
||||
(:require
|
||||
[auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.datomic
|
||||
:refer [audit-transact conn pull-attr]]
|
||||
[auto-ap.datomic.accounts :as d-accounts]
|
||||
@@ -219,10 +218,9 @@
|
||||
:content-fn (fn [c] (pull-attr (dc/db conn) :vendor/name c))
|
||||
:x-model "vendorId"})]))
|
||||
[:div.mb-4
|
||||
[:span.text-sm.text-gray-500 "Can't find the vendor? "
|
||||
(com/link {:href (bidi.bidi/path-for
|
||||
client-routes/routes
|
||||
:new-vendor)
|
||||
;; TODO DO NOT MERGE UNTIL THIS IS FIXED
|
||||
#_[:span.text-sm.text-gray-500 "Can't find the vendor? "
|
||||
(com/link {:href ...
|
||||
:target "new"}
|
||||
"Add new vendor")
|
||||
" in a new window, then return here."]]
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(ns auto-ap.ssr.invoices
|
||||
(:require
|
||||
[auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.datomic
|
||||
:refer [add-sorter-fields apply-pagination apply-sort-3
|
||||
audit-transact audit-transact-batch conn merge-query
|
||||
@@ -20,7 +19,9 @@
|
||||
[auto-ap.permissions :refer [can? wrap-must]]
|
||||
[auto-ap.query-params :refer [wrap-copy-qp-pqp]]
|
||||
[auto-ap.routes.invoice :as route]
|
||||
[auto-ap.routes.ledger :as ledger-routes]
|
||||
[auto-ap.routes.payments :as payment-route]
|
||||
[auto-ap.routes.transactions :as transaction-routes]
|
||||
[auto-ap.routes.utils
|
||||
:refer [wrap-admin wrap-client-redirect-unauthenticated]]
|
||||
[auto-ap.rule-matching :as rm]
|
||||
@@ -660,12 +661,12 @@
|
||||
{:exact-match-id (:db/id p)})
|
||||
:content (str (format "$%,.2f" (:payment/amount p))
|
||||
(some-> (:payment/date p) coerce/to-date-time (atime/unparse-local atime/normal-date) (#(str " payment on " %))))}]
|
||||
(:payment/transaction p) (conj {:link (hu/url (bidi/path-for client-routes/routes :transactions)
|
||||
(:payment/transaction p) (conj {:link (hu/url (bidi/path-for ssr-routes/only-routes ::transaction-routes/all-page)
|
||||
{:exact-match-id (:db/id (first (:payment/transaction p)))})
|
||||
:color :secondary
|
||||
:content "Transaction"})))))
|
||||
(when (:invoice/journal-entry i)
|
||||
[{:link (hu/url (bidi/path-for client-routes/routes :ledger)
|
||||
[{:link (hu/url (bidi/path-for ssr-routes/only-routes ::ledger-routes/all-page)
|
||||
{:exact-match-id (:db/id (first (:invoice/journal-entry i)))})
|
||||
:color :yellow
|
||||
:content "Ledger entry"}])
|
||||
|
||||
@@ -1,31 +1,32 @@
|
||||
(ns auto-ap.ssr.ledger.common
|
||||
(:require [auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.datomic
|
||||
(:require
|
||||
[auto-ap.datomic
|
||||
:refer [add-sorter-fields apply-pagination apply-sort-4 conn
|
||||
merge-query observable-query pull-many]]
|
||||
[auto-ap.datomic.accounts :as d-accounts]
|
||||
[auto-ap.graphql.utils :refer [extract-client-ids]]
|
||||
[auto-ap.permissions :refer [can?]]
|
||||
[auto-ap.routes.invoice :as invoice-route]
|
||||
[auto-ap.routes.ledger :as route]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.components.link-dropdown :refer [link-dropdown]]
|
||||
[auto-ap.ssr.grid-page-helper :as helper]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
[auto-ap.ssr.pos.common :refer [date-range-field*]]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.utils
|
||||
:refer [clj-date-schema entity-id html-response main-transformer
|
||||
ref->enum-schema strip]]
|
||||
[auto-ap.time :as atime]
|
||||
[auto-ap.utils :refer [dollars-0?]]
|
||||
[bidi.bidi :as bidi]
|
||||
[clj-time.coerce :as coerce]
|
||||
[clojure.string :as str]
|
||||
[datomic.api :as dc]
|
||||
[hiccup.util :as hu]
|
||||
[malli.core :as mc]))
|
||||
[auto-ap.datomic.accounts :as d-accounts]
|
||||
[auto-ap.graphql.utils :refer [extract-client-ids]]
|
||||
[auto-ap.permissions :refer [can?]]
|
||||
[auto-ap.routes.invoice :as invoice-route]
|
||||
[auto-ap.routes.ledger :as route]
|
||||
[auto-ap.routes.transactions :as transaction-routes]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.components.link-dropdown :refer [link-dropdown]]
|
||||
[auto-ap.ssr.grid-page-helper :as helper]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
[auto-ap.ssr.pos.common :refer [date-range-field*]]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.utils
|
||||
:refer [clj-date-schema entity-id html-response ref->enum-schema
|
||||
strip]]
|
||||
[auto-ap.time :as atime]
|
||||
[auto-ap.utils :refer [dollars-0?]]
|
||||
[bidi.bidi :as bidi]
|
||||
[clj-time.coerce :as coerce]
|
||||
[clojure.string :as str]
|
||||
[datomic.api :as dc]
|
||||
[hiccup.util :as hu]
|
||||
[malli.core :as mc]))
|
||||
|
||||
(defn exact-match-id* [request]
|
||||
(if (nat-int? (:exact-match-id (:query-params request)))
|
||||
@@ -580,8 +581,8 @@ args
|
||||
|
||||
(-> i :journal-entry/original-entity :transaction/description-original)
|
||||
(conj
|
||||
{:link (hu/url (bidi/path-for client-routes/routes
|
||||
:transactions)
|
||||
{:link (hu/url (bidi/path-for ssr-routes/only-routes
|
||||
::transaction-routes/all-page)
|
||||
{:exact-match-id (:db/id (:journal-entry/original-entity i))})
|
||||
:color :primary
|
||||
:content (format "Transaction '%s'" (-> i :journal-entry/original-entity :transaction/description-original))})
|
||||
|
||||
@@ -1,42 +1,43 @@
|
||||
(ns auto-ap.ssr.payments
|
||||
(:require [auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.datomic
|
||||
(:require
|
||||
[auto-ap.datomic
|
||||
:refer [add-sorter-fields apply-pagination apply-sort-3
|
||||
audit-transact conn merge-query observable-query
|
||||
pull-many]]
|
||||
[auto-ap.graphql.utils :refer [assert-can-see-client
|
||||
exception->notification
|
||||
extract-client-ids notify-if-locked]]
|
||||
[auto-ap.query-params :refer [wrap-copy-qp-pqp]]
|
||||
[auto-ap.logging :as alog]
|
||||
[auto-ap.permissions :refer [can?]]
|
||||
[auto-ap.routes.invoice :as invoice-route]
|
||||
[auto-ap.routes.payments :as route]
|
||||
[auto-ap.routes.utils
|
||||
[auto-ap.graphql.utils :refer [assert-can-see-client
|
||||
exception->notification extract-client-ids
|
||||
notify-if-locked]]
|
||||
[auto-ap.logging :as alog]
|
||||
[auto-ap.permissions :refer [can?]]
|
||||
[auto-ap.query-params :refer [wrap-copy-qp-pqp]]
|
||||
[auto-ap.routes.invoice :as invoice-route]
|
||||
[auto-ap.routes.payments :as route]
|
||||
[auto-ap.routes.transactions :as transaction-routes]
|
||||
[auto-ap.routes.utils
|
||||
:refer [wrap-admin wrap-client-redirect-unauthenticated]]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.components.bank-account-icon :as bank-account-icon]
|
||||
[auto-ap.ssr.components.link-dropdown :refer [link-dropdown]]
|
||||
[auto-ap.ssr.grid-page-helper :as helper :refer [wrap-apply-sort]]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
[auto-ap.ssr.pos.common :refer [date-range-field*]]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.utils
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.components.bank-account-icon :as bank-account-icon]
|
||||
[auto-ap.ssr.components.link-dropdown :refer [link-dropdown]]
|
||||
[auto-ap.ssr.grid-page-helper :as helper :refer [wrap-apply-sort]]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
[auto-ap.ssr.pos.common :refer [date-range-field*]]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.utils
|
||||
:refer [apply-middleware-to-all-handlers clj-date-schema
|
||||
dissoc-nil-transformer entity-id html-response
|
||||
main-transformer modal-response ref->enum-schema strip
|
||||
wrap-entity wrap-implied-route-param wrap-merge-prior-hx
|
||||
wrap-schema-enforce]]
|
||||
[auto-ap.time :as atime]
|
||||
[bidi.bidi :as bidi]
|
||||
[clj-time.coerce :as coerce]
|
||||
[clojure.string :as str]
|
||||
[datomic.api :as dc]
|
||||
[hiccup.util :as hu]
|
||||
[iol-ion.query :refer [dollars-0?]]
|
||||
[malli.core :as mc]
|
||||
[malli.transform :as mt]))
|
||||
[auto-ap.time :as atime]
|
||||
[bidi.bidi :as bidi]
|
||||
[clj-time.coerce :as coerce]
|
||||
[clojure.string :as str]
|
||||
[datomic.api :as dc]
|
||||
[hiccup.util :as hu]
|
||||
[iol-ion.query :refer [dollars-0?]]
|
||||
[malli.core :as mc]
|
||||
[malli.transform :as mt]))
|
||||
|
||||
(defn exact-match-id* [request]
|
||||
(if (nat-int? (:exact-match-id (:query-params request)))
|
||||
@@ -426,8 +427,7 @@
|
||||
{:exact-match-id (:db/id invoice)})
|
||||
:content (str "Inv. " (:invoice/invoice-number invoice))})))
|
||||
(some-> p :transaction/_payment ((fn [t]
|
||||
[{:link (hu/url (bidi/path-for client-routes/routes
|
||||
:transactions)
|
||||
[{:link (hu/url (bidi/path-for ssr-routes/only-routes ::transaction-routes/all-page)
|
||||
{:exact-match-id (:db/id (first t))})
|
||||
:color :secondary
|
||||
:content "Transaction"}]))))))}]}))
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
(ns auto-ap.ssr.pos.expected-deposits
|
||||
(:require
|
||||
[auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.datomic
|
||||
:refer [add-sorter-fields apply-pagination apply-sort-3 conn merge-query
|
||||
pull-many query2]]
|
||||
[auto-ap.graphql.utils :refer [extract-client-ids]]
|
||||
[auto-ap.query-params :as query-params :refer [wrap-copy-qp-pqp]]
|
||||
[auto-ap.routes.transactions :as transaction-routes]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.grid-page-helper :as helper :refer [wrap-apply-sort]]
|
||||
@@ -167,8 +167,8 @@
|
||||
(com/a-icon-button {:href (:expected-deposit/reference-link e)}
|
||||
svg/external-link))
|
||||
(when-let [transaction-id (-> e (:transaction/_expected-deposit) first :db/id)]
|
||||
(com/a-button {:href (str (bidi/path-for client-routes/routes
|
||||
:transactions)
|
||||
(com/a-button {:href (str (bidi/path-for ssr-routes/only-routes
|
||||
::transaction-routes/all-page)
|
||||
"?exact-match-id="
|
||||
transaction-id)} "Transaction"))])
|
||||
:headers [{:key "client"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(ns auto-ap.ssr.transaction
|
||||
(:require
|
||||
[auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.datomic
|
||||
:refer [add-sorter-fields apply-pagination apply-sort-4 conn
|
||||
merge-query observable-query pull-many]]
|
||||
@@ -394,14 +393,7 @@
|
||||
:color :secondary
|
||||
:content (format "Invoice '%s'" (:invoice/invoice-number inv))}))
|
||||
|
||||
;; Client overrides
|
||||
(and (:transaction/client-overrides i) (seq (:transaction/client-overrides i)))
|
||||
(conj
|
||||
{:link (hu/url (bidi/path-for client-routes/routes
|
||||
:transactions)
|
||||
{:exact-match-id (:db/id i)})
|
||||
:color :primary
|
||||
:content "Client Overrides"})))))
|
||||
))))
|
||||
:render-for #{:html}}]}))
|
||||
|
||||
(def row* (partial helper/row* grid-page))
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
(ns auto-ap.ssr.transaction.edit
|
||||
(:require
|
||||
[auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.datomic
|
||||
:refer [audit-transact conn pull-attr pull-ref]]
|
||||
[auto-ap.datomic.accounts :as d-accounts]
|
||||
@@ -380,14 +379,6 @@
|
||||
:url (bidi/path-for ssr-routes/only-routes :vendor-search)
|
||||
:value (fc/field-value)
|
||||
:content-fn (fn [c] (pull-attr (dc/db conn) :vendor/name c)) })]))
|
||||
[:div.mb-4
|
||||
[:span.text-sm.text-gray-500 "Can't find the vendor? "
|
||||
(com/link {:href (bidi.bidi/path-for
|
||||
client-routes/routes
|
||||
:new-vendor)
|
||||
:target "new"}
|
||||
"Add new vendor")
|
||||
" in a new window, then return here."]]
|
||||
|
||||
;; Memo field
|
||||
(fc/with-field :transaction/memo
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
(ns auto-ap.ssr.transaction.insights
|
||||
(:require
|
||||
[auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.datomic :refer [conn visible-clients]]
|
||||
[auto-ap.routes.transactions :as transaction-routes]
|
||||
[auto-ap.rule-matching :refer [spread-cents]]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.ui :refer [base-page]]
|
||||
[auto-ap.ssr.utils :refer [html-response modal-response]]
|
||||
@@ -14,9 +15,7 @@
|
||||
[clj-http.client :as http]
|
||||
[clj-time.coerce :as coerce]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]
|
||||
[iol-ion.tx :refer [random-tempid]]
|
||||
[auto-ap.ssr.hx :as hx]))
|
||||
[iol-ion.tx :refer [random-tempid]]))
|
||||
|
||||
(def pull-expr [:transaction/description-original
|
||||
:db/id
|
||||
@@ -332,8 +331,8 @@
|
||||
:hx-swap "outerHTML swap:300ms"}
|
||||
:request request}
|
||||
(com/breadcrumbs {}
|
||||
[:a {:href (bidi/path-for client-routes/routes
|
||||
:transactions)}
|
||||
[:a {:href (bidi/path-for ssr-routes/only-routes
|
||||
::transaction-routes/all-page)}
|
||||
"Transactions"]
|
||||
[:a {:href (bidi/path-for ssr-routes/only-routes
|
||||
:transaction-insights)}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
[datomic.api :as dc]
|
||||
[puget.printer :as puget]
|
||||
[datomic.api :as d]
|
||||
[figwheel.main.api]
|
||||
#_[figwheel.main.api]
|
||||
[hawk.core]
|
||||
[mount.core :as mount]
|
||||
[nrepl.middleware.print])
|
||||
@@ -350,7 +350,7 @@
|
||||
|
||||
|
||||
(defn- auto-reset-handler [ctx event]
|
||||
(require 'figwheel.main.api)
|
||||
#_(require 'figwheel.main.api)
|
||||
(binding [*ns* *ns*]
|
||||
(clojure.tools.namespace.repl/refresh)
|
||||
ctx))
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
(ns auto-ap.routes.transactions)
|
||||
|
||||
(def routes {"" {:get ::page
|
||||
:put ::edit-wizard-navigate}
|
||||
:put ::edit-wizard-navigate
|
||||
"/unapproved" ::unapproved-page
|
||||
"/requires-feedback" ::requires-feedback-page
|
||||
"/approved" ::approved-page}
|
||||
"/new" {:get ::new
|
||||
:post ::new-submit
|
||||
"/location-select" ::location-select
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
(ns auto-ap.shared-views)
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
(ns auto-ap.shared-views.admin.side-bar
|
||||
(:require [bidi.bidi :as bidi]
|
||||
[auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
#?(:cljs [re-frame.core :as re-frame])
|
||||
#?(:cljs [reagent.core :as r])
|
||||
[auto-ap.routes.admin.import-batch :as ib-routes]
|
||||
[auto-ap.routes.admin.transaction-rules :as tr-routes]
|
||||
[auto-ap.routes.admin.excel-invoices :as ei-routes]))
|
||||
|
||||
(defn deep-merge [v & vs]
|
||||
(letfn [(rec-merge [v1 v2]
|
||||
(if (and (map? v1) (map? v2))
|
||||
(merge-with deep-merge v1 v2)
|
||||
v2))]
|
||||
(when (some identity vs)
|
||||
(reduce #(rec-merge %1 %2) v vs))))
|
||||
(def all-client-visible-routes
|
||||
["/" (deep-merge ssr-routes/routes (second client-routes/routes))])
|
||||
|
||||
|
||||
(defn menu-item [{:keys [label route test-route active-route icon-class icon-style]}]
|
||||
[:p.menu-item
|
||||
[:a.item {:href (bidi/path-for all-client-visible-routes route)
|
||||
:class (when (test-route active-route) "is-active")}
|
||||
(if icon-style
|
||||
[:span {:class icon-class :style icon-style}]
|
||||
[:span {:class "icon"}
|
||||
[:i {:class icon-class}]])
|
||||
[:span {:class "name"} label]]])
|
||||
|
||||
(defn admin-side-bar-impl [active-route children]
|
||||
[:div
|
||||
[:p.menu-label "General"]
|
||||
(menu-item {:label "Dashboard"
|
||||
:icon-class "fa fa-tachometer"
|
||||
:test-route #{:admin}
|
||||
:active-route active-route
|
||||
:route :auto-ap.routes.admin/page})
|
||||
|
||||
[:p.menu-label "Setup"]
|
||||
(menu-item {:label "Clients"
|
||||
:icon-class "fa fa-star-o"
|
||||
:test-route #{:admin-clients
|
||||
:admin-specific-client
|
||||
:admin-specific-bank-account}
|
||||
:active-route active-route
|
||||
:route :admin-clients})
|
||||
(menu-item {:label "Vendors"
|
||||
:icon-class "fa fa-star-o"
|
||||
:test-route #{:admin-vendors}
|
||||
:active-route active-route
|
||||
:route :admin-vendors})
|
||||
(menu-item {:label "Users"
|
||||
:icon-class "icon icon-single-neutral-book"
|
||||
:test-route #{:users}
|
||||
:active-route active-route
|
||||
:route :users
|
||||
:icon-style {:font-size "25px"}})
|
||||
(menu-item {:label "Accounts"
|
||||
:icon-class "icon icon-list-bullets"
|
||||
:test-route #{:admin-accounts}
|
||||
:active-route active-route
|
||||
:route :admin-accounts
|
||||
:icon-style {:font-size "25px"}})
|
||||
(menu-item {:label "Rules"
|
||||
:icon-class "icon icon-cog-play-1"
|
||||
:test-route #{::tr-routes/page}
|
||||
:active-route active-route
|
||||
:route ::tr-routes/page
|
||||
:icon-style {:font-size "25px"}})
|
||||
(menu-item {:label "History"
|
||||
:icon-class "icon icon-cog-play-1"
|
||||
:test-route #{:admin-history :admin-history-search :admin-history-inspect}
|
||||
:active-route active-route
|
||||
:route :admin-history
|
||||
:icon-style {:font-size "25px"}})
|
||||
(menu-item {:label "Background Jobs"
|
||||
:icon-class "icon icon-cog-play-1"
|
||||
:test-route #{:admin-jobs}
|
||||
:active-route active-route
|
||||
:route :admin-jobs
|
||||
:icon-style {:font-size "25px"}})
|
||||
[:p.menu-label "Import"]
|
||||
(menu-item {:label "Excel Invoices"
|
||||
:icon-class "fa fa-download"
|
||||
:test-route #{:admin-excel-import}
|
||||
:active-route active-route
|
||||
:route ::ei-routes/page})
|
||||
(menu-item {:label "Import Batches"
|
||||
:icon-class "fa fa-download"
|
||||
:test-route #{:admin-import-batches}
|
||||
:active-route active-route
|
||||
:route ::ib-routes/page})
|
||||
(menu-item {:label "EZCater XLS Import"
|
||||
:icon-class "icon icon-cog-play-1"
|
||||
:test-route #{:admin-ezcater-xls}
|
||||
:active-route active-route
|
||||
:route :admin-ezcater-xls
|
||||
:icon-style {:font-size "25px"}})
|
||||
(menu-item {:label "Invoice glimpse"
|
||||
:icon-class "icon icon-cog-play-1"
|
||||
:test-route #{:invoice-glimpse}
|
||||
:active-route active-route
|
||||
:route :invoice-glimpse
|
||||
:icon-style {:font-size "25px"}})
|
||||
|
||||
(into [:div] children)])
|
||||
|
||||
#?(:clj
|
||||
(defn admin-side-bar [active-page]
|
||||
(admin-side-bar-impl active-page nil))
|
||||
:cljs
|
||||
(defn admin-side-bar []
|
||||
(admin-side-bar-impl @(re-frame/subscribe [:auto-ap.subs/active-page])
|
||||
(r/children (r/current-component)))))
|
||||
@@ -1,73 +0,0 @@
|
||||
(ns auto-ap.shared-views.company.sidebar
|
||||
(:require [bidi.bidi :as bidi]
|
||||
[auto-ap.client-routes :as client-routes]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
#?(:cljs [re-frame.core :as re-frame])
|
||||
#?(:cljs [reagent.core :as r])))
|
||||
|
||||
|
||||
(defn active-when [active-page f & rest]
|
||||
(when (apply f (into [active-page] rest)) " is-active"))
|
||||
|
||||
(defn deep-merge [v & vs]
|
||||
(letfn [(rec-merge [v1 v2]
|
||||
(if (and (map? v1) (map? v2))
|
||||
(merge-with deep-merge v1 v2)
|
||||
v2))]
|
||||
(when (some identity vs)
|
||||
(reduce #(rec-merge %1 %2) v vs))))
|
||||
|
||||
(def all-client-visible-routes
|
||||
["/" (deep-merge ssr-routes/routes (second client-routes/routes))])
|
||||
|
||||
(defn menu-item [{:keys [label route test-route active-route icon-class icon-style]}]
|
||||
[:p.menu-item
|
||||
[:a.item {:href (bidi/path-for all-client-visible-routes route)
|
||||
:class (when (test-route active-route) "is-active")}
|
||||
(if icon-style
|
||||
[:span {:class icon-class :style icon-style}]
|
||||
[:span {:class "icon"}
|
||||
[:i {:class icon-class}]])
|
||||
[:span {:class "name"} label]]])
|
||||
|
||||
(defn company-side-bar-impl [active-route]
|
||||
[:div
|
||||
(menu-item {:label "Reports"
|
||||
:route :reports
|
||||
:test-route #{:reports}
|
||||
:active-route active-route
|
||||
:icon-class "icon icon-receipt"
|
||||
:icon-style {:font-size "25px"}})
|
||||
|
||||
(menu-item {:label "Plaid Link"
|
||||
:route :plaid
|
||||
:test-route #{:plaid}
|
||||
:active-route active-route
|
||||
:icon-class "icon icon-saving-bank-1"
|
||||
:icon-style {:font-size "25px"}})
|
||||
(menu-item {:label "Yodlee Link"
|
||||
:route :yodlee2
|
||||
:test-route #{:yodlee2}
|
||||
:active-route active-route
|
||||
:icon-class "icon icon-saving-bank-1"
|
||||
:icon-style {:font-size "25px"}})
|
||||
|
||||
(menu-item {:label "Other"
|
||||
:route :company-other
|
||||
:test-route #{:company-other}
|
||||
:active-route active-route
|
||||
:icon-class "icon icon-cog-play-1"
|
||||
:icon-style {:font-size "25px"}})
|
||||
(menu-item {:label "1099 Info"
|
||||
:route :company-1099
|
||||
:test-route #{:company-1099}
|
||||
:active-route active-route
|
||||
:icon-class "icon icon-cog-play-1"
|
||||
:icon-style {:font-size "25px"}})])
|
||||
|
||||
#?(:clj
|
||||
(defn company-side-bar [active-page]
|
||||
(company-side-bar-impl active-page))
|
||||
:cljs
|
||||
(defn company-side-bar []
|
||||
(company-side-bar-impl @(re-frame/subscribe [:auto-ap.subs/active-page]))))
|
||||
@@ -1,9 +0,0 @@
|
||||
(ns auto-ap.views.pages.admin
|
||||
(:require
|
||||
[auto-ap.shared-views.admin.side-bar :refer [admin-side-bar]]
|
||||
[auto-ap.views.components.layouts :refer [side-bar-layout]]))
|
||||
|
||||
(defn admin-page []
|
||||
[side-bar-layout {:side-bar [admin-side-bar {}]
|
||||
:main [:div
|
||||
[:h1.title "Admin"]]}])
|
||||
4
tasks
4
tasks
@@ -5,4 +5,6 @@
|
||||
* Hide unhelpful report from the dashboard
|
||||
* Check permissions on ledger, transactions, reports
|
||||
* Make sure that you can't change a transaction if its payment is set
|
||||
* also add tests
|
||||
* also add tests
|
||||
* Make sure that "Shared" really shares locations
|
||||
* make sure transactions support import-batch-id query parameter
|
||||
Reference in New Issue
Block a user