fixes several issues with scheduled payments
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -23,10 +23,20 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defn row* [gridspec user entity {:keys [flash? delete-after-settle? request class] :as options}]
|
(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? gridspec)
|
(let [cells (if check-boxes?
|
||||||
[(com/data-grid-cell {} (com/checkbox {:name "id" :value ((:id-fn gridspec) entity)
|
[(com/data-grid-cell {:class "relative"}
|
||||||
:x-model "selected"}))]
|
(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
|
cells (->> gridspec
|
||||||
:headers
|
:headers
|
||||||
|
|||||||
@@ -416,6 +416,11 @@
|
|||||||
(cond
|
(cond
|
||||||
(not all-credits-or-debits)
|
(not all-credits-or-debits)
|
||||||
[:div "All vendor totals must be either positive or negative."]
|
[: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))
|
(= 0 (count ids))
|
||||||
[:div "Please select some invoices to pay"]
|
[:div "Please select some invoices to pay"]
|
||||||
(> selected-client-count 1)
|
(> selected-client-count 1)
|
||||||
@@ -435,6 +440,8 @@
|
|||||||
(helper/build {:id "entity-table"
|
(helper/build {:id "entity-table"
|
||||||
:nav com/main-aside-nav
|
:nav com/main-aside-nav
|
||||||
:check-boxes? true
|
:check-boxes? true
|
||||||
|
:check-box-warning? (fn [e]
|
||||||
|
(some? (:invoice/scheduled-payment e)))
|
||||||
:page-specific-nav filters
|
:page-specific-nav filters
|
||||||
:fetch-page fetch-page
|
:fetch-page fetch-page
|
||||||
:oob-render
|
:oob-render
|
||||||
@@ -521,7 +528,22 @@
|
|||||||
:name "Due"
|
:name "Due"
|
||||||
:show-starting "xl" ;; xl:table-cell
|
:show-starting "xl" ;; xl:table-cell
|
||||||
:render (fn [{:invoice/keys [due]}]
|
: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"
|
{:key "status"
|
||||||
:name "Status"
|
:name "Status"
|
||||||
:render (fn [{:invoice/keys [status scheduled-payment]}]
|
:render (fn [{:invoice/keys [status scheduled-payment]}]
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
(last vs))))
|
(last vs))))
|
||||||
|
|
||||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
#_{: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]}
|
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||||
(defn allow-once [f]
|
(defn allow-once [f]
|
||||||
|
|||||||
Reference in New Issue
Block a user