Adds refresh button
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
(println "orders")
|
||||
(doseq [d (per/periodic-seq (time/plus (time/today) (time/days (- days)))
|
||||
(time/today)
|
||||
(time/plus (time/today) (time/days 2))
|
||||
(time/days 1))]
|
||||
(println d)
|
||||
@(square3/upsert client square-location (coerce/to-date-time d) (coerce/to-date-time (time/plus d (time/days 1)))))
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#_#_:connection-request-timeout 5000
|
||||
:as :json))
|
||||
(catch Throwable e
|
||||
(println e)
|
||||
(log/warn ::raw-request-failed
|
||||
:exception e)
|
||||
(throw e)))))
|
||||
@@ -789,13 +790,17 @@
|
||||
:square-location/square-id (:id square-location)})))))))
|
||||
|
||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||
(defn reset []
|
||||
(defn reset [client]
|
||||
(->>
|
||||
(dc/q {:find ['?e]
|
||||
:in ['$]
|
||||
:where ['(or [?e :sales-order/date]
|
||||
[?e :expected-deposit/date])]}
|
||||
(dc/db conn))
|
||||
:in ['$ '?c]
|
||||
:where ['(or [?e :sales-order/client ?c]
|
||||
[?e :expected-deposit/client ?c]
|
||||
[?e :sales-refund/client ?c]
|
||||
[?e :charge/client ?c]
|
||||
[?e :cash-drawer-shift/client ?c])]}
|
||||
(dc/db conn)
|
||||
client)
|
||||
(map first)
|
||||
(map (fn [x] [:db/retractEntity x]))))
|
||||
|
||||
@@ -1008,12 +1013,15 @@
|
||||
|
||||
|
||||
(require 'auto-ap.time-reader)
|
||||
|
||||
@(upsert-all "NGPG")
|
||||
|
||||
(clojure.pprint/pprint (let [[c [l]] (get-square-client-and-location "NGHW")]
|
||||
(clojure.pprint/pprint (let [[c [l]] (get-square-client-and-location "NGVT")]
|
||||
l
|
||||
|
||||
(def z @(search c l #clj-time/date-time "2024-04-10T00:00:00-08:00"
|
||||
#clj-time/date-time "2024-04-13T00:00:00-08:00"))))
|
||||
|
||||
(def z @(search c l #clj-time/date-time "2024-04-25T00:00:00-08:00"
|
||||
#clj-time/date-time "2024-04-28T00:00:00-08:00"))))
|
||||
|
||||
(->> z
|
||||
(filter (fn [o]
|
||||
|
||||
@@ -1324,19 +1324,23 @@
|
||||
:body (mm/default-step-body
|
||||
{}
|
||||
[:div
|
||||
(fc/with-field :client/square-auth-token
|
||||
(com/validated-field
|
||||
{:errors (fc/field-errors)
|
||||
:label "Square Auth Token"}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:error? (fc/error?)
|
||||
:hx-get (bidi/path-for ssr-routes/only-routes ::route/refresh-square-locations)
|
||||
:hx-trigger "keyup changed delay:1s queue:none"
|
||||
:hx-indicator "#square-locations"
|
||||
:hx-target "#square-locations"
|
||||
:placeholder "Token from square"
|
||||
:class "w-64"
|
||||
:value (fc/field-value)})))
|
||||
[:div.flex.gap-2.items-center
|
||||
(fc/with-field :client/square-auth-token
|
||||
(com/validated-field
|
||||
{:errors (fc/field-errors)
|
||||
:label "Square Auth Token"}
|
||||
(com/text-input {:name (fc/field-name)
|
||||
:id "square-token"
|
||||
:error? (fc/error?)
|
||||
:placeholder "Token from square"
|
||||
:class "w-64"
|
||||
:value (fc/field-value)})))
|
||||
(com/button {:hx-get (bidi/path-for ssr-routes/only-routes ::route/refresh-square-locations)
|
||||
:hx-include "#square-token"
|
||||
:hx-trigger "click"
|
||||
:hx-indicator "#square-locations"
|
||||
:hx-target "#square-locations" }
|
||||
"Refresh")]
|
||||
|
||||
(fc/with-field :client/square-locations
|
||||
(square-location-table))])
|
||||
|
||||
Reference in New Issue
Block a user