Open ended end dates, defaults to last year on invoices

This commit is contained in:
2024-04-23 14:27:43 -07:00
parent 633973cde4
commit 72c53add1b
2 changed files with 5 additions and 5 deletions

View File

@@ -240,7 +240,7 @@
(if date-range-value (if date-range-value
(-> (condp = date-range-value (-> (condp = date-range-value
"week" "week"
(let [last-monday (atime/last-monday)] (let [last-monday (coerce/to-date-time (atime/last-monday))]
(assoc m (assoc m
start-date-key (time/plus last-monday (time/days -7)) start-date-key (time/plus last-monday (time/days -7))
end-date-key last-monday)) end-date-key last-monday))
@@ -248,16 +248,16 @@
"month" "month"
(assoc m (assoc m
start-date-key (time/plus (time/now) (time/months -1)) start-date-key (time/plus (time/now) (time/months -1))
end-date-key (time/now)) end-date-key nil)
"year" "year"
(assoc m (assoc m
start-date-key (time/plus (time/now) (time/years -1)) start-date-key (time/plus (time/now) (time/years -1))
end-date-key (time/now)) end-date-key nil)
"all" "all"
(assoc m start-date-key (time/plus (time/now) (time/years -6)) (assoc m start-date-key (time/plus (time/now) (time/years -6))
end-date-key (time/now)) end-date-key nil)
m) m)
(dissoc date-range-key)) (dissoc date-range-key))

View File

@@ -177,7 +177,7 @@
"Home" ] "Home" ]
(when (p/can? @user {:subject :invoice-page}) (when (p/can? @user {:subject :invoice-page})
[:a.navbar-item {:class [(active-when ap #{:unpaid-invoices :paid-invoices})] [:a.navbar-item {:class [(active-when ap #{:unpaid-invoices :paid-invoices})]
:href (str (bidi/path-for ssr-routes/only-routes ::invoice-routes/unpaid-page) "?date-range=month")} :href (str (bidi/path-for ssr-routes/only-routes ::invoice-routes/unpaid-page) "?date-range=year")}
"Invoices" ]) "Invoices" ])
(when (p/can? @user {:subject :payment-page}) (when (p/can? @user {:subject :payment-page})
[:a.navbar-item {:class [(active-when ap = :payments)] [:a.navbar-item {:class [(active-when ap = :payments)]