Files
integreat/src/clj/auto_ap/ssr/pos/common.clj
2023-10-31 12:44:10 -07:00

56 lines
3.2 KiB
Clojure

(ns auto-ap.ssr.pos.common
(:require [auto-ap.ssr.components :as com]
[auto-ap.time :as atime]
[auto-ap.ssr.svg :as svg]))
(defn processor-field* [request]
(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* [request]
(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 request))
: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 request))
:placeholder "9999.34"
:size :small})]))
(defn exact-match-id-field* [request]
(when-let [exact-match-id (:exact-match-id (:parsed-query-params request))]
[:div
(com/field {:label "Exact match"}
(com/pill {:color :primary}
[:span.inline-flex.gap-2
exact-match-id
[:a {:href "?exact-match-id="}
[:div.h-4.w-4 svg/x]]]))]))