Adds refresh button
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
(println "orders")
|
(println "orders")
|
||||||
(doseq [d (per/periodic-seq (time/plus (time/today) (time/days (- days)))
|
(doseq [d (per/periodic-seq (time/plus (time/today) (time/days (- days)))
|
||||||
(time/today)
|
(time/plus (time/today) (time/days 2))
|
||||||
(time/days 1))]
|
(time/days 1))]
|
||||||
(println d)
|
(println d)
|
||||||
@(square3/upsert client square-location (coerce/to-date-time d) (coerce/to-date-time (time/plus d (time/days 1)))))
|
@(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
|
#_#_:connection-request-timeout 5000
|
||||||
:as :json))
|
:as :json))
|
||||||
(catch Throwable e
|
(catch Throwable e
|
||||||
|
(println e)
|
||||||
(log/warn ::raw-request-failed
|
(log/warn ::raw-request-failed
|
||||||
:exception e)
|
:exception e)
|
||||||
(throw e)))))
|
(throw e)))))
|
||||||
@@ -789,13 +790,17 @@
|
|||||||
:square-location/square-id (:id square-location)})))))))
|
:square-location/square-id (:id square-location)})))))))
|
||||||
|
|
||||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||||
(defn reset []
|
(defn reset [client]
|
||||||
(->>
|
(->>
|
||||||
(dc/q {:find ['?e]
|
(dc/q {:find ['?e]
|
||||||
:in ['$]
|
:in ['$ '?c]
|
||||||
:where ['(or [?e :sales-order/date]
|
:where ['(or [?e :sales-order/client ?c]
|
||||||
[?e :expected-deposit/date])]}
|
[?e :expected-deposit/client ?c]
|
||||||
(dc/db conn))
|
[?e :sales-refund/client ?c]
|
||||||
|
[?e :charge/client ?c]
|
||||||
|
[?e :cash-drawer-shift/client ?c])]}
|
||||||
|
(dc/db conn)
|
||||||
|
client)
|
||||||
(map first)
|
(map first)
|
||||||
(map (fn [x] [:db/retractEntity x]))))
|
(map (fn [x] [:db/retractEntity x]))))
|
||||||
|
|
||||||
@@ -1008,12 +1013,15 @@
|
|||||||
|
|
||||||
|
|
||||||
(require 'auto-ap.time-reader)
|
(require 'auto-ap.time-reader)
|
||||||
|
|
||||||
@(upsert-all "NGPG")
|
@(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
|
(->> z
|
||||||
(filter (fn [o]
|
(filter (fn [o]
|
||||||
|
|||||||
@@ -1324,19 +1324,23 @@
|
|||||||
:body (mm/default-step-body
|
:body (mm/default-step-body
|
||||||
{}
|
{}
|
||||||
[:div
|
[:div
|
||||||
|
[:div.flex.gap-2.items-center
|
||||||
(fc/with-field :client/square-auth-token
|
(fc/with-field :client/square-auth-token
|
||||||
(com/validated-field
|
(com/validated-field
|
||||||
{:errors (fc/field-errors)
|
{:errors (fc/field-errors)
|
||||||
:label "Square Auth Token"}
|
:label "Square Auth Token"}
|
||||||
(com/text-input {:name (fc/field-name)
|
(com/text-input {:name (fc/field-name)
|
||||||
|
:id "square-token"
|
||||||
:error? (fc/error?)
|
: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"
|
:placeholder "Token from square"
|
||||||
:class "w-64"
|
:class "w-64"
|
||||||
:value (fc/field-value)})))
|
: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
|
(fc/with-field :client/square-locations
|
||||||
(square-location-table))])
|
(square-location-table))])
|
||||||
|
|||||||
Reference in New Issue
Block a user