Applies all of the feedback for the new page

This commit is contained in:
Bryce
2024-04-14 22:29:01 -07:00
parent 6031f15246
commit 71b5b9864c
10 changed files with 74 additions and 53 deletions

View File

@@ -61,9 +61,10 @@
(dissoc (dissoc
(condp = (source-key query-params) (condp = (source-key query-params)
"week" "week"
(assoc query-params (let [last-monday (atime/last-monday)]
start-date-key (time/plus (time/now) (time/days -7)) (assoc query-params
end-date-key (time/now)) start-date-key (time/plus last-monday (time/days -7))
end-date-key last-monday))
"month" "month"
(assoc query-params (assoc query-params

View File

@@ -111,26 +111,26 @@
:active? (= "invoices" selected)} :active? (= "invoices" selected)}
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes (menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::invoice-route/all-page) ::invoice-route/all-page)
{:date-range "month"}) {:date-range "year"})
:active? (= ::invoice-route/all-page (:matched-route request)) :active? (= ::invoice-route/all-page (:matched-route request))
:hx-boost "true"} :hx-boost "true"}
"All") "All")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes (menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::invoice-route/paid-page) ::invoice-route/paid-page)
{:date-range "month"}) {:date-range "year"})
:active? (= ::invoice-route/paid-page (:matched-route request)) :active? (= ::invoice-route/paid-page (:matched-route request))
:hx-boost "true"} :hx-boost "true"}
"Paid") "Paid")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes (menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::invoice-route/unpaid-page) ::invoice-route/unpaid-page)
{:date-range "month"}) {:date-range "year"})
:active? (= ::invoice-route/unpaid-page (:matched-route request)) :active? (= ::invoice-route/unpaid-page (:matched-route request))
:hx-boost "true"} :hx-boost "true"}
"Unpaid") "Unpaid")
(menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes (menu-button- {:href (hu/url (bidi/path-for ssr-routes/only-routes
::invoice-route/voided-page) ::invoice-route/voided-page)
{:date-range "month"}) {:date-range "year"})
:active? (= ::invoice-route/voided-page (:matched-route request)) :active? (= ::invoice-route/voided-page (:matched-route request))
:hx-boost "true"} :hx-boost "true"}
"Voided") "Voided")

View File

@@ -1,8 +1,11 @@
(ns auto-ap.ssr.components.date-range (ns auto-ap.ssr.components.date-range
(:require [auto-ap.ssr.components :as com] (:require [auto-ap.ssr.components :as com]
[auto-ap.time :as atime])) [auto-ap.time :as atime]
[clj-time.coerce :as c]
[clj-time.core :as t]
[clj-time.periodic :as per]))
(defn date-range-field [{:keys [value id] }] (defn date-range-field [{:keys [value id]}]
[:div {:id id} [:div {:id id}
(com/field {:label "Date Range"} (com/field {:label "Date Range"}
[:div.space-y-4 [:div.space-y-4
@@ -11,12 +14,11 @@
(com/button-group-button {:size :small :value "all" :hx-trigger "click"} "All") (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 "week" :hx-trigger "click"} "Week")
(com/button-group-button {:size :small :value "month" :hx-trigger "click"} "Month") (com/button-group-button {:size :small :value "month" :hx-trigger "click"} "Month")
(com/button-group-button {:size :small :value "year" :hx-trigger "click"} "Year")) (com/button-group-button {:size :small :value "year" :hx-trigger "click"} "Year"))]
]
[:div.flex.space-x-1.items-baseline.w-full.justify-start [:div.flex.space-x-1.items-baseline.w-full.justify-start
(com/date-input {:name "start-date" (com/date-input {:name "start-date"
:value (some-> (:start value) :value (some-> (:start value)
(atime/unparse-local atime/normal-date)) (atime/unparse-local atime/normal-date))
:placeholder "Date" :placeholder "Date"
:size :small :size :small
:class "shrink"}) :class "shrink"})

View File

@@ -20,6 +20,6 @@
[:div.flex.flex-col.gap-y-2 [:div.flex.flex-col.gap-y-2
(for [l links] (for [l links]
[:div.flex-initial [:div.flex-initial
[:a {:href (:link l)} [:a {:href (:link l) :target "_blank"}
(com/pill {:color (or (:color l) :primary) :class "truncate block shrink grow-0"} (com/pill {:color (or (:color l) :primary) :class "truncate block shrink grow-0"}
(:content l))]])]]]])) (:content l))]])]]]]))

View File

