This commit is contained in:
Bryce Covert
2023-01-11 11:01:39 -08:00
parent ec4e6624b5
commit 7cec382c52
9 changed files with 45 additions and 1815 deletions

View File

@@ -2,6 +2,7 @@
(:require
[amazonica.core :refer [defcredential]]
[auto-ap.client-routes :as client-routes]
[auto-ap.ssr.admin :as ssr-admin]
[auto-ap.routes.auth :as auth]
[auto-ap.routes.exports :as exports]
[auto-ap.routes.graphql :as graphql]
@@ -38,6 +39,7 @@
(defroutes static-routes
(GET "/" [] (response/resource-response "index.html" {:root "public"}))
(route/resources "/")
(routes (ANY "*" {:keys [uri]}
(if (bidi/match-route client-routes/routes uri)
@@ -73,6 +75,7 @@
(def app-routes
(routes
(wrap-transaction api-routes)
ssr-admin/admin-routes
static-routes))
(defn wrap-logging [handler]

View File

@@ -15,6 +15,8 @@
(def normal-date "MM/dd/yyyy")
(def iso-date "yyyy-MM-dd")
(def standard-time "MM/dd/yyyy hh:mm aa")
(defn parse [v format]
(try
(time/from-time-zone (f/parse (f/formatter format) v)

View File

@@ -27,6 +27,20 @@
(defn ^:export init []
(dev-setup)
(.addEventListener (.-body js/document)
"htmx:configRequest"
(fn [event]
(aset (.-headers (.-detail event))
"Authorization"
(some->> (.getItem js/localStorage "jwt")
(str "Token ")))))
;; document.body.addEventListener('htmx:configRequest', function(evt) {
;; evt.detail.parameters['auth_token'] = getAuthToken(); // add a new parameter into the request
;;;; evt.detail.headers['Authentication-Token'] = getAuthToken(); // add a new header into the request
;; });
(if-let [jwt (.get (js/URLSearchParams. (.-search (.-location js/window))) "jwt")]
(do
(.setItem js/localStorage "jwt" jwt)

View File

@@ -45,6 +45,10 @@
[:a {:href (bidi/path-for routes/routes :admin-rules), :class (str "item" (active-when ap = :admin-rules))}
[:span {:class "icon icon-cog-play-1" :style {:font-size "25px"}}]
[:span {:class "name"} "Rules"]]]
[:li.menu-item
[:a {:href "/admin/history", :class (str "item" (active-when ap = :admin-history))}
[:span {:class "icon icon-cog-play-1" :style {:font-size "25px"}}]
[:span {:class "name"} "History"]]]
[:ul ]]
[:p.menu-label "Import"]
[:ul.menu-list

View File

@@ -12,6 +12,7 @@
[auto-ap.views.pages.error :refer [error-page]]
[auto-ap.views.pages.ledger.balance-sheet :refer [balance-sheet-page]]
[auto-ap.views.pages.admin.jobs :refer [jobs-page]]
[auto-ap.views.pages.admin.history :refer [history-page]]
[auto-ap.views.pages.ledger.external-import :refer [external-import-page]]
[auto-ap.views.pages.ledger.external-ledger :refer [external-ledger-page]]
[auto-ap.views.pages.ledger.profit-and-loss :refer [profit-and-loss-page]]
@@ -153,6 +154,10 @@
(defmethod page :admin-excel-import [_]
[admin-excel-import-page])
(defmethod page :admin-history [_]
[history-page])
(defmethod page :initial-error [_]
[error-page])