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" ]
|
:source-paths ["src/clj" "src/cljc" "src/cljs" "iol_ion/src" ]
|
||||||
:resource-paths ["resources"]
|
:resource-paths ["resources"]
|
||||||
:aliases {"build" ["do" ["uberjar"]]
|
: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"]
|
"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 {
|
:profiles {
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
[org.clojure/java.jdbc "0.7.11"]
|
[org.clojure/java.jdbc "0.7.11"]
|
||||||
#_[com.datomic/dev-local "1.0.243"]
|
#_[com.datomic/dev-local "1.0.243"]
|
||||||
[etaoin "0.4.1"]
|
[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/ring-core
|
ring/ring-core
|
||||||
ring/ring-codec
|
ring/ring-codec
|
||||||
@@ -150,7 +150,7 @@
|
|||||||
{:java-cmd "/usr/lib/jvm/java-11-openjdk/bin/java"
|
{:java-cmd "/usr/lib/jvm/java-11-openjdk/bin/java"
|
||||||
:aot []
|
:aot []
|
||||||
:prep-tasks ["fig:min"]
|
: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/ring-core
|
ring/ring-core
|
||||||
ring/ring-codec
|
ring/ring-codec
|
||||||
@@ -165,18 +165,18 @@
|
|||||||
org.eclipse.jetty.websocket/websocket-server
|
org.eclipse.jetty.websocket/websocket-server
|
||||||
org.eclipse.jetty.websocket/websocket-servlet
|
org.eclipse.jetty.websocket/websocket-servlet
|
||||||
args4j]]]}
|
args4j]]]}
|
||||||
:provided {:dependencies [[org.clojure/clojurescript "1.11.4"
|
:provided {:dependencies [#_[org.clojure/clojurescript "1.11.4"
|
||||||
:exclusions [com.google.code.findbugs/jsr305
|
:exclusions [com.google.code.findbugs/jsr305
|
||||||
com.fasterxml.jackson.core/jackson-core]]
|
com.fasterxml.jackson.core/jackson-core]]
|
||||||
[reagent "1.0.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server] ]
|
#_[reagent "1.0.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server] ]
|
||||||
[re-frame "1.1.2"
|
#_[re-frame "1.1.2"
|
||||||
:exclusions
|
:exclusions
|
||||||
[reagent
|
[reagent
|
||||||
org.clojure/clojurescript]]
|
org.clojure/clojurescript]]
|
||||||
[re-frame-utils "0.1.0"]
|
#_[re-frame-utils "0.1.0"]
|
||||||
[com.andrewmcveigh/cljs-time "0.5.2"]
|
#_[com.andrewmcveigh/cljs-time "0.5.2"]
|
||||||
[cljs-http "0.1.46"]
|
#_[cljs-http "0.1.46"]
|
||||||
[kibu/pushy "0.3.8"]]}
|
#_[kibu/pushy "0.3.8"]]}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,11 +143,14 @@
|
|||||||
(doseq [d dates]
|
(doseq [d dates]
|
||||||
(assert-not-locked client-id d)))
|
(assert-not-locked client-id d)))
|
||||||
|
|
||||||
|
(defn strip-special [q]
|
||||||
|
(str/replace q #"[\[\]\+\*\-\?]" ""))
|
||||||
|
|
||||||
(defn cleanse-query [q]
|
(defn cleanse-query [q]
|
||||||
(if (str/includes? q "&")
|
(if (str/includes? q "&")
|
||||||
(str "\"" q "\"~0.8")
|
(str "\"" q "\"~0.8")
|
||||||
(let [parts (-> q
|
(let [parts (-> q
|
||||||
(str/replace #"[\[\]\+\*\-\?]" "")
|
(strip-special)
|
||||||
(str/split #"\s+"))
|
(str/split #"\s+"))
|
||||||
exacts (butlast parts)
|
exacts (butlast parts)
|
||||||
partial (some-> (last parts)
|
partial (some-> (last parts)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
(ns auto-ap.handler
|
(ns auto-ap.handler
|
||||||
(:require [amazonica.core :refer [defcredential]]
|
(:require [amazonica.core :refer [defcredential]]
|
||||||
[auto-ap.client-routes :as client-routes]
|
|
||||||
[auto-ap.datomic :refer [conn pull-many]]
|
[auto-ap.datomic :refer [conn pull-many]]
|
||||||
[auto-ap.graphql.utils :refer [extract-client-ids limited-clients]]
|
[auto-ap.graphql.utils :refer [extract-client-ids limited-clients]]
|
||||||
[auto-ap.logging :as alog]
|
[auto-ap.logging :as alog]
|
||||||
@@ -54,7 +53,6 @@
|
|||||||
|
|
||||||
(def all-routes ["/" (-> (into []
|
(def all-routes ["/" (-> (into []
|
||||||
(deep-merge ssr-routes/routes
|
(deep-merge ssr-routes/routes
|
||||||
(second client-routes/routes)
|
|
||||||
graphql/routes
|
graphql/routes
|
||||||
ezcater/routes
|
ezcater/routes
|
||||||
health/routes
|
health/routes
|
||||||
@@ -86,13 +84,7 @@
|
|||||||
(merge auth/match->handler)
|
(merge auth/match->handler)
|
||||||
(merge invoices/match->handler)
|
(merge invoices/match->handler)
|
||||||
(merge exports/match->handler)
|
(merge exports/match->handler)
|
||||||
(merge
|
))
|
||||||
(into {}
|
|
||||||
(map
|
|
||||||
|
|
||||||
(fn [k]
|
|
||||||
[k render-index])
|
|
||||||
client-routes/all-matches)))))
|
|
||||||
|
|
||||||
(def match->handler
|
(def match->handler
|
||||||
(fn [route]
|
(fn [route]
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
[auto-ap.parse :as parse]
|
[auto-ap.parse :as parse]
|
||||||
[amazonica.aws.lambda :as lambda]
|
[amazonica.aws.lambda :as lambda]
|
||||||
[config.core :refer [env]]
|
[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-routes :as ssr-routes]
|
||||||
[auto-ap.ssr.ui :refer [base-page]]
|
[auto-ap.ssr.ui :refer [base-page]]
|
||||||
[auto-ap.ssr.utils :refer [html-response]]
|
[auto-ap.ssr.utils :refer [html-response]]
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
(ns auto-ap.ssr.admin.import-batch
|
(ns auto-ap.ssr.admin.import-batch
|
||||||
(:require
|
(:require
|
||||||
[auto-ap.client-routes :as client-routes]
|
|
||||||
[auto-ap.datomic
|
[auto-ap.datomic
|
||||||
:refer [add-sorter-fields apply-pagination apply-sort-3 conn merge-query
|
:refer [add-sorter-fields apply-pagination apply-sort-3 conn merge-query
|
||||||
pull-many query2]]
|
pull-many query2]]
|
||||||
[auto-ap.query-params :refer [wrap-copy-qp-pqp]]
|
[auto-ap.query-params :refer [wrap-copy-qp-pqp]]
|
||||||
[auto-ap.routes.admin.import-batch :as route]
|
[auto-ap.routes.admin.import-batch :as route]
|
||||||
|
[auto-ap.routes.transactions :as transaction-routes]
|
||||||
[auto-ap.routes.utils
|
[auto-ap.routes.utils
|
||||||
:refer [wrap-admin wrap-client-redirect-unauthenticated]]
|
:refer [wrap-admin wrap-client-redirect-unauthenticated]]
|
||||||
[auto-ap.ssr-routes :as ssr-routes]
|
[auto-ap.ssr-routes :as ssr-routes]
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
:fetch-page fetch-page
|
:fetch-page fetch-page
|
||||||
:page-specific-nav filters
|
:page-specific-nav filters
|
||||||
:row-buttons (fn [_ entity]
|
: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)})
|
{:import-batch-id (:db/id entity)})
|
||||||
:hx-boost true}
|
:hx-boost true}
|
||||||
svg/external-link)])
|
svg/external-link)])
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
(ns auto-ap.ssr.company-dropdown
|
(ns auto-ap.ssr.company-dropdown
|
||||||
(:require [auto-ap.datomic :refer [conn pull-many]]
|
(:require
|
||||||
[auto-ap.graphql.utils :refer [cleanse-query]]
|
[auto-ap.datomic :refer [conn pull-many]]
|
||||||
[auto-ap.solr :as solr]
|
[auto-ap.graphql.utils :refer [cleanse-query strip-special]]
|
||||||
[auto-ap.ssr-routes :as ssr-routes]
|
[auto-ap.logging :as alog]
|
||||||
[auto-ap.ssr.hx :as hx]
|
[auto-ap.solr :as solr]
|
||||||
[auto-ap.ssr.svg :as svg]
|
[auto-ap.ssr-routes :as ssr-routes]
|
||||||
[auto-ap.ssr.utils :refer [html-response]]
|
[auto-ap.ssr.hx :as hx]
|
||||||
[bidi.bidi :as bidi]
|
[auto-ap.ssr.svg :as svg]
|
||||||
[clojure.string :as str]
|
[auto-ap.ssr.utils :refer [html-response]]
|
||||||
[datomic.api :as dc]
|
[bidi.bidi :as bidi]
|
||||||
[hiccup2.core :as hiccup]
|
[clojure.data.json :as json]
|
||||||
[iol-ion.query :refer [can-see-client?]]
|
[clojure.string :as str]
|
||||||
[clojure.data.json :as json]))
|
[datomic.api :as dc]
|
||||||
|
[hiccup2.core :as hiccup]
|
||||||
|
[iol-ion.query :refer [can-see-client?]]))
|
||||||
|
|
||||||
|
|
||||||
(defn dropdown-search-results* [{:keys [options]}]
|
(defn dropdown-search-results* [{:keys [options]}]
|
||||||
@@ -46,22 +48,35 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn get-clients [identity query]
|
(defn get-clients [identity query]
|
||||||
(if (str/starts-with? query "g:")
|
(let [raw-query (not-empty (strip-special query))
|
||||||
(let [search-query (str "groups:(" (subs query 2) ")")]
|
cleansed-query (not-empty (cleanse-query query))
|
||||||
[{:group (subs query 2)
|
cleansed-search-query (str "name:(" query ")")
|
||||||
:name (str "All clients matching " (subs query 2))}])
|
exec-search (fn []
|
||||||
(if-let [query (not-empty (cleanse-query query))]
|
(for [n (pull-many (dc/db conn) [:client/name :db/id]
|
||||||
(let [search-query (str "name:(" query ")")]
|
(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]
|
raw-query
|
||||||
(for [{:keys [id name]} (solr/query solr/impl "clients" {"query" search-query
|
(let [code-matches (for [n (pull-many (dc/db conn) [:client/name :db/id]
|
||||||
"fields" "id, name"})
|
(for [{:keys [id name]} (solr/query solr/impl "clients" {"query" (format "code:\"%s\"" raw-query)
|
||||||
:let [client-id (Long/parseLong id)]
|
"fields" "id, name"})
|
||||||
:when (can-see-client? identity client-id)]
|
:let [client-id (Long/parseLong id)]
|
||||||
client-id))]
|
:when (can-see-client? identity client-id)]
|
||||||
{:id (:db/id n)
|
client-id))]
|
||||||
:name (:client/name n)}))
|
{: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}]
|
(defn dropdown-search-results [{:keys [identity] :as request}]
|
||||||
(html-response
|
(html-response
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
(ns auto-ap.ssr.components.aside
|
(ns auto-ap.ssr.components.aside
|
||||||
(:require
|
(:require
|
||||||
[auto-ap.client-routes :as client-routes]
|
|
||||||
[auto-ap.graphql.utils :refer [is-admin?]]
|
[auto-ap.graphql.utils :refer [is-admin?]]
|
||||||
[auto-ap.permissions :refer [can?]]
|
[auto-ap.permissions :refer [can?]]
|
||||||
[auto-ap.routes.admin.clients :as ac-routes]
|
[auto-ap.routes.admin.clients :as ac-routes]
|
||||||
@@ -13,6 +12,7 @@
|
|||||||
[auto-ap.routes.ledger :as ledger-routes]
|
[auto-ap.routes.ledger :as ledger-routes]
|
||||||
[auto-ap.routes.outgoing-invoice :as oi-routes]
|
[auto-ap.routes.outgoing-invoice :as oi-routes]
|
||||||
[auto-ap.routes.payments :as payment-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-routes :as ssr-routes]
|
||||||
[auto-ap.ssr.components.tags :as tags]
|
[auto-ap.ssr.components.tags :as tags]
|
||||||
[auto-ap.ssr.hiccup-helper :as hh]
|
[auto-ap.ssr.hiccup-helper :as hh]
|
||||||
@@ -255,14 +255,14 @@
|
|||||||
|
|
||||||
(sub-menu- {:selector "transactions"
|
(sub-menu- {:selector "transactions"
|
||||||
:active? (= "transactions" selected)}
|
:active? (= "transactions" selected)}
|
||||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
|
||||||
:transactions)} "All")
|
::transaction-routes/all-page)} "All")
|
||||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
|
||||||
:unapproved-transactions)} "Unapproved")
|
::transaction-routes/unapproved-page)} "Unapproved")
|
||||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
|
||||||
:requires-feedback-transactions)} "Client Review")
|
::transaction-routes/requires-feedback-page)} "Client Review")
|
||||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
|
||||||
:approved-transactions)} "Approved")
|
::transaction-routes/approved-page)} "Approved")
|
||||||
(when (can? (:identity request)
|
(when (can? (:identity request)
|
||||||
{:subject :transaction :activity :insights})
|
{:subject :transaction :activity :insights})
|
||||||
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
|
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
|
||||||
@@ -277,17 +277,14 @@
|
|||||||
"Ledger")
|
"Ledger")
|
||||||
(sub-menu- {:selector "ledger"
|
(sub-menu- {:selector "ledger"
|
||||||
:active? (= "ledger" selected)}
|
:active? (= "ledger" selected)}
|
||||||
(if (is-admin? (:identity request))
|
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
::ledger-routes/all-page)
|
||||||
::ledger-routes/all-page)
|
{:date-range "month"})
|
||||||
{:date-range "month"})
|
:active? (= ::ledger-routes/all-page (:matched-route request))
|
||||||
:active? (= ::ledger-routes/all-page (:matched-route request))
|
:hx-boost "true"}
|
||||||
:hx-boost "true"}
|
[:div.flex.gap-2
|
||||||
[:div.flex.gap-2
|
"Register"
|
||||||
"Register"
|
(tags/pill- {:color :secondary} "WIP")])
|
||||||
(tags/pill- {:color :secondary} "WIP")])
|
|
||||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
|
||||||
:ledger)} "Register"))
|
|
||||||
(when (is-admin? (:identity request))
|
(when (is-admin? (:identity request))
|
||||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||||
::ledger-routes/external-page)
|
::ledger-routes/external-page)
|
||||||
@@ -297,67 +294,40 @@
|
|||||||
[:div.flex.gap-2
|
[:div.flex.gap-2
|
||||||
"External Register"
|
"External Register"
|
||||||
(tags/pill- {:color :secondary} "WIP")]))
|
(tags/pill- {:color :secondary} "WIP")]))
|
||||||
(when (is-admin? (:identity request))
|
|
||||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||||
:ledger)} "Old Register"))
|
::ledger-routes/profit-and-loss))
|
||||||
(if (is-admin? (:identity request))
|
:active? (= ::ledger-routes/profit-and-loss (:matched-route request))
|
||||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
:hx-boost "true"}
|
||||||
::ledger-routes/profit-and-loss))
|
[:div.flex.gap-2
|
||||||
:active? (= ::ledger-routes/profit-and-loss (:matched-route request))
|
"Profit and loss"
|
||||||
:hx-boost "true"}
|
(tags/pill- {:color :secondary} "WIP")])
|
||||||
[:div.flex.gap-2
|
|
||||||
"Profit and loss"
|
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||||
(tags/pill- {:color :secondary} "WIP")])
|
::ledger-routes/cash-flows))
|
||||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
:active? (= ::ledger-routes/cash-flows (:matched-route request))
|
||||||
:profit-and-loss)}
|
:hx-boost "true"}
|
||||||
"Profit and Loss"))
|
[:div.flex.gap-2
|
||||||
(when (is-admin? (:identity request))
|
"Cash flows"
|
||||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
(tags/pill- {:color :secondary} "WIP")])
|
||||||
:profit-and-loss)} "Old profit and loss"))
|
|
||||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||||
:profit-and-loss-detail)} "Profit & Loss Detail")
|
::ledger-routes/balance-sheet))
|
||||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
:active? (= ::ledger-routes/balance-sheet (:matched-route request))
|
||||||
:cash-flows)} "Cash Flows")
|
:hx-boost "true"}
|
||||||
(if (is-admin? (:identity request))
|
[:div.flex.gap-2
|
||||||
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
"Balance Sheet"
|
||||||
::ledger-routes/cash-flows))
|
(tags/pill- {:color :secondary} "WIP")])
|
||||||
:active? (= ::ledger-routes/cash-flows (:matched-route request))
|
|
||||||
:hx-boost "true"}
|
|
||||||
[:div.flex.gap-2
|
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
|
||||||
"Cash flows"
|
::ledger-routes/external-import-page)
|
||||||
(tags/pill- {:color :secondary} "WIP")])
|
{:date-range "month"})
|
||||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
:active? (= ::ledger-routes/external-import-page (:matched-route request))
|
||||||
:cash-flows)} "Cash flows"))
|
:hx-boost "true"}
|
||||||
(when (is-admin? (:identity request))
|
[:div.flex.gap-2
|
||||||
(menu-button- {:href (bidi/path-for client-routes/routes
|
"External Import"
|
||||||
:cash-flows)} "Old Cash flows"))
|
(tags/pill- {:color :secondary} "WIP")]))))]))
|
||||||
(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")])))))]))
|
|
||||||
|
|
||||||
|
|
||||||
(defn company-aside-nav- [request]
|
(defn company-aside-nav- [request]
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
(ns auto-ap.ssr.components.user-dropdown
|
(ns auto-ap.ssr.components.user-dropdown
|
||||||
(:require
|
(:require
|
||||||
[auto-ap.client-routes :as client-routes2]
|
|
||||||
[auto-ap.datomic :refer [conn pull-attr]]
|
[auto-ap.datomic :refer [conn pull-attr]]
|
||||||
[auto-ap.ssr-routes :as ssr-routes]
|
[auto-ap.ssr-routes :as ssr-routes]
|
||||||
[bidi.bidi :as bidi]
|
[bidi.bidi :as bidi]
|
||||||
|
|||||||
@@ -1,29 +1,28 @@
|
|||||||
(ns auto-ap.ssr.dashboard
|
(ns auto-ap.ssr.dashboard
|
||||||
(:require [auto-ap.client-routes :as client-routes]
|
(:require
|
||||||
[auto-ap.datomic :refer [conn]]
|
[auto-ap.datomic :refer [conn]]
|
||||||
[auto-ap.graphql.ledger :refer [get-profit-and-loss-raw]]
|
[auto-ap.graphql.ledger :refer [get-profit-and-loss-raw]]
|
||||||
[auto-ap.graphql.utils :refer [<-graphql]]
|
[auto-ap.graphql.utils :refer [<-graphql]]
|
||||||
[auto-ap.ledger.reports :as r]
|
[auto-ap.ledger.reports :as r]
|
||||||
[auto-ap.routes.dashboard :as d-routes]
|
[auto-ap.routes.dashboard :as d-routes]
|
||||||
[auto-ap.routes.invoice :as i-routes]
|
[auto-ap.routes.invoice :as i-routes]
|
||||||
[auto-ap.routes.utils :refer [wrap-admin
|
[auto-ap.routes.transactions :as transaction-routes]
|
||||||
wrap-client-redirect-unauthenticated]]
|
[auto-ap.routes.utils :refer [wrap-admin
|
||||||
[auto-ap.ssr-routes :as ssr-routes]
|
wrap-client-redirect-unauthenticated]]
|
||||||
[auto-ap.ssr.company.reports.expense :refer [expense-breakdown-card]]
|
[auto-ap.ssr-routes :as ssr-routes]
|
||||||
[auto-ap.ssr.components :as com]
|
[auto-ap.ssr.components :as com]
|
||||||
[auto-ap.ssr.hiccup-helper :as hh]
|
[auto-ap.ssr.hiccup-helper :as hh]
|
||||||
[auto-ap.ssr.hx :as hx]
|
[auto-ap.ssr.hx :as hx]
|
||||||
[auto-ap.ssr.svg :as svg]
|
[auto-ap.ssr.svg :as svg]
|
||||||
[auto-ap.ssr.ui :refer [base-page]]
|
[auto-ap.ssr.ui :refer [base-page]]
|
||||||
[auto-ap.ssr.utils :refer [apply-middleware-to-all-handlers
|
[auto-ap.ssr.utils :refer [apply-middleware-to-all-handlers html-response]]
|
||||||
html-response]]
|
[auto-ap.time :as atime]
|
||||||
[auto-ap.time :as atime]
|
[bidi.bidi :as bidi]
|
||||||
[bidi.bidi :as bidi]
|
[cemerick.url :as url]
|
||||||
[cemerick.url :as url]
|
[clj-time.coerce :as coerce]
|
||||||
[clj-time.coerce :as coerce]
|
[clj-time.core :as time]
|
||||||
[clj-time.core :as time]
|
[datomic.api :as dc]
|
||||||
[datomic.api :as dc]
|
[hiccup.util :as hu]))
|
||||||
[hiccup.util :as hu]))
|
|
||||||
|
|
||||||
(defn bank-accounts-card [request]
|
(defn bank-accounts-card [request]
|
||||||
(html-response
|
(html-response
|
||||||
@@ -264,7 +263,7 @@
|
|||||||
[:div.bg-gray-50.rounded.p-4
|
[:div.bg-gray-50.rounded.p-4
|
||||||
[:span "You have " (str uncategorized-transaction-count) " transactions needing your feedback. " ]
|
[: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="
|
"?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)}))) }
|
(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]]
|
[config.core :refer [env]]
|
||||||
[datomic.api :as dc]
|
[datomic.api :as dc]
|
||||||
[hiccup2.core :as hiccup]
|
[hiccup2.core :as hiccup]
|
||||||
[malli.core :as mc]
|
[malli.core :as mc])
|
||||||
[auto-ap.client-routes :as client-routes])
|
|
||||||
(:import [java.util UUID]))
|
(:import [java.util UUID]))
|
||||||
|
|
||||||
|
|
||||||
@@ -338,11 +337,7 @@
|
|||||||
[:div.px-4.py-3.space-y-4
|
[: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.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"}}]
|
[:div#page-notification.notification.block {:style {:display "none"}}]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
(ns auto-ap.ssr.invoice.new-invoice-wizard
|
(ns auto-ap.ssr.invoice.new-invoice-wizard
|
||||||
(:require
|
(:require
|
||||||
[auto-ap.client-routes :as client-routes]
|
|
||||||
[auto-ap.datomic
|
[auto-ap.datomic
|
||||||
:refer [audit-transact conn pull-attr]]
|
:refer [audit-transact conn pull-attr]]
|
||||||
[auto-ap.datomic.accounts :as d-accounts]
|
[auto-ap.datomic.accounts :as d-accounts]
|
||||||
@@ -219,10 +218,9 @@
|
|||||||
:content-fn (fn [c] (pull-attr (dc/db conn) :vendor/name c))
|
:content-fn (fn [c] (pull-attr (dc/db conn) :vendor/name c))
|
||||||
:x-model "vendorId"})]))
|
:x-model "vendorId"})]))
|
||||||
[:div.mb-4
|
[:div.mb-4
|
||||||
[:span.text-sm.text-gray-500 "Can't find the vendor? "
|
;; TODO DO NOT MERGE UNTIL THIS IS FIXED
|
||||||
(com/link {:href (bidi.bidi/path-for
|
#_[:span.text-sm.text-gray-500 "Can't find the vendor? "
|
||||||
client-routes/routes
|
(com/link {:href ...
|
||||||
:new-vendor)
|
|
||||||
:target "new"}
|
:target "new"}
|
||||||
"Add new vendor")
|
"Add new vendor")
|
||||||
" in a new window, then return here."]]
|
" in a new window, then return here."]]
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
(ns auto-ap.ssr.invoices
|
(ns auto-ap.ssr.invoices
|
||||||
(:require
|
(:require
|
||||||
[auto-ap.client-routes :as client-routes]
|
|
||||||
[auto-ap.datomic
|
[auto-ap.datomic
|
||||||
:refer [add-sorter-fields apply-pagination apply-sort-3
|
:refer [add-sorter-fields apply-pagination apply-sort-3
|
||||||
audit-transact audit-transact-batch conn merge-query
|
audit-transact audit-transact-batch conn merge-query
|
||||||
@@ -20,7 +19,9 @@
|
|||||||
[auto-ap.permissions :refer [can? wrap-must]]
|
[auto-ap.permissions :refer [can? wrap-must]]
|
||||||
[auto-ap.query-params :refer [wrap-copy-qp-pqp]]
|
[auto-ap.query-params :refer [wrap-copy-qp-pqp]]
|
||||||
[auto-ap.routes.invoice :as route]
|
[auto-ap.routes.invoice :as route]
|
||||||
|
[auto-ap.routes.ledger :as ledger-routes]
|
||||||
[auto-ap.routes.payments :as payment-route]
|
[auto-ap.routes.payments :as payment-route]
|
||||||
|
[auto-ap.routes.transactions :as transaction-routes]
|
||||||
[auto-ap.routes.utils
|
[auto-ap.routes.utils
|
||||||
:refer [wrap-admin wrap-client-redirect-unauthenticated]]
|
:refer [wrap-admin wrap-client-redirect-unauthenticated]]
|
||||||
[auto-ap.rule-matching :as rm]
|
[auto-ap.rule-matching :as rm]
|
||||||
@@ -660,12 +661,12 @@
|
|||||||
{:exact-match-id (:db/id p)})
|
{:exact-match-id (:db/id p)})
|
||||||
:content (str (format "$%,.2f" (:payment/amount 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 " %))))}]
|
(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)))})
|
{:exact-match-id (:db/id (first (:payment/transaction p)))})
|
||||||
:color :secondary
|
:color :secondary
|
||||||
:content "Transaction"})))))
|
:content "Transaction"})))))
|
||||||
(when (:invoice/journal-entry i)
|
(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)))})
|
{:exact-match-id (:db/id (first (:invoice/journal-entry i)))})
|
||||||
:color :yellow
|
:color :yellow
|
||||||
:content "Ledger entry"}])
|
:content "Ledger entry"}])
|
||||||
|
|||||||
@@ -1,31 +1,32 @@
|
|||||||
(ns auto-ap.ssr.ledger.common
|
(ns auto-ap.ssr.ledger.common
|
||||||
(:require [auto-ap.client-routes :as client-routes]
|
(:require
|
||||||
[auto-ap.datomic
|
[auto-ap.datomic
|
||||||
:refer [add-sorter-fields apply-pagination apply-sort-4 conn
|
:refer [add-sorter-fields apply-pagination apply-sort-4 conn
|
||||||
merge-query observable-query pull-many]]
|
merge-query observable-query pull-many]]
|
||||||
[auto-ap.datomic.accounts :as d-accounts]
|
[auto-ap.datomic.accounts :as d-accounts]
|
||||||
[auto-ap.graphql.utils :refer [extract-client-ids]]
|
[auto-ap.graphql.utils :refer [extract-client-ids]]
|
||||||
[auto-ap.permissions :refer [can?]]
|
[auto-ap.permissions :refer [can?]]
|
||||||
[auto-ap.routes.invoice :as invoice-route]
|
[auto-ap.routes.invoice :as invoice-route]
|
||||||
[auto-ap.routes.ledger :as route]
|
[auto-ap.routes.ledger :as route]
|
||||||
[auto-ap.ssr-routes :as ssr-routes]
|
[auto-ap.routes.transactions :as transaction-routes]
|
||||||
[auto-ap.ssr.components :as com]
|
[auto-ap.ssr-routes :as ssr-routes]
|
||||||
[auto-ap.ssr.components.link-dropdown :refer [link-dropdown]]
|
[auto-ap.ssr.components :as com]
|
||||||
[auto-ap.ssr.grid-page-helper :as helper]
|
[auto-ap.ssr.components.link-dropdown :refer [link-dropdown]]
|
||||||
[auto-ap.ssr.hx :as hx]
|
[auto-ap.ssr.grid-page-helper :as helper]
|
||||||
[auto-ap.ssr.pos.common :refer [date-range-field*]]
|
[auto-ap.ssr.hx :as hx]
|
||||||
[auto-ap.ssr.svg :as svg]
|
[auto-ap.ssr.pos.common :refer [date-range-field*]]
|
||||||
[auto-ap.ssr.utils
|
[auto-ap.ssr.svg :as svg]
|
||||||
:refer [clj-date-schema entity-id html-response main-transformer
|
[auto-ap.ssr.utils
|
||||||
ref->enum-schema strip]]
|
:refer [clj-date-schema entity-id html-response ref->enum-schema
|
||||||
[auto-ap.time :as atime]
|
strip]]
|
||||||
[auto-ap.utils :refer [dollars-0?]]
|
[auto-ap.time :as atime]
|
||||||
[bidi.bidi :as bidi]
|
[auto-ap.utils :refer [dollars-0?]]
|
||||||
[clj-time.coerce :as coerce]
|
[bidi.bidi :as bidi]
|
||||||
[clojure.string :as str]
|
[clj-time.coerce :as coerce]
|
||||||
[datomic.api :as dc]
|
[clojure.string :as str]
|
||||||
[hiccup.util :as hu]
|
[datomic.api :as dc]
|
||||||
[malli.core :as mc]))
|
[hiccup.util :as hu]
|
||||||
|
[malli.core :as mc]))
|
||||||
|
|
||||||
(defn exact-match-id* [request]
|
(defn exact-match-id* [request]
|
||||||
(if (nat-int? (:exact-match-id (:query-params request)))
|
(if (nat-int? (:exact-match-id (:query-params request)))
|
||||||
@@ -580,8 +581,8 @@ args
|
|||||||
|
|
||||||
(-> i :journal-entry/original-entity :transaction/description-original)
|
(-> i :journal-entry/original-entity :transaction/description-original)
|
||||||
(conj
|
(conj
|
||||||
{:link (hu/url (bidi/path-for client-routes/routes
|
{:link (hu/url (bidi/path-for ssr-routes/only-routes
|
||||||
:transactions)
|
::transaction-routes/all-page)
|
||||||
{:exact-match-id (:db/id (:journal-entry/original-entity i))})
|
{:exact-match-id (:db/id (:journal-entry/original-entity i))})
|
||||||
:color :primary
|
:color :primary
|
||||||
:content (format "Transaction '%s'" (-> i :journal-entry/original-entity :transaction/description-original))})
|
:content (format "Transaction '%s'" (-> i :journal-entry/original-entity :transaction/description-original))})
|
||||||
|
|||||||
@@ -1,42 +1,43 @@
|
|||||||
(ns auto-ap.ssr.payments
|
(ns auto-ap.ssr.payments
|
||||||
(:require [auto-ap.client-routes :as client-routes]
|
(:require
|
||||||
[auto-ap.datomic
|
[auto-ap.datomic
|
||||||
:refer [add-sorter-fields apply-pagination apply-sort-3
|
:refer [add-sorter-fields apply-pagination apply-sort-3
|
||||||
audit-transact conn merge-query observable-query
|
audit-transact conn merge-query observable-query
|
||||||
pull-many]]
|
pull-many]]
|
||||||
[auto-ap.graphql.utils :refer [assert-can-see-client
|
[auto-ap.graphql.utils :refer [assert-can-see-client
|
||||||
exception->notification
|
exception->notification extract-client-ids
|
||||||
extract-client-ids notify-if-locked]]
|
notify-if-locked]]
|
||||||
[auto-ap.query-params :refer [wrap-copy-qp-pqp]]
|
[auto-ap.logging :as alog]
|
||||||
[auto-ap.logging :as alog]
|
[auto-ap.permissions :refer [can?]]
|
||||||
[auto-ap.permissions :refer [can?]]
|
[auto-ap.query-params :refer [wrap-copy-qp-pqp]]
|
||||||
[auto-ap.routes.invoice :as invoice-route]
|
[auto-ap.routes.invoice :as invoice-route]
|
||||||
[auto-ap.routes.payments :as route]
|
[auto-ap.routes.payments :as route]
|
||||||
[auto-ap.routes.utils
|
[auto-ap.routes.transactions :as transaction-routes]
|
||||||
|
[auto-ap.routes.utils
|
||||||
:refer [wrap-admin wrap-client-redirect-unauthenticated]]
|
:refer [wrap-admin wrap-client-redirect-unauthenticated]]
|
||||||
[auto-ap.ssr-routes :as ssr-routes]
|
[auto-ap.ssr-routes :as ssr-routes]
|
||||||
[auto-ap.ssr.components :as com]
|
[auto-ap.ssr.components :as com]
|
||||||
[auto-ap.ssr.components.bank-account-icon :as bank-account-icon]
|
[auto-ap.ssr.components.bank-account-icon :as bank-account-icon]
|
||||||
[auto-ap.ssr.components.link-dropdown :refer [link-dropdown]]
|
[auto-ap.ssr.components.link-dropdown :refer [link-dropdown]]
|
||||||
[auto-ap.ssr.grid-page-helper :as helper :refer [wrap-apply-sort]]
|
[auto-ap.ssr.grid-page-helper :as helper :refer [wrap-apply-sort]]
|
||||||
[auto-ap.ssr.hx :as hx]
|
[auto-ap.ssr.hx :as hx]
|
||||||
[auto-ap.ssr.pos.common :refer [date-range-field*]]
|
[auto-ap.ssr.pos.common :refer [date-range-field*]]
|
||||||
[auto-ap.ssr.svg :as svg]
|
[auto-ap.ssr.svg :as svg]
|
||||||
[auto-ap.ssr.utils
|
[auto-ap.ssr.utils
|
||||||
:refer [apply-middleware-to-all-handlers clj-date-schema
|
:refer [apply-middleware-to-all-handlers clj-date-schema
|
||||||
dissoc-nil-transformer entity-id html-response
|
dissoc-nil-transformer entity-id html-response
|
||||||
main-transformer modal-response ref->enum-schema strip
|
main-transformer modal-response ref->enum-schema strip
|
||||||
wrap-entity wrap-implied-route-param wrap-merge-prior-hx
|
wrap-entity wrap-implied-route-param wrap-merge-prior-hx
|
||||||
wrap-schema-enforce]]
|
wrap-schema-enforce]]
|
||||||
[auto-ap.time :as atime]
|
[auto-ap.time :as atime]
|
||||||
[bidi.bidi :as bidi]
|
[bidi.bidi :as bidi]
|
||||||
[clj-time.coerce :as coerce]
|
[clj-time.coerce :as coerce]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[datomic.api :as dc]
|
[datomic.api :as dc]
|
||||||
[hiccup.util :as hu]
|
[hiccup.util :as hu]
|
||||||
[iol-ion.query :refer [dollars-0?]]
|
[iol-ion.query :refer [dollars-0?]]
|
||||||
[malli.core :as mc]
|
[malli.core :as mc]
|
||||||
[malli.transform :as mt]))
|
[malli.transform :as mt]))
|
||||||
|
|
||||||
(defn exact-match-id* [request]
|
(defn exact-match-id* [request]
|
||||||
(if (nat-int? (:exact-match-id (:query-params request)))
|
(if (nat-int? (:exact-match-id (:query-params request)))
|
||||||
@@ -426,8 +427,7 @@
|
|||||||
{:exact-match-id (:db/id invoice)})
|
{:exact-match-id (:db/id invoice)})
|
||||||
:content (str "Inv. " (:invoice/invoice-number invoice))})))
|
:content (str "Inv. " (:invoice/invoice-number invoice))})))
|
||||||
(some-> p :transaction/_payment ((fn [t]
|
(some-> p :transaction/_payment ((fn [t]
|
||||||
[{:link (hu/url (bidi/path-for client-routes/routes
|
[{:link (hu/url (bidi/path-for ssr-routes/only-routes ::transaction-routes/all-page)
|
||||||
:transactions)
|
|
||||||
{:exact-match-id (:db/id (first t))})
|
{:exact-match-id (:db/id (first t))})
|
||||||
:color :secondary
|
:color :secondary
|
||||||
:content "Transaction"}]))))))}]}))
|
:content "Transaction"}]))))))}]}))
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
(ns auto-ap.ssr.pos.expected-deposits
|
(ns auto-ap.ssr.pos.expected-deposits
|
||||||
(:require
|
(:require
|
||||||
[auto-ap.client-routes :as client-routes]
|
|
||||||
[auto-ap.datomic
|
[auto-ap.datomic
|
||||||
:refer [add-sorter-fields apply-pagination apply-sort-3 conn merge-query
|
:refer [add-sorter-fields apply-pagination apply-sort-3 conn merge-query
|
||||||
pull-many query2]]
|
pull-many query2]]
|
||||||
[auto-ap.graphql.utils :refer [extract-client-ids]]
|
[auto-ap.graphql.utils :refer [extract-client-ids]]
|
||||||
[auto-ap.query-params :as query-params :refer [wrap-copy-qp-pqp]]
|
[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-routes :as ssr-routes]
|
||||||
[auto-ap.ssr.components :as com]
|
[auto-ap.ssr.components :as com]
|
||||||
[auto-ap.ssr.grid-page-helper :as helper :refer [wrap-apply-sort]]
|
[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)}
|
(com/a-icon-button {:href (:expected-deposit/reference-link e)}
|
||||||
svg/external-link))
|
svg/external-link))
|
||||||
(when-let [transaction-id (-> e (:transaction/_expected-deposit) first :db/id)]
|
(when-let [transaction-id (-> e (:transaction/_expected-deposit) first :db/id)]
|
||||||
(com/a-button {:href (str (bidi/path-for client-routes/routes
|
(com/a-button {:href (str (bidi/path-for ssr-routes/only-routes
|
||||||
:transactions)
|
::transaction-routes/all-page)
|
||||||
"?exact-match-id="
|
"?exact-match-id="
|
||||||
transaction-id)} "Transaction"))])
|
transaction-id)} "Transaction"))])
|
||||||
:headers [{:key "client"
|
:headers [{:key "client"
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
(ns auto-ap.ssr.transaction
|
(ns auto-ap.ssr.transaction
|
||||||
(:require
|
(:require
|
||||||
[auto-ap.client-routes :as client-routes]
|
|
||||||
[auto-ap.datomic
|
[auto-ap.datomic
|
||||||
:refer [add-sorter-fields apply-pagination apply-sort-4 conn
|
:refer [add-sorter-fields apply-pagination apply-sort-4 conn
|
||||||
merge-query observable-query pull-many]]
|
merge-query observable-query pull-many]]
|
||||||
@@ -394,14 +393,7 @@
|
|||||||
:color :secondary
|
:color :secondary
|
||||||
:content (format "Invoice '%s'" (:invoice/invoice-number inv))}))
|
: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}}]}))
|
:render-for #{:html}}]}))
|
||||||
|
|
||||||
(def row* (partial helper/row* grid-page))
|
(def row* (partial helper/row* grid-page))
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
(ns auto-ap.ssr.transaction.edit
|
(ns auto-ap.ssr.transaction.edit
|
||||||
(:require
|
(:require
|
||||||
[auto-ap.client-routes :as client-routes]
|
|
||||||
[auto-ap.datomic
|
[auto-ap.datomic
|
||||||
:refer [audit-transact conn pull-attr pull-ref]]
|
:refer [audit-transact conn pull-attr pull-ref]]
|
||||||
[auto-ap.datomic.accounts :as d-accounts]
|
[auto-ap.datomic.accounts :as d-accounts]
|
||||||
@@ -380,14 +379,6 @@
|
|||||||
:url (bidi/path-for ssr-routes/only-routes :vendor-search)
|
:url (bidi/path-for ssr-routes/only-routes :vendor-search)
|
||||||
:value (fc/field-value)
|
:value (fc/field-value)
|
||||||
:content-fn (fn [c] (pull-attr (dc/db conn) :vendor/name c)) })]))
|
: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
|
;; Memo field
|
||||||
(fc/with-field :transaction/memo
|
(fc/with-field :transaction/memo
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
(ns auto-ap.ssr.transaction.insights
|
(ns auto-ap.ssr.transaction.insights
|
||||||
(:require
|
(:require
|
||||||
[auto-ap.client-routes :as client-routes]
|
|
||||||
[auto-ap.datomic :refer [conn visible-clients]]
|
[auto-ap.datomic :refer [conn visible-clients]]
|
||||||
|
[auto-ap.routes.transactions :as transaction-routes]
|
||||||
[auto-ap.rule-matching :refer [spread-cents]]
|
[auto-ap.rule-matching :refer [spread-cents]]
|
||||||
[auto-ap.ssr-routes :as ssr-routes]
|
[auto-ap.ssr-routes :as ssr-routes]
|
||||||
[auto-ap.ssr.components :as com]
|
[auto-ap.ssr.components :as com]
|
||||||
|
[auto-ap.ssr.hx :as hx]
|
||||||
[auto-ap.ssr.svg :as svg]
|
[auto-ap.ssr.svg :as svg]
|
||||||
[auto-ap.ssr.ui :refer [base-page]]
|
[auto-ap.ssr.ui :refer [base-page]]
|
||||||
[auto-ap.ssr.utils :refer [html-response modal-response]]
|
[auto-ap.ssr.utils :refer [html-response modal-response]]
|
||||||
@@ -14,9 +15,7 @@
|
|||||||
[clj-http.client :as http]
|
[clj-http.client :as http]
|
||||||
[clj-time.coerce :as coerce]
|
[clj-time.coerce :as coerce]
|
||||||
[datomic.api :as dc]
|
[datomic.api :as dc]
|
||||||
[hiccup2.core :as hiccup]
|
[iol-ion.tx :refer [random-tempid]]))
|
||||||
[iol-ion.tx :refer [random-tempid]]
|
|
||||||
[auto-ap.ssr.hx :as hx]))
|
|
||||||
|
|
||||||
(def pull-expr [:transaction/description-original
|
(def pull-expr [:transaction/description-original
|
||||||
:db/id
|
:db/id
|
||||||
@@ -332,8 +331,8 @@
|
|||||||
:hx-swap "outerHTML swap:300ms"}
|
:hx-swap "outerHTML swap:300ms"}
|
||||||
:request request}
|
:request request}
|
||||||
(com/breadcrumbs {}
|
(com/breadcrumbs {}
|
||||||
[:a {:href (bidi/path-for client-routes/routes
|
[:a {:href (bidi/path-for ssr-routes/only-routes
|
||||||
:transactions)}
|
::transaction-routes/all-page)}
|
||||||
"Transactions"]
|
"Transactions"]
|
||||||
[:a {:href (bidi/path-for ssr-routes/only-routes
|
[:a {:href (bidi/path-for ssr-routes/only-routes
|
||||||
:transaction-insights)}
|
:transaction-insights)}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
[datomic.api :as dc]
|
[datomic.api :as dc]
|
||||||
[puget.printer :as puget]
|
[puget.printer :as puget]
|
||||||
[datomic.api :as d]
|
[datomic.api :as d]
|
||||||
[figwheel.main.api]
|
#_[figwheel.main.api]
|
||||||
[hawk.core]
|
[hawk.core]
|
||||||
[mount.core :as mount]
|
[mount.core :as mount]
|
||||||
[nrepl.middleware.print])
|
[nrepl.middleware.print])
|
||||||
@@ -350,7 +350,7 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn- auto-reset-handler [ctx event]
|
(defn- auto-reset-handler [ctx event]
|
||||||
(require 'figwheel.main.api)
|
#_(require 'figwheel.main.api)
|
||||||
(binding [*ns* *ns*]
|
(binding [*ns* *ns*]
|
||||||
(clojure.tools.namespace.repl/refresh)
|
(clojure.tools.namespace.repl/refresh)
|
||||||
ctx))
|
ctx))
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
(ns auto-ap.routes.transactions)
|
(ns auto-ap.routes.transactions)
|
||||||
|
|
||||||
(def routes {"" {:get ::page
|
(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
|
"/new" {:get ::new
|
||||||
:post ::new-submit
|
:post ::new-submit
|
||||||
"/location-select" ::location-select
|
"/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"]]}])
|
|
||||||
2
tasks
2
tasks
@@ -6,3 +6,5 @@
|
|||||||
* Check permissions on ledger, transactions, reports
|
* Check permissions on ledger, transactions, reports
|
||||||
* Make sure that you can't change a transaction if its payment is set
|
* 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