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

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]}]