every ssr page is tailwindified.

This commit is contained in:
Bryce
2023-06-01 12:00:30 -07:00
parent 3540346fc8
commit 1b044ff5cd
12 changed files with 72 additions and 44 deletions

View File

@@ -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")))