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

@@ -0,0 +1,77 @@
(ns auto-ap.ssr.pos.common
(:require [auto-ap.ssr.components :as com]
[auto-ap.time :as atime]))
(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 processor-field* [params]
(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"}]})))
(defn total-field* [params]
(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})]))