progress on ssr sales.

This commit is contained in:
2023-09-23 07:13:32 -07:00
parent 85597fd9eb
commit e23cc6e8fd
2 changed files with 58 additions and 25 deletions

View File

@@ -11,13 +11,44 @@
[bidi.bidi :as bidi]
[clj-time.coerce :as coerce]))
(def grid-page {:id "sales-table"
:nav (com/main-aside-nav)
:id-fn :db/id
:fetch-page (fn [user args]
(d-sales/get-graphql (-> args
(assoc :date-range {:start (coerce/to-date-time #inst "2023-05-01")}))))
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
(defn filters [params]
[:form {"hx-trigger" "change delay:1000ms"
"hx-get" (bidi/path-for ssr-routes/only-routes
:pos-sales-table)
"hx-target" "#sales-table"}
[:div.space-y-6
[:div
(com/field {:label "Starting"}
(com/date-input {:name "start-date"
:value (:start-date params)
:placeholder "Date"}))]
[:div
(com/field {:label "Ending"}
(com/date-input {:name "end-date"
:value nil
:placeholder "Date"}))]
[:div
(com/field {:label "Total"}
(com/money-input {:name "total-gte"
:value nil
:placeholder "Total >="}))]]])
(def grid-page {:id "sales-table"
:nav (com/main-aside-nav)
:page-specific-nav filters
:id-fn :db/id
:fetch-page (fn [user args]
(d-sales/get-graphql (-> args
(assoc :date-range {:start (some-> args
:query-params
(get "start-date")
(atime/parse atime/iso-date))
:end (some-> args
:query-params
(get "end-date")
(atime/parse atime/iso-date))}
:total-gte (some-> args :query-params (get "total-gte") (#(if (string? %) (Double/parseDouble %) (double %))))))))
:breadcrumbs [[:a {:href (bidi/path-for ssr-routes/only-routes
:company)}
"POS"]
@@ -40,7 +71,7 @@
:request-method :delete))
:hx-target "closest tr"}
svg/trash))]))
:headers [
:headers [
{:key "client"
:name "Client"
:sort-key "client"