fixes several issues with scheduled payments

This commit is contained in:
2024-08-02 22:32:18 -07:00
parent ed22f9d0cc
commit e947b4592c
4 changed files with 39 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@@ -23,10 +23,20 @@
(defn row* [gridspec user entity {:keys [flash? delete-after-settle? request class] :as options}]
(let [cells (if (:check-boxes? gridspec)
[(com/data-grid-cell {} (com/checkbox {:name "id" :value ((:id-fn gridspec) entity)
:x-model "selected"}))]
(defn row* [{:keys [check-box-warning? check-boxes?] :as gridspec} user entity {:keys [flash? delete-after-settle? request class] :as options}]
(let [cells (if check-boxes?
[(com/data-grid-cell {:class "relative"}
(let [cb (com/checkbox {:name "id" :value ((:id-fn gridspec) entity)
:x-model "selected"})]
(if (and check-box-warning? (check-box-warning? entity))
(do
[:div.bg-yellow-100.absolute.inset-0.flex.items-center.px-4.py-2
[:div {:class "absolute inset-0 bg-yellow-50 z-0",
:style "background-image: linear-gradient(135deg, rgba(0, 0, 0, 0.1) 12.5%, transparent 12.5%, transparent 50%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.1) 62.5%, transparent 62.5%, transparent);\n background-size: 10px 10px;"}]
[:div {:class "z-10"} cb]])
cb)))]
[])
cells (->> gridspec
:headers

View File

@@ -416,6 +416,11 @@
(cond
(not all-credits-or-debits)
[:div "All vendor totals must be either positive or negative."]
(and (= 0 (count ids))
(not= (count (:ids params))
0))
[:div "No " [:span.font-bold "payable"] " invoices selected."]
(= 0 (count ids))
[:div "Please select some invoices to pay"]
(> selected-client-count 1)
@@ -435,6 +440,8 @@
(helper/build {:id "entity-table"
:nav com/main-aside-nav
:check-boxes? true
:check-box-warning? (fn [e]
(some? (:invoice/scheduled-payment e)))
:page-specific-nav filters
:fetch-page fetch-page
:oob-render
@@ -521,7 +528,22 @@
:name "Due"
:show-starting "xl" ;; xl:table-cell
:render (fn [{:invoice/keys [due]}]
(some-> due (atime/unparse-local atime/normal-date)))}
(if-let [due-date (some-> due (atime/unparse-local atime/normal-date)) ]
(let [
today (time/now)
[start end] (if (time/before? due today)
[due today]
[today due])
i (time/interval start end )
days (if (time/before? due today)
(- (time/in-days i))
(time/in-days i))]
(cond (= 0 days)
[:div.text-primary-700 "today"]
(> days 0)
[:div.text-primary-700 (format "in %d days", days)]
:else
[:div.text-red-700 (format "%d days ago", (- days))]))))}
{:key "status"
:name "Status"
:render (fn [{:invoice/keys [status scheduled-payment]}]

View File

@@ -48,7 +48,7 @@
(last vs))))
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(def default-pagination-size 20)
(def default-pagination-size 25)
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defn allow-once [f]