further cleans up POS

This commit is contained in:
2023-09-28 20:41:00 -07:00
parent c73c7619d8
commit d1798f6b5c
13 changed files with 684 additions and 381 deletions

View File

@@ -1,9 +1,15 @@
(ns auto-ap.ssr.pos.common
(:require [auto-ap.ssr.components :as com]
[auto-ap.time :as atime]))
[auto-ap.time :as atime]
[auto-ap.ssr.svg :as svg]))
;; TODO make date-input take clj date
;; TODO make total fields take decimals
(defn date-range-field* [params]
(defn date-range-field* [request]
(println "DR" (some-> request
:parsed-query-params
))
[:div#date-range {}
(com/field {:label "Date Range"}
[:div.space-y-4
@@ -16,26 +22,22 @@
]
[:div.flex.space-x-1.items-baseline
(com/date-input {:name "start-date"
:value (some-> params
:value (some-> request
:parsed-query-params
:start-date
(atime/parse atime/normal-date)
(atime/unparse-local
atime/normal-date))
(atime/unparse-local atime/normal-date))
:placeholder "Date"
:size :small})
(com/date-input {:name "end-date"
:value (some-> params
:value (some-> request
:parsed-query-params
:end-date
(atime/parse atime/normal-date)
(atime/unparse-local
atime/normal-date))
(atime/unparse-local atime/normal-date))
:placeholder "Date"
:size :small})]]
)])
(defn processor-field* [params]
:size :small})]])])
(defn processor-field* [request]
(com/field {:label "Processor"}
(com/radio {:size :small
:name "processor"
@@ -56,14 +58,14 @@
{:value "na"
:content "No Processor"}]})))
(defn total-field* [params]
(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 params))
:value (:total-gte (:parsed-query-params request))
:placeholder "0.01"
:size :small})
[:div.align-baseline
@@ -72,6 +74,16 @@
:hx-preserve "true"
:id "total-lte"
:class "hot-filter"
:value (:total-lte (:parsed-query-params params))
: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]]]))]))