@@ -114,7 +114,7 @@
:class "dark:text-blue-500"} :class "dark:text-blue-500"}
"Back"]) "Back"])
(defn default-next-button [linear-wizard step validation-route] (defn default-next-button [linear-wizard step validation-route & {:keys [next-button-content]}]
(let [steps (steps linear-wizard) (let [steps (steps linear-wizard)
last? (= (step-key step) (last steps)) last? (= (step-key step) (last steps))
next-step (when-not last? (->> steps next-step (when-not last? (->> steps
@@ -131,9 +131,10 @@
{:from (encode-step-key (step-key step)) {:from (encode-step-key (step-key step))
:to (encode-step-key (step-key next-step))}))) :to (encode-step-key (step-key next-step))})))
(if next-step (or next-button-content
(step-name next-step) (if next-step
"Save") (step-name next-step)
"Save"))
(when-not last? (when-not last?
[:div.w-5.h-5 svg/arrow-right])))) [:div.w-5.h-5 svg/arrow-right]))))
@@ -143,7 +144,8 @@
(defn default-step-footer [linear-wizard step & {:keys [validation-route (defn default-step-footer [linear-wizard step & {:keys [validation-route
discard-button discard-button
next-button]}] next-button
next-button-content]}]
[:div.flex.justify-end [:div.flex.justify-end
[:div.flex.items-baseline.gap-x-4 [:div.flex.items-baseline.gap-x-4
(com/form-errors {:errors (:errors (:step-params fc/*form-errors*))}) (com/form-errors {:errors (:errors (:step-params fc/*form-errors*))})
@@ -157,7 +159,8 @@
next-button next-button
validation-route validation-route
(default-next-button linear-wizard step validation-route) (default-next-button linear-wizard step validation-route
:next-button-content next-button-content)
:else :else
[:div "No action possible."])]]) [:div "No action possible."])]])

View File

@@ -1003,7 +1003,8 @@
:name (fc/field-name) :name (fc/field-name)
:error? (fc/error?)}))))))))))]]) :error? (fc/error?)}))))))))))]])
:footer :footer
(mm/default-step-footer linear-wizard this :validation-route ::route/pay-wizard-navigate) (mm/default-step-footer linear-wizard this :validation-route ::route/pay-wizard-navigate
:next-button-content "Pay")
:validation-route ::route/pay-wizard-navigate))) :validation-route ::route/pay-wizard-navigate)))
(defn add-handwritten-check [request wizard snapshot] (defn add-handwritten-check [request wizard snapshot]

View File

@@ -57,6 +57,16 @@
:placeholder "Johnny Testerson" :placeholder "Johnny Testerson"
:size :small})) :size :small}))
(com/field {:label "Client"}
(com/typeahead {:name "client"
:placeholder "Search..."
:url (bidi/path-for ssr-routes/only-routes
:company-search)
:id (str "client-search")
:value (:client (:parsed-query-params request))
:value-fn :db/id
:content-fn :client/name}))
(com/field {:label "Email"} (com/field {:label "Email"}
(com/text-input {:name "email" (com/text-input {:name "email"
:id "email" :id "email"
@@ -66,31 +76,22 @@
:size :small})) :size :small}))
(com/field {:label "Role"} (com/field {:label "Role"}
(com/radio-card {:size :small (com/radio-card {:size :small
:name "role" :name "role"
:options [{:value "" :options [{:value ""
:content "All"} :content "All"}
{:value "admin" {:value "admin"
:content "Admin"} :content "Admin"}
{:value "power-user" {:value "power-user"
:content "Power user"} :content "Power user"}
{:value "manager" {:value "manager"
:content "Manager"} :content "Manager"}
{:value "user" {:value "user"
:content "User"} :content "User"}
{:value "read-only" {:value "read-only"
:content "Read Only"} :content "Read Only"}
{:value "none" {:value "none"
:content "None"}]})) :content "None"}]}))]])
(com/field {:label "Client"}
(com/typeahead {:name "client"
:placeholder "Search..."
:url (bidi/path-for ssr-routes/only-routes
:company-search)
:id (str "client-search")
:value (:client (:parsed-query-params request))
:value-fn :db/id
:content-fn :client/name}))]])
(def default-read '[:db/id (def default-read '[:db/id
:user/name :user/name

View File

@@ -240,9 +240,10 @@
(if date-range-value (if date-range-value
(-> (condp = date-range-value (-> (condp = date-range-value
"week" "week"
(assoc m (let [last-monday (atime/last-monday)]
start-date-key (time/plus (time/now) (time/days -7)) (assoc m
end-date-key (time/now)) start-date-key (time/plus last-monday (time/days -7))
end-date-key last-monday))
"month" "month"
(assoc m (assoc m

View File

@@ -1,5 +1,6 @@
(ns auto-ap.time (ns auto-ap.time
(:require [clj-time.core :as time] (:require [clj-time.core :as time]
[clj-time.coerce :as coerce]
[clj-time.format :as f] [clj-time.format :as f]
[auto-ap.logging :as alog])) [auto-ap.logging :as alog]))
@@ -52,3 +53,14 @@
d d
(recur (time/plus d (time/days 1)))))] (recur (time/plus d (time/days 1)))))]
(iterate #(time/plus % (time/days 7)) next-day))) (iterate #(time/plus % (time/days 7)) next-day)))
(defn local-today []
(coerce/in-time-zone (time/now) (time/time-zone-for-id "America/Los_Angeles")))
(defn last-monday []
(loop [current (local-now)]
(if (= 1 (time/day-of-week current))
current
(recur (time/minus current (time/days 1))))))

View File

@@ -1,2 +1,2 @@
#!/bin/sh #!/bin/sh
ssh -L 2049:172.31.32.90:2049 3.213.115.86 -L 8983:solr-staging.local:8983 -L 4334:integreat-datomic.local:4334 -L9001:integreat-app-staging.local:9000 ssh -L 2049:172.31.32.90:2049 3.213.115.86 -L 8984:solr-staging.local:8983 -L 4334:integreat-datomic.local:4334 -L9001:integreat-app-staging.local:9000