Another admin page

This commit is contained in:
2023-10-31 12:44:10 -07:00
parent f61aca26cd
commit 7796e34834
11 changed files with 238 additions and 41 deletions

View File

@@ -6,7 +6,8 @@
[auto-ap.client-routes :as client-routes]
[auto-ap.ssr.hx :as hx]
[auto-ap.routes.admin.transaction-rules :as transaction-rules]
[auto-ap.ssr.hiccup-helper :as hh]))
[auto-ap.ssr.hiccup-helper :as hh]
[auto-ap.routes.admin.import-batch :as ib-routes]))
(defn menu-button- [params & children]
[:div
@@ -242,8 +243,8 @@
{:x-show "open"})
(menu-button- {:href (bidi/path-for client-routes/routes
:admin-excel-import)} "Excel Invoices")
(menu-button- {:href (bidi/path-for client-routes/routes
:admin-import-batches)} "Import Batches")
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
::ib-routes/page)} "Import Batches")
(menu-button- {:href (bidi/path-for ssr-routes/only-routes
:admin-ezcater-xls)
:hx-boost "true"} "EZCater XLS Import"))]])

View File

@@ -0,0 +1,29 @@
(ns auto-ap.ssr.components.date-range
(:require [auto-ap.ssr.components :as com]
[auto-ap.time :as atime]))
(defn date-range-field [{:keys [value id] }]
[:div {:id id}
(com/field {:label "Date Range"}
[:div.space-y-4
[:div
(com/button-group {:name "date-range"}
(com/button-group-button {:size :small :value "all" :hx-trigger "click"} "All")
(com/button-group-button {:size :small :value "week" :hx-trigger "click"} "Week")
(com/button-group-button {:size :small :value "month" :hx-trigger "click"} "Month")
(com/button-group-button {:size :small :value "year" :hx-trigger "click"} "Year"))
]
[:div.flex.space-x-1.items-baseline.w-full.justify-start
(com/date-input {:name "start-date"
:value (some-> (:start value)
(atime/unparse-local atime/normal-date))
:placeholder "Date"
:size :small
:class "shrink"})
(com/date-input {:name "end-date"
:value (some-> (:end value)
(atime/unparse-local atime/normal-date))
:placeholder "Date"
:size :small
:class "shrink"})]])])

View File

@@ -155,7 +155,7 @@
(dissoc :size))])
(defn date-input- [{:keys [size] :as params}]
[:div
[:div.shrink
[:input
(-> params
(update :class (fnil hh/add-class "") default-input-classes)
@@ -163,7 +163,7 @@
(assoc "_" (hiccup/raw "init initDatepicker(me)"))
(assoc "hx-on" (hiccup/raw "changeDate: htmx.trigger(this, \"change\")
htmx:beforeCleanupElement: this.dp.destroy()"))
(update :class #(str % (use-size size)))
(update :class #(str % (use-size size) " w-full"))
(dissoc :size))]])