makes all sales orders use new grid helper

This commit is contained in:
2023-09-27 23:52:57 -07:00
parent da6e492b4d
commit fddd3d9007
14 changed files with 926 additions and 122 deletions

View File

@@ -6,6 +6,8 @@
[auto-ap.ssr-routes :as ssr-routes]
[auto-ap.ssr.components :as com]
[auto-ap.ssr.grid-page-helper :as helper]
[auto-ap.ssr.pos.common
:refer [date-range-field* processor-field* total-field*]]
[auto-ap.ssr.svg :as svg]
[auto-ap.time :as atime]
[bidi.bidi :as bidi]))
@@ -15,67 +17,18 @@
;; always should be fast
;; make params parsing composable
(defn date-range-field* [params]
[:div#date-range {}
(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
(com/date-input {:name "start-date"
:value (some-> params
:parsed-query-params
:start-date
(atime/parse atime/normal-date)
(atime/unparse-local
atime/normal-date))
:placeholder "Date"
:size :small})
(com/date-input {:name "end-date"
:value (some-> params
:parsed-query-params
:end-date
(atime/parse atime/normal-date)
(atime/unparse-local
atime/normal-date))
:placeholder "Date"
:size :small})]]
)])
(defn filters [params]
[:form {"hx-trigger" "change delay:500ms, keyup changed from:.hot-filter delay:1000ms"
"hx-get" (bidi/path-for ssr-routes/only-routes
[:form {"hx-trigger" "change delay:500ms, keyup changed from:.hot-filter delay:1000ms"
"hx-get" (bidi/path-for ssr-routes/only-routes
:pos-sales-table)
"hx-target" "#sales-table"
"hx-indicator" "#sales-table"
"hx-target" "#sales-table"
"hx-indicator" "#sales-table"
#_#_:hx-disabled-elt "find fieldset"}
[:fieldset.space-y-6
(date-range-field* params)
[:div
(com/field {:label "Total"}
[:div.flex.space-x-4.items-baseline
(com/money-input {:name "total-gte"
:id "total-gte"
:hx-preserve "true"
:class "hot-filter"
:value (:total-gte (:parsed-query-params params))
:placeholder "0.01"
:size :small})
[:div.align-baseline
"to"]
(com/money-input {:name "total-lte"
:hx-preserve "true"
:id "total-lte"
:class "hot-filter"
:value (:total-lte (:parsed-query-params params))
:placeholder "9999.34"
:size :small})])]
[:div (total-field* params)]
[:div
(com/field {:label "Payment Method"}
(com/radio {:size :small
@@ -92,27 +45,7 @@
:content "Other"}
]}))]
[:div
(com/field {:label "Processor"}
(com/radio {:size :small
:name "processor"
:options [{:value ""
:content "All"}
{:value "square"
:content [:div.flex.space-x-2 [:img.align-center {:src "/img/square.png" :style {:width "16px" :height "16px"}}] [:div "Square"]]}
{:value "doordash"
:content [:div.flex.space-x-2 [:img.align-center {:src "/img/doordash.png" :style {:width "16px" :height "16px"}}] [:div "Doordash"]]}
{:value "uber-eats"
:content [:div.flex.space-x-2 [:img.align-center {:src "/img/ubereats.png" :style {:width "16px" :height "16px"}}] [:div "Uber eats"]]}
{:value "grubhub"
:content [:div.flex.space-x-2 [:img.align-center {:src "/img/grubhub.png" :style {:width "16px" :height "16px"}}] [:div "Grubhub"]]}
{:value "koala"
:content [:div.flex.space-x-2 [:img.align-center {:src "/img/koala.png" :style {:width "16px" :height "16px"}}] [:div "Koala"]]}
{:value "ezcater"
:content [:div.flex.space-x-2 [:img.align-center {:src "/img/ezcater.png" :style {:width "16px" :height "16px"}}] [:div "EZCater"]]}
{:value "na"
:content "No Processor"}
]}))]
(processor-field* params)]
[:div
(com/field {:label "Category"}