every ssr page is tailwindified.
This commit is contained in:
@@ -18,7 +18,8 @@
|
||||
[com.brunobonacci.mulog :as mu]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]
|
||||
[amazonica.aws.s3 :as s3]))
|
||||
[amazonica.aws.s3 :as s3]
|
||||
[auto-ap.ssr.components :as com]))
|
||||
|
||||
(defn fmt-amount [a]
|
||||
(with-precision 2
|
||||
@@ -27,18 +28,12 @@
|
||||
(.setScale 2 java.math.RoundingMode/HALF_UP)
|
||||
(double))))
|
||||
|
||||
|
||||
|
||||
|
||||
(defn rows->maps [rows]
|
||||
(let [[headers & rows] rows]
|
||||
(for [r rows]
|
||||
(into {}
|
||||
(map vector headers r)))))
|
||||
|
||||
|
||||
|
||||
|
||||
(defn map->sales-order [r clients]
|
||||
(let [order-number (get r "Order Number")
|
||||
event-date (get r "Event Date")
|
||||
@@ -136,30 +131,29 @@
|
||||
(stream->sales-orders s)))
|
||||
|
||||
(defn page* []
|
||||
[:div
|
||||
[:h1.title "EZCater XLS Import"]
|
||||
[:div.card.block {:style {:width "500px"}}
|
||||
[:div.card-content
|
||||
"Please go to "
|
||||
[:a {:href "https://www.ezcater.com/ez_manage/reports/new" :target "_blank"} "EZCater's report page"]
|
||||
" to generate a new report. Then drop it below."]]
|
||||
[:div#page-notification.notification.block {:style {:display "none"}}]
|
||||
[:div.card.block
|
||||
[:div.card-content
|
||||
[:form {:action (bidi/path-for ssr-routes/only-routes
|
||||
:admin-ezcater-xls)
|
||||
:method "POST"
|
||||
:class "dropzone"
|
||||
:id "ezcater"}]]]
|
||||
[:script
|
||||
(hiccup/raw
|
||||
"
|
||||
[:div.mt-4
|
||||
(com/card {}
|
||||
[:div.px-4.py-3.space-y-4.flex.flex-col
|
||||
[:h1.text-2xl.mb-3.font-bold "EZCater XLS Import"]
|
||||
[:p.text-sm.italic
|
||||
"Please go to "
|
||||
(com/link {:href "https://www.ezcater.com/ez_manage/reports/new" :target "_blank"} "EZCater's report page")
|
||||
" to generate a new report. Then drop it below."]
|
||||
[:div#page-notification.notification.block {:style {:display "none"}}]
|
||||
[:form.bg-blue-300 {:action (bidi/path-for ssr-routes/only-routes
|
||||
:admin-ezcater-xls)
|
||||
:method "POST"
|
||||
:class "dropzone"
|
||||
:id "ezcater"}]
|
||||
[:script
|
||||
(hiccup/raw
|
||||
"
|
||||
Dropzone.options.ezcater = {
|
||||
success: function (file, response) {
|
||||
document.getElementById(\"page-notification\").innerHTML = response;
|
||||
document.getElementById(\"page-notification\").style[\"display\"] = \"block\";
|
||||
}
|
||||
}")]])
|
||||
}")]])])
|
||||
|
||||
(defn upload-xls [{:keys [identity] :as request}]
|
||||
|
||||
@@ -195,8 +189,23 @@
|
||||
(if (= :post request-method)
|
||||
(upload-xls request)
|
||||
(base-page
|
||||
request
|
||||
(page*)
|
||||
|
||||
(admin-side-bar matched-route))))
|
||||
request
|
||||
(com/page {:nav (com/company-aside-nav)
|
||||
:active-client (:client (:session request))
|
||||
:identity (:identity request)
|
||||
:app-params {:hx-get (bidi/path-for ssr-routes/only-routes
|
||||
:admin-ezcater-xls)
|
||||
:hx-trigger "clientSelected from:body"
|
||||
:hx-select "#app-contents"
|
||||
:hx-swap "outerHTML swap:300ms"}}
|
||||
(com/breadcrumbs {}
|
||||
[:a {:href (bidi/path-for ssr-routes/only-routes
|
||||
:admin)}
|
||||
"Admin"]
|
||||
[:a {:href (bidi/path-for ssr-routes/only-routes
|
||||
:admin-ezcater-xls)}
|
||||
"EZCater XLS Import"])
|
||||
(page*))
|
||||
|
||||
"EZCater upload")))
|
||||
|
||||
|
||||
@@ -111,8 +111,7 @@
|
||||
(com/data-grid-card {:id "history-table"
|
||||
:title (format "History for %s: %d" (str/capitalize best-guess-entity) entity-id)
|
||||
:route :history-table
|
||||
:start 0
|
||||
:per-page (count history)
|
||||
:paginate? false
|
||||
:total (count history)
|
||||
:subtitle nil
|
||||
:action-buttons nil
|
||||
@@ -188,4 +187,4 @@
|
||||
[:div#history-table])
|
||||
[:div#inspector]
|
||||
])
|
||||
nil)))
|
||||
"History")))
|
||||
|
||||
@@ -63,5 +63,5 @@
|
||||
:company)}
|
||||
"My Company"])
|
||||
(main-content* {:client (:client (:session request))}))
|
||||
nil))
|
||||
"My Company"))
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
(update-in c [1 1 :class ] str " flex items-center p-2 pl-11 w-full text-base font-normal text-gray-900 rounded-lg transition duration-75 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700")])])
|
||||
|
||||
(defn left-aside- [{:keys [nav page-specific]} & children]
|
||||
[:aside {:id "left-nav", :class "fixed top-0 left-0 pt-16 z-20 w-64 h-screen transition-transform -translate-x-full lg:translate-x-0", :aria-labelledby "left-nav" :aria-hidden "true"}
|
||||
[:aside {:id "left-nav", :class "fixed top-0 left-0 pt-16 z-20 w-64 h-screen transition-transform -translate-x-full lg:translate-x-0", :aria-labelledby "left-nav" :aria-hidden "true"
|
||||
"_" (hiccup/raw "init call initSidebarToggle()")}
|
||||
|
||||
[:div {:class "overflow-y-auto py-5 px-3 h-full bg-gray-50 border-r border-gray-200 dark:bg-gray-800 dark:border-gray-700"}
|
||||
nav
|
||||
@@ -125,6 +126,7 @@
|
||||
[:use {:width "30", :height "20", :transform "matrix(16 -19.968 19.968 16 256 230.4)", :xlink:href "#a"}]] "中文 (繁體)"]]]]]]
|
||||
[:script {:lang "text/javascript"}
|
||||
(hiccup/raw "
|
||||
function initSidebarToggle() {
|
||||
var $targetEl = document.getElementById('left-nav');
|
||||
|
||||
var $triggerEl = document.getElementById('left-nav-toggle');
|
||||
@@ -140,8 +142,8 @@
|
||||
}
|
||||
};
|
||||
|
||||
// var collapse = new Collapse($targetEl, $triggerEl, options);
|
||||
|
||||
var collapse = new Collapse($targetEl, $triggerEl, options);
|
||||
}
|
||||
")]])
|
||||
|
||||
(defn main-aside-nav- []
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
rows)]
|
||||
|
||||
(when (or paginate?
|
||||
(not (nil? paginate?)))
|
||||
(nil? paginate?))
|
||||
(paginator- {:start start
|
||||
:end (Math/min (+ start per-page) total)
|
||||
:per-page per-page
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
(def key->handler {:logout auth/logout
|
||||
:admin-history (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/history)))
|
||||
:admin-history-search (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/history-search)))
|
||||
:admin-history-search (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/history)))
|
||||
:admin-history-inspect (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin admin/inspect)))
|
||||
:active-client (wrap-client-redirect-unauthenticated (wrap-secure (wrap-admin company-dropdown/active-client)))
|
||||
:company-dropdown-search-results
|
||||
|
||||
@@ -183,4 +183,4 @@
|
||||
(table* grid-spec
|
||||
identity
|
||||
(extract-params grid-spec request)))
|
||||
nil))
|
||||
(:title grid-spec)))
|
||||
|
||||
@@ -214,4 +214,4 @@
|
||||
(insight-table* {:selected-client
|
||||
(-> session :client :db/id)
|
||||
:identity identity})]
|
||||
[:div (company-side-bar matched-route)]))
|
||||
"Transaction Insights"))
|
||||
|
||||
@@ -11,15 +11,16 @@
|
||||
{}
|
||||
hiccup))})
|
||||
|
||||
(defn base-page [request contents side-bar-contents]
|
||||
(defn base-page [request contents page-name]
|
||||
(html-page
|
||||
[:html.has-navbar-fixed-top
|
||||
[:head
|
||||
[:meta {:charset "utf-8"}]
|
||||
[:meta {:http-equiv "X-UA-Compatible", :content "IE=edge"}]
|
||||
[:meta {:name "viewport", :content "width=device-width, initial-scale=1"}]
|
||||
[:title "Integreat"]
|
||||
[:title (str "Integreat | " page-name)]
|
||||
[:link {:href "/css/font.min.css", :rel "stylesheet"}]
|
||||
[:link {:rel "icon" :type "image/png" :href "/favicon.png"}]
|
||||
[:link {:rel "stylesheet", :href "/css/react-datepicker.min.inc.css"}]
|
||||
[:link {:rel "stylesheet", :href "/output.css"}]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